From 7ecc4abee89e10c7bf2aeccf2f3d5207d88599b0 Mon Sep 17 00:00:00 2001 From: David Choi Date: Wed, 12 Nov 2025 17:00:33 -0800 Subject: [PATCH 01/38] Split Triton protobuf instructions to separate file. --- README.md | 133 +++++++----------------------------------------------- TRITON.md | 96 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 112 insertions(+), 117 deletions(-) create mode 100644 TRITON.md diff --git a/README.md b/README.md index f63c93b..7756def 100644 --- a/README.md +++ b/README.md @@ -7,15 +7,15 @@ This library is compatible with Go 1.22+ # Introduction -The goal of this library to provide a deep-learning model prediction HTTP service which can speed up end to end execution by leveraging a caching system. +The goal of this library & service to provide a deep-learning model prediction HTTP service which can speed up end to end execution by leveraging a caching system. **Supported Backends:** - **TensorFlow** (native integration) - **Triton Inference Server** (via gRPC) -The client cares of any dictionary-based key generation and model changes automatically. +The client handles dictionary-based key generation and model changes automatically. -In practice this library can provide substantial (100x) E2E execution improvement from the client side perspective, with the input space of billions of distinct keys. +In practice this library can provide substantial (100x) E2E execution improvement from the client side perspective, with the input space of billions of distinct keys. Each model provides both TensorFlow and cache-level performance metrics via HTTP REST API. @@ -56,7 +56,7 @@ In order to leverage caching, the model has to use categorical features with a f Categorical features can be cached, and out-of-dictionary values will be cached using the `UNK` token. Numerical features can be cached limiting decimal precision, otherwise it is not recommended to leverage the cache for models with numerical features. -By default, the client will configure itself using the web service cache settings. +By default, the client will configure itself using the web service cache settings. This enables the `mly` client to handle key generation without additional configuration or code. The library supports 3 types of caching: @@ -66,15 +66,15 @@ The library supports 3 types of caching: The in-memory cache uses [scache](https://github.com/viant/scache)'s most-recently-used implementation. -When an external cache is used, the client will first check the external cache that is shared with web service; if data is found, it's copied to local in-memory cache. +When an external cache is used, the client will first check the external cache that is shared with web service; if data is found, it's copied to local in-memory cache. To deal with larger key spaces, an external cache can be further configured using a tiered caching strategy. Any cached value will propagate upwards once found. For example, we can have a 2 tier caching strategy, where we will call the tiers L1 and L2. -In this scenario, the L2 cache can be a very large SSD-backed Aerospike instance and L1 cache could be a smaller memory-based instance. +In this scenario, the L2 cache can be a very large SSD-backed Aerospike instance and L1 cache could be a smaller memory-based instance. -In this case, when we look for a cached value, first the in-memory cache is checked, followed by L1, then L2. +In this case, when we look for a cached value, first the in-memory cache is checked, followed by L1, then L2. Then with a cache miss, the value is calculated then copied to L2 - then from L2 to L1 and L1 to local memory. **Example of `config.yaml` with both an in-memory and an Aerospike cache** @@ -104,7 +104,7 @@ See [WORKFLOW.md](WORKFLOW.md) for Mermaid diagrams explaining the Client and mo ## Dictionary hash code In caching mode, in order to manage cache and client/server consistency every time a model/dictionary gets re/loaded, `mly` computes a dictionary hash code. -This hash code gets stored in the cache along with model prediction and is passed to the client in every response. +This hash code gets stored in the cache along with model prediction and is passed to the client in every response. Once a client detects a change in dictionary hash code, it automatically initiates a dictionary reload and invalidates cache entries. Note: The dictionary hash code is stored under a special key in Aerospike defined in `shared/common.HashBin`. To prevent conflicts, do not use that same key name for storing your own model predictions. @@ -203,114 +203,13 @@ Models: DataType: int64 ``` -**Configuration Fields:** -- `Platform`: Set to `"triton"` to enable Triton backend -- `URL`: Triton server HTTP endpoint (will be converted to gRPC port 8001) -- `ModelName`: Name of the model in Triton's model repository -- `Timeout`: Request timeout (default: 30s) -- `Inputs`/`Outputs`: Model signature (must match Triton model config) - -**URL Format:** -- HTTP URL is automatically converted to gRPC endpoint -- `http://localhost:8000` → `localhost:8001` (gRPC) -- `https://triton.example.com:8000` → `triton.example.com:8001` (gRPC) +[See `CONFIG.md`](CONFIG.md), for more details. ## Triton gRPC Proto Files -The Triton integration uses protocol buffers for gRPC communication. Generated proto files are **committed to the repository** for build reliability. - -### When to Regenerate Proto Files - -Regenerate only when: -- Modifying `proto/triton/grpc_service.proto` -- Upgrading to a new Triton API version -- Upgrading protobuf/gRPC to a new major version - -### Prerequisites - -Install `protoc` (Protocol Buffer Compiler): - -```bash -# macOS -brew install protobuf - -# Linux (Debian/Ubuntu) -apt-get install -y protobuf-compiler - -# Verify installation -protoc --version # Should be 3.x or higher -``` - -Install Go protoc plugins: - -```bash -go install google.golang.org/protobuf/cmd/protoc-gen-go@latest -go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest - -# Ensure GOPATH/bin is in PATH -export PATH="$PATH:$(go env GOPATH)/bin" - -# Verify installation -which protoc-gen-go -which protoc-gen-go-grpc -``` - -### Regeneration Steps - -```bash -# 1. Navigate to repo root -cd /path/to/viant/mly - -# 2. Delete old generated files (ensures clean regeneration) -rm -f proto/triton/grpc_service.pb.go -rm -f proto/triton/grpc_service_grpc.pb.go - -# 3. Regenerate -protoc \ - --go_out=. \ - --go_opt=paths=source_relative \ - --go-grpc_out=. \ - --go-grpc_opt=paths=source_relative \ - proto/triton/grpc_service.proto - -# 4. Verify generation succeeded -ls -lh proto/triton/*.pb.go -``` - -### Verification - -After regeneration: - -```bash -# Ensure code compiles -go build ./... - -# Run tests -go test ./service/platform/... - -# Review changes -git diff proto/triton/ -``` - -### Troubleshooting - -**Error: `protoc: command not found`** -- Install protoc using package manager (see Prerequisites) - -**Error: `protoc-gen-go: program not found`** -- Ensure `$GOPATH/bin` is in your `$PATH` -- Run: `export PATH="$PATH:$(go env GOPATH)/bin"` - -**Error: `Import "..." was not found`** -- Run protoc from the repository root directory -- Verify proto file imports are correct - -**Notes:** -- Generated files are ~30KB and should be committed -- Proto definitions are based on [Triton's official protocol](https://github.com/triton-inference-server/common/blob/main/protobuf/grpc_service.proto) -- Triton uses `raw_output_contents` for performance (binary format vs. structured) +[See `TRITON.md`](TRITON.md), for instructions on how and when to recreate the protocol buffer files for Triton's gRPC API. -# Transformer +# Transformer By default, the model signature outputs the layer names alongside the model prediction to produce cachable output. @@ -318,11 +217,11 @@ See [`TRANSFORMER.md`](TRANSFORMER.md) for more details. # Server Endpoints -## `/v1/api/config` +## `/v1/api/config` Shows the loaded and processed configuration. -## `/v1/api/health` +## `/v1/api/health` Shows if any models are failing to reload. Payload is a JSON object whose keys are each model ID as specified in the `config.yaml`, with values a number, where 0 indicates a failure to reload and 1 indicates that the last attempted reload was successful. @@ -350,7 +249,7 @@ The `/v1/api/health` endpoint will provide a response like: } ``` -## `/v1/api/metric/operations` +## `/v1/api/metric/operations` TODO - Add more metrics added from server-side batching. @@ -367,7 +266,7 @@ In all these, `%s` is `Model[].ID` (i.e. from `config.yaml`) ## `/v1/api/debug` -Requires `EnableMemProf` and / or `EnableCPUProf` to be enabled. +Requires `EnableMemProf` and / or `EnableCPUProf` to be enabled. See [`service/endpoint/prof.go`](service/endpoint/prof.go) for details - otherwise, refer to `pprof` documentation. ## `/v1/api/model` @@ -401,7 +300,7 @@ all compatible with Apache License, Version 2. Please see individual files for d # Versioning Notes - `v0.14.1` last support for go 1.17 -- `v0.8.0` - numeric features are supported. +- `v0.8.0` - numeric features are supported. Until `v0.8.0`, only `StringLookup` and `IntegerLookup` layers are supported for caching. diff --git a/TRITON.md b/TRITON.md new file mode 100644 index 0000000..eef8d14 --- /dev/null +++ b/TRITON.md @@ -0,0 +1,96 @@ + +# Triton gRPC + +The Triton integration uses protocol buffers for gRPC communication. +Generated proto files are **committed to the repository** for build reliability. + +# When to Regenerate Proto Files + +Regenerate only when: +- Modifying `proto/triton/grpc_service.proto` +- Upgrading to a new Triton API version +- Upgrading protobuf/gRPC to a new major version + +# Prerequisites + +Install `protoc` (Protocol Buffer Compiler): + +```bash +# macOS +brew install protobuf + +# Linux (Debian/Ubuntu) +apt-get install -y protobuf-compiler + +# Verify installation +protoc --version # Should be 3.x or higher +``` + +Install Go protoc plugins: + +```bash +go install google.golang.org/protobuf/cmd/protoc-gen-go@latest +go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest + +# Ensure GOPATH/bin is in PATH +export PATH="$PATH:$(go env GOPATH)/bin" + +# Verify installation +which protoc-gen-go +which protoc-gen-go-grpc +``` + +# Regeneration Steps + +```bash +# 1. Navigate to repo root +cd /path/to/viant/mly + +# 2. Delete old generated files (ensures clean regeneration) +rm -f proto/triton/grpc_service.pb.go +rm -f proto/triton/grpc_service_grpc.pb.go + +# 3. Regenerate +protoc \ + --go_out=. \ + --go_opt=paths=source_relative \ + --go-grpc_out=. \ + --go-grpc_opt=paths=source_relative \ + proto/triton/grpc_service.proto + +# 4. Verify generation succeeded +ls -lh proto/triton/*.pb.go +``` + +# Verification + +After regeneration: + +```bash +# Ensure code compiles +go build ./... + +# Run tests +go test ./service/platform/... + +# Review changes +git diff proto/triton/ +``` + +# Troubleshooting + +**Error: `protoc: command not found`** +- Install protoc using package manager (see Prerequisites) + +**Error: `protoc-gen-go: program not found`** +- Ensure `$GOPATH/bin` is in your `$PATH` +- Run: `export PATH="$PATH:$(go env GOPATH)/bin"` + +**Error: `Import "..." was not found`** +- Run protoc from the repository root directory +- Verify proto file imports are correct + +**Notes:** +- Generated files are ~30KB and should be committed +- Proto definitions are based on [Triton's official protocol](https://github.com/triton-inference-server/common/blob/main/protobuf/grpc_service.proto) +- Triton uses `raw_output_contents` for performance (binary format vs. structured) \ No newline at end of file From 3bc4614b50ea38c77a3ac8e31eb3b22cc7d257bd Mon Sep 17 00:00:00 2001 From: David Choi Date: Wed, 12 Nov 2025 17:01:38 -0800 Subject: [PATCH 02/38] Add Triton configuration rework and Router configuration components. --- service/config/model.go | 63 +++++++++++++++++++++-------- service/config/models.go | 9 +++-- service/config/router.go | 63 +++++++++++++++++++++++++++++ service/config/triton.go | 17 ++++++++ service/endpoint/config.go | 4 ++ service/endpoint/model.go | 3 +- shared/config/router/router.go | 12 ++++++ shared/config/router/router_test.go | 58 ++++++++++++++++++++++++++ shared/field.go | 3 ++ 9 files changed, 211 insertions(+), 21 deletions(-) create mode 100644 service/config/router.go create mode 100644 service/config/triton.go create mode 100644 shared/config/router/router.go create mode 100644 shared/config/router/router_test.go diff --git a/service/config/model.go b/service/config/model.go index f033385..bbe2057 100644 --- a/service/config/model.go +++ b/service/config/model.go @@ -17,17 +17,24 @@ type Model struct { ID string Debug bool - // Platform specifies the model platform (tensorflow, triton) - // Defaults to "tensorflow" for backward compatibility + // Mode overrides the endpoint behavior from inference to routing. + // Can be one of "inference" or "router". + // Defaults to "inference". + Mode string `json:",omitempty" yaml:",omitempty"` + + // Platform specifies where inference occurs. + // Can be one of "tensorflow" or "triton". + // Defaults to "tensorflow". Platform string `json:",omitempty" yaml:",omitempty"` // Location is the path the model will be copied to. Location string `json:",omitempty" yaml:",omitempty"` // Dir is used to build a Location if Location is not provided. - // The build Location will use Dir directory after os.TempDir() and ID. + // The built Location will use Dir directory after os.TempDir() and ID. Dir string + // URL is the location of the model. URL string Batch *BatcherConfigFile `json:",omitempty" yaml:",omitempty"` @@ -40,18 +47,22 @@ type Model struct { // If UseDict is nil, defaults to true. UseDict *bool `json:",omitempty" yaml:",omitempty"` - DictURL string // Deprecated: we usually extract the dictionary/vocabulary from TF graph + // Deprecated: we usually extract the dictionary/vocabulary from TF graph + DictURL string shared.MetaInput `json:",omitempty" yaml:",inline"` // Deprecated: we can infer output types from TF graph, and there may be more than one output OutputType string `json:",omitempty" yaml:",omitempty"` + // Transformer is the name of the model output transformer. Transformer string `json:",omitempty" yaml:",omitempty"` - // caching + // DataStore is the name of the datastore to use for caching. DataStore string `json:",omitempty" yaml:",omitempty"` + Router *RouterConfig `json:",omitempty" yaml:",omitempty"` + // Stream is a github.com/viant/tapper configuration. // All requests are eligible to be logged. Stream *config.Stream `json:",omitempty" yaml:",omitempty"` @@ -64,6 +75,7 @@ type Model struct { DictMeta DictionaryMeta + // Test is used to test the model on startup. Test TestPayload `json:",omitempty" yaml:",omitempty"` } @@ -135,37 +147,56 @@ func (m *Model) Validate() error { if m.URL == "" { return fmt.Errorf("tensorflow model %s requires URL", m.ID) } + + if m.Mode == "router" { + return fmt.Errorf("tensorflow model %s is not supported in router mode", m.ID) + } case "triton": - // Triton models require Triton configuration if m.Triton == nil { return fmt.Errorf("triton model %s requires Triton configuration", m.ID) } - if m.URL == "" { - return fmt.Errorf("triton model %s requires URL (Triton server endpoint)", m.ID) - } - if err := m.Triton.Validate(); err != nil { + + if err := m.Triton.Validate(m.URL != ""); err != nil { return fmt.Errorf("triton model %s config invalid: %w", m.ID, err) } default: return fmt.Errorf("unsupported platform '%s' for model %s (supported: tensorflow, triton)", platform, m.ID) } + if m.Mode == "router" { + if m.Router == nil { + return fmt.Errorf("router model %s requires Router configuration", m.ID) + } + + if err := m.Router.Validate(); err != nil { + return fmt.Errorf("router model %s config invalid: %w", m.ID, err) + } + } + return nil } // TritonConfig represents Triton Inference Server specific configuration type TritonConfig struct { - ModelName string `json:",omitempty" yaml:",omitempty"` // Model name in Triton - Timeout int `json:",omitempty" yaml:",omitempty"` // HTTP timeout in milliseconds + // Model name in Triton + ModelName string `json:",omitempty" yaml:",omitempty"` + + // ServerID is the ID of the Triton server. + ServerID string `json:",omitempty" yaml:",omitempty"` + + // HTTP timeout in milliseconds + Timeout int `json:",omitempty" yaml:",omitempty"` } -func (t *TritonConfig) Validate() error { +func (t *TritonConfig) Validate(urlPresent bool) error { if t.ModelName == "" { - return fmt.Errorf("Triton ModelName is required") + return fmt.Errorf("triton ModelName is required") } - if t.Timeout <= 0 { - t.Timeout = 100 + + if t.ServerID == "" && !urlPresent { + return fmt.Errorf("triton ServerID or Model.URL is required") } + return nil } diff --git a/service/config/models.go b/service/config/models.go index dafeb91..9300b15 100644 --- a/service/config/models.go +++ b/service/config/models.go @@ -6,12 +6,12 @@ import ( "github.com/viant/mly/service/tfmodel/batcher/config" ) -//ModelList represents model +// ModelList represents model type ModelList struct { Models []*Model } -//Init initialises model list +// Init initialises model list func (l *ModelList) Init(bc *config.BatcherConfig) { if len(l.Models) == 0 { return @@ -22,14 +22,15 @@ func (l *ModelList) Init(bc *config.BatcherConfig) { } } -//Validate validates model list +// Validate validates model list func (l *ModelList) Validate() error { if len(l.Models) == 0 { return fmt.Errorf("models were empty") } + for _, model := range l.Models { if err := model.Validate(); err != nil { - return err + return fmt.Errorf("failed to validate model: %s, err: %w", model.ID, err) } } return nil diff --git a/service/config/router.go b/service/config/router.go new file mode 100644 index 0000000..f8186c8 --- /dev/null +++ b/service/config/router.go @@ -0,0 +1,63 @@ +package config + +import "fmt" + +type RouterConfig struct { + // Required + ConfigURL string + + // Required + InputName string `json:",omitempty" yaml:",omitempty"` + + // Unimplemented. + // If true, the router will batch the requests to the backend. + BatchBackend bool `json:",omitempty" yaml:",omitempty"` + + Global GlobalModelConfig + + Output OutputConfig +} + +type GlobalModelConfig struct { + // Defaults to false + Exists bool `json:",omitempty" yaml:",omitempty"` + + // Required if Exists is false + PredictionReplacements []PredictionReplacement `json:",omitempty" yaml:",omitempty"` +} + +type PredictionReplacement struct { + Name string + Type string + Value any +} + +type OutputConfig struct { + // The name of the output field that contains the model ID. + // If this is blank, then the model ID will not be part of the outputs. + FieldName string `json:",omitempty" yaml:",omitempty"` + + // If the global model is used, this will be used as the global model name + // If RouterConfig.Global.Exists is false, this will be ignored. + GlobalModelOverride string `json:",omitempty" yaml:",omitempty"` + + // If no model is used, this will be used as the model ID + // If RouterConfig.Global.Exists is true, this will be ignored. + NoModelID string `json:",omitempty" yaml:",omitempty"` +} + +func (o *RouterConfig) Validate() error { + if o.ConfigURL == "" { + return fmt.Errorf("config URL is required") + } + + if o.InputName == "" { + return fmt.Errorf("input name is required") + } + + if !o.Global.Exists && len(o.Global.PredictionReplacements) == 0 { + return fmt.Errorf("global model does not exist but no rediction replacements were provided") + } + + return nil +} diff --git a/service/config/triton.go b/service/config/triton.go new file mode 100644 index 0000000..f1219f1 --- /dev/null +++ b/service/config/triton.go @@ -0,0 +1,17 @@ +package config + +type TritonServer struct { + ID string + + // HTTPBaseURL is the base URL for the Triton HTTP server. + // Defaults to http://localhost:8000 + HTTPBaseURL string `json:",omitempty" yaml:",omitempty"` + + // GRPCBaseURL is the base URL for the Triton GRPC server. + // Defaults to localhost:8001 + GRPCBaseURL string `json:",omitempty" yaml:",omitempty"` + + // StartupTimeoutSeconds is the timeout for the Triton server to start up. + // Defaults to 30 seconds. + StartupTimeoutSeconds int `json:",omitempty" yaml:",omitempty"` +} diff --git a/service/endpoint/config.go b/service/endpoint/config.go index abd058c..c5ba49f 100644 --- a/service/endpoint/config.go +++ b/service/endpoint/config.go @@ -25,6 +25,8 @@ type Config struct { config.ModelList `json:",omitempty" yaml:",inline"` sconfig.DatastoreList `json:",omitempty" yaml:",inline"` + TritonServers []config.TritonServer `json:",omitempty" yaml:",omitempty"` + // GlobalBatching provides a default batching configuration if // models do not provide their own. // If GlobalBatching is provided but a model should not be batching, @@ -63,9 +65,11 @@ func (c *Config) Validate() error { if err := c.ModelList.Validate(); err != nil { return err } + if err := c.DatastoreList.Validate(); err != nil { return err } + return nil } diff --git a/service/endpoint/model.go b/service/endpoint/model.go index 7a717b0..a2258cb 100644 --- a/service/endpoint/model.go +++ b/service/endpoint/model.go @@ -104,7 +104,7 @@ func Build(mux *http.ServeMux, config *Config, datastores map[string]*datastore. mstart := time.Now() - log.Printf("[%s] model loading", model.ID) + log.Printf("[%s] Model loading", model.ID) // Validate model configuration first if validateErr := model.Validate(); validateErr != nil { @@ -124,6 +124,7 @@ func Build(mux *http.ServeMux, config *Config, datastores map[string]*datastore. // Default to TensorFlow for models without explicit platform model.Platform = "tensorflow" } + modelSrv, err = service.NewWithPlatform(context.Background(), model, fs, metrics, datastores, sema, cfge.MaxEvaluatorWait, serviceOpts...) if err != nil { diff --git a/shared/config/router/router.go b/shared/config/router/router.go new file mode 100644 index 0000000..c57d952 --- /dev/null +++ b/shared/config/router/router.go @@ -0,0 +1,12 @@ +package config + +type RouterConfig struct { + EntityMapping []EntityKV `json:"entityMapping" yaml:"entityMapping"` + + GlobalModelName string `json:"globalModelName" yaml:"globalModelName"` +} + +type EntityKV struct { + EntityID int `json:"entityID" yaml:"entityID"` + ModelName string `json:"modelName" yaml:"modelName"` +} diff --git a/shared/config/router/router_test.go b/shared/config/router/router_test.go new file mode 100644 index 0000000..7fe3d09 --- /dev/null +++ b/shared/config/router/router_test.go @@ -0,0 +1,58 @@ +package config + +import ( + "encoding/json" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestJSON_EncodeDecode_WithGlobal(t *testing.T) { + cfg := &RouterConfig{ + EntityMapping: []EntityKV{ + {EntityID: 12345, ModelName: "roas_model_12345_202511121116"}, + {EntityID: 12347, ModelName: "roas_model_12347_202511111116"}, + }, + GlobalModelName: "roas_global_202511111116", + } + + data, err := json.Marshal(cfg) + require.NoError(t, err) + + expected := `{"entityMapping":[{"entityID":12345,"modelName":"roas_model_12345_202511121116"},{"entityID":12347,"modelName":"roas_model_12347_202511111116"}],"globalModelName":"roas_global_202511111116"}` + require.Equal(t, expected, string(data)) + + var decoded RouterConfig + require.NoError(t, json.Unmarshal(data, &decoded)) + + require.Equal(t, cfg.GlobalModelName, decoded.GlobalModelName) + require.Len(t, decoded.EntityMapping, 2) + require.Equal(t, 12345, decoded.EntityMapping[0].EntityID) + require.Equal(t, "roas_model_12345_202511121116", decoded.EntityMapping[0].ModelName) + require.Equal(t, 12347, decoded.EntityMapping[1].EntityID) + require.Equal(t, "roas_model_12347_202511111116", decoded.EntityMapping[1].ModelName) +} + +func TestJSON_Decode_NoGlobal(t *testing.T) { + data := []byte(`{"entityMapping":[{"entityID":1,"modelName":"m1"}]}`) + var cfg RouterConfig + require.NoError(t, json.Unmarshal(data, &cfg)) + require.Empty(t, cfg.GlobalModelName) + require.Len(t, cfg.EntityMapping, 1) + require.Equal(t, 1, cfg.EntityMapping[0].EntityID) + require.Equal(t, "m1", cfg.EntityMapping[0].ModelName) +} + +func TestJSON_Decode_EmptyArray(t *testing.T) { + data := []byte(`{"entityMapping":[]}`) + var cfg RouterConfig + require.NoError(t, json.Unmarshal(data, &cfg)) + require.NotNil(t, cfg.EntityMapping) + require.Len(t, cfg.EntityMapping, 0) +} + +func TestJSON_Decode_InvalidEntityID(t *testing.T) { + data := []byte(`{"entityMapping":[{"entityID":"oops","modelName":"x"}]}`) + var cfg RouterConfig + require.Error(t, json.Unmarshal(data, &cfg)) +} diff --git a/shared/field.go b/shared/field.go index dbfceb9..f498040 100644 --- a/shared/field.go +++ b/shared/field.go @@ -137,11 +137,14 @@ func (m *MetaInput) FieldByName() map[string]*Field { func (m *MetaInput) Init() { // TODO assess why this approach was taken - this condition could be improved by having a map to see if the field by name already exists if len(m.Inputs) == 0 { + // Add KeyFields to Inputs if len(m.KeyFields) > 0 { for _, field := range m.KeyFields { m.Inputs = append(m.Inputs, &Field{Name: field}) } } + + // Add Auxiliary fields to Inputs if len(m.Auxiliary) > 0 { for _, field := range m.Auxiliary { m.Inputs = append(m.Inputs, &Field{Name: field, Auxiliary: true}) From 1b31c42396df6e998089de3f55800bc868c26df3 Mon Sep 17 00:00:00 2001 From: David Choi Date: Thu, 13 Nov 2025 10:54:17 -0800 Subject: [PATCH 03/38] Reorganize platform, separate tests for Triton Config, start updating intra-project Health APIs. --- service/config/triton_test.go | 168 ++++++++++++ service/domain/input.go | 18 +- service/endpoint/health.go | 1 - service/endpoint/health/handler.go | 21 +- .../endpoint/health/health_endpoint_test.go | 49 +--- service/platform/evaluator.go | 42 +++ service/platform/factory.go | 42 --- service/platform/factory/factory.go | 38 +++ service/platform/router.go | 69 ----- service/platform/tensorflow.go | 18 -- service/service.go | 93 +++---- service/service_health_test.go | 28 -- service/tfmodel/evaluator/meta.go | 1 + service/tfmodel/service.go | 9 +- service/{platform => triton}/triton.go | 19 +- .../triton_test.go} | 245 ++---------------- 16 files changed, 363 insertions(+), 498 deletions(-) create mode 100644 service/config/triton_test.go delete mode 100644 service/endpoint/health.go create mode 100644 service/platform/evaluator.go delete mode 100644 service/platform/factory.go create mode 100644 service/platform/factory/factory.go delete mode 100644 service/platform/router.go delete mode 100644 service/service_health_test.go rename service/{platform => triton}/triton.go (97%) rename service/{platform/platform_test.go => triton/triton_test.go} (81%) diff --git a/service/config/triton_test.go b/service/config/triton_test.go new file mode 100644 index 0000000..6a867fc --- /dev/null +++ b/service/config/triton_test.go @@ -0,0 +1,168 @@ +package config + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestTritonModelConfigValidation(t *testing.T) { + testCases := []struct { + name string + config *Model + expectError bool + errorMsg string + }{ + { + name: "valid_tensorflow_model", + config: &Model{ + ID: "test_tf", + Platform: "tensorflow", + URL: "file:///tmp/model", + }, + expectError: false, + }, + { + name: "valid_triton_model", + config: &Model{ + ID: "test_triton", + Platform: "triton", + URL: "http://localhost:8000", + Triton: &TritonConfig{ + ModelName: "test_model", + Timeout: 30, + }, + }, + expectError: false, + }, + { + name: "tensorflow_missing_url", + config: &Model{ + ID: "test_tf_no_url", + Platform: "tensorflow", + }, + expectError: true, + errorMsg: "URL", + }, + { + name: "triton_missing_config", + config: &Model{ + ID: "test_triton_no_config", + Platform: "triton", + }, + expectError: true, + errorMsg: "Triton configuration", + }, + { + name: "triton_missing_server_url", + config: &Model{ + ID: "test_triton_no_server", + Platform: "triton", + Triton: &TritonConfig{ + ModelName: "test_model", + }, + }, + expectError: true, + errorMsg: "URL", + }, + { + name: "triton_missing_model_name", + config: &Model{ + ID: "test_triton_no_model", + Platform: "triton", + URL: "http://localhost:8000", + Triton: &TritonConfig{}, + }, + expectError: true, + errorMsg: "ModelName", + }, + { + name: "missing_model_id", + config: &Model{ + Platform: "tensorflow", + URL: "file:///tmp/model", + }, + expectError: true, + errorMsg: "ID", + }, + { + name: "default_platform_missing_url", + config: &Model{ + ID: "test_default_no_url", + // No platform specified, should default to tensorflow + }, + expectError: true, + errorMsg: "URL", + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + err := tc.config.Validate() + + if tc.expectError { + assert.Error(t, err) + if tc.errorMsg != "" { + assert.Contains(t, err.Error(), tc.errorMsg) + } + } else { + assert.NoError(t, err) + } + }) + } +} + +func TestTritonConfigValidation(t *testing.T) { + testCases := []struct { + name string + config *TritonConfig + expectError bool + errorMsg string + }{ + { + name: "valid_triton_config", + config: &TritonConfig{ + ModelName: "test_model", + Timeout: 30, + }, + expectError: false, + }, + { + name: "valid_triton_config_minimal", + config: &TritonConfig{ + ModelName: "test_model", + // Timeout is optional + }, + expectError: false, + }, + { + name: "missing_model_name", + config: &TritonConfig{}, + expectError: true, + errorMsg: "ModelName", + }, + { + name: "empty_model_name", + config: &TritonConfig{ + ModelName: "", + }, + expectError: true, + errorMsg: "ModelName", + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + err := tc.config.Validate(true) + + if tc.expectError { + assert.Error(t, err) + if tc.errorMsg != "" { + assert.Contains(t, err.Error(), tc.errorMsg) + } + } else { + assert.NoError(t, err) + } + }) + } +} diff --git a/service/domain/input.go b/service/domain/input.go index 536c1e8..1dfe28e 100644 --- a/service/domain/input.go +++ b/service/domain/input.go @@ -7,13 +7,21 @@ import ( ) type Input struct { - Name string - Index int // Position of Tensor in model input. + Name string - Placeholder tf.Output // TODO refactor out this usage in service/domain.Signature is different from its usage in service/request.Request + // Position of Tensor in model input. + // Overwritten when the TF signature is parsed. + Index int - Vocab bool // false if embedded vocabulary should be ignored - Auxiliary bool // true if this input isn't part of the model + // TODO refactor out this usage in service/domain.Signature is different from its usage in service/request.Request + Placeholder tf.Output + + // Vocab is false if embedded vocabulary should be ignored + // This is used in evaluators that support a deeper graph traversal (TensorFlow). + Vocab bool + + // Auxiliary is true if this input isn't part of the model + Auxiliary bool Type reflect.Type } diff --git a/service/endpoint/health.go b/service/endpoint/health.go deleted file mode 100644 index c7747cf..0000000 --- a/service/endpoint/health.go +++ /dev/null @@ -1 +0,0 @@ -package endpoint diff --git a/service/endpoint/health/handler.go b/service/endpoint/health/handler.go index 72b6504..f123192 100644 --- a/service/endpoint/health/handler.go +++ b/service/endpoint/health/handler.go @@ -10,31 +10,40 @@ import ( ) type HealthHandler struct { - healths map[string]*int32 + healths map[string]GetHealth mu *sync.Mutex } +type GetHealth interface { + GetHealth() int32 +} + func NewHealthHandler() *HealthHandler { return &HealthHandler{ mu: new(sync.Mutex), - healths: make(map[string]*int32), + healths: make(map[string]GetHealth), } } -func (h *HealthHandler) RegisterHealthPoint(name string, isOkPtr *int32) { +func (h *HealthHandler) RegisterHealthPoint(name string, gh GetHealth) { h.mu.Lock() defer h.mu.Unlock() - h.healths[name] = isOkPtr + h.healths[name] = gh } // implements Hook func (h *HealthHandler) Hook(model *config.Model, modelSrv *service.Service) { - h.RegisterHealthPoint(model.ID, &modelSrv.HealthStatus) + h.RegisterHealthPoint(model.ID, modelSrv) } // implements http.Handler func (h *HealthHandler) ServeHTTP(writer http.ResponseWriter, request *http.Request) { - JSON, _ := json.Marshal(h.healths) + healths := make(map[string]int32) + for name, gh := range h.healths { + healths[name] = gh.GetHealth() + } + + JSON, _ := json.Marshal(healths) writer.Header().Set("Content-Type", "application/json") writer.Write(JSON) } diff --git a/service/endpoint/health/health_endpoint_test.go b/service/endpoint/health/health_endpoint_test.go index c6e10e7..7d25a26 100644 --- a/service/endpoint/health/health_endpoint_test.go +++ b/service/endpoint/health/health_endpoint_test.go @@ -4,7 +4,6 @@ import ( "encoding/json" "net/http" "net/http/httptest" - "sync/atomic" "testing" "github.com/stretchr/testify/assert" @@ -13,56 +12,14 @@ import ( "github.com/viant/mly/service/config" ) -func TestHealthHandler_WithHealthStatus(t *testing.T) { - handler := NewHealthHandler() - - // Test basic health reporting with new HealthStatus field - srv := &service.Service{} - atomic.StoreInt32(&srv.HealthStatus, 1) // Healthy - - model := &config.Model{ID: "test_model"} - handler.Hook(model, srv) - - // Create HTTP request - req := httptest.NewRequest("GET", "/v1/health", nil) - w := httptest.NewRecorder() - - // Handle request - handler.ServeHTTP(w, req) - - // Verify response - assert.Equal(t, http.StatusOK, w.Code) - assert.Equal(t, "application/json", w.Header().Get("Content-Type")) - - // Parse response - var response map[string]*int32 - err := json.Unmarshal(w.Body.Bytes(), &response) - require.NoError(t, err) - - // Verify model is healthy - require.Contains(t, response, "test_model") - assert.Equal(t, int32(1), *response["test_model"]) - - // Test dynamic health changes - atomic.StoreInt32(&srv.HealthStatus, 0) - - req2 := httptest.NewRequest("GET", "/v1/health", nil) - w2 := httptest.NewRecorder() - handler.ServeHTTP(w2, req2) - - var response2 map[string]*int32 - err = json.Unmarshal(w2.Body.Bytes(), &response2) - require.NoError(t, err) - assert.Equal(t, int32(0), *response2["test_model"]) -} - // Test backward compatibility - health endpoint API unchanged func TestHealthHandler_BackwardCompatibility(t *testing.T) { handler := NewHealthHandler() // The health endpoint API should remain the same for clients - srv := &service.Service{} - atomic.StoreInt32(&srv.HealthStatus, 1) + srv := &service.Service{ + ReloadOK: 1, + } model := &config.Model{ID: "compat_test"} handler.Hook(model, srv) diff --git a/service/platform/evaluator.go b/service/platform/evaluator.go new file mode 100644 index 0000000..28cb9be --- /dev/null +++ b/service/platform/evaluator.go @@ -0,0 +1,42 @@ +package platform + +import ( + "context" + + "github.com/viant/mly/service/domain" + "github.com/viant/mly/shared/common" +) + +// ModelPlatform represents the different model platforms supported +type ModelPlatform string + +const ( + PlatformTensorFlow ModelPlatform = "tensorflow" + PlatformTriton ModelPlatform = "triton" +) + +// PlatformEvaluator defines the interface that all platform-specific evaluators must implement +type PlatformEvaluator interface { + // Predict performs model inference with the given parameters + Predict(ctx context.Context, params []interface{}) ([]interface{}, error) + + // Signature returns underlying model's signature + Signature() *domain.Signature + + // Dictionary returns vocabulary if available + Dictionary() *common.Dictionary + + // Inputs returns the model input definitions for request validation + Inputs() map[string]*domain.Input + + // Stats returns platform-specific live metrics, for debugging + Stats(stats map[string]interface{}) + + // Close releases resources + Close() error + + // ReloadIfNeeded will update models as needed, and check their health. + // For in-process models (TensorFlow), this will check if the underlying models need to be updated. + // For external models (Triton), this will check Triton models' health. + ReloadIfNeeded(ctx context.Context) error +} diff --git a/service/platform/factory.go b/service/platform/factory.go deleted file mode 100644 index 42c0870..0000000 --- a/service/platform/factory.go +++ /dev/null @@ -1,42 +0,0 @@ -package platform - -import ( - "fmt" - "time" - - "github.com/viant/afs" - "github.com/viant/gmetric" - "github.com/viant/mly/service/config" - "github.com/viant/mly/service/tfmodel" - "golang.org/x/sync/semaphore" -) - -// CreateEvaluator creates the appropriate platform evaluator based on the model configuration -func CreateEvaluator(cfg *config.Model, fs afs.Service, metrics *gmetric.Service, sema *semaphore.Weighted, maxEvaluatorWait time.Duration) (PlatformEvaluator, ModelPlatform, error) { - platform := cfg.GetPlatform() - - switch platform { - case "tensorflow": - // Create TensorFlow service using existing code - tfService := tfmodel.NewService(cfg, fs, metrics, sema, maxEvaluatorWait) - evaluator := NewTensorFlowEvaluator(tfService) - return evaluator, PlatformTensorFlow, nil - - case "triton": - evaluator := NewTritonEvaluator(cfg) - return evaluator, PlatformTriton, nil - - default: - return nil, "", fmt.Errorf("unsupported platform: %s for model %s", platform, cfg.ID) - } -} - -// CreateEvaluatorContext creates a platform evaluator with context -func CreateEvaluatorContext(cfg *config.Model, fs afs.Service, metrics *gmetric.Service, sema *semaphore.Weighted, maxEvaluatorWait time.Duration) (*PlatformEvaluatorContext, error) { - evaluator, platform, err := CreateEvaluator(cfg, fs, metrics, sema, maxEvaluatorWait) - if err != nil { - return nil, err - } - - return NewEvaluatorContext(cfg, evaluator, platform), nil -} diff --git a/service/platform/factory/factory.go b/service/platform/factory/factory.go new file mode 100644 index 0000000..36cd73a --- /dev/null +++ b/service/platform/factory/factory.go @@ -0,0 +1,38 @@ +package factory + +import ( + "fmt" + "time" + + "github.com/viant/afs" + "github.com/viant/gmetric" + "github.com/viant/mly/service/config" + "github.com/viant/mly/service/platform" + "github.com/viant/mly/service/tfmodel" + "github.com/viant/mly/service/triton" + "golang.org/x/sync/semaphore" +) + +// CreateEvaluator creates the appropriate platform evaluator based on the model configuration +func CreateEvaluator( + cfg *config.Model, + fs afs.Service, + metrics *gmetric.Service, + sema *semaphore.Weighted, + maxEvaluatorWait time.Duration, +) (platform.PlatformEvaluator, error) { + p := cfg.GetPlatform() + + switch p { + case "tensorflow": + // Create TensorFlow service using existing code + tfService := tfmodel.NewService(cfg, fs, metrics, sema, maxEvaluatorWait) + return tfService, nil + + case "triton": + return triton.NewTritonEvaluator(cfg) + + default: + return nil, fmt.Errorf("unsupported platform: %s for model %s", p, cfg.ID) + } +} diff --git a/service/platform/router.go b/service/platform/router.go deleted file mode 100644 index 45eceaf..0000000 --- a/service/platform/router.go +++ /dev/null @@ -1,69 +0,0 @@ -package platform - -import ( - "context" - - "github.com/viant/mly/service/config" - "github.com/viant/mly/service/domain" - "github.com/viant/mly/shared/common" -) - -// ModelPlatform represents the different model platforms supported -type ModelPlatform string - -const ( - PlatformTensorFlow ModelPlatform = "tensorflow" - PlatformTriton ModelPlatform = "triton" -) - -// PlatformEvaluator defines the interface that all platform-specific evaluators must implement -type PlatformEvaluator interface { - // Predict performs model inference with the given parameters - Predict(ctx context.Context, params []interface{}) ([]interface{}, error) - - // Signature returns model signature information - Signature() *domain.Signature - - // Dictionary returns vocabulary dictionary if available - Dictionary() *common.Dictionary - - // Inputs returns the model input definitions for request validation - Inputs() map[string]*domain.Input - - // Stats returns platform-specific statistics - Stats(stats map[string]interface{}) - - // Close releases resources - Close() error - - // IsHealthy performs health check for the platform/model - IsHealthy() bool - - // SetHealthStatus sets the health status pointer for centralized health reporting - SetHealthStatus(healthPtr *int32) - - // SupportsHealthReporting returns true if this platform supports centralized health reporting - SupportsHealthReporting() bool - - // ReloadIfNeeded performs model reload if needed (for platforms that support reload) - ReloadIfNeeded(ctx context.Context) error - - // SupportsReload returns true if this platform supports model reloading - SupportsReload() bool -} - -// PlatformEvaluatorContext holds platform evaluator with context -type PlatformEvaluatorContext struct { - Evaluator PlatformEvaluator - Platform ModelPlatform - Config *config.Model -} - -// NewEvaluatorContext creates a new platform evaluator context -func NewEvaluatorContext(config *config.Model, evaluator PlatformEvaluator, platform ModelPlatform) *PlatformEvaluatorContext { - return &PlatformEvaluatorContext{ - Evaluator: evaluator, - Platform: platform, - Config: config, - } -} diff --git a/service/platform/tensorflow.go b/service/platform/tensorflow.go index 11a3a50..3b4b2f2 100644 --- a/service/platform/tensorflow.go +++ b/service/platform/tensorflow.go @@ -2,7 +2,6 @@ package platform import ( "context" - "sync/atomic" "github.com/viant/mly/service/domain" "github.com/viant/mly/service/tfmodel" @@ -51,23 +50,6 @@ func (t *TensorFlowEvaluator) Inputs() map[string]*domain.Input { return t.tfService.Inputs() } -// IsHealthy returns true if the TensorFlow model is healthy (reload successful) -func (t *TensorFlowEvaluator) IsHealthy() bool { - if t.tfService.ReloadOK == nil { - return false - } - return atomic.LoadInt32(t.tfService.ReloadOK) == 1 -} - -// SetHealthStatus sets the health status pointer for centralized health reporting -func (t *TensorFlowEvaluator) SetHealthStatus(healthPtr *int32) { - t.tfService.ReloadOK = healthPtr -} - -func (t *TensorFlowEvaluator) SupportsHealthReporting() bool { - return true -} - // ReloadIfNeeded performs model reload if needed for TensorFlow models func (t *TensorFlowEvaluator) ReloadIfNeeded(ctx context.Context) error { return t.tfService.ReloadIfNeeded(ctx) diff --git a/service/service.go b/service/service.go index 9afe693..fd365c3 100644 --- a/service/service.go +++ b/service/service.go @@ -18,6 +18,7 @@ import ( serrs "github.com/viant/mly/service/errors" "github.com/viant/mly/service/gtlyop" "github.com/viant/mly/service/platform" + "github.com/viant/mly/service/platform/factory" "github.com/viant/mly/service/request" "github.com/viant/mly/service/stat" "github.com/viant/mly/service/stream" @@ -47,10 +48,11 @@ type Service struct { inputProvider *gtly.Provider // health status for centralized health reporting - HealthStatus int32 + // Deprecated: use GetHealth() instead + ReloadOK int32 // Platform evaluator context for multi-platform support - evaluatorContext *platform.PlatformEvaluatorContext + evaluator platform.PlatformEvaluator // caching useDatastore bool @@ -62,19 +64,22 @@ type Service struct { // serviceMetric measures validate + model + transformer serviceMetric *gmetric.Operation - reloadMetric *gmetric.Operation + + // reloadMetric measures model reloading and health + reloadMetric *gmetric.Operation // logging stream *stream.Service } +// TODO find usages func (s *Service) Close() error { if !atomic.CompareAndSwapInt32(&s.closed, 0, 1) { return fmt.Errorf("already closed") } - if s.evaluatorContext != nil && s.evaluatorContext.Evaluator != nil { - return s.evaluatorContext.Evaluator.Close() + if s.evaluator != nil { + return s.evaluator.Close() } return nil @@ -85,15 +90,15 @@ func (s *Service) Config() *config.Model { } func (s *Service) Signature() *domain.Signature { - if s.evaluatorContext != nil && s.evaluatorContext.Evaluator != nil { - return s.evaluatorContext.Evaluator.Signature() + if s.evaluator != nil { + return s.evaluator.Signature() } return nil } func (s *Service) Dictionary() *common.Dictionary { - if s.evaluatorContext != nil && s.evaluatorContext.Evaluator != nil { - return s.evaluatorContext.Evaluator.Dictionary() + if s.evaluator != nil { + return s.evaluator.Dictionary() } return nil } @@ -101,8 +106,8 @@ func (s *Service) Dictionary() *common.Dictionary { func (s *Service) Stats() map[string]interface{} { st := make(map[string]interface{}) - if s.evaluatorContext != nil && s.evaluatorContext.Evaluator != nil { - s.evaluatorContext.Evaluator.Stats(st) + if s.evaluator != nil { + s.evaluator.Stats(st) } return st @@ -183,8 +188,8 @@ func (s *Service) evaluate(ctx context.Context, request *request.Request) ([]int var result []interface{} var err error - if s.evaluatorContext != nil && s.evaluatorContext.Evaluator != nil { - result, err = s.evaluatorContext.Evaluator.Predict(ctx, request.Feeds) + if s.evaluator != nil { + result, err = s.evaluator.Predict(ctx, request.Feeds) } else { panic("no evaluator configured for model " + s.config.ID) } @@ -294,7 +299,7 @@ func (s *Service) transformOutput(ctx context.Context, request *request.Request, } func (s *Service) initializeService(ctx context.Context, cfg *config.Model, fs afs.Service, metrics *gmetric.Service, datastores map[string]*datastore.Service) error { - err := s.reloadIfNeeded(ctx) + err := s.evaluator.ReloadIfNeeded(ctx) if err != nil { return err } @@ -329,9 +334,16 @@ func (s *Service) initializeService(ctx context.Context, cfg *config.Model, fs a } // NewWithPlatform creates a service with platform router support -func NewWithPlatform(ctx context.Context, - cfg *config.Model, fs afs.Service, metrics *gmetric.Service, datastores map[string]*datastore.Service, - sema *semaphore.Weighted, maxEvaluatorWait time.Duration, options ...Option) (*Service, error) { +func NewWithPlatform( + ctx context.Context, + cfg *config.Model, + fs afs.Service, + metrics *gmetric.Service, + datastores map[string]*datastore.Service, + sema *semaphore.Weighted, + maxEvaluatorWait time.Duration, + options ...Option, +) (*Service, error) { if metrics == nil { metrics = gmetric.New() @@ -342,27 +354,20 @@ func NewWithPlatform(ctx context.Context, cfg.Init(nil) // Create platform evaluator context - evaluatorContext, err := platform.CreateEvaluatorContext(cfg, fs, metrics, sema, maxEvaluatorWait) + evaluatorContext, err := factory.CreateEvaluator(cfg, fs, metrics, sema, maxEvaluatorWait) if err != nil { return nil, fmt.Errorf("failed to create platform evaluator for model %s: %w", cfg.ID, err) } srv := &Service{ - config: cfg, - evaluatorContext: evaluatorContext, - useDatastore: cfg.UseDictionary() && cfg.DataStore != "", - serviceMetric: metrics.MultiOperationCounter(location, cfg.ID+"Perf", cfg.ID+" service performance", time.Microsecond, time.Minute, 2, stat.NewProvider()), - } - - // Set up health reporting for platforms that support it - if evaluatorContext.Evaluator.SupportsHealthReporting() { - evaluatorContext.Evaluator.SetHealthStatus(&srv.HealthStatus) + config: cfg, + evaluator: evaluatorContext, + useDatastore: cfg.UseDictionary() && cfg.DataStore != "", + serviceMetric: metrics.MultiOperationCounter(location, cfg.ID+"Perf", cfg.ID+" service performance", time.Microsecond, time.Minute, 2, stat.NewProvider()), } // Set up reload metrics for platforms that support reloading - if evaluatorContext.Evaluator.SupportsReload() { - srv.reloadMetric = metrics.MultiOperationCounter(location, cfg.ID+"Reload", cfg.ID+" reloading", time.Microsecond, time.Minute, 1, sstat.NewCtxErrOnly()) - } + srv.reloadMetric = metrics.MultiOperationCounter(location, cfg.ID+"Reload", cfg.ID+" reloading", time.Microsecond, time.Minute, 1, sstat.NewCtxErrOnly()) for _, opt := range options { opt.Apply(srv) @@ -373,21 +378,11 @@ func NewWithPlatform(ctx context.Context, return nil, err } - if evaluatorContext.Evaluator.SupportsReload() { - go srv.scheduleModelReload() - } + go srv.pollModelReload() return srv, err } -func (s *Service) reloadIfNeeded(ctx context.Context) error { - - if s.evaluatorContext != nil && s.evaluatorContext.Evaluator != nil { - return s.evaluatorContext.Evaluator.ReloadIfNeeded(ctx) - } - return nil -} - // NewRequest should be used for Do() func (s *Service) NewRequest() *request.Request { numKeyInputs := s.config.KeysLen() @@ -396,8 +391,8 @@ func (s *Service) NewRequest() *request.Request { var inputs map[string]*domain.Input - if s.evaluatorContext != nil && s.evaluatorContext.Evaluator != nil { - inputs = s.evaluatorContext.Evaluator.Inputs() + if s.evaluator != nil { + inputs = s.evaluator.Inputs() } return request.NewRequest(numKeyInputs, inputs) @@ -443,7 +438,13 @@ func (s *Service) initDatastore(cfg *config.Model, datastores map[string]*datast return nil } -func (s *Service) scheduleModelReload() { +// GetHealth returns the health status of the service +// Implements service/endpoint/health.GetHealth +func (s *Service) GetHealth() int32 { + return s.ReloadOK +} + +func (s *Service) pollModelReload() { for range time.Tick(time.Minute) { ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) defer cancel() @@ -456,12 +457,12 @@ func (s *Service) scheduleModelReload() { }() } - err := s.reloadIfNeeded(ctx) + err := s.evaluator.ReloadIfNeeded(ctx) if err != nil { stats.AppendError(err) log.Printf("[%s reload] failed to reload model:%v", s.config.ID, err) // Update health status for reload failure (TensorFlow models) - atomic.StoreInt32(&s.HealthStatus, 0) + atomic.StoreInt32(&s.ReloadOK, 0) } if atomic.LoadInt32(&s.closed) != 0 { diff --git a/service/service_health_test.go b/service/service_health_test.go deleted file mode 100644 index b5e74b7..0000000 --- a/service/service_health_test.go +++ /dev/null @@ -1,28 +0,0 @@ -package service - -import ( - "sync/atomic" - "testing" - - "github.com/stretchr/testify/assert" -) - -// Test that HealthStatus field works correctly -func TestService_HealthStatusField(t *testing.T) { - srv := &Service{} - - // Verify the field exists and can be used - assert.Equal(t, int32(0), srv.HealthStatus) - - // Test atomic operations - atomic.StoreInt32(&srv.HealthStatus, 1) - assert.Equal(t, int32(1), atomic.LoadInt32(&srv.HealthStatus)) - - atomic.StoreInt32(&srv.HealthStatus, 0) - assert.Equal(t, int32(0), atomic.LoadInt32(&srv.HealthStatus)) - - // Test that it works with pointers (for health endpoint) - healthPtr := &srv.HealthStatus - atomic.StoreInt32(healthPtr, 1) - assert.Equal(t, int32(1), atomic.LoadInt32(&srv.HealthStatus)) -} diff --git a/service/tfmodel/evaluator/meta.go b/service/tfmodel/evaluator/meta.go index 1793d1d..40d5a6e 100644 --- a/service/tfmodel/evaluator/meta.go +++ b/service/tfmodel/evaluator/meta.go @@ -13,6 +13,7 @@ type EvaluatorMeta struct { // prevents potentially explosive thread generation due to concurrent requests // this should be shared across all Evaluators. semaphore *semaphore.Weighted + // prevents excessive waiting if semaphore is full and no other safeguards in place maxEvaluatorWait time.Duration diff --git a/service/tfmodel/service.go b/service/tfmodel/service.go index 337f7d4..a2bf8e5 100644 --- a/service/tfmodel/service.go +++ b/service/tfmodel/service.go @@ -10,7 +10,6 @@ import ( "reflect" "strings" "sync" - "sync/atomic" "time" tf "github.com/tensorflow/tensorflow/tensorflow/go" @@ -36,6 +35,7 @@ import ( // model runs. // It manages loading and reloading the model files, as well as providing // metadata based off the model and configuration. +// Implements platform.PlatformEvaluator. type Service struct { // Modifies this object to be used by config endpoints. config *config.Model @@ -60,9 +60,6 @@ type Service struct { dictionary *common.Dictionary fs afs.Service - - // Should point to service.Service.ReloadOK - ReloadOK *int32 } func (s *Service) Predict(ctx context.Context, params []interface{}) ([]interface{}, error) { @@ -97,13 +94,12 @@ func (s *Service) ReloadIfNeeded(ctx context.Context) error { } if !s.isModified(snapshot) { - atomic.StoreInt32(s.ReloadOK, 1) return nil } model, err := s.loadModel(ctx, err) if err != nil { - return err + return fmt.Errorf("failed to load model:%w", err) } signature, err := signature.Signature(model) @@ -207,7 +203,6 @@ func (s *Service) ReloadIfNeeded(ctx context.Context) error { s.signature = signature s.inputs = modelInputsByName - atomic.StoreInt32(s.ReloadOK, 1) return nil } diff --git a/service/platform/triton.go b/service/triton/triton.go similarity index 97% rename from service/platform/triton.go rename to service/triton/triton.go index fbbda63..e42b3f6 100644 --- a/service/platform/triton.go +++ b/service/triton/triton.go @@ -1,4 +1,4 @@ -package platform +package triton import ( "context" @@ -12,9 +12,11 @@ import ( "time" triton "github.com/viant/mly/proto/triton" + "github.com/viant/mly/service/config" "github.com/viant/mly/service/domain" "github.com/viant/mly/shared/common" + "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" ) @@ -29,7 +31,8 @@ type preparedInput struct { // TritonEvaluator implements PlatformEvaluator for Triton Inference Server via gRPC type TritonEvaluator struct { - config *config.Model + config *config.Model + serverURL string modelName string @@ -48,7 +51,7 @@ type TritonEvaluator struct { } // NewTritonEvaluator creates a new Triton evaluator -func NewTritonEvaluator(config *config.Model) *TritonEvaluator { +func NewTritonEvaluator(config *config.Model) (*TritonEvaluator, error) { serverURL := config.URL modelName := config.ID timeout := 100 * time.Millisecond @@ -67,8 +70,9 @@ func NewTritonEvaluator(config *config.Model) *TritonEvaluator { conn, err := grpc.NewClient(grpcAddr, grpc.WithTransportCredentials(insecure.NewCredentials()), ) + if err != nil { - panic(fmt.Sprintf("Failed to create Triton gRPC client at %s: %v", grpcAddr, err)) + return nil, fmt.Errorf("failed to create Triton gRPC client at %s: %w", grpcAddr, err) } evaluator := &TritonEvaluator{ @@ -84,7 +88,7 @@ func NewTritonEvaluator(config *config.Model) *TritonEvaluator { evaluator.signature = evaluator.computeSignature() evaluator.inputs = evaluator.computeInputs() - return evaluator + return evaluator, nil } func parseGRPCAddress(url string) string { @@ -663,8 +667,3 @@ func (t *TritonEvaluator) ReloadIfNeeded(ctx context.Context) error { // No-op: Triton models are managed externally return nil } - -// SupportsReload returns false since Triton models don't support reloading through MLY -func (t *TritonEvaluator) SupportsReload() bool { - return false -} diff --git a/service/platform/platform_test.go b/service/triton/triton_test.go similarity index 81% rename from service/platform/platform_test.go rename to service/triton/triton_test.go index 548bd1b..c98a4a4 100644 --- a/service/platform/platform_test.go +++ b/service/triton/triton_test.go @@ -1,4 +1,4 @@ -package platform +package triton import ( "context" @@ -11,13 +11,19 @@ import ( "github.com/stretchr/testify/require" triton "github.com/viant/mly/proto/triton" "github.com/viant/mly/service/config" - "github.com/viant/mly/service/tfmodel" + "github.com/viant/mly/service/platform" "github.com/viant/mly/shared" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/test/bufconn" ) +func newTritonEvaluator(t *testing.T, cfg *config.Model) *TritonEvaluator { + evaluator, err := NewTritonEvaluator(cfg) + require.NoError(t, err) + return evaluator +} + func TestTritonEvaluator_Signature(t *testing.T) { cfg := &config.Model{ ID: "test_model", @@ -37,7 +43,7 @@ func TestTritonEvaluator_Signature(t *testing.T) { }, } - evaluator := NewTritonEvaluator(cfg) + evaluator := newTritonEvaluator(t, cfg) defer evaluator.Close() sig := evaluator.Signature() @@ -67,7 +73,7 @@ func TestTritonEvaluator_SignatureWithAuxiliaryInputs(t *testing.T) { }, } - evaluator := NewTritonEvaluator(cfg) + evaluator := newTritonEvaluator(t, cfg) defer evaluator.Close() sig := evaluator.Signature() @@ -95,7 +101,7 @@ func TestTritonEvaluator_Dictionary(t *testing.T) { }, } - evaluator := NewTritonEvaluator(cfg) + evaluator := newTritonEvaluator(t, cfg) defer evaluator.Close() dict := evaluator.Dictionary() @@ -120,7 +126,7 @@ func TestTritonEvaluator_Stats(t *testing.T) { }, } - evaluator := NewTritonEvaluator(cfg) + evaluator := newTritonEvaluator(t, cfg) defer evaluator.Close() stats := make(map[string]interface{}) @@ -150,12 +156,9 @@ func TestTritonEvaluator_ReloadAndSupportsReload(t *testing.T) { }, } - evaluator := NewTritonEvaluator(cfg) + evaluator := newTritonEvaluator(t, cfg) defer evaluator.Close() - // Triton models don't support reloading through MLY - assert.False(t, evaluator.SupportsReload()) - // ReloadIfNeeded should be a no-op err := evaluator.ReloadIfNeeded(context.Background()) assert.NoError(t, err) @@ -183,7 +186,7 @@ func TestTritonEvaluator_InputsMapping(t *testing.T) { }, } - evaluator := NewTritonEvaluator(cfg) + evaluator := newTritonEvaluator(t, cfg) defer evaluator.Close() inputs := evaluator.Inputs() @@ -272,197 +275,6 @@ func TestConfigGetPlatform(t *testing.T) { } } -func TestModelValidation(t *testing.T) { - testCases := []struct { - name string - config *config.Model - expectError bool - errorMsg string - }{ - { - name: "valid_tensorflow_model", - config: &config.Model{ - ID: "test_tf", - Platform: "tensorflow", - URL: "file:///tmp/model", - }, - expectError: false, - }, - { - name: "valid_triton_model", - config: &config.Model{ - ID: "test_triton", - Platform: "triton", - URL: "http://localhost:8000", - Triton: &config.TritonConfig{ - ModelName: "test_model", - Timeout: 30, - }, - }, - expectError: false, - }, - { - name: "tensorflow_missing_url", - config: &config.Model{ - ID: "test_tf_no_url", - Platform: "tensorflow", - }, - expectError: true, - errorMsg: "tensorflow model test_tf_no_url requires URL", - }, - { - name: "triton_missing_config", - config: &config.Model{ - ID: "test_triton_no_config", - Platform: "triton", - }, - expectError: true, - errorMsg: "triton model test_triton_no_config requires Triton configuration", - }, - { - name: "triton_missing_server_url", - config: &config.Model{ - ID: "test_triton_no_server", - Platform: "triton", - Triton: &config.TritonConfig{ - ModelName: "test_model", - }, - }, - expectError: true, - errorMsg: "requires URL (Triton server endpoint)", - }, - { - name: "triton_missing_model_name", - config: &config.Model{ - ID: "test_triton_no_model", - Platform: "triton", - URL: "http://localhost:8000", - Triton: &config.TritonConfig{}, - }, - expectError: true, - errorMsg: "Triton ModelName is required", - }, - { - name: "unsupported_platform", - config: &config.Model{ - ID: "test_unsupported", - Platform: "pytorch", - URL: "file:///tmp/model", - }, - expectError: true, - errorMsg: "unsupported platform 'pytorch' for model test_unsupported", - }, - { - name: "missing_model_id", - config: &config.Model{ - Platform: "tensorflow", - URL: "file:///tmp/model", - }, - expectError: true, - errorMsg: "model.ID was empty", - }, - { - name: "default_platform_missing_url", - config: &config.Model{ - ID: "test_default_no_url", - // No platform specified, should default to tensorflow - }, - expectError: true, - errorMsg: "tensorflow model test_default_no_url requires URL", - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - err := tc.config.Validate() - - if tc.expectError { - assert.Error(t, err) - if tc.errorMsg != "" { - assert.Contains(t, err.Error(), tc.errorMsg) - } - } else { - assert.NoError(t, err) - } - }) - } -} - -func TestTritonConfigValidation(t *testing.T) { - testCases := []struct { - name string - config *config.TritonConfig - expectError bool - errorMsg string - }{ - { - name: "valid_triton_config", - config: &config.TritonConfig{ - ModelName: "test_model", - Timeout: 30, - }, - expectError: false, - }, - { - name: "valid_triton_config_minimal", - config: &config.TritonConfig{ - ModelName: "test_model", - // Timeout is optional - }, - expectError: false, - }, - { - name: "missing_model_name", - config: &config.TritonConfig{}, - expectError: true, - errorMsg: "Triton ModelName is required", - }, - { - name: "empty_model_name", - config: &config.TritonConfig{ - ModelName: "", - }, - expectError: true, - errorMsg: "Triton ModelName is required", - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - err := tc.config.Validate() - - if tc.expectError { - assert.Error(t, err) - if tc.errorMsg != "" { - assert.Contains(t, err.Error(), tc.errorMsg) - } - } else { - assert.NoError(t, err) - } - }) - } -} - -func TestTensorFlowEvaluator_Health(t *testing.T) { - tfService := &tfmodel.Service{} - evaluator := NewTensorFlowEvaluator(tfService) - - // Test basic health functionality - assert.True(t, evaluator.SupportsHealthReporting()) - assert.True(t, evaluator.SupportsReload()) - assert.False(t, evaluator.IsHealthy()) // Uninitialized - - // Test health status with pointer - var healthStatus int32 - evaluator.SetHealthStatus(&healthStatus) - - atomic.StoreInt32(&healthStatus, 1) - assert.True(t, evaluator.IsHealthy()) - - atomic.StoreInt32(&healthStatus, 0) - assert.False(t, evaluator.IsHealthy()) -} - // mockTritonServer implements triton.GRPCInferenceServiceServer for testing type mockTritonServer struct { triton.UnimplementedGRPCInferenceServiceServer @@ -567,7 +379,7 @@ func TestTritonEvaluator_PredictWithMockServer(t *testing.T) { }, } - evaluator := NewTritonEvaluator(cfg) + evaluator := newTritonEvaluator(t, cfg) defer evaluator.Close() // Replace the gRPC connection with mock @@ -634,7 +446,7 @@ func TestTritonEvaluator_PredictWithRawOutputContents(t *testing.T) { }, } - evaluator := NewTritonEvaluator(cfg) + evaluator := newTritonEvaluator(t, cfg) defer evaluator.Close() evaluator.grpcConn = createMockTritonClient(ctx, t, listener) @@ -770,7 +582,7 @@ func TestTritonEvaluator_PredictAllInputTypes(t *testing.T) { }, } - evaluator := NewTritonEvaluator(cfg) + evaluator := newTritonEvaluator(t, cfg) defer evaluator.Close() evaluator.grpcConn = createMockTritonClient(ctx, t, listener) @@ -826,7 +638,7 @@ func TestTritonEvaluator_PredictBytesOutput(t *testing.T) { }, } - evaluator := NewTritonEvaluator(cfg) + evaluator := newTritonEvaluator(t, cfg) defer evaluator.Close() evaluator.grpcConn = createMockTritonClient(ctx, t, listener) @@ -907,7 +719,7 @@ func TestTritonEvaluator_PredictDifferentBatchSizes(t *testing.T) { }, } - evaluator := NewTritonEvaluator(cfg) + evaluator := newTritonEvaluator(t, cfg) defer evaluator.Close() evaluator.grpcConn = createMockTritonClient(ctx, t, listener) @@ -973,7 +785,7 @@ func TestTritonEvaluator_PredictUnsupportedType(t *testing.T) { }, } - evaluator := NewTritonEvaluator(cfg) + evaluator := newTritonEvaluator(t, cfg) defer evaluator.Close() evaluator.grpcConn = createMockTritonClient(ctx, t, listener) @@ -1006,7 +818,7 @@ func TestTritonEvaluator_PredictEmptyBatch(t *testing.T) { }, } - evaluator := NewTritonEvaluator(cfg) + evaluator := newTritonEvaluator(t, cfg) defer evaluator.Close() _, err := evaluator.Predict(context.Background(), []interface{}{}) @@ -1054,7 +866,7 @@ func TestTritonEvaluator_PredictMissingOutput(t *testing.T) { }, } - evaluator := NewTritonEvaluator(cfg) + evaluator := newTritonEvaluator(t, cfg) defer evaluator.Close() evaluator.grpcConn = createMockTritonClient(ctx, t, listener) @@ -1071,7 +883,7 @@ func TestTritonEvaluator_PredictMissingOutput(t *testing.T) { func TestTritonEvaluator_Health(t *testing.T) { t.Run("interface_compliance", func(t *testing.T) { - var _ PlatformEvaluator = (*TritonEvaluator)(nil) + var _ platform.PlatformEvaluator = (*TritonEvaluator)(nil) }) t.Run("supports_health_reporting", func(t *testing.T) { @@ -1092,7 +904,7 @@ func TestTritonEvaluator_Health(t *testing.T) { }, } - evaluator := NewTritonEvaluator(cfg) + evaluator := newTritonEvaluator(t, cfg) defer evaluator.Close() assert.True(t, evaluator.SupportsHealthReporting()) @@ -1116,7 +928,7 @@ func TestTritonEvaluator_Health(t *testing.T) { }, } - evaluator := NewTritonEvaluator(cfg) + evaluator := newTritonEvaluator(t, cfg) defer evaluator.Close() // Initially not healthy (no health pointer set) @@ -1134,10 +946,3 @@ func TestTritonEvaluator_Health(t *testing.T) { assert.False(t, evaluator.IsHealthy()) }) } - -func TestPlatformEvaluator_Interface_Compliance(t *testing.T) { - tfService := &tfmodel.Service{} - var _ PlatformEvaluator = NewTensorFlowEvaluator(tfService) - - var _ PlatformEvaluator = (*TritonEvaluator)(nil) -} From 8120b9c1c2b17a8ebde056ee78878f0e5b45e39e Mon Sep 17 00:00:00 2001 From: David Choi Date: Thu, 13 Nov 2025 11:57:07 -0800 Subject: [PATCH 04/38] Use git submodules and generate entire Triton PB API. --- .gitmodules | 3 + TRITON.md | 23 +- proto/triton/grpc_service.pb.go | 5329 ++++++++++++++++++++--- proto/triton/grpc_service.proto | 65 - proto/triton/grpc_service_grpc.pb.go | 943 ++++- proto/triton/model_config.pb.go | 5829 ++++++++++++++++++++++++++ third_party/triton-common | 1 + 7 files changed, 11626 insertions(+), 567 deletions(-) create mode 100644 .gitmodules delete mode 100644 proto/triton/grpc_service.proto create mode 100644 proto/triton/model_config.pb.go create mode 160000 third_party/triton-common diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..937bfd3 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "third_party/triton-common"] + path = third_party/triton-common + url = git@github.com:triton-inference-server/common.git diff --git a/TRITON.md b/TRITON.md index eef8d14..56ee0a1 100644 --- a/TRITON.md +++ b/TRITON.md @@ -4,6 +4,8 @@ The Triton integration uses protocol buffers for gRPC communication. Generated proto files are **committed to the repository** for build reliability. +Triton uses `raw_output_contents` for performance (binary format vs. structured). + # When to Regenerate Proto Files Regenerate only when: @@ -42,21 +44,20 @@ which protoc-gen-go-grpc # Regeneration Steps -```bash -# 1. Navigate to repo root -cd /path/to/viant/mly +Initialize submodule in `third_party/triton-common`. -# 2. Delete old generated files (ensures clean regeneration) +```bash +# 1. Delete old generated files (ensures clean regeneration) rm -f proto/triton/grpc_service.pb.go rm -f proto/triton/grpc_service_grpc.pb.go -# 3. Regenerate +# 2. Regenerate protoc \ - --go_out=. \ - --go_opt=paths=source_relative \ - --go-grpc_out=. \ - --go-grpc_opt=paths=source_relative \ - proto/triton/grpc_service.proto + -I "$PWD/third_party/triton-common/protobuf" \ + --go_out=paths=source_relative,Mgrpc_service.proto=github.com/viant/mly/proto/triton,Mmodel_config.proto=github.com/viant/mly/proto/triton:"$PWD/proto/triton" \ + --go-grpc_out=paths=source_relative,Mgrpc_service.proto=github.com/viant/mly/proto/triton,Mmodel_config.proto=github.com/viant/mly/proto/triton:"$PWD/proto/triton" \ + "$PWD/third_party/triton-common/protobuf/model_config.proto" \ + "$PWD/third_party/triton-common/protobuf/grpc_service.proto" # 4. Verify generation succeeded ls -lh proto/triton/*.pb.go @@ -92,5 +93,3 @@ git diff proto/triton/ **Notes:** - Generated files are ~30KB and should be committed -- Proto definitions are based on [Triton's official protocol](https://github.com/triton-inference-server/common/blob/main/protobuf/grpc_service.proto) -- Triton uses `raw_output_contents` for performance (binary format vs. structured) \ No newline at end of file diff --git a/proto/triton/grpc_service.pb.go b/proto/triton/grpc_service.pb.go index 57d0fbb..41cedc7 100644 --- a/proto/triton/grpc_service.pb.go +++ b/proto/triton/grpc_service.pb.go @@ -1,8 +1,34 @@ +// Copyright 2020-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 -// protoc v5.29.3 -// source: proto/triton/grpc_service.proto +// protoc-gen-go v1.36.10 +// protoc v6.32.0 +// source: grpc_service.proto package triton @@ -11,6 +37,7 @@ import ( protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" + unsafe "unsafe" ) const ( @@ -20,22 +47,224 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -type ModelReadyRequest struct { - state protoimpl.MessageState +// @@ +// @@.. cpp:var:: message ServerLiveRequest +// @@ +// @@ Request message for ServerLive. +// @@ +type ServerLiveRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache +} + +func (x *ServerLiveRequest) Reset() { + *x = ServerLiveRequest{} + mi := &file_grpc_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ServerLiveRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ServerLiveRequest) ProtoMessage() {} + +func (x *ServerLiveRequest) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ServerLiveRequest.ProtoReflect.Descriptor instead. +func (*ServerLiveRequest) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{0} +} + +// @@ +// @@.. cpp:var:: message ServerLiveResponse +// @@ +// @@ Response message for ServerLive. +// @@ +type ServerLiveResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ + // @@ .. cpp:var:: bool live + // @@ + // @@ True if the inference server is live, false it not live. + // @@ + Live bool `protobuf:"varint,1,opt,name=live,proto3" json:"live,omitempty"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` +func (x *ServerLiveResponse) Reset() { + *x = ServerLiveResponse{} + mi := &file_grpc_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (x *ModelReadyRequest) Reset() { - *x = ModelReadyRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_triton_grpc_service_proto_msgTypes[0] +func (x *ServerLiveResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ServerLiveResponse) ProtoMessage() {} + +func (x *ServerLiveResponse) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ServerLiveResponse.ProtoReflect.Descriptor instead. +func (*ServerLiveResponse) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{1} +} + +func (x *ServerLiveResponse) GetLive() bool { + if x != nil { + return x.Live + } + return false +} + +// @@ +// @@.. cpp:var:: message ServerReadyRequest +// @@ +// @@ Request message for ServerReady. +// @@ +type ServerReadyRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ServerReadyRequest) Reset() { + *x = ServerReadyRequest{} + mi := &file_grpc_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ServerReadyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ServerReadyRequest) ProtoMessage() {} + +func (x *ServerReadyRequest) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ServerReadyRequest.ProtoReflect.Descriptor instead. +func (*ServerReadyRequest) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{2} +} + +// @@ +// @@.. cpp:var:: message ServerReadyResponse +// @@ +// @@ Response message for ServerReady. +// @@ +type ServerReadyResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ + // @@ .. cpp:var:: bool ready + // @@ + // @@ True if the inference server is ready, false it not ready. + // @@ + Ready bool `protobuf:"varint,1,opt,name=ready,proto3" json:"ready,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ServerReadyResponse) Reset() { + *x = ServerReadyResponse{} + mi := &file_grpc_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ServerReadyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ServerReadyResponse) ProtoMessage() {} + +func (x *ServerReadyResponse) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[3] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ServerReadyResponse.ProtoReflect.Descriptor instead. +func (*ServerReadyResponse) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{3} +} + +func (x *ServerReadyResponse) GetReady() bool { + if x != nil { + return x.Ready } + return false +} + +// @@ +// @@.. cpp:var:: message ModelReadyRequest +// @@ +// @@ Request message for ModelReady. +// @@ +type ModelReadyRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ + // @@ .. cpp:var:: string name + // @@ + // @@ The name of the model to check for readiness. + // @@ + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // @@ .. cpp:var:: string version + // @@ + // @@ The version of the model to check for readiness. If not given the + // @@ server will choose a version based on the model and internal policy. + // @@ + Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelReadyRequest) Reset() { + *x = ModelReadyRequest{} + mi := &file_grpc_service_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ModelReadyRequest) String() string { @@ -45,8 +274,8 @@ func (x *ModelReadyRequest) String() string { func (*ModelReadyRequest) ProtoMessage() {} func (x *ModelReadyRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_triton_grpc_service_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + mi := &file_grpc_service_proto_msgTypes[4] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -58,7 +287,7 @@ func (x *ModelReadyRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ModelReadyRequest.ProtoReflect.Descriptor instead. func (*ModelReadyRequest) Descriptor() ([]byte, []int) { - return file_proto_triton_grpc_service_proto_rawDescGZIP(), []int{0} + return file_grpc_service_proto_rawDescGZIP(), []int{4} } func (x *ModelReadyRequest) GetName() string { @@ -75,21 +304,28 @@ func (x *ModelReadyRequest) GetVersion() string { return "" } +// @@ +// @@.. cpp:var:: message ModelReadyResponse +// @@ +// @@ Response message for ModelReady. +// @@ type ModelReadyResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + // @@ + // @@ .. cpp:var:: bool ready + // @@ + // @@ True if the model is ready, false it not ready. + // @@ + Ready bool `protobuf:"varint,1,opt,name=ready,proto3" json:"ready,omitempty"` unknownFields protoimpl.UnknownFields - - Ready bool `protobuf:"varint,1,opt,name=ready,proto3" json:"ready,omitempty"` + sizeCache protoimpl.SizeCache } func (x *ModelReadyResponse) Reset() { *x = ModelReadyResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_triton_grpc_service_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_grpc_service_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ModelReadyResponse) String() string { @@ -99,8 +335,8 @@ func (x *ModelReadyResponse) String() string { func (*ModelReadyResponse) ProtoMessage() {} func (x *ModelReadyResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_triton_grpc_service_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + mi := &file_grpc_service_proto_msgTypes[5] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -112,7 +348,7 @@ func (x *ModelReadyResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ModelReadyResponse.ProtoReflect.Descriptor instead. func (*ModelReadyResponse) Descriptor() ([]byte, []int) { - return file_proto_triton_grpc_service_proto_rawDescGZIP(), []int{1} + return file_grpc_service_proto_rawDescGZIP(), []int{5} } func (x *ModelReadyResponse) GetReady() bool { @@ -122,39 +358,92 @@ func (x *ModelReadyResponse) GetReady() bool { return false } -type InferTensorContents struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache +// @@ +// @@.. cpp:var:: message ServerMetadataRequest +// @@ +// @@ Request message for ServerMetadata. +// @@ +type ServerMetadataRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} - BoolContents []bool `protobuf:"varint,1,rep,packed,name=bool_contents,json=boolContents,proto3" json:"bool_contents,omitempty"` - IntContents []int32 `protobuf:"varint,2,rep,packed,name=int_contents,json=intContents,proto3" json:"int_contents,omitempty"` - Int64Contents []int64 `protobuf:"varint,3,rep,packed,name=int64_contents,json=int64Contents,proto3" json:"int64_contents,omitempty"` - UintContents []uint32 `protobuf:"varint,4,rep,packed,name=uint_contents,json=uintContents,proto3" json:"uint_contents,omitempty"` - Uint64Contents []uint64 `protobuf:"varint,5,rep,packed,name=uint64_contents,json=uint64Contents,proto3" json:"uint64_contents,omitempty"` - Fp32Contents []float32 `protobuf:"fixed32,6,rep,packed,name=fp32_contents,json=fp32Contents,proto3" json:"fp32_contents,omitempty"` - Fp64Contents []float64 `protobuf:"fixed64,7,rep,packed,name=fp64_contents,json=fp64Contents,proto3" json:"fp64_contents,omitempty"` - BytesContents [][]byte `protobuf:"bytes,8,rep,name=bytes_contents,json=bytesContents,proto3" json:"bytes_contents,omitempty"` +func (x *ServerMetadataRequest) Reset() { + *x = ServerMetadataRequest{} + mi := &file_grpc_service_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (x *InferTensorContents) Reset() { - *x = InferTensorContents{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_triton_grpc_service_proto_msgTypes[2] +func (x *ServerMetadataRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ServerMetadataRequest) ProtoMessage() {} + +func (x *ServerMetadataRequest) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[6] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } + return mi.MessageOf(x) } -func (x *InferTensorContents) String() string { +// Deprecated: Use ServerMetadataRequest.ProtoReflect.Descriptor instead. +func (*ServerMetadataRequest) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{6} +} + +// @@ +// @@.. cpp:var:: message ServerMetadataResponse +// @@ +// @@ Response message for ServerMetadata. +// @@ +type ServerMetadataResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ + // @@ .. cpp:var:: string name + // @@ + // @@ The server name. + // @@ + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // @@ + // @@ .. cpp:var:: string version + // @@ + // @@ The server version. + // @@ + Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` + // @@ + // @@ .. cpp:var:: string extensions (repeated) + // @@ + // @@ The extensions supported by the server. + // @@ + Extensions []string `protobuf:"bytes,3,rep,name=extensions,proto3" json:"extensions,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ServerMetadataResponse) Reset() { + *x = ServerMetadataResponse{} + mi := &file_grpc_service_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ServerMetadataResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*InferTensorContents) ProtoMessage() {} +func (*ServerMetadataResponse) ProtoMessage() {} -func (x *InferTensorContents) ProtoReflect() protoreflect.Message { - mi := &file_proto_triton_grpc_service_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { +func (x *ServerMetadataResponse) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[7] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -164,98 +453,157 @@ func (x *InferTensorContents) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use InferTensorContents.ProtoReflect.Descriptor instead. -func (*InferTensorContents) Descriptor() ([]byte, []int) { - return file_proto_triton_grpc_service_proto_rawDescGZIP(), []int{2} +// Deprecated: Use ServerMetadataResponse.ProtoReflect.Descriptor instead. +func (*ServerMetadataResponse) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{7} } -func (x *InferTensorContents) GetBoolContents() []bool { +func (x *ServerMetadataResponse) GetName() string { if x != nil { - return x.BoolContents + return x.Name } - return nil + return "" } -func (x *InferTensorContents) GetIntContents() []int32 { +func (x *ServerMetadataResponse) GetVersion() string { if x != nil { - return x.IntContents + return x.Version } - return nil + return "" } -func (x *InferTensorContents) GetInt64Contents() []int64 { +func (x *ServerMetadataResponse) GetExtensions() []string { if x != nil { - return x.Int64Contents + return x.Extensions } return nil } -func (x *InferTensorContents) GetUintContents() []uint32 { - if x != nil { - return x.UintContents - } - return nil +// @@ +// @@.. cpp:var:: message ModelMetadataRequest +// @@ +// @@ Request message for ModelMetadata. +// @@ +type ModelMetadataRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ + // @@ .. cpp:var:: string name + // @@ + // @@ The name of the model. + // @@ + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // @@ .. cpp:var:: string version + // @@ + // @@ The version of the model to check for readiness. If not + // @@ given the server will choose a version based on the + // @@ model and internal policy. + // @@ + Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (x *InferTensorContents) GetUint64Contents() []uint64 { - if x != nil { - return x.Uint64Contents - } - return nil +func (x *ModelMetadataRequest) Reset() { + *x = ModelMetadataRequest{} + mi := &file_grpc_service_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (x *InferTensorContents) GetFp32Contents() []float32 { +func (x *ModelMetadataRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelMetadataRequest) ProtoMessage() {} + +func (x *ModelMetadataRequest) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[8] if x != nil { - return x.Fp32Contents + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } - return nil + return mi.MessageOf(x) } -func (x *InferTensorContents) GetFp64Contents() []float64 { +// Deprecated: Use ModelMetadataRequest.ProtoReflect.Descriptor instead. +func (*ModelMetadataRequest) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{8} +} + +func (x *ModelMetadataRequest) GetName() string { if x != nil { - return x.Fp64Contents + return x.Name } - return nil + return "" } -func (x *InferTensorContents) GetBytesContents() [][]byte { +func (x *ModelMetadataRequest) GetVersion() string { if x != nil { - return x.BytesContents + return x.Version } - return nil + return "" } -type ModelInferRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache +// @@ +// @@.. cpp:var:: message ModelMetadataResponse +// @@ +// @@ Response message for ModelMetadata. +// @@ +type ModelMetadataResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ + // @@ .. cpp:var:: string name + // @@ + // @@ The model name. + // @@ + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // @@ + // @@ .. cpp:var:: string versions (repeated) + // @@ + // @@ The versions of the model. + // @@ + Versions []string `protobuf:"bytes,2,rep,name=versions,proto3" json:"versions,omitempty"` + // @@ + // @@ .. cpp:var:: string platform + // @@ + // @@ The model's platform. + // @@ + Platform string `protobuf:"bytes,3,opt,name=platform,proto3" json:"platform,omitempty"` + // @@ + // @@ .. cpp:var:: TensorMetadata inputs (repeated) + // @@ + // @@ The model's inputs. + // @@ + Inputs []*ModelMetadataResponse_TensorMetadata `protobuf:"bytes,4,rep,name=inputs,proto3" json:"inputs,omitempty"` + // @@ + // @@ .. cpp:var:: TensorMetadata outputs (repeated) + // @@ + // @@ The model's outputs. + // @@ + Outputs []*ModelMetadataResponse_TensorMetadata `protobuf:"bytes,5,rep,name=outputs,proto3" json:"outputs,omitempty"` unknownFields protoimpl.UnknownFields - - ModelName string `protobuf:"bytes,1,opt,name=model_name,json=modelName,proto3" json:"model_name,omitempty"` - ModelVersion string `protobuf:"bytes,2,opt,name=model_version,json=modelVersion,proto3" json:"model_version,omitempty"` - Id string `protobuf:"bytes,3,opt,name=id,proto3" json:"id,omitempty"` - Inputs []*ModelInferRequest_InferInputTensor `protobuf:"bytes,5,rep,name=inputs,proto3" json:"inputs,omitempty"` - Outputs []*ModelInferRequest_InferRequestedOutputTensor `protobuf:"bytes,6,rep,name=outputs,proto3" json:"outputs,omitempty"` - RawInputContents [][]byte `protobuf:"bytes,7,rep,name=raw_input_contents,json=rawInputContents,proto3" json:"raw_input_contents,omitempty"` + sizeCache protoimpl.SizeCache } -func (x *ModelInferRequest) Reset() { - *x = ModelInferRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_triton_grpc_service_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } +func (x *ModelMetadataResponse) Reset() { + *x = ModelMetadataResponse{} + mi := &file_grpc_service_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (x *ModelInferRequest) String() string { +func (x *ModelMetadataResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ModelInferRequest) ProtoMessage() {} +func (*ModelMetadataResponse) ProtoMessage() {} -func (x *ModelInferRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_triton_grpc_service_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { +func (x *ModelMetadataResponse) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[9] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -265,83 +613,91 @@ func (x *ModelInferRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ModelInferRequest.ProtoReflect.Descriptor instead. -func (*ModelInferRequest) Descriptor() ([]byte, []int) { - return file_proto_triton_grpc_service_proto_rawDescGZIP(), []int{3} +// Deprecated: Use ModelMetadataResponse.ProtoReflect.Descriptor instead. +func (*ModelMetadataResponse) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{9} } -func (x *ModelInferRequest) GetModelName() string { +func (x *ModelMetadataResponse) GetName() string { if x != nil { - return x.ModelName + return x.Name } return "" } -func (x *ModelInferRequest) GetModelVersion() string { +func (x *ModelMetadataResponse) GetVersions() []string { if x != nil { - return x.ModelVersion + return x.Versions } - return "" + return nil } -func (x *ModelInferRequest) GetId() string { +func (x *ModelMetadataResponse) GetPlatform() string { if x != nil { - return x.Id + return x.Platform } return "" } -func (x *ModelInferRequest) GetInputs() []*ModelInferRequest_InferInputTensor { +func (x *ModelMetadataResponse) GetInputs() []*ModelMetadataResponse_TensorMetadata { if x != nil { return x.Inputs } return nil } -func (x *ModelInferRequest) GetOutputs() []*ModelInferRequest_InferRequestedOutputTensor { +func (x *ModelMetadataResponse) GetOutputs() []*ModelMetadataResponse_TensorMetadata { if x != nil { return x.Outputs } return nil } -func (x *ModelInferRequest) GetRawInputContents() [][]byte { - if x != nil { - return x.RawInputContents - } - return nil -} - -type ModelInferResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ModelName string `protobuf:"bytes,1,opt,name=model_name,json=modelName,proto3" json:"model_name,omitempty"` - ModelVersion string `protobuf:"bytes,2,opt,name=model_version,json=modelVersion,proto3" json:"model_version,omitempty"` - Id string `protobuf:"bytes,3,opt,name=id,proto3" json:"id,omitempty"` - Outputs []*ModelInferResponse_InferOutputTensor `protobuf:"bytes,5,rep,name=outputs,proto3" json:"outputs,omitempty"` - RawOutputContents [][]byte `protobuf:"bytes,6,rep,name=raw_output_contents,json=rawOutputContents,proto3" json:"raw_output_contents,omitempty"` +// @@ +// @@.. cpp:var:: message InferParameter +// @@ +// @@ An inference parameter value. +// @@ +type InferParameter struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: oneof parameter_choice + // @@ + // @@ The parameter value can be a string, an int64, + // @@ an uint64, a double, or a boolean + // @@ + // @@ Note: double and uint64 are currently + // @@ placeholders for future use and + // @@ are not supported for custom parameters + // @@ + // + // Types that are valid to be assigned to ParameterChoice: + // + // *InferParameter_BoolParam + // *InferParameter_Int64Param + // *InferParameter_StringParam + // *InferParameter_DoubleParam + // *InferParameter_Uint64Param + ParameterChoice isInferParameter_ParameterChoice `protobuf_oneof:"parameter_choice"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (x *ModelInferResponse) Reset() { - *x = ModelInferResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_triton_grpc_service_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } +func (x *InferParameter) Reset() { + *x = InferParameter{} + mi := &file_grpc_service_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (x *ModelInferResponse) String() string { +func (x *InferParameter) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ModelInferResponse) ProtoMessage() {} +func (*InferParameter) ProtoMessage() {} -func (x *ModelInferResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_triton_grpc_service_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { +func (x *InferParameter) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[10] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -351,75 +707,3400 @@ func (x *ModelInferResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ModelInferResponse.ProtoReflect.Descriptor instead. -func (*ModelInferResponse) Descriptor() ([]byte, []int) { - return file_proto_triton_grpc_service_proto_rawDescGZIP(), []int{4} +// Deprecated: Use InferParameter.ProtoReflect.Descriptor instead. +func (*InferParameter) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{10} } -func (x *ModelInferResponse) GetModelName() string { +func (x *InferParameter) GetParameterChoice() isInferParameter_ParameterChoice { if x != nil { - return x.ModelName + return x.ParameterChoice } - return "" + return nil } -func (x *ModelInferResponse) GetModelVersion() string { +func (x *InferParameter) GetBoolParam() bool { if x != nil { - return x.ModelVersion + if x, ok := x.ParameterChoice.(*InferParameter_BoolParam); ok { + return x.BoolParam + } } - return "" + return false } -func (x *ModelInferResponse) GetId() string { +func (x *InferParameter) GetInt64Param() int64 { if x != nil { - return x.Id + if x, ok := x.ParameterChoice.(*InferParameter_Int64Param); ok { + return x.Int64Param + } } - return "" + return 0 } -func (x *ModelInferResponse) GetOutputs() []*ModelInferResponse_InferOutputTensor { +func (x *InferParameter) GetStringParam() string { if x != nil { - return x.Outputs + if x, ok := x.ParameterChoice.(*InferParameter_StringParam); ok { + return x.StringParam + } + } + return "" +} + +func (x *InferParameter) GetDoubleParam() float64 { + if x != nil { + if x, ok := x.ParameterChoice.(*InferParameter_DoubleParam); ok { + return x.DoubleParam + } + } + return 0 +} + +func (x *InferParameter) GetUint64Param() uint64 { + if x != nil { + if x, ok := x.ParameterChoice.(*InferParameter_Uint64Param); ok { + return x.Uint64Param + } + } + return 0 +} + +type isInferParameter_ParameterChoice interface { + isInferParameter_ParameterChoice() +} + +type InferParameter_BoolParam struct { + // @@ .. cpp:var:: bool bool_param + // @@ + // @@ A boolean parameter value. + // @@ + BoolParam bool `protobuf:"varint,1,opt,name=bool_param,json=boolParam,proto3,oneof"` +} + +type InferParameter_Int64Param struct { + // @@ .. cpp:var:: int64 int64_param + // @@ + // @@ An int64 parameter value. + // @@ + Int64Param int64 `protobuf:"varint,2,opt,name=int64_param,json=int64Param,proto3,oneof"` +} + +type InferParameter_StringParam struct { + // @@ .. cpp:var:: string string_param + // @@ + // @@ A string parameter value. + // @@ + StringParam string `protobuf:"bytes,3,opt,name=string_param,json=stringParam,proto3,oneof"` +} + +type InferParameter_DoubleParam struct { + // @@ .. cpp:var:: double double_param + // @@ + // @@ A double parameter value. + // @@ + DoubleParam float64 `protobuf:"fixed64,4,opt,name=double_param,json=doubleParam,proto3,oneof"` +} + +type InferParameter_Uint64Param struct { + // @@ .. cpp:var:: uint64 uint64_param + // @@ + // @@ A uint64 parameter value. + // @@ + // @@ Not supported for custom parameters + // @@ + Uint64Param uint64 `protobuf:"varint,5,opt,name=uint64_param,json=uint64Param,proto3,oneof"` +} + +func (*InferParameter_BoolParam) isInferParameter_ParameterChoice() {} + +func (*InferParameter_Int64Param) isInferParameter_ParameterChoice() {} + +func (*InferParameter_StringParam) isInferParameter_ParameterChoice() {} + +func (*InferParameter_DoubleParam) isInferParameter_ParameterChoice() {} + +func (*InferParameter_Uint64Param) isInferParameter_ParameterChoice() {} + +// @@ +// @@.. cpp:var:: message InferTensorContents +// @@ +// @@ The data contained in a tensor represented by the repeated type +// @@ that matches the tensor's data type. Protobuf oneof is not used +// @@ because oneofs cannot contain repeated fields. +// @@ +type InferTensorContents struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ + // @@ .. cpp:var:: bool bool_contents (repeated) + // @@ + // @@ Representation for BOOL data type. The size must match what is + // @@ expected by the tensor's shape. The contents must be the flattened, + // @@ one-dimensional, row-major order of the tensor elements. + // @@ + BoolContents []bool `protobuf:"varint,1,rep,packed,name=bool_contents,json=boolContents,proto3" json:"bool_contents,omitempty"` + // @@ + // @@ .. cpp:var:: int32 int_contents (repeated) + // @@ + // @@ Representation for INT8, INT16, and INT32 data types. The size + // @@ must match what is expected by the tensor's shape. The contents + // @@ must be the flattened, one-dimensional, row-major order of the + // @@ tensor elements. + // @@ + IntContents []int32 `protobuf:"varint,2,rep,packed,name=int_contents,json=intContents,proto3" json:"int_contents,omitempty"` + // @@ + // @@ .. cpp:var:: int64 int64_contents (repeated) + // @@ + // @@ Representation for INT64 data types. The size must match what + // @@ is expected by the tensor's shape. The contents must be the + // @@ flattened, one-dimensional, row-major order of the tensor elements. + // @@ + Int64Contents []int64 `protobuf:"varint,3,rep,packed,name=int64_contents,json=int64Contents,proto3" json:"int64_contents,omitempty"` + // @@ + // @@ .. cpp:var:: uint32 uint_contents (repeated) + // @@ + // @@ Representation for UINT8, UINT16, and UINT32 data types. The size + // @@ must match what is expected by the tensor's shape. The contents + // @@ must be the flattened, one-dimensional, row-major order of the + // @@ tensor elements. + // @@ + UintContents []uint32 `protobuf:"varint,4,rep,packed,name=uint_contents,json=uintContents,proto3" json:"uint_contents,omitempty"` + // @@ + // @@ .. cpp:var:: uint64 uint64_contents (repeated) + // @@ + // @@ Representation for UINT64 data types. The size must match what + // @@ is expected by the tensor's shape. The contents must be the + // @@ flattened, one-dimensional, row-major order of the tensor elements. + // @@ + Uint64Contents []uint64 `protobuf:"varint,5,rep,packed,name=uint64_contents,json=uint64Contents,proto3" json:"uint64_contents,omitempty"` + // @@ + // @@ .. cpp:var:: float fp32_contents (repeated) + // @@ + // @@ Representation for FP32 data type. The size must match what is + // @@ expected by the tensor's shape. The contents must be the flattened, + // @@ one-dimensional, row-major order of the tensor elements. + // @@ + Fp32Contents []float32 `protobuf:"fixed32,6,rep,packed,name=fp32_contents,json=fp32Contents,proto3" json:"fp32_contents,omitempty"` + // @@ + // @@ .. cpp:var:: double fp64_contents (repeated) + // @@ + // @@ Representation for FP64 data type. The size must match what is + // @@ expected by the tensor's shape. The contents must be the flattened, + // @@ one-dimensional, row-major order of the tensor elements. + // @@ + Fp64Contents []float64 `protobuf:"fixed64,7,rep,packed,name=fp64_contents,json=fp64Contents,proto3" json:"fp64_contents,omitempty"` + // @@ + // @@ .. cpp:var:: bytes bytes_contents (repeated) + // @@ + // @@ Representation for BYTES data type. The size must match what is + // @@ expected by the tensor's shape. The contents must be the flattened, + // @@ one-dimensional, row-major order of the tensor elements. + // @@ + BytesContents [][]byte `protobuf:"bytes,8,rep,name=bytes_contents,json=bytesContents,proto3" json:"bytes_contents,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *InferTensorContents) Reset() { + *x = InferTensorContents{} + mi := &file_grpc_service_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *InferTensorContents) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InferTensorContents) ProtoMessage() {} + +func (x *InferTensorContents) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InferTensorContents.ProtoReflect.Descriptor instead. +func (*InferTensorContents) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{11} +} + +func (x *InferTensorContents) GetBoolContents() []bool { + if x != nil { + return x.BoolContents + } + return nil +} + +func (x *InferTensorContents) GetIntContents() []int32 { + if x != nil { + return x.IntContents + } + return nil +} + +func (x *InferTensorContents) GetInt64Contents() []int64 { + if x != nil { + return x.Int64Contents + } + return nil +} + +func (x *InferTensorContents) GetUintContents() []uint32 { + if x != nil { + return x.UintContents + } + return nil +} + +func (x *InferTensorContents) GetUint64Contents() []uint64 { + if x != nil { + return x.Uint64Contents + } + return nil +} + +func (x *InferTensorContents) GetFp32Contents() []float32 { + if x != nil { + return x.Fp32Contents + } + return nil +} + +func (x *InferTensorContents) GetFp64Contents() []float64 { + if x != nil { + return x.Fp64Contents + } + return nil +} + +func (x *InferTensorContents) GetBytesContents() [][]byte { + if x != nil { + return x.BytesContents + } + return nil +} + +// @@ +// @@.. cpp:var:: message ModelInferRequest +// @@ +// @@ Request message for ModelInfer. +// @@ +type ModelInferRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: string model_name + // @@ + // @@ The name of the model to use for inferencing. + // @@ + ModelName string `protobuf:"bytes,1,opt,name=model_name,json=modelName,proto3" json:"model_name,omitempty"` + // @@ .. cpp:var:: string model_version + // @@ + // @@ The version of the model to use for inference. If not + // @@ given the latest/most-recent version of the model is used. + // @@ + ModelVersion string `protobuf:"bytes,2,opt,name=model_version,json=modelVersion,proto3" json:"model_version,omitempty"` + // @@ .. cpp:var:: string id + // @@ + // @@ Optional identifier for the request. If specified will be + // @@ returned in the response. + // @@ + Id string `protobuf:"bytes,3,opt,name=id,proto3" json:"id,omitempty"` + // @@ .. cpp:var:: map parameters + // @@ + // @@ Optional inference parameters. + // @@ + Parameters map[string]*InferParameter `protobuf:"bytes,4,rep,name=parameters,proto3" json:"parameters,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // @@ + // @@ .. cpp:var:: InferInputTensor inputs (repeated) + // @@ + // @@ The input tensors for the inference. + // @@ + Inputs []*ModelInferRequest_InferInputTensor `protobuf:"bytes,5,rep,name=inputs,proto3" json:"inputs,omitempty"` + // @@ + // @@ .. cpp:var:: InferRequestedOutputTensor outputs (repeated) + // @@ + // @@ The requested output tensors for the inference. Optional, if not + // @@ specified all outputs specified in the model config will be + // @@ returned. + // @@ + Outputs []*ModelInferRequest_InferRequestedOutputTensor `protobuf:"bytes,6,rep,name=outputs,proto3" json:"outputs,omitempty"` + // @@ + // @@ .. cpp:var:: bytes raw_input_contents + // @@ + // @@ The data contained in an input tensor can be represented in + // @@ "raw" bytes form or in the repeated type that matches the + // @@ tensor's data type. Using the "raw" bytes form will + // @@ typically allow higher performance due to the way protobuf + // @@ allocation and reuse interacts with GRPC. For example, see + // @@ https://github.com/grpc/grpc/issues/23231. + // @@ + // @@ To use the raw representation 'raw_input_contents' must be + // @@ initialized with data for each tensor in the same order as + // @@ 'inputs'. For each tensor, the size of this content must + // @@ match what is expected by the tensor's shape and data + // @@ type. The raw data must be the flattened, one-dimensional, + // @@ row-major order of the tensor elements without any stride + // @@ or padding between the elements. Note that the FP16 and BF16 data + // @@ types must be represented as raw content as there is no + // @@ specific data type for a 16-bit float type. + // @@ + // @@ If this field is specified then InferInputTensor::contents + // @@ must not be specified for any input tensor. + // @@ + RawInputContents [][]byte `protobuf:"bytes,7,rep,name=raw_input_contents,json=rawInputContents,proto3" json:"raw_input_contents,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelInferRequest) Reset() { + *x = ModelInferRequest{} + mi := &file_grpc_service_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelInferRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelInferRequest) ProtoMessage() {} + +func (x *ModelInferRequest) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelInferRequest.ProtoReflect.Descriptor instead. +func (*ModelInferRequest) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{12} +} + +func (x *ModelInferRequest) GetModelName() string { + if x != nil { + return x.ModelName + } + return "" +} + +func (x *ModelInferRequest) GetModelVersion() string { + if x != nil { + return x.ModelVersion + } + return "" +} + +func (x *ModelInferRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *ModelInferRequest) GetParameters() map[string]*InferParameter { + if x != nil { + return x.Parameters + } + return nil +} + +func (x *ModelInferRequest) GetInputs() []*ModelInferRequest_InferInputTensor { + if x != nil { + return x.Inputs + } + return nil +} + +func (x *ModelInferRequest) GetOutputs() []*ModelInferRequest_InferRequestedOutputTensor { + if x != nil { + return x.Outputs + } + return nil +} + +func (x *ModelInferRequest) GetRawInputContents() [][]byte { + if x != nil { + return x.RawInputContents + } + return nil +} + +// @@ +// @@.. cpp:var:: message ModelInferResponse +// @@ +// @@ Response message for ModelInfer. +// @@ +type ModelInferResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: string model_name + // @@ + // @@ The name of the model used for inference. + // @@ + ModelName string `protobuf:"bytes,1,opt,name=model_name,json=modelName,proto3" json:"model_name,omitempty"` + // @@ .. cpp:var:: string model_version + // @@ + // @@ The version of the model used for inference. + // @@ + ModelVersion string `protobuf:"bytes,2,opt,name=model_version,json=modelVersion,proto3" json:"model_version,omitempty"` + // @@ .. cpp:var:: string id + // @@ + // @@ The id of the inference request if one was specified. + // @@ + Id string `protobuf:"bytes,3,opt,name=id,proto3" json:"id,omitempty"` + // @@ .. cpp:var:: map parameters + // @@ + // @@ Optional inference response parameters. + // @@ + Parameters map[string]*InferParameter `protobuf:"bytes,4,rep,name=parameters,proto3" json:"parameters,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // @@ + // @@ .. cpp:var:: InferOutputTensor outputs (repeated) + // @@ + // @@ The output tensors holding inference results. + // @@ + Outputs []*ModelInferResponse_InferOutputTensor `protobuf:"bytes,5,rep,name=outputs,proto3" json:"outputs,omitempty"` + // @@ + // @@ .. cpp:var:: bytes raw_output_contents + // @@ + // @@ The data contained in an output tensor can be represented in + // @@ "raw" bytes form or in the repeated type that matches the + // @@ tensor's data type. Using the "raw" bytes form will + // @@ typically allow higher performance due to the way protobuf + // @@ allocation and reuse interacts with GRPC. For example, see + // @@ https://github.com/grpc/grpc/issues/23231. + // @@ + // @@ To use the raw representation 'raw_output_contents' must be + // @@ initialized with data for each tensor in the same order as + // @@ 'outputs'. For each tensor, the size of this content must + // @@ match what is expected by the tensor's shape and data + // @@ type. The raw data must be the flattened, one-dimensional, + // @@ row-major order of the tensor elements without any stride + // @@ or padding between the elements. Note that the FP16 and BF16 data + // @@ types must be represented as raw content as there is no + // @@ specific data type for a 16-bit float type. + // @@ + // @@ If this field is specified then InferOutputTensor::contents + // @@ must not be specified for any output tensor. + // @@ + RawOutputContents [][]byte `protobuf:"bytes,6,rep,name=raw_output_contents,json=rawOutputContents,proto3" json:"raw_output_contents,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelInferResponse) Reset() { + *x = ModelInferResponse{} + mi := &file_grpc_service_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelInferResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelInferResponse) ProtoMessage() {} + +func (x *ModelInferResponse) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[13] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelInferResponse.ProtoReflect.Descriptor instead. +func (*ModelInferResponse) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{13} +} + +func (x *ModelInferResponse) GetModelName() string { + if x != nil { + return x.ModelName + } + return "" +} + +func (x *ModelInferResponse) GetModelVersion() string { + if x != nil { + return x.ModelVersion + } + return "" +} + +func (x *ModelInferResponse) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *ModelInferResponse) GetParameters() map[string]*InferParameter { + if x != nil { + return x.Parameters + } + return nil +} + +func (x *ModelInferResponse) GetOutputs() []*ModelInferResponse_InferOutputTensor { + if x != nil { + return x.Outputs + } + return nil +} + +func (x *ModelInferResponse) GetRawOutputContents() [][]byte { + if x != nil { + return x.RawOutputContents + } + return nil +} + +// @@ +// @@.. cpp:var:: message ModelStreamInferResponse +// @@ +// @@ Response message for ModelStreamInfer. +// @@ +type ModelStreamInferResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ + // @@ .. cpp:var:: string error_message + // @@ + // @@ The message describing the error. The empty message + // @@ indicates the inference was successful without errors. + // @@ + ErrorMessage string `protobuf:"bytes,1,opt,name=error_message,json=errorMessage,proto3" json:"error_message,omitempty"` + // @@ + // @@ .. cpp:var:: ModelInferResponse infer_response + // @@ + // @@ Holds the results of the request. + // @@ + InferResponse *ModelInferResponse `protobuf:"bytes,2,opt,name=infer_response,json=inferResponse,proto3" json:"infer_response,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelStreamInferResponse) Reset() { + *x = ModelStreamInferResponse{} + mi := &file_grpc_service_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelStreamInferResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelStreamInferResponse) ProtoMessage() {} + +func (x *ModelStreamInferResponse) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[14] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelStreamInferResponse.ProtoReflect.Descriptor instead. +func (*ModelStreamInferResponse) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{14} +} + +func (x *ModelStreamInferResponse) GetErrorMessage() string { + if x != nil { + return x.ErrorMessage + } + return "" +} + +func (x *ModelStreamInferResponse) GetInferResponse() *ModelInferResponse { + if x != nil { + return x.InferResponse + } + return nil +} + +// @@ +// @@.. cpp:var:: message ModelConfigRequest +// @@ +// @@ Request message for ModelConfig. +// @@ +type ModelConfigRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ + // @@ .. cpp:var:: string name + // @@ + // @@ The name of the model. + // @@ + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // @@ .. cpp:var:: string version + // @@ + // @@ The version of the model. If not given the model version + // @@ is selected automatically based on the version policy. + // @@ + Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelConfigRequest) Reset() { + *x = ModelConfigRequest{} + mi := &file_grpc_service_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelConfigRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelConfigRequest) ProtoMessage() {} + +func (x *ModelConfigRequest) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[15] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelConfigRequest.ProtoReflect.Descriptor instead. +func (*ModelConfigRequest) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{15} +} + +func (x *ModelConfigRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ModelConfigRequest) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +// @@ +// @@.. cpp:var:: message ModelConfigResponse +// @@ +// @@ Response message for ModelConfig. +// @@ +type ModelConfigResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ + // @@ .. cpp:var:: ModelConfig config + // @@ + // @@ The model configuration. + // @@ + Config *ModelConfig `protobuf:"bytes,1,opt,name=config,proto3" json:"config,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelConfigResponse) Reset() { + *x = ModelConfigResponse{} + mi := &file_grpc_service_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelConfigResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelConfigResponse) ProtoMessage() {} + +func (x *ModelConfigResponse) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[16] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelConfigResponse.ProtoReflect.Descriptor instead. +func (*ModelConfigResponse) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{16} +} + +func (x *ModelConfigResponse) GetConfig() *ModelConfig { + if x != nil { + return x.Config + } + return nil +} + +// @@ +// @@.. cpp:var:: message ModelStatisticsRequest +// @@ +// @@ Request message for ModelStatistics. +// @@ +type ModelStatisticsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: string name + // @@ + // @@ The name of the model. If not given returns statistics for + // @@ all models. + // @@ + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // @@ .. cpp:var:: string version + // @@ + // @@ The version of the model. If not given returns statistics for + // @@ all model versions. + // @@ + Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelStatisticsRequest) Reset() { + *x = ModelStatisticsRequest{} + mi := &file_grpc_service_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelStatisticsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelStatisticsRequest) ProtoMessage() {} + +func (x *ModelStatisticsRequest) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[17] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelStatisticsRequest.ProtoReflect.Descriptor instead. +func (*ModelStatisticsRequest) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{17} +} + +func (x *ModelStatisticsRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ModelStatisticsRequest) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +// @@ +// @@.. cpp:var:: message StatisticDuration +// @@ +// @@ Statistic recording a cumulative duration metric. +// @@ +type StatisticDuration struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: uint64 count + // @@ + // @@ Cumulative number of times this metric occurred. + // @@ + Count uint64 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` + // @@ .. cpp:var:: uint64 total_time_ns + // @@ + // @@ Total collected duration of this metric in nanoseconds. + // @@ + Ns uint64 `protobuf:"varint,2,opt,name=ns,proto3" json:"ns,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *StatisticDuration) Reset() { + *x = StatisticDuration{} + mi := &file_grpc_service_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *StatisticDuration) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StatisticDuration) ProtoMessage() {} + +func (x *StatisticDuration) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[18] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StatisticDuration.ProtoReflect.Descriptor instead. +func (*StatisticDuration) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{18} +} + +func (x *StatisticDuration) GetCount() uint64 { + if x != nil { + return x.Count + } + return 0 +} + +func (x *StatisticDuration) GetNs() uint64 { + if x != nil { + return x.Ns + } + return 0 +} + +// @@ +// @@.. cpp:var:: message InferStatistics +// @@ +// @@ Inference statistics. +// @@ +type InferStatistics struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: StatisticDuration success + // @@ + // @@ Cumulative count and duration for successful inference + // @@ request. The "success" count and cumulative duration includes + // @@ cache hits. + // @@ + Success *StatisticDuration `protobuf:"bytes,1,opt,name=success,proto3" json:"success,omitempty"` + // @@ .. cpp:var:: StatisticDuration fail + // @@ + // @@ Cumulative count and duration for failed inference + // @@ request. + // @@ + Fail *StatisticDuration `protobuf:"bytes,2,opt,name=fail,proto3" json:"fail,omitempty"` + // @@ .. cpp:var:: StatisticDuration queue + // @@ + // @@ The count and cumulative duration that inference requests wait in + // @@ scheduling or other queues. The "queue" count and cumulative + // @@ duration includes cache hits. + // @@ + Queue *StatisticDuration `protobuf:"bytes,3,opt,name=queue,proto3" json:"queue,omitempty"` + // @@ .. cpp:var:: StatisticDuration compute_input + // @@ + // @@ The count and cumulative duration to prepare input tensor data as + // @@ required by the model framework / backend. For example, this duration + // @@ should include the time to copy input tensor data to the GPU. + // @@ The "compute_input" count and cumulative duration do not account for + // @@ requests that were a cache hit. See the "cache_hit" field for more + // @@ info. + // @@ + ComputeInput *StatisticDuration `protobuf:"bytes,4,opt,name=compute_input,json=computeInput,proto3" json:"compute_input,omitempty"` + // @@ .. cpp:var:: StatisticDuration compute_infer + // @@ + // @@ The count and cumulative duration to execute the model. + // @@ The "compute_infer" count and cumulative duration do not account for + // @@ requests that were a cache hit. See the "cache_hit" field for more + // @@ info. + // @@ + ComputeInfer *StatisticDuration `protobuf:"bytes,5,opt,name=compute_infer,json=computeInfer,proto3" json:"compute_infer,omitempty"` + // @@ .. cpp:var:: StatisticDuration compute_output + // @@ + // @@ The count and cumulative duration to extract output tensor data + // @@ produced by the model framework / backend. For example, this duration + // @@ should include the time to copy output tensor data from the GPU. + // @@ The "compute_output" count and cumulative duration do not account for + // @@ requests that were a cache hit. See the "cache_hit" field for more + // @@ info. + // @@ + ComputeOutput *StatisticDuration `protobuf:"bytes,6,opt,name=compute_output,json=computeOutput,proto3" json:"compute_output,omitempty"` + // @@ .. cpp:var:: StatisticDuration cache_hit + // @@ + // @@ The count of response cache hits and cumulative duration to lookup + // @@ and extract output tensor data from the Response Cache on a cache + // @@ hit. For example, this duration should include the time to copy + // @@ output tensor data from the Response Cache to the response object. + // @@ On cache hits, triton does not need to go to the model/backend + // @@ for the output tensor data, so the "compute_input", "compute_infer", + // @@ and "compute_output" fields are not updated. Assuming the response + // @@ cache is enabled for a given model, a cache hit occurs for a + // @@ request to that model when the request metadata (model name, + // @@ model version, model inputs) hashes to an existing entry in the + // @@ cache. On a cache miss, the request hash and response output tensor + // @@ data is added to the cache. See response cache docs for more info: + // @@ + // https://github.com/triton-inference-server/server/blob/main/docs/response_cache.md + // @@ + CacheHit *StatisticDuration `protobuf:"bytes,7,opt,name=cache_hit,json=cacheHit,proto3" json:"cache_hit,omitempty"` + // @@ .. cpp:var:: StatisticDuration cache_miss + // @@ + // @@ The count of response cache misses and cumulative duration to lookup + // @@ and insert output tensor data from the computed response to the + // cache. + // @@ For example, this duration should include the time to copy + // @@ output tensor data from the response object to the Response Cache. + // @@ Assuming the response cache is enabled for a given model, a cache + // @@ miss occurs for a request to that model when the request metadata + // @@ does NOT hash to an existing entry in the cache. See the response + // @@ cache docs for more info: + // @@ + // https://github.com/triton-inference-server/server/blob/main/docs/response_cache.md + // @@ + CacheMiss *StatisticDuration `protobuf:"bytes,8,opt,name=cache_miss,json=cacheMiss,proto3" json:"cache_miss,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *InferStatistics) Reset() { + *x = InferStatistics{} + mi := &file_grpc_service_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *InferStatistics) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InferStatistics) ProtoMessage() {} + +func (x *InferStatistics) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[19] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InferStatistics.ProtoReflect.Descriptor instead. +func (*InferStatistics) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{19} +} + +func (x *InferStatistics) GetSuccess() *StatisticDuration { + if x != nil { + return x.Success + } + return nil +} + +func (x *InferStatistics) GetFail() *StatisticDuration { + if x != nil { + return x.Fail + } + return nil +} + +func (x *InferStatistics) GetQueue() *StatisticDuration { + if x != nil { + return x.Queue + } + return nil +} + +func (x *InferStatistics) GetComputeInput() *StatisticDuration { + if x != nil { + return x.ComputeInput + } + return nil +} + +func (x *InferStatistics) GetComputeInfer() *StatisticDuration { + if x != nil { + return x.ComputeInfer + } + return nil +} + +func (x *InferStatistics) GetComputeOutput() *StatisticDuration { + if x != nil { + return x.ComputeOutput + } + return nil +} + +func (x *InferStatistics) GetCacheHit() *StatisticDuration { + if x != nil { + return x.CacheHit + } + return nil +} + +func (x *InferStatistics) GetCacheMiss() *StatisticDuration { + if x != nil { + return x.CacheMiss + } + return nil +} + +// @@ +// @@.. cpp:var:: message InferResponseStatistics +// @@ +// @@ Statistics per response. +// @@ +type InferResponseStatistics struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: StatisticDuration compute_infer + // @@ + // @@ The count and cumulative duration to compute a response. + // @@ + ComputeInfer *StatisticDuration `protobuf:"bytes,1,opt,name=compute_infer,json=computeInfer,proto3" json:"compute_infer,omitempty"` + // @@ .. cpp:var:: StatisticDuration compute_output + // @@ + // @@ The count and cumulative duration to extract the output tensors of a + // @@ response. + // @@ + ComputeOutput *StatisticDuration `protobuf:"bytes,2,opt,name=compute_output,json=computeOutput,proto3" json:"compute_output,omitempty"` + // @@ .. cpp:var:: StatisticDuration success + // @@ + // @@ The count and cumulative duration for successful responses. + // @@ + Success *StatisticDuration `protobuf:"bytes,3,opt,name=success,proto3" json:"success,omitempty"` + // @@ .. cpp:var:: StatisticDuration fail + // @@ + // @@ The count and cumulative duration for failed responses. + // @@ + Fail *StatisticDuration `protobuf:"bytes,4,opt,name=fail,proto3" json:"fail,omitempty"` + // @@ .. cpp:var:: StatisticDuration empty_response + // @@ + // @@ The count and cumulative duration for empty responses. + // @@ + EmptyResponse *StatisticDuration `protobuf:"bytes,5,opt,name=empty_response,json=emptyResponse,proto3" json:"empty_response,omitempty"` + // @@ .. cpp:var:: StatisticDuration cancel + // @@ + // @@ The count and cumulative duration, for cleaning up resources held by + // @@ a cancelled request, for cancelled responses. + // @@ + Cancel *StatisticDuration `protobuf:"bytes,6,opt,name=cancel,proto3" json:"cancel,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *InferResponseStatistics) Reset() { + *x = InferResponseStatistics{} + mi := &file_grpc_service_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *InferResponseStatistics) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InferResponseStatistics) ProtoMessage() {} + +func (x *InferResponseStatistics) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[20] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InferResponseStatistics.ProtoReflect.Descriptor instead. +func (*InferResponseStatistics) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{20} +} + +func (x *InferResponseStatistics) GetComputeInfer() *StatisticDuration { + if x != nil { + return x.ComputeInfer + } + return nil +} + +func (x *InferResponseStatistics) GetComputeOutput() *StatisticDuration { + if x != nil { + return x.ComputeOutput + } + return nil +} + +func (x *InferResponseStatistics) GetSuccess() *StatisticDuration { + if x != nil { + return x.Success + } + return nil +} + +func (x *InferResponseStatistics) GetFail() *StatisticDuration { + if x != nil { + return x.Fail + } + return nil +} + +func (x *InferResponseStatistics) GetEmptyResponse() *StatisticDuration { + if x != nil { + return x.EmptyResponse + } + return nil +} + +func (x *InferResponseStatistics) GetCancel() *StatisticDuration { + if x != nil { + return x.Cancel + } + return nil +} + +// @@ +// @@.. cpp:var:: message InferBatchStatistics +// @@ +// @@ Inference batch statistics. +// @@ +type InferBatchStatistics struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: uint64 batch_size + // @@ + // @@ The size of the batch. + // @@ + BatchSize uint64 `protobuf:"varint,1,opt,name=batch_size,json=batchSize,proto3" json:"batch_size,omitempty"` + // @@ .. cpp:var:: StatisticDuration compute_input + // @@ + // @@ The count and cumulative duration to prepare input tensor data as + // @@ required by the model framework / backend with the given batch size. + // @@ For example, this duration should include the time to copy input + // @@ tensor data to the GPU. + // @@ + ComputeInput *StatisticDuration `protobuf:"bytes,2,opt,name=compute_input,json=computeInput,proto3" json:"compute_input,omitempty"` + // @@ .. cpp:var:: StatisticDuration compute_infer + // @@ + // @@ The count and cumulative duration to execute the model with the given + // @@ batch size. + // @@ + ComputeInfer *StatisticDuration `protobuf:"bytes,3,opt,name=compute_infer,json=computeInfer,proto3" json:"compute_infer,omitempty"` + // @@ .. cpp:var:: StatisticDuration compute_output + // @@ + // @@ The count and cumulative duration to extract output tensor data + // @@ produced by the model framework / backend with the given batch size. + // @@ For example, this duration should include the time to copy output + // @@ tensor data from the GPU. + // @@ + ComputeOutput *StatisticDuration `protobuf:"bytes,4,opt,name=compute_output,json=computeOutput,proto3" json:"compute_output,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *InferBatchStatistics) Reset() { + *x = InferBatchStatistics{} + mi := &file_grpc_service_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *InferBatchStatistics) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InferBatchStatistics) ProtoMessage() {} + +func (x *InferBatchStatistics) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[21] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InferBatchStatistics.ProtoReflect.Descriptor instead. +func (*InferBatchStatistics) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{21} +} + +func (x *InferBatchStatistics) GetBatchSize() uint64 { + if x != nil { + return x.BatchSize + } + return 0 +} + +func (x *InferBatchStatistics) GetComputeInput() *StatisticDuration { + if x != nil { + return x.ComputeInput + } + return nil +} + +func (x *InferBatchStatistics) GetComputeInfer() *StatisticDuration { + if x != nil { + return x.ComputeInfer + } + return nil +} + +func (x *InferBatchStatistics) GetComputeOutput() *StatisticDuration { + if x != nil { + return x.ComputeOutput + } + return nil +} + +// @@ +// @@.. cpp:var:: message MemoryUsage +// @@ +// @@ Memory usage. +// @@ +type MemoryUsage struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: string type + // @@ + // @@ The type of memory, the value can be "CPU", "CPU_PINNED", "GPU". + // @@ + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + // @@ .. cpp:var:: int64 id + // @@ + // @@ The id of the memory, typically used with "type" to identify + // @@ a device that hosts the memory. + // @@ + Id int64 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"` + // @@ .. cpp:var:: uint64 byte_size + // @@ + // @@ The byte size of the memory. + // @@ + ByteSize uint64 `protobuf:"varint,3,opt,name=byte_size,json=byteSize,proto3" json:"byte_size,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MemoryUsage) Reset() { + *x = MemoryUsage{} + mi := &file_grpc_service_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MemoryUsage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MemoryUsage) ProtoMessage() {} + +func (x *MemoryUsage) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[22] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MemoryUsage.ProtoReflect.Descriptor instead. +func (*MemoryUsage) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{22} +} + +func (x *MemoryUsage) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *MemoryUsage) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *MemoryUsage) GetByteSize() uint64 { + if x != nil { + return x.ByteSize + } + return 0 +} + +// @@ +// @@.. cpp:var:: message ModelStatistics +// @@ +// @@ Statistics for a specific model and version. +// @@ +type ModelStatistics struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: string name + // @@ + // @@ The name of the model. If not given returns statistics for all + // @@ + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // @@ .. cpp:var:: string version + // @@ + // @@ The version of the model. + // @@ + Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` + // @@ .. cpp:var:: uint64 last_inference + // @@ + // @@ The timestamp of the last inference request made for this model, + // @@ as milliseconds since the epoch. + // @@ + LastInference uint64 `protobuf:"varint,3,opt,name=last_inference,json=lastInference,proto3" json:"last_inference,omitempty"` + // @@ .. cpp:var:: uint64 last_inference + // @@ + // @@ The cumulative count of successful inference requests made for this + // @@ model. Each inference in a batched request is counted as an + // @@ individual inference. For example, if a client sends a single + // @@ inference request with batch size 64, "inference_count" will be + // @@ incremented by 64. Similarly, if a clients sends 64 individual + // @@ requests each with batch size 1, "inference_count" will be + // @@ incremented by 64. The "inference_count" value DOES NOT include + // @@ cache hits. + // @@ + InferenceCount uint64 `protobuf:"varint,4,opt,name=inference_count,json=inferenceCount,proto3" json:"inference_count,omitempty"` + // @@ .. cpp:var:: uint64 last_inference + // @@ + // @@ The cumulative count of the number of successful inference executions + // @@ performed for the model. When dynamic batching is enabled, a single + // @@ model execution can perform inferencing for more than one inference + // @@ request. For example, if a clients sends 64 individual requests each + // @@ with batch size 1 and the dynamic batcher batches them into a single + // @@ large batch for model execution then "execution_count" will be + // @@ incremented by 1. If, on the other hand, the dynamic batcher is not + // @@ enabled for that each of the 64 individual requests is executed + // @@ independently, then "execution_count" will be incremented by 64. + // @@ The "execution_count" value DOES NOT include cache hits. + // @@ + ExecutionCount uint64 `protobuf:"varint,5,opt,name=execution_count,json=executionCount,proto3" json:"execution_count,omitempty"` + // @@ .. cpp:var:: InferStatistics inference_stats + // @@ + // @@ The aggregate statistics for the model/version. + // @@ + InferenceStats *InferStatistics `protobuf:"bytes,6,opt,name=inference_stats,json=inferenceStats,proto3" json:"inference_stats,omitempty"` + // @@ .. cpp:var:: InferBatchStatistics batch_stats (repeated) + // @@ + // @@ The aggregate statistics for each different batch size that is + // @@ executed in the model. The batch statistics indicate how many actual + // @@ model executions were performed and show differences due to different + // @@ batch size (for example, larger batches typically take longer to + // @@ compute). + // @@ + BatchStats []*InferBatchStatistics `protobuf:"bytes,7,rep,name=batch_stats,json=batchStats,proto3" json:"batch_stats,omitempty"` + // @@ .. cpp:var:: MemoryUsage memory_usage (repeated) + // @@ + // @@ The memory usage detected during model loading, which may be used to + // @@ estimate the memory to be released once the model is unloaded. Note + // @@ that the estimation is inferenced by the profiling tools and + // @@ framework's memory schema, therefore it is advised to perform + // @@ experiments to understand the scenario that the reported memory usage + // @@ can be relied on. As a starting point, the GPU memory usage for + // @@ models in ONNX Runtime backend and TensorRT backend is usually + // @@ aligned. + // @@ + MemoryUsage []*MemoryUsage `protobuf:"bytes,8,rep,name=memory_usage,json=memoryUsage,proto3" json:"memory_usage,omitempty"` + // @@ .. cpp:var:: map response_stats + // @@ + // @@ The key and value pairs for all responses statistics. The key is a + // @@ string identifying a set of response statistics aggregated together + // @@ (i.e. index of the response sent). The value is the aggregated + // @@ response statistics. + // @@ + ResponseStats map[string]*InferResponseStatistics `protobuf:"bytes,9,rep,name=response_stats,json=responseStats,proto3" json:"response_stats,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelStatistics) Reset() { + *x = ModelStatistics{} + mi := &file_grpc_service_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelStatistics) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelStatistics) ProtoMessage() {} + +func (x *ModelStatistics) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[23] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelStatistics.ProtoReflect.Descriptor instead. +func (*ModelStatistics) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{23} +} + +func (x *ModelStatistics) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ModelStatistics) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +func (x *ModelStatistics) GetLastInference() uint64 { + if x != nil { + return x.LastInference + } + return 0 +} + +func (x *ModelStatistics) GetInferenceCount() uint64 { + if x != nil { + return x.InferenceCount + } + return 0 +} + +func (x *ModelStatistics) GetExecutionCount() uint64 { + if x != nil { + return x.ExecutionCount + } + return 0 +} + +func (x *ModelStatistics) GetInferenceStats() *InferStatistics { + if x != nil { + return x.InferenceStats + } + return nil +} + +func (x *ModelStatistics) GetBatchStats() []*InferBatchStatistics { + if x != nil { + return x.BatchStats + } + return nil +} + +func (x *ModelStatistics) GetMemoryUsage() []*MemoryUsage { + if x != nil { + return x.MemoryUsage + } + return nil +} + +func (x *ModelStatistics) GetResponseStats() map[string]*InferResponseStatistics { + if x != nil { + return x.ResponseStats + } + return nil +} + +// @@ +// @@.. cpp:var:: message ModelStatisticsResponse +// @@ +// @@ Response message for ModelStatistics. +// @@ +type ModelStatisticsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: ModelStatistics model_stats (repeated) + // @@ + // @@ Statistics for each requested model. + // @@ + ModelStats []*ModelStatistics `protobuf:"bytes,1,rep,name=model_stats,json=modelStats,proto3" json:"model_stats,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelStatisticsResponse) Reset() { + *x = ModelStatisticsResponse{} + mi := &file_grpc_service_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelStatisticsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelStatisticsResponse) ProtoMessage() {} + +func (x *ModelStatisticsResponse) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[24] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelStatisticsResponse.ProtoReflect.Descriptor instead. +func (*ModelStatisticsResponse) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{24} +} + +func (x *ModelStatisticsResponse) GetModelStats() []*ModelStatistics { + if x != nil { + return x.ModelStats + } + return nil +} + +// @@ +// @@.. cpp:var:: message ModelRepositoryParameter +// @@ +// @@ An model repository parameter value. +// @@ +type ModelRepositoryParameter struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: oneof parameter_choice + // @@ + // @@ The parameter value can be a string, an int64 or + // @@ a boolean + // @@ + // + // Types that are valid to be assigned to ParameterChoice: + // + // *ModelRepositoryParameter_BoolParam + // *ModelRepositoryParameter_Int64Param + // *ModelRepositoryParameter_StringParam + // *ModelRepositoryParameter_BytesParam + ParameterChoice isModelRepositoryParameter_ParameterChoice `protobuf_oneof:"parameter_choice"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelRepositoryParameter) Reset() { + *x = ModelRepositoryParameter{} + mi := &file_grpc_service_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelRepositoryParameter) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelRepositoryParameter) ProtoMessage() {} + +func (x *ModelRepositoryParameter) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[25] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelRepositoryParameter.ProtoReflect.Descriptor instead. +func (*ModelRepositoryParameter) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{25} +} + +func (x *ModelRepositoryParameter) GetParameterChoice() isModelRepositoryParameter_ParameterChoice { + if x != nil { + return x.ParameterChoice + } + return nil +} + +func (x *ModelRepositoryParameter) GetBoolParam() bool { + if x != nil { + if x, ok := x.ParameterChoice.(*ModelRepositoryParameter_BoolParam); ok { + return x.BoolParam + } + } + return false +} + +func (x *ModelRepositoryParameter) GetInt64Param() int64 { + if x != nil { + if x, ok := x.ParameterChoice.(*ModelRepositoryParameter_Int64Param); ok { + return x.Int64Param + } + } + return 0 +} + +func (x *ModelRepositoryParameter) GetStringParam() string { + if x != nil { + if x, ok := x.ParameterChoice.(*ModelRepositoryParameter_StringParam); ok { + return x.StringParam + } + } + return "" +} + +func (x *ModelRepositoryParameter) GetBytesParam() []byte { + if x != nil { + if x, ok := x.ParameterChoice.(*ModelRepositoryParameter_BytesParam); ok { + return x.BytesParam + } + } + return nil +} + +type isModelRepositoryParameter_ParameterChoice interface { + isModelRepositoryParameter_ParameterChoice() +} + +type ModelRepositoryParameter_BoolParam struct { + // @@ .. cpp:var:: bool bool_param + // @@ + // @@ A boolean parameter value. + // @@ + BoolParam bool `protobuf:"varint,1,opt,name=bool_param,json=boolParam,proto3,oneof"` +} + +type ModelRepositoryParameter_Int64Param struct { + // @@ .. cpp:var:: int64 int64_param + // @@ + // @@ An int64 parameter value. + // @@ + Int64Param int64 `protobuf:"varint,2,opt,name=int64_param,json=int64Param,proto3,oneof"` +} + +type ModelRepositoryParameter_StringParam struct { + // @@ .. cpp:var:: string string_param + // @@ + // @@ A string parameter value. + // @@ + StringParam string `protobuf:"bytes,3,opt,name=string_param,json=stringParam,proto3,oneof"` +} + +type ModelRepositoryParameter_BytesParam struct { + // @@ .. cpp:var:: bytes bytes_param + // @@ + // @@ A bytes parameter value. + // @@ + BytesParam []byte `protobuf:"bytes,4,opt,name=bytes_param,json=bytesParam,proto3,oneof"` +} + +func (*ModelRepositoryParameter_BoolParam) isModelRepositoryParameter_ParameterChoice() {} + +func (*ModelRepositoryParameter_Int64Param) isModelRepositoryParameter_ParameterChoice() {} + +func (*ModelRepositoryParameter_StringParam) isModelRepositoryParameter_ParameterChoice() {} + +func (*ModelRepositoryParameter_BytesParam) isModelRepositoryParameter_ParameterChoice() {} + +// @@ +// @@.. cpp:var:: message RepositoryIndexRequest +// @@ +// @@ Request message for RepositoryIndex. +// @@ +type RepositoryIndexRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: string repository_name + // @@ + // @@ The name of the repository. If empty the index is returned + // @@ for all repositories. + // @@ + RepositoryName string `protobuf:"bytes,1,opt,name=repository_name,json=repositoryName,proto3" json:"repository_name,omitempty"` + // @@ .. cpp:var:: bool ready + // @@ + // @@ If true returned only models currently ready for inferencing. + // @@ + Ready bool `protobuf:"varint,2,opt,name=ready,proto3" json:"ready,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RepositoryIndexRequest) Reset() { + *x = RepositoryIndexRequest{} + mi := &file_grpc_service_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RepositoryIndexRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RepositoryIndexRequest) ProtoMessage() {} + +func (x *RepositoryIndexRequest) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[26] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RepositoryIndexRequest.ProtoReflect.Descriptor instead. +func (*RepositoryIndexRequest) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{26} +} + +func (x *RepositoryIndexRequest) GetRepositoryName() string { + if x != nil { + return x.RepositoryName + } + return "" +} + +func (x *RepositoryIndexRequest) GetReady() bool { + if x != nil { + return x.Ready + } + return false +} + +// @@ +// @@.. cpp:var:: message RepositoryIndexResponse +// @@ +// @@ Response message for RepositoryIndex. +// @@ +type RepositoryIndexResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ + // @@ .. cpp:var:: ModelIndex models (repeated) + // @@ + // @@ An index entry for each model. + // @@ + Models []*RepositoryIndexResponse_ModelIndex `protobuf:"bytes,1,rep,name=models,proto3" json:"models,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RepositoryIndexResponse) Reset() { + *x = RepositoryIndexResponse{} + mi := &file_grpc_service_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RepositoryIndexResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RepositoryIndexResponse) ProtoMessage() {} + +func (x *RepositoryIndexResponse) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[27] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RepositoryIndexResponse.ProtoReflect.Descriptor instead. +func (*RepositoryIndexResponse) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{27} +} + +func (x *RepositoryIndexResponse) GetModels() []*RepositoryIndexResponse_ModelIndex { + if x != nil { + return x.Models + } + return nil +} + +// @@ +// @@.. cpp:var:: message RepositoryModelLoadRequest +// @@ +// @@ Request message for RepositoryModelLoad. +// @@ +type RepositoryModelLoadRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: string repository_name + // @@ + // @@ The name of the repository to load from. If empty the model + // @@ is loaded from any repository. + // @@ + RepositoryName string `protobuf:"bytes,1,opt,name=repository_name,json=repositoryName,proto3" json:"repository_name,omitempty"` + // @@ .. cpp:var:: string repository_name + // @@ + // @@ The name of the model to load, or reload. + // @@ + ModelName string `protobuf:"bytes,2,opt,name=model_name,json=modelName,proto3" json:"model_name,omitempty"` + // @@ .. cpp:var:: map parameters + // @@ + // @@ Optional model repository request parameters. + // @@ + Parameters map[string]*ModelRepositoryParameter `protobuf:"bytes,3,rep,name=parameters,proto3" json:"parameters,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RepositoryModelLoadRequest) Reset() { + *x = RepositoryModelLoadRequest{} + mi := &file_grpc_service_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RepositoryModelLoadRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RepositoryModelLoadRequest) ProtoMessage() {} + +func (x *RepositoryModelLoadRequest) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[28] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RepositoryModelLoadRequest.ProtoReflect.Descriptor instead. +func (*RepositoryModelLoadRequest) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{28} +} + +func (x *RepositoryModelLoadRequest) GetRepositoryName() string { + if x != nil { + return x.RepositoryName + } + return "" +} + +func (x *RepositoryModelLoadRequest) GetModelName() string { + if x != nil { + return x.ModelName + } + return "" +} + +func (x *RepositoryModelLoadRequest) GetParameters() map[string]*ModelRepositoryParameter { + if x != nil { + return x.Parameters + } + return nil +} + +// @@ +// @@.. cpp:var:: message RepositoryModelLoadResponse +// @@ +// @@ Response message for RepositoryModelLoad. +// @@ +type RepositoryModelLoadResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RepositoryModelLoadResponse) Reset() { + *x = RepositoryModelLoadResponse{} + mi := &file_grpc_service_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RepositoryModelLoadResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RepositoryModelLoadResponse) ProtoMessage() {} + +func (x *RepositoryModelLoadResponse) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[29] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RepositoryModelLoadResponse.ProtoReflect.Descriptor instead. +func (*RepositoryModelLoadResponse) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{29} +} + +// @@ +// @@.. cpp:var:: message RepositoryModelUnloadRequest +// @@ +// @@ Request message for RepositoryModelUnload. +// @@ +type RepositoryModelUnloadRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: string repository_name + // @@ + // @@ The name of the repository from which the model was originally + // @@ loaded. If empty the repository is not considered. + // @@ + RepositoryName string `protobuf:"bytes,1,opt,name=repository_name,json=repositoryName,proto3" json:"repository_name,omitempty"` + // @@ .. cpp:var:: string repository_name + // @@ + // @@ The name of the model to unload. + // @@ + ModelName string `protobuf:"bytes,2,opt,name=model_name,json=modelName,proto3" json:"model_name,omitempty"` + // @@ .. cpp:var:: map parameters + // @@ + // @@ Optional model repository request parameters. + // @@ + Parameters map[string]*ModelRepositoryParameter `protobuf:"bytes,3,rep,name=parameters,proto3" json:"parameters,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RepositoryModelUnloadRequest) Reset() { + *x = RepositoryModelUnloadRequest{} + mi := &file_grpc_service_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RepositoryModelUnloadRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RepositoryModelUnloadRequest) ProtoMessage() {} + +func (x *RepositoryModelUnloadRequest) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[30] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RepositoryModelUnloadRequest.ProtoReflect.Descriptor instead. +func (*RepositoryModelUnloadRequest) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{30} +} + +func (x *RepositoryModelUnloadRequest) GetRepositoryName() string { + if x != nil { + return x.RepositoryName + } + return "" +} + +func (x *RepositoryModelUnloadRequest) GetModelName() string { + if x != nil { + return x.ModelName + } + return "" +} + +func (x *RepositoryModelUnloadRequest) GetParameters() map[string]*ModelRepositoryParameter { + if x != nil { + return x.Parameters + } + return nil +} + +// @@ +// @@.. cpp:var:: message RepositoryModelUnloadResponse +// @@ +// @@ Response message for RepositoryModelUnload. +// @@ +type RepositoryModelUnloadResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RepositoryModelUnloadResponse) Reset() { + *x = RepositoryModelUnloadResponse{} + mi := &file_grpc_service_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RepositoryModelUnloadResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RepositoryModelUnloadResponse) ProtoMessage() {} + +func (x *RepositoryModelUnloadResponse) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[31] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RepositoryModelUnloadResponse.ProtoReflect.Descriptor instead. +func (*RepositoryModelUnloadResponse) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{31} +} + +// @@ +// @@.. cpp:var:: message SystemSharedMemoryStatusRequest +// @@ +// @@ Request message for SystemSharedMemoryStatus. +// @@ +type SystemSharedMemoryStatusRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ + // @@ .. cpp:var:: string name + // @@ + // @@ The name of the region to get status for. If empty the + // @@ status is returned for all registered regions. + // @@ + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SystemSharedMemoryStatusRequest) Reset() { + *x = SystemSharedMemoryStatusRequest{} + mi := &file_grpc_service_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SystemSharedMemoryStatusRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SystemSharedMemoryStatusRequest) ProtoMessage() {} + +func (x *SystemSharedMemoryStatusRequest) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[32] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SystemSharedMemoryStatusRequest.ProtoReflect.Descriptor instead. +func (*SystemSharedMemoryStatusRequest) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{32} +} + +func (x *SystemSharedMemoryStatusRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +// @@ +// @@.. cpp:var:: message SystemSharedMemoryStatusResponse +// @@ +// @@ Response message for SystemSharedMemoryStatus. +// @@ +type SystemSharedMemoryStatusResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ + // @@ .. cpp:var:: map regions + // @@ + // @@ Status for each of the registered regions, indexed by + // @@ region name. + // @@ + Regions map[string]*SystemSharedMemoryStatusResponse_RegionStatus `protobuf:"bytes,1,rep,name=regions,proto3" json:"regions,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SystemSharedMemoryStatusResponse) Reset() { + *x = SystemSharedMemoryStatusResponse{} + mi := &file_grpc_service_proto_msgTypes[33] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SystemSharedMemoryStatusResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SystemSharedMemoryStatusResponse) ProtoMessage() {} + +func (x *SystemSharedMemoryStatusResponse) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[33] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SystemSharedMemoryStatusResponse.ProtoReflect.Descriptor instead. +func (*SystemSharedMemoryStatusResponse) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{33} +} + +func (x *SystemSharedMemoryStatusResponse) GetRegions() map[string]*SystemSharedMemoryStatusResponse_RegionStatus { + if x != nil { + return x.Regions + } + return nil +} + +// @@ +// @@.. cpp:var:: message SystemSharedMemoryRegisterRequest +// @@ +// @@ Request message for SystemSharedMemoryRegister. +// @@ +type SystemSharedMemoryRegisterRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ + // @@ .. cpp:var:: string name + // @@ + // @@ The name of the region to register. + // @@ + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // @@ .. cpp:var:: string shared_memory_key + // @@ + // @@ The key of the underlying memory object that contains the + // @@ shared memory region. + // @@ + Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + // @@ .. cpp:var:: uint64 offset + // @@ + // @@ Offset, in bytes, within the underlying memory object to + // @@ the start of the shared memory region. + // @@ + Offset uint64 `protobuf:"varint,3,opt,name=offset,proto3" json:"offset,omitempty"` + // @@ .. cpp:var:: uint64 byte_size + // @@ + // @@ Size of the shared memory region, in bytes. + // @@ + ByteSize uint64 `protobuf:"varint,4,opt,name=byte_size,json=byteSize,proto3" json:"byte_size,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SystemSharedMemoryRegisterRequest) Reset() { + *x = SystemSharedMemoryRegisterRequest{} + mi := &file_grpc_service_proto_msgTypes[34] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SystemSharedMemoryRegisterRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SystemSharedMemoryRegisterRequest) ProtoMessage() {} + +func (x *SystemSharedMemoryRegisterRequest) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[34] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SystemSharedMemoryRegisterRequest.ProtoReflect.Descriptor instead. +func (*SystemSharedMemoryRegisterRequest) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{34} +} + +func (x *SystemSharedMemoryRegisterRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *SystemSharedMemoryRegisterRequest) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *SystemSharedMemoryRegisterRequest) GetOffset() uint64 { + if x != nil { + return x.Offset + } + return 0 +} + +func (x *SystemSharedMemoryRegisterRequest) GetByteSize() uint64 { + if x != nil { + return x.ByteSize + } + return 0 +} + +// @@ +// @@.. cpp:var:: message SystemSharedMemoryRegisterResponse +// @@ +// @@ Response message for SystemSharedMemoryRegister. +// @@ +type SystemSharedMemoryRegisterResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SystemSharedMemoryRegisterResponse) Reset() { + *x = SystemSharedMemoryRegisterResponse{} + mi := &file_grpc_service_proto_msgTypes[35] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SystemSharedMemoryRegisterResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SystemSharedMemoryRegisterResponse) ProtoMessage() {} + +func (x *SystemSharedMemoryRegisterResponse) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[35] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SystemSharedMemoryRegisterResponse.ProtoReflect.Descriptor instead. +func (*SystemSharedMemoryRegisterResponse) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{35} +} + +// @@ +// @@.. cpp:var:: message SystemSharedMemoryUnregisterRequest +// @@ +// @@ Request message for SystemSharedMemoryUnregister. +// @@ +type SystemSharedMemoryUnregisterRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ + // @@ .. cpp:var:: string name + // @@ + // @@ The name of the system region to unregister. If empty + // @@ all system shared-memory regions are unregistered. + // @@ + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SystemSharedMemoryUnregisterRequest) Reset() { + *x = SystemSharedMemoryUnregisterRequest{} + mi := &file_grpc_service_proto_msgTypes[36] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SystemSharedMemoryUnregisterRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SystemSharedMemoryUnregisterRequest) ProtoMessage() {} + +func (x *SystemSharedMemoryUnregisterRequest) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[36] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SystemSharedMemoryUnregisterRequest.ProtoReflect.Descriptor instead. +func (*SystemSharedMemoryUnregisterRequest) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{36} +} + +func (x *SystemSharedMemoryUnregisterRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +// @@ +// @@.. cpp:var:: message SystemSharedMemoryUnregisterResponse +// @@ +// @@ Response message for SystemSharedMemoryUnregister. +// @@ +type SystemSharedMemoryUnregisterResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SystemSharedMemoryUnregisterResponse) Reset() { + *x = SystemSharedMemoryUnregisterResponse{} + mi := &file_grpc_service_proto_msgTypes[37] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SystemSharedMemoryUnregisterResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SystemSharedMemoryUnregisterResponse) ProtoMessage() {} + +func (x *SystemSharedMemoryUnregisterResponse) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[37] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SystemSharedMemoryUnregisterResponse.ProtoReflect.Descriptor instead. +func (*SystemSharedMemoryUnregisterResponse) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{37} +} + +// @@ +// @@.. cpp:var:: message CudaSharedMemoryStatusRequest +// @@ +// @@ Request message for CudaSharedMemoryStatus. +// @@ +type CudaSharedMemoryStatusRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ + // @@ .. cpp:var:: string name + // @@ + // @@ The name of the region to get status for. If empty the + // @@ status is returned for all registered regions. + // @@ + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CudaSharedMemoryStatusRequest) Reset() { + *x = CudaSharedMemoryStatusRequest{} + mi := &file_grpc_service_proto_msgTypes[38] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CudaSharedMemoryStatusRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CudaSharedMemoryStatusRequest) ProtoMessage() {} + +func (x *CudaSharedMemoryStatusRequest) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[38] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CudaSharedMemoryStatusRequest.ProtoReflect.Descriptor instead. +func (*CudaSharedMemoryStatusRequest) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{38} +} + +func (x *CudaSharedMemoryStatusRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +// @@ +// @@.. cpp:var:: message CudaSharedMemoryStatusResponse +// @@ +// @@ Response message for CudaSharedMemoryStatus. +// @@ +type CudaSharedMemoryStatusResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ + // @@ .. cpp:var:: map regions + // @@ + // @@ Status for each of the registered regions, indexed by + // @@ region name. + // @@ + Regions map[string]*CudaSharedMemoryStatusResponse_RegionStatus `protobuf:"bytes,1,rep,name=regions,proto3" json:"regions,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CudaSharedMemoryStatusResponse) Reset() { + *x = CudaSharedMemoryStatusResponse{} + mi := &file_grpc_service_proto_msgTypes[39] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CudaSharedMemoryStatusResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CudaSharedMemoryStatusResponse) ProtoMessage() {} + +func (x *CudaSharedMemoryStatusResponse) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[39] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CudaSharedMemoryStatusResponse.ProtoReflect.Descriptor instead. +func (*CudaSharedMemoryStatusResponse) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{39} +} + +func (x *CudaSharedMemoryStatusResponse) GetRegions() map[string]*CudaSharedMemoryStatusResponse_RegionStatus { + if x != nil { + return x.Regions + } + return nil +} + +// @@ +// @@.. cpp:var:: message CudaSharedMemoryRegisterRequest +// @@ +// @@ Request message for CudaSharedMemoryRegister. +// @@ +type CudaSharedMemoryRegisterRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ + // @@ .. cpp:var:: string name + // @@ + // @@ The name of the region to register. + // @@ + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // @@ .. cpp:var:: bytes raw_handle + // @@ + // @@ The raw serialized cudaIPC handle. + // @@ + RawHandle []byte `protobuf:"bytes,2,opt,name=raw_handle,json=rawHandle,proto3" json:"raw_handle,omitempty"` + // @@ .. cpp:var:: int64 device_id + // @@ + // @@ The GPU device ID on which the cudaIPC handle was created. + // @@ + DeviceId int64 `protobuf:"varint,3,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"` + // @@ .. cpp:var:: uint64 byte_size + // @@ + // @@ Size of the shared memory block, in bytes. + // @@ + ByteSize uint64 `protobuf:"varint,4,opt,name=byte_size,json=byteSize,proto3" json:"byte_size,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CudaSharedMemoryRegisterRequest) Reset() { + *x = CudaSharedMemoryRegisterRequest{} + mi := &file_grpc_service_proto_msgTypes[40] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CudaSharedMemoryRegisterRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CudaSharedMemoryRegisterRequest) ProtoMessage() {} + +func (x *CudaSharedMemoryRegisterRequest) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[40] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CudaSharedMemoryRegisterRequest.ProtoReflect.Descriptor instead. +func (*CudaSharedMemoryRegisterRequest) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{40} +} + +func (x *CudaSharedMemoryRegisterRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CudaSharedMemoryRegisterRequest) GetRawHandle() []byte { + if x != nil { + return x.RawHandle + } + return nil +} + +func (x *CudaSharedMemoryRegisterRequest) GetDeviceId() int64 { + if x != nil { + return x.DeviceId + } + return 0 +} + +func (x *CudaSharedMemoryRegisterRequest) GetByteSize() uint64 { + if x != nil { + return x.ByteSize + } + return 0 +} + +// @@ +// @@.. cpp:var:: message CudaSharedMemoryRegisterResponse +// @@ +// @@ Response message for CudaSharedMemoryRegister. +// @@ +type CudaSharedMemoryRegisterResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CudaSharedMemoryRegisterResponse) Reset() { + *x = CudaSharedMemoryRegisterResponse{} + mi := &file_grpc_service_proto_msgTypes[41] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CudaSharedMemoryRegisterResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CudaSharedMemoryRegisterResponse) ProtoMessage() {} + +func (x *CudaSharedMemoryRegisterResponse) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[41] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CudaSharedMemoryRegisterResponse.ProtoReflect.Descriptor instead. +func (*CudaSharedMemoryRegisterResponse) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{41} +} + +// @@ +// @@.. cpp:var:: message CudaSharedMemoryUnregisterRequest +// @@ +// @@ Request message for CudaSharedMemoryUnregister. +// @@ +type CudaSharedMemoryUnregisterRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ + // @@ .. cpp:var:: string name + // @@ + // @@ The name of the cuda region to unregister. If empty + // @@ all cuda shared-memory regions are unregistered. + // @@ + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CudaSharedMemoryUnregisterRequest) Reset() { + *x = CudaSharedMemoryUnregisterRequest{} + mi := &file_grpc_service_proto_msgTypes[42] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CudaSharedMemoryUnregisterRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CudaSharedMemoryUnregisterRequest) ProtoMessage() {} + +func (x *CudaSharedMemoryUnregisterRequest) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[42] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CudaSharedMemoryUnregisterRequest.ProtoReflect.Descriptor instead. +func (*CudaSharedMemoryUnregisterRequest) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{42} +} + +func (x *CudaSharedMemoryUnregisterRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +// @@ +// @@.. cpp:var:: message CudaSharedMemoryUnregisterResponse +// @@ +// @@ Response message for CudaSharedMemoryUnregister. +// @@ +type CudaSharedMemoryUnregisterResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CudaSharedMemoryUnregisterResponse) Reset() { + *x = CudaSharedMemoryUnregisterResponse{} + mi := &file_grpc_service_proto_msgTypes[43] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CudaSharedMemoryUnregisterResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CudaSharedMemoryUnregisterResponse) ProtoMessage() {} + +func (x *CudaSharedMemoryUnregisterResponse) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[43] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CudaSharedMemoryUnregisterResponse.ProtoReflect.Descriptor instead. +func (*CudaSharedMemoryUnregisterResponse) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{43} +} + +// @@ +// @@.. cpp:var:: message TraceSettingRequest +// @@ +// @@ Request message for TraceSetting. +// @@ +type TraceSettingRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: map settings + // @@ + // @@ The new setting values to be updated, + // @@ settings that are not specified will remain unchanged. + // @@ + Settings map[string]*TraceSettingRequest_SettingValue `protobuf:"bytes,1,rep,name=settings,proto3" json:"settings,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // @@ + // @@ .. cpp:var:: string model_name + // @@ + // @@ The name of the model to apply the new trace settings. + // @@ If not given, the new settings will be applied globally. + // @@ + ModelName string `protobuf:"bytes,2,opt,name=model_name,json=modelName,proto3" json:"model_name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TraceSettingRequest) Reset() { + *x = TraceSettingRequest{} + mi := &file_grpc_service_proto_msgTypes[44] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TraceSettingRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TraceSettingRequest) ProtoMessage() {} + +func (x *TraceSettingRequest) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[44] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TraceSettingRequest.ProtoReflect.Descriptor instead. +func (*TraceSettingRequest) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{44} +} + +func (x *TraceSettingRequest) GetSettings() map[string]*TraceSettingRequest_SettingValue { + if x != nil { + return x.Settings + } + return nil +} + +func (x *TraceSettingRequest) GetModelName() string { + if x != nil { + return x.ModelName + } + return "" +} + +// @@ +// @@.. cpp:var:: message TraceSettingResponse +// @@ +// @@ Response message for TraceSetting. +// @@ +type TraceSettingResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: map settings + // @@ + // @@ The current trace settings, including any changes specified + // @@ by TraceSettingRequest. + // @@ + Settings map[string]*TraceSettingResponse_SettingValue `protobuf:"bytes,1,rep,name=settings,proto3" json:"settings,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TraceSettingResponse) Reset() { + *x = TraceSettingResponse{} + mi := &file_grpc_service_proto_msgTypes[45] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TraceSettingResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TraceSettingResponse) ProtoMessage() {} + +func (x *TraceSettingResponse) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[45] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TraceSettingResponse.ProtoReflect.Descriptor instead. +func (*TraceSettingResponse) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{45} +} + +func (x *TraceSettingResponse) GetSettings() map[string]*TraceSettingResponse_SettingValue { + if x != nil { + return x.Settings + } + return nil +} + +// @@ +// @@.. cpp:var:: message LogSettingsRequest +// @@ +// @@ Request message for LogSettings. +// @@ +type LogSettingsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: map settings + // @@ + // @@ The current log settings. + // @@ + Settings map[string]*LogSettingsRequest_SettingValue `protobuf:"bytes,1,rep,name=settings,proto3" json:"settings,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LogSettingsRequest) Reset() { + *x = LogSettingsRequest{} + mi := &file_grpc_service_proto_msgTypes[46] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LogSettingsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LogSettingsRequest) ProtoMessage() {} + +func (x *LogSettingsRequest) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[46] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LogSettingsRequest.ProtoReflect.Descriptor instead. +func (*LogSettingsRequest) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{46} +} + +func (x *LogSettingsRequest) GetSettings() map[string]*LogSettingsRequest_SettingValue { + if x != nil { + return x.Settings + } + return nil +} + +// @@ +// @@.. cpp:var:: message LogSettingsResponse +// @@ +// @@ Response message for LogSettings. +// @@ +type LogSettingsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: map settings + // @@ + // @@ The current log settings. + // @@ + Settings map[string]*LogSettingsResponse_SettingValue `protobuf:"bytes,1,rep,name=settings,proto3" json:"settings,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LogSettingsResponse) Reset() { + *x = LogSettingsResponse{} + mi := &file_grpc_service_proto_msgTypes[47] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LogSettingsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LogSettingsResponse) ProtoMessage() {} + +func (x *LogSettingsResponse) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[47] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LogSettingsResponse.ProtoReflect.Descriptor instead. +func (*LogSettingsResponse) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{47} +} + +func (x *LogSettingsResponse) GetSettings() map[string]*LogSettingsResponse_SettingValue { + if x != nil { + return x.Settings + } + return nil +} + +// @@ +// @@ .. cpp:var:: message TensorMetadata +// @@ +// @@ Metadata for a tensor. +// @@ +type ModelMetadataResponse_TensorMetadata struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ + // @@ .. cpp:var:: string name + // @@ + // @@ The tensor name. + // @@ + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // @@ + // @@ .. cpp:var:: string datatype + // @@ + // @@ The tensor data type. + // @@ + Datatype string `protobuf:"bytes,2,opt,name=datatype,proto3" json:"datatype,omitempty"` + // @@ + // @@ .. cpp:var:: int64 shape (repeated) + // @@ + // @@ The tensor shape. A variable-size dimension is represented + // @@ by a -1 value. + // @@ + Shape []int64 `protobuf:"varint,3,rep,packed,name=shape,proto3" json:"shape,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelMetadataResponse_TensorMetadata) Reset() { + *x = ModelMetadataResponse_TensorMetadata{} + mi := &file_grpc_service_proto_msgTypes[48] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelMetadataResponse_TensorMetadata) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelMetadataResponse_TensorMetadata) ProtoMessage() {} + +func (x *ModelMetadataResponse_TensorMetadata) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[48] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelMetadataResponse_TensorMetadata.ProtoReflect.Descriptor instead. +func (*ModelMetadataResponse_TensorMetadata) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{9, 0} +} + +func (x *ModelMetadataResponse_TensorMetadata) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ModelMetadataResponse_TensorMetadata) GetDatatype() string { + if x != nil { + return x.Datatype + } + return "" +} + +func (x *ModelMetadataResponse_TensorMetadata) GetShape() []int64 { + if x != nil { + return x.Shape + } + return nil +} + +// @@ +// @@ .. cpp:var:: message InferInputTensor +// @@ +// @@ An input tensor for an inference request. +// @@ +type ModelInferRequest_InferInputTensor struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ + // @@ .. cpp:var:: string name + // @@ + // @@ The tensor name. + // @@ + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // @@ + // @@ .. cpp:var:: string datatype + // @@ + // @@ The tensor data type. + // @@ + Datatype string `protobuf:"bytes,2,opt,name=datatype,proto3" json:"datatype,omitempty"` + // @@ + // @@ .. cpp:var:: int64 shape (repeated) + // @@ + // @@ The tensor shape. + // @@ + Shape []int64 `protobuf:"varint,3,rep,packed,name=shape,proto3" json:"shape,omitempty"` + // @@ .. cpp:var:: map parameters + // @@ + // @@ Optional inference input tensor parameters. + // @@ + Parameters map[string]*InferParameter `protobuf:"bytes,4,rep,name=parameters,proto3" json:"parameters,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // @@ .. cpp:var:: InferTensorContents contents + // @@ + // @@ The tensor contents using a data-type format. This field + // @@ must not be specified if tensor contents are being specified + // @@ in ModelInferRequest.raw_input_contents. + // @@ + Contents *InferTensorContents `protobuf:"bytes,5,opt,name=contents,proto3" json:"contents,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelInferRequest_InferInputTensor) Reset() { + *x = ModelInferRequest_InferInputTensor{} + mi := &file_grpc_service_proto_msgTypes[49] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelInferRequest_InferInputTensor) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelInferRequest_InferInputTensor) ProtoMessage() {} + +func (x *ModelInferRequest_InferInputTensor) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[49] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelInferRequest_InferInputTensor.ProtoReflect.Descriptor instead. +func (*ModelInferRequest_InferInputTensor) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{12, 0} +} + +func (x *ModelInferRequest_InferInputTensor) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ModelInferRequest_InferInputTensor) GetDatatype() string { + if x != nil { + return x.Datatype + } + return "" +} + +func (x *ModelInferRequest_InferInputTensor) GetShape() []int64 { + if x != nil { + return x.Shape + } + return nil +} + +func (x *ModelInferRequest_InferInputTensor) GetParameters() map[string]*InferParameter { + if x != nil { + return x.Parameters + } + return nil +} + +func (x *ModelInferRequest_InferInputTensor) GetContents() *InferTensorContents { + if x != nil { + return x.Contents + } + return nil +} + +// @@ +// @@ .. cpp:var:: message InferRequestedOutputTensor +// @@ +// @@ An output tensor requested for an inference request. +// @@ +type ModelInferRequest_InferRequestedOutputTensor struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ + // @@ .. cpp:var:: string name + // @@ + // @@ The tensor name. + // @@ + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // @@ .. cpp:var:: map parameters + // @@ + // @@ Optional requested output tensor parameters. + // @@ + Parameters map[string]*InferParameter `protobuf:"bytes,2,rep,name=parameters,proto3" json:"parameters,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelInferRequest_InferRequestedOutputTensor) Reset() { + *x = ModelInferRequest_InferRequestedOutputTensor{} + mi := &file_grpc_service_proto_msgTypes[50] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelInferRequest_InferRequestedOutputTensor) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelInferRequest_InferRequestedOutputTensor) ProtoMessage() {} + +func (x *ModelInferRequest_InferRequestedOutputTensor) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[50] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelInferRequest_InferRequestedOutputTensor.ProtoReflect.Descriptor instead. +func (*ModelInferRequest_InferRequestedOutputTensor) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{12, 1} +} + +func (x *ModelInferRequest_InferRequestedOutputTensor) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ModelInferRequest_InferRequestedOutputTensor) GetParameters() map[string]*InferParameter { + if x != nil { + return x.Parameters + } + return nil +} + +// @@ +// @@ .. cpp:var:: message InferOutputTensor +// @@ +// @@ An output tensor returned for an inference request. +// @@ +type ModelInferResponse_InferOutputTensor struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ + // @@ .. cpp:var:: string name + // @@ + // @@ The tensor name. + // @@ + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // @@ + // @@ .. cpp:var:: string datatype + // @@ + // @@ The tensor data type. + // @@ + Datatype string `protobuf:"bytes,2,opt,name=datatype,proto3" json:"datatype,omitempty"` + // @@ + // @@ .. cpp:var:: int64 shape (repeated) + // @@ + // @@ The tensor shape. + // @@ + Shape []int64 `protobuf:"varint,3,rep,packed,name=shape,proto3" json:"shape,omitempty"` + // @@ .. cpp:var:: map parameters + // @@ + // @@ Optional output tensor parameters. + // @@ + Parameters map[string]*InferParameter `protobuf:"bytes,4,rep,name=parameters,proto3" json:"parameters,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // @@ .. cpp:var:: InferTensorContents contents + // @@ + // @@ The tensor contents using a data-type format. This field + // @@ must not be specified if tensor contents are being specified + // @@ in ModelInferResponse.raw_output_contents. + // @@ + Contents *InferTensorContents `protobuf:"bytes,5,opt,name=contents,proto3" json:"contents,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelInferResponse_InferOutputTensor) Reset() { + *x = ModelInferResponse_InferOutputTensor{} + mi := &file_grpc_service_proto_msgTypes[54] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelInferResponse_InferOutputTensor) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelInferResponse_InferOutputTensor) ProtoMessage() {} + +func (x *ModelInferResponse_InferOutputTensor) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[54] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelInferResponse_InferOutputTensor.ProtoReflect.Descriptor instead. +func (*ModelInferResponse_InferOutputTensor) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{13, 0} +} + +func (x *ModelInferResponse_InferOutputTensor) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ModelInferResponse_InferOutputTensor) GetDatatype() string { + if x != nil { + return x.Datatype + } + return "" +} + +func (x *ModelInferResponse_InferOutputTensor) GetShape() []int64 { + if x != nil { + return x.Shape } return nil } -func (x *ModelInferResponse) GetRawOutputContents() [][]byte { +func (x *ModelInferResponse_InferOutputTensor) GetParameters() map[string]*InferParameter { if x != nil { - return x.RawOutputContents + return x.Parameters } return nil } -type ModelInferRequest_InferInputTensor struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields +func (x *ModelInferResponse_InferOutputTensor) GetContents() *InferTensorContents { + if x != nil { + return x.Contents + } + return nil +} - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Datatype string `protobuf:"bytes,2,opt,name=datatype,proto3" json:"datatype,omitempty"` - Shape []int64 `protobuf:"varint,3,rep,packed,name=shape,proto3" json:"shape,omitempty"` - Contents *InferTensorContents `protobuf:"bytes,5,opt,name=contents,proto3" json:"contents,omitempty"` +// @@ +// @@ .. cpp:var:: message ModelIndex +// @@ +// @@ Index entry for a model. +// @@ +type RepositoryIndexResponse_ModelIndex struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ + // @@ .. cpp:var:: string name + // @@ + // @@ The name of the model. + // @@ + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // @@ .. cpp:var:: string version + // @@ + // @@ The version of the model. + // @@ + Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` + // @@ + // @@ .. cpp:var:: string state + // @@ + // @@ The state of the model. + // @@ + State string `protobuf:"bytes,3,opt,name=state,proto3" json:"state,omitempty"` + // @@ + // @@ .. cpp:var:: string reason + // @@ + // @@ The reason, if any, that the model is in the given state. + // @@ + Reason string `protobuf:"bytes,4,opt,name=reason,proto3" json:"reason,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (x *ModelInferRequest_InferInputTensor) Reset() { - *x = ModelInferRequest_InferInputTensor{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_triton_grpc_service_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } +func (x *RepositoryIndexResponse_ModelIndex) Reset() { + *x = RepositoryIndexResponse_ModelIndex{} + mi := &file_grpc_service_proto_msgTypes[58] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (x *ModelInferRequest_InferInputTensor) String() string { +func (x *RepositoryIndexResponse_ModelIndex) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ModelInferRequest_InferInputTensor) ProtoMessage() {} +func (*RepositoryIndexResponse_ModelIndex) ProtoMessage() {} -func (x *ModelInferRequest_InferInputTensor) ProtoReflect() protoreflect.Message { - mi := &file_proto_triton_grpc_service_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { +func (x *RepositoryIndexResponse_ModelIndex) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[58] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -429,65 +4110,174 @@ func (x *ModelInferRequest_InferInputTensor) ProtoReflect() protoreflect.Message return mi.MessageOf(x) } -// Deprecated: Use ModelInferRequest_InferInputTensor.ProtoReflect.Descriptor instead. -func (*ModelInferRequest_InferInputTensor) Descriptor() ([]byte, []int) { - return file_proto_triton_grpc_service_proto_rawDescGZIP(), []int{3, 0} +// Deprecated: Use RepositoryIndexResponse_ModelIndex.ProtoReflect.Descriptor instead. +func (*RepositoryIndexResponse_ModelIndex) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{27, 0} } -func (x *ModelInferRequest_InferInputTensor) GetName() string { +func (x *RepositoryIndexResponse_ModelIndex) GetName() string { if x != nil { return x.Name } return "" } -func (x *ModelInferRequest_InferInputTensor) GetDatatype() string { +func (x *RepositoryIndexResponse_ModelIndex) GetVersion() string { if x != nil { - return x.Datatype + return x.Version } return "" } -func (x *ModelInferRequest_InferInputTensor) GetShape() []int64 { +func (x *RepositoryIndexResponse_ModelIndex) GetState() string { if x != nil { - return x.Shape + return x.State } - return nil + return "" } -func (x *ModelInferRequest_InferInputTensor) GetContents() *InferTensorContents { +func (x *RepositoryIndexResponse_ModelIndex) GetReason() string { if x != nil { - return x.Contents + return x.Reason } - return nil + return "" } -type ModelInferRequest_InferRequestedOutputTensor struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache +// @@ +// @@ .. cpp:var:: message RegionStatus +// @@ +// @@ Status for a shared memory region. +// @@ +type SystemSharedMemoryStatusResponse_RegionStatus struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ + // @@ .. cpp:var:: string name + // @@ + // @@ The name for the shared memory region. + // @@ + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // @@ .. cpp:var:: string shared_memory_key + // @@ + // @@ The key of the underlying memory object that contains the + // @@ shared memory region. + // @@ + Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + // @@ .. cpp:var:: uint64 offset + // @@ + // @@ Offset, in bytes, within the underlying memory object to + // @@ the start of the shared memory region. + // @@ + Offset uint64 `protobuf:"varint,3,opt,name=offset,proto3" json:"offset,omitempty"` + // @@ .. cpp:var:: uint64 byte_size + // @@ + // @@ Size of the shared memory region, in bytes. + // @@ + ByteSize uint64 `protobuf:"varint,4,opt,name=byte_size,json=byteSize,proto3" json:"byte_size,omitempty"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +func (x *SystemSharedMemoryStatusResponse_RegionStatus) Reset() { + *x = SystemSharedMemoryStatusResponse_RegionStatus{} + mi := &file_grpc_service_proto_msgTypes[61] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (x *ModelInferRequest_InferRequestedOutputTensor) Reset() { - *x = ModelInferRequest_InferRequestedOutputTensor{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_triton_grpc_service_proto_msgTypes[6] +func (x *SystemSharedMemoryStatusResponse_RegionStatus) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SystemSharedMemoryStatusResponse_RegionStatus) ProtoMessage() {} + +func (x *SystemSharedMemoryStatusResponse_RegionStatus) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[61] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } + return mi.MessageOf(x) } -func (x *ModelInferRequest_InferRequestedOutputTensor) String() string { +// Deprecated: Use SystemSharedMemoryStatusResponse_RegionStatus.ProtoReflect.Descriptor instead. +func (*SystemSharedMemoryStatusResponse_RegionStatus) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{33, 0} +} + +func (x *SystemSharedMemoryStatusResponse_RegionStatus) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *SystemSharedMemoryStatusResponse_RegionStatus) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *SystemSharedMemoryStatusResponse_RegionStatus) GetOffset() uint64 { + if x != nil { + return x.Offset + } + return 0 +} + +func (x *SystemSharedMemoryStatusResponse_RegionStatus) GetByteSize() uint64 { + if x != nil { + return x.ByteSize + } + return 0 +} + +// @@ +// @@ .. cpp:var:: message RegionStatus +// @@ +// @@ Status for a shared memory region. +// @@ +type CudaSharedMemoryStatusResponse_RegionStatus struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ + // @@ .. cpp:var:: string name + // @@ + // @@ The name for the shared memory region. + // @@ + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // @@ .. cpp:var:: uin64 device_id + // @@ + // @@ The GPU device ID where the cudaIPC handle was created. + // @@ + DeviceId uint64 `protobuf:"varint,2,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"` + // @@ .. cpp:var:: uint64 byte_size + // @@ + // @@ Size of the shared memory region, in bytes. + // @@ + ByteSize uint64 `protobuf:"varint,3,opt,name=byte_size,json=byteSize,proto3" json:"byte_size,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CudaSharedMemoryStatusResponse_RegionStatus) Reset() { + *x = CudaSharedMemoryStatusResponse_RegionStatus{} + mi := &file_grpc_service_proto_msgTypes[63] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CudaSharedMemoryStatusResponse_RegionStatus) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ModelInferRequest_InferRequestedOutputTensor) ProtoMessage() {} +func (*CudaSharedMemoryStatusResponse_RegionStatus) ProtoMessage() {} -func (x *ModelInferRequest_InferRequestedOutputTensor) ProtoReflect() protoreflect.Message { - mi := &file_proto_triton_grpc_service_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { +func (x *CudaSharedMemoryStatusResponse_RegionStatus) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[63] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -497,47 +4287,170 @@ func (x *ModelInferRequest_InferRequestedOutputTensor) ProtoReflect() protorefle return mi.MessageOf(x) } -// Deprecated: Use ModelInferRequest_InferRequestedOutputTensor.ProtoReflect.Descriptor instead. -func (*ModelInferRequest_InferRequestedOutputTensor) Descriptor() ([]byte, []int) { - return file_proto_triton_grpc_service_proto_rawDescGZIP(), []int{3, 1} +// Deprecated: Use CudaSharedMemoryStatusResponse_RegionStatus.ProtoReflect.Descriptor instead. +func (*CudaSharedMemoryStatusResponse_RegionStatus) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{39, 0} } -func (x *ModelInferRequest_InferRequestedOutputTensor) GetName() string { +func (x *CudaSharedMemoryStatusResponse_RegionStatus) GetName() string { if x != nil { return x.Name } return "" } -type ModelInferResponse_InferOutputTensor struct { - state protoimpl.MessageState +func (x *CudaSharedMemoryStatusResponse_RegionStatus) GetDeviceId() uint64 { + if x != nil { + return x.DeviceId + } + return 0 +} + +func (x *CudaSharedMemoryStatusResponse_RegionStatus) GetByteSize() uint64 { + if x != nil { + return x.ByteSize + } + return 0 +} + +// @@ +// @@ .. cpp:var:: message SettingValue +// @@ +// @@ The values to be associated with a trace setting. +// @@ If no value is provided, the setting will be clear and +// @@ the global setting value will be used. +// @@ +type TraceSettingRequest_SettingValue struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ + // @@ .. cpp:var:: string value (repeated) + // @@ + // @@ The value. + // @@ + Value []string `protobuf:"bytes,1,rep,name=value,proto3" json:"value,omitempty"` + unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache +} + +func (x *TraceSettingRequest_SettingValue) Reset() { + *x = TraceSettingRequest_SettingValue{} + mi := &file_grpc_service_proto_msgTypes[65] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TraceSettingRequest_SettingValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TraceSettingRequest_SettingValue) ProtoMessage() {} + +func (x *TraceSettingRequest_SettingValue) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[65] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TraceSettingRequest_SettingValue.ProtoReflect.Descriptor instead. +func (*TraceSettingRequest_SettingValue) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{44, 0} +} + +func (x *TraceSettingRequest_SettingValue) GetValue() []string { + if x != nil { + return x.Value + } + return nil +} + +// @@ +// @@ .. cpp:var:: message SettingValue +// @@ +// @@ The values to be associated with a trace setting. +// @@ +type TraceSettingResponse_SettingValue struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ + // @@ .. cpp:var:: string value (repeated) + // @@ + // @@ The value. + // @@ + Value []string `protobuf:"bytes,1,rep,name=value,proto3" json:"value,omitempty"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Datatype string `protobuf:"bytes,2,opt,name=datatype,proto3" json:"datatype,omitempty"` - Shape []int64 `protobuf:"varint,3,rep,packed,name=shape,proto3" json:"shape,omitempty"` - Contents *InferTensorContents `protobuf:"bytes,5,opt,name=contents,proto3" json:"contents,omitempty"` +func (x *TraceSettingResponse_SettingValue) Reset() { + *x = TraceSettingResponse_SettingValue{} + mi := &file_grpc_service_proto_msgTypes[67] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (x *ModelInferResponse_InferOutputTensor) Reset() { - *x = ModelInferResponse_InferOutputTensor{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_triton_grpc_service_proto_msgTypes[7] +func (x *TraceSettingResponse_SettingValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TraceSettingResponse_SettingValue) ProtoMessage() {} + +func (x *TraceSettingResponse_SettingValue) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[67] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } + return mi.MessageOf(x) } -func (x *ModelInferResponse_InferOutputTensor) String() string { +// Deprecated: Use TraceSettingResponse_SettingValue.ProtoReflect.Descriptor instead. +func (*TraceSettingResponse_SettingValue) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{45, 0} +} + +func (x *TraceSettingResponse_SettingValue) GetValue() []string { + if x != nil { + return x.Value + } + return nil +} + +type LogSettingsRequest_SettingValue struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to ParameterChoice: + // + // *LogSettingsRequest_SettingValue_BoolParam + // *LogSettingsRequest_SettingValue_Uint32Param + // *LogSettingsRequest_SettingValue_StringParam + ParameterChoice isLogSettingsRequest_SettingValue_ParameterChoice `protobuf_oneof:"parameter_choice"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LogSettingsRequest_SettingValue) Reset() { + *x = LogSettingsRequest_SettingValue{} + mi := &file_grpc_service_proto_msgTypes[69] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LogSettingsRequest_SettingValue) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ModelInferResponse_InferOutputTensor) ProtoMessage() {} +func (*LogSettingsRequest_SettingValue) ProtoMessage() {} -func (x *ModelInferResponse_InferOutputTensor) ProtoReflect() protoreflect.Message { - mi := &file_proto_triton_grpc_service_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { +func (x *LogSettingsRequest_SettingValue) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[69] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -547,303 +4460,751 @@ func (x *ModelInferResponse_InferOutputTensor) ProtoReflect() protoreflect.Messa return mi.MessageOf(x) } -// Deprecated: Use ModelInferResponse_InferOutputTensor.ProtoReflect.Descriptor instead. -func (*ModelInferResponse_InferOutputTensor) Descriptor() ([]byte, []int) { - return file_proto_triton_grpc_service_proto_rawDescGZIP(), []int{4, 0} +// Deprecated: Use LogSettingsRequest_SettingValue.ProtoReflect.Descriptor instead. +func (*LogSettingsRequest_SettingValue) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{46, 0} } -func (x *ModelInferResponse_InferOutputTensor) GetName() string { +func (x *LogSettingsRequest_SettingValue) GetParameterChoice() isLogSettingsRequest_SettingValue_ParameterChoice { if x != nil { - return x.Name + return x.ParameterChoice } - return "" + return nil } -func (x *ModelInferResponse_InferOutputTensor) GetDatatype() string { +func (x *LogSettingsRequest_SettingValue) GetBoolParam() bool { if x != nil { - return x.Datatype + if x, ok := x.ParameterChoice.(*LogSettingsRequest_SettingValue_BoolParam); ok { + return x.BoolParam + } + } + return false +} + +func (x *LogSettingsRequest_SettingValue) GetUint32Param() uint32 { + if x != nil { + if x, ok := x.ParameterChoice.(*LogSettingsRequest_SettingValue_Uint32Param); ok { + return x.Uint32Param + } + } + return 0 +} + +func (x *LogSettingsRequest_SettingValue) GetStringParam() string { + if x != nil { + if x, ok := x.ParameterChoice.(*LogSettingsRequest_SettingValue_StringParam); ok { + return x.StringParam + } } return "" } -func (x *ModelInferResponse_InferOutputTensor) GetShape() []int64 { +type isLogSettingsRequest_SettingValue_ParameterChoice interface { + isLogSettingsRequest_SettingValue_ParameterChoice() +} + +type LogSettingsRequest_SettingValue_BoolParam struct { + // @@ .. cpp:var:: bool bool_param + // @@ + // @@ A boolean parameter value. + // @@ + BoolParam bool `protobuf:"varint,1,opt,name=bool_param,json=boolParam,proto3,oneof"` +} + +type LogSettingsRequest_SettingValue_Uint32Param struct { + // @@ .. cpp:var:: uint32 uint32_param + // @@ + // @@ An uint32 parameter value. + // @@ + Uint32Param uint32 `protobuf:"varint,2,opt,name=uint32_param,json=uint32Param,proto3,oneof"` +} + +type LogSettingsRequest_SettingValue_StringParam struct { + // @@ .. cpp:var:: string string_param + // @@ + // @@ A string parameter value. + // @@ + StringParam string `protobuf:"bytes,3,opt,name=string_param,json=stringParam,proto3,oneof"` +} + +func (*LogSettingsRequest_SettingValue_BoolParam) isLogSettingsRequest_SettingValue_ParameterChoice() { +} + +func (*LogSettingsRequest_SettingValue_Uint32Param) isLogSettingsRequest_SettingValue_ParameterChoice() { +} + +func (*LogSettingsRequest_SettingValue_StringParam) isLogSettingsRequest_SettingValue_ParameterChoice() { +} + +type LogSettingsResponse_SettingValue struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to ParameterChoice: + // + // *LogSettingsResponse_SettingValue_BoolParam + // *LogSettingsResponse_SettingValue_Uint32Param + // *LogSettingsResponse_SettingValue_StringParam + ParameterChoice isLogSettingsResponse_SettingValue_ParameterChoice `protobuf_oneof:"parameter_choice"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LogSettingsResponse_SettingValue) Reset() { + *x = LogSettingsResponse_SettingValue{} + mi := &file_grpc_service_proto_msgTypes[71] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LogSettingsResponse_SettingValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LogSettingsResponse_SettingValue) ProtoMessage() {} + +func (x *LogSettingsResponse_SettingValue) ProtoReflect() protoreflect.Message { + mi := &file_grpc_service_proto_msgTypes[71] if x != nil { - return x.Shape + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } - return nil + return mi.MessageOf(x) } -func (x *ModelInferResponse_InferOutputTensor) GetContents() *InferTensorContents { +// Deprecated: Use LogSettingsResponse_SettingValue.ProtoReflect.Descriptor instead. +func (*LogSettingsResponse_SettingValue) Descriptor() ([]byte, []int) { + return file_grpc_service_proto_rawDescGZIP(), []int{47, 0} +} + +func (x *LogSettingsResponse_SettingValue) GetParameterChoice() isLogSettingsResponse_SettingValue_ParameterChoice { if x != nil { - return x.Contents + return x.ParameterChoice } return nil } -var File_proto_triton_grpc_service_proto protoreflect.FileDescriptor - -var file_proto_triton_grpc_service_proto_rawDesc = []byte{ - 0x0a, 0x1f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x72, 0x69, 0x74, 0x6f, 0x6e, 0x2f, 0x67, - 0x72, 0x70, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x09, 0x69, 0x6e, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x22, 0x41, 0x0a, 0x11, - 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x52, 0x65, 0x61, 0x64, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, - 0x2a, 0x0a, 0x12, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x52, 0x65, 0x61, 0x64, 0x79, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x65, 0x61, 0x64, 0x79, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x72, 0x65, 0x61, 0x64, 0x79, 0x22, 0xc3, 0x02, 0x0a, 0x13, - 0x49, 0x6e, 0x66, 0x65, 0x72, 0x54, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x43, 0x6f, 0x6e, 0x74, 0x65, - 0x6e, 0x74, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, 0x63, 0x6f, 0x6e, 0x74, - 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x08, 0x52, 0x0c, 0x62, 0x6f, 0x6f, 0x6c, - 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x6e, 0x74, 0x5f, - 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, 0x52, 0x0b, - 0x69, 0x6e, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x69, - 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, - 0x03, 0x28, 0x03, 0x52, 0x0d, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, - 0x74, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x75, 0x69, 0x6e, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, - 0x6e, 0x74, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x0c, 0x75, 0x69, 0x6e, 0x74, 0x43, - 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x75, 0x69, 0x6e, 0x74, 0x36, - 0x34, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x04, - 0x52, 0x0e, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, - 0x12, 0x23, 0x0a, 0x0d, 0x66, 0x70, 0x33, 0x32, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, - 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x02, 0x52, 0x0c, 0x66, 0x70, 0x33, 0x32, 0x43, 0x6f, 0x6e, - 0x74, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x66, 0x70, 0x36, 0x34, 0x5f, 0x63, 0x6f, - 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x01, 0x52, 0x0c, 0x66, 0x70, - 0x36, 0x34, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x62, 0x79, - 0x74, 0x65, 0x73, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x08, 0x20, 0x03, - 0x28, 0x0c, 0x52, 0x0d, 0x62, 0x79, 0x74, 0x65, 0x73, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, - 0x73, 0x22, 0xf8, 0x03, 0x0a, 0x11, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x49, 0x6e, 0x66, 0x65, 0x72, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x6f, 0x64, 0x65, 0x6c, - 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x6f, 0x64, - 0x65, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, - 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6d, - 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, - 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x45, 0x0a, 0x06, 0x69, - 0x6e, 0x70, 0x75, 0x74, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x69, 0x6e, - 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x2e, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x49, 0x6e, 0x66, - 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x49, 0x6e, 0x66, 0x65, 0x72, 0x49, - 0x6e, 0x70, 0x75, 0x74, 0x54, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x52, 0x06, 0x69, 0x6e, 0x70, 0x75, - 0x74, 0x73, 0x12, 0x51, 0x0a, 0x07, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x73, 0x18, 0x06, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x37, 0x2e, 0x69, 0x6e, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x2e, - 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x49, 0x6e, 0x66, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x2e, 0x49, 0x6e, 0x66, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x65, 0x64, - 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x54, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x52, 0x07, 0x6f, 0x75, - 0x74, 0x70, 0x75, 0x74, 0x73, 0x12, 0x2c, 0x0a, 0x12, 0x72, 0x61, 0x77, 0x5f, 0x69, 0x6e, 0x70, - 0x75, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, - 0x0c, 0x52, 0x10, 0x72, 0x61, 0x77, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, - 0x6e, 0x74, 0x73, 0x1a, 0x94, 0x01, 0x0a, 0x10, 0x49, 0x6e, 0x66, 0x65, 0x72, 0x49, 0x6e, 0x70, - 0x75, 0x74, 0x54, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, - 0x64, 0x61, 0x74, 0x61, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, - 0x64, 0x61, 0x74, 0x61, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x68, 0x61, 0x70, - 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x03, 0x52, 0x05, 0x73, 0x68, 0x61, 0x70, 0x65, 0x12, 0x3a, - 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1e, 0x2e, 0x69, 0x6e, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x2e, 0x49, 0x6e, 0x66, - 0x65, 0x72, 0x54, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, - 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x1a, 0x30, 0x0a, 0x1a, 0x49, 0x6e, - 0x66, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x65, 0x64, 0x4f, 0x75, 0x74, 0x70, - 0x75, 0x74, 0x54, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0xfb, 0x02, 0x0a, - 0x12, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x49, 0x6e, 0x66, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x4e, 0x61, - 0x6d, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x76, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6d, 0x6f, 0x64, 0x65, 0x6c, - 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x49, 0x0a, 0x07, 0x6f, 0x75, 0x74, 0x70, 0x75, - 0x74, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x69, 0x6e, 0x66, 0x65, 0x72, - 0x65, 0x6e, 0x63, 0x65, 0x2e, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x49, 0x6e, 0x66, 0x65, 0x72, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x49, 0x6e, 0x66, 0x65, 0x72, 0x4f, 0x75, 0x74, - 0x70, 0x75, 0x74, 0x54, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x52, 0x07, 0x6f, 0x75, 0x74, 0x70, 0x75, - 0x74, 0x73, 0x12, 0x2e, 0x0a, 0x13, 0x72, 0x61, 0x77, 0x5f, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, - 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0c, 0x52, - 0x11, 0x72, 0x61, 0x77, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, - 0x74, 0x73, 0x1a, 0x95, 0x01, 0x0a, 0x11, 0x49, 0x6e, 0x66, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, - 0x75, 0x74, 0x54, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, - 0x64, 0x61, 0x74, 0x61, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, - 0x64, 0x61, 0x74, 0x61, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x68, 0x61, 0x70, - 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x03, 0x52, 0x05, 0x73, 0x68, 0x61, 0x70, 0x65, 0x12, 0x3a, - 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1e, 0x2e, 0x69, 0x6e, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x2e, 0x49, 0x6e, 0x66, - 0x65, 0x72, 0x54, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, - 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x32, 0xb0, 0x01, 0x0a, 0x14, 0x47, - 0x52, 0x50, 0x43, 0x49, 0x6e, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x12, 0x4b, 0x0a, 0x0a, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x52, 0x65, 0x61, 0x64, - 0x79, 0x12, 0x1c, 0x2e, 0x69, 0x6e, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x2e, 0x4d, 0x6f, - 0x64, 0x65, 0x6c, 0x52, 0x65, 0x61, 0x64, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x1d, 0x2e, 0x69, 0x6e, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x2e, 0x4d, 0x6f, 0x64, 0x65, - 0x6c, 0x52, 0x65, 0x61, 0x64, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, - 0x12, 0x4b, 0x0a, 0x0a, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x49, 0x6e, 0x66, 0x65, 0x72, 0x12, 0x1c, - 0x2e, 0x69, 0x6e, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x2e, 0x4d, 0x6f, 0x64, 0x65, 0x6c, - 0x49, 0x6e, 0x66, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x69, - 0x6e, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x2e, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x49, 0x6e, - 0x66, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x23, 0x5a, - 0x21, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x76, 0x69, 0x61, 0x6e, - 0x74, 0x2f, 0x6d, 0x6c, 0x79, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x72, 0x69, 0x74, - 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +func (x *LogSettingsResponse_SettingValue) GetBoolParam() bool { + if x != nil { + if x, ok := x.ParameterChoice.(*LogSettingsResponse_SettingValue_BoolParam); ok { + return x.BoolParam + } + } + return false +} + +func (x *LogSettingsResponse_SettingValue) GetUint32Param() uint32 { + if x != nil { + if x, ok := x.ParameterChoice.(*LogSettingsResponse_SettingValue_Uint32Param); ok { + return x.Uint32Param + } + } + return 0 +} + +func (x *LogSettingsResponse_SettingValue) GetStringParam() string { + if x != nil { + if x, ok := x.ParameterChoice.(*LogSettingsResponse_SettingValue_StringParam); ok { + return x.StringParam + } + } + return "" +} + +type isLogSettingsResponse_SettingValue_ParameterChoice interface { + isLogSettingsResponse_SettingValue_ParameterChoice() +} + +type LogSettingsResponse_SettingValue_BoolParam struct { + // @@ .. cpp:var:: bool bool_param + // @@ + // @@ A boolean parameter value. + // @@ + BoolParam bool `protobuf:"varint,1,opt,name=bool_param,json=boolParam,proto3,oneof"` +} + +type LogSettingsResponse_SettingValue_Uint32Param struct { + // @@ .. cpp:var:: uint32 uint32_param + // @@ + // @@ An int32 parameter value. + // @@ + Uint32Param uint32 `protobuf:"varint,2,opt,name=uint32_param,json=uint32Param,proto3,oneof"` +} + +type LogSettingsResponse_SettingValue_StringParam struct { + // @@ .. cpp:var:: string string_param + // @@ + // @@ A string parameter value. + // @@ + StringParam string `protobuf:"bytes,3,opt,name=string_param,json=stringParam,proto3,oneof"` +} + +func (*LogSettingsResponse_SettingValue_BoolParam) isLogSettingsResponse_SettingValue_ParameterChoice() { +} + +func (*LogSettingsResponse_SettingValue_Uint32Param) isLogSettingsResponse_SettingValue_ParameterChoice() { +} + +func (*LogSettingsResponse_SettingValue_StringParam) isLogSettingsResponse_SettingValue_ParameterChoice() { } +var File_grpc_service_proto protoreflect.FileDescriptor + +const file_grpc_service_proto_rawDesc = "" + + "\n" + + "\x12grpc_service.proto\x12\tinference\x1a\x12model_config.proto\"\x13\n" + + "\x11ServerLiveRequest\"(\n" + + "\x12ServerLiveResponse\x12\x12\n" + + "\x04live\x18\x01 \x01(\bR\x04live\"\x14\n" + + "\x12ServerReadyRequest\"+\n" + + "\x13ServerReadyResponse\x12\x14\n" + + "\x05ready\x18\x01 \x01(\bR\x05ready\"A\n" + + "\x11ModelReadyRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x18\n" + + "\aversion\x18\x02 \x01(\tR\aversion\"*\n" + + "\x12ModelReadyResponse\x12\x14\n" + + "\x05ready\x18\x01 \x01(\bR\x05ready\"\x17\n" + + "\x15ServerMetadataRequest\"f\n" + + "\x16ServerMetadataResponse\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x18\n" + + "\aversion\x18\x02 \x01(\tR\aversion\x12\x1e\n" + + "\n" + + "extensions\x18\x03 \x03(\tR\n" + + "extensions\"D\n" + + "\x14ModelMetadataRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x18\n" + + "\aversion\x18\x02 \x01(\tR\aversion\"\xcf\x02\n" + + "\x15ModelMetadataResponse\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x1a\n" + + "\bversions\x18\x02 \x03(\tR\bversions\x12\x1a\n" + + "\bplatform\x18\x03 \x01(\tR\bplatform\x12G\n" + + "\x06inputs\x18\x04 \x03(\v2/.inference.ModelMetadataResponse.TensorMetadataR\x06inputs\x12I\n" + + "\aoutputs\x18\x05 \x03(\v2/.inference.ModelMetadataResponse.TensorMetadataR\aoutputs\x1aV\n" + + "\x0eTensorMetadata\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x1a\n" + + "\bdatatype\x18\x02 \x01(\tR\bdatatype\x12\x14\n" + + "\x05shape\x18\x03 \x03(\x03R\x05shape\"\xd7\x01\n" + + "\x0eInferParameter\x12\x1f\n" + + "\n" + + "bool_param\x18\x01 \x01(\bH\x00R\tboolParam\x12!\n" + + "\vint64_param\x18\x02 \x01(\x03H\x00R\n" + + "int64Param\x12#\n" + + "\fstring_param\x18\x03 \x01(\tH\x00R\vstringParam\x12#\n" + + "\fdouble_param\x18\x04 \x01(\x01H\x00R\vdoubleParam\x12#\n" + + "\fuint64_param\x18\x05 \x01(\x04H\x00R\vuint64ParamB\x12\n" + + "\x10parameter_choice\"\xc3\x02\n" + + "\x13InferTensorContents\x12#\n" + + "\rbool_contents\x18\x01 \x03(\bR\fboolContents\x12!\n" + + "\fint_contents\x18\x02 \x03(\x05R\vintContents\x12%\n" + + "\x0eint64_contents\x18\x03 \x03(\x03R\rint64Contents\x12#\n" + + "\ruint_contents\x18\x04 \x03(\rR\fuintContents\x12'\n" + + "\x0fuint64_contents\x18\x05 \x03(\x04R\x0euint64Contents\x12#\n" + + "\rfp32_contents\x18\x06 \x03(\x02R\ffp32Contents\x12#\n" + + "\rfp64_contents\x18\a \x03(\x01R\ffp64Contents\x12%\n" + + "\x0ebytes_contents\x18\b \x03(\fR\rbytesContents\"\x9d\b\n" + + "\x11ModelInferRequest\x12\x1d\n" + + "\n" + + "model_name\x18\x01 \x01(\tR\tmodelName\x12#\n" + + "\rmodel_version\x18\x02 \x01(\tR\fmodelVersion\x12\x0e\n" + + "\x02id\x18\x03 \x01(\tR\x02id\x12L\n" + + "\n" + + "parameters\x18\x04 \x03(\v2,.inference.ModelInferRequest.ParametersEntryR\n" + + "parameters\x12E\n" + + "\x06inputs\x18\x05 \x03(\v2-.inference.ModelInferRequest.InferInputTensorR\x06inputs\x12Q\n" + + "\aoutputs\x18\x06 \x03(\v27.inference.ModelInferRequest.InferRequestedOutputTensorR\aoutputs\x12,\n" + + "\x12raw_input_contents\x18\a \x03(\fR\x10rawInputContents\x1a\xcd\x02\n" + + "\x10InferInputTensor\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x1a\n" + + "\bdatatype\x18\x02 \x01(\tR\bdatatype\x12\x14\n" + + "\x05shape\x18\x03 \x03(\x03R\x05shape\x12]\n" + + "\n" + + "parameters\x18\x04 \x03(\v2=.inference.ModelInferRequest.InferInputTensor.ParametersEntryR\n" + + "parameters\x12:\n" + + "\bcontents\x18\x05 \x01(\v2\x1e.inference.InferTensorContentsR\bcontents\x1aX\n" + + "\x0fParametersEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12/\n" + + "\x05value\x18\x02 \x01(\v2\x19.inference.InferParameterR\x05value:\x028\x01\x1a\xf3\x01\n" + + "\x1aInferRequestedOutputTensor\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12g\n" + + "\n" + + "parameters\x18\x02 \x03(\v2G.inference.ModelInferRequest.InferRequestedOutputTensor.ParametersEntryR\n" + + "parameters\x1aX\n" + + "\x0fParametersEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12/\n" + + "\x05value\x18\x02 \x01(\v2\x19.inference.InferParameterR\x05value:\x028\x01\x1aX\n" + + "\x0fParametersEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12/\n" + + "\x05value\x18\x02 \x01(\v2\x19.inference.InferParameterR\x05value:\x028\x01\"\xdf\x05\n" + + "\x12ModelInferResponse\x12\x1d\n" + + "\n" + + "model_name\x18\x01 \x01(\tR\tmodelName\x12#\n" + + "\rmodel_version\x18\x02 \x01(\tR\fmodelVersion\x12\x0e\n" + + "\x02id\x18\x03 \x01(\tR\x02id\x12M\n" + + "\n" + + "parameters\x18\x04 \x03(\v2-.inference.ModelInferResponse.ParametersEntryR\n" + + "parameters\x12I\n" + + "\aoutputs\x18\x05 \x03(\v2/.inference.ModelInferResponse.InferOutputTensorR\aoutputs\x12.\n" + + "\x13raw_output_contents\x18\x06 \x03(\fR\x11rawOutputContents\x1a\xd0\x02\n" + + "\x11InferOutputTensor\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x1a\n" + + "\bdatatype\x18\x02 \x01(\tR\bdatatype\x12\x14\n" + + "\x05shape\x18\x03 \x03(\x03R\x05shape\x12_\n" + + "\n" + + "parameters\x18\x04 \x03(\v2?.inference.ModelInferResponse.InferOutputTensor.ParametersEntryR\n" + + "parameters\x12:\n" + + "\bcontents\x18\x05 \x01(\v2\x1e.inference.InferTensorContentsR\bcontents\x1aX\n" + + "\x0fParametersEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12/\n" + + "\x05value\x18\x02 \x01(\v2\x19.inference.InferParameterR\x05value:\x028\x01\x1aX\n" + + "\x0fParametersEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12/\n" + + "\x05value\x18\x02 \x01(\v2\x19.inference.InferParameterR\x05value:\x028\x01\"\x85\x01\n" + + "\x18ModelStreamInferResponse\x12#\n" + + "\rerror_message\x18\x01 \x01(\tR\ferrorMessage\x12D\n" + + "\x0einfer_response\x18\x02 \x01(\v2\x1d.inference.ModelInferResponseR\rinferResponse\"B\n" + + "\x12ModelConfigRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x18\n" + + "\aversion\x18\x02 \x01(\tR\aversion\"E\n" + + "\x13ModelConfigResponse\x12.\n" + + "\x06config\x18\x01 \x01(\v2\x16.inference.ModelConfigR\x06config\"F\n" + + "\x16ModelStatisticsRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x18\n" + + "\aversion\x18\x02 \x01(\tR\aversion\"9\n" + + "\x11StatisticDuration\x12\x14\n" + + "\x05count\x18\x01 \x01(\x04R\x05count\x12\x0e\n" + + "\x02ns\x18\x02 \x01(\x04R\x02ns\"\xf2\x03\n" + + "\x0fInferStatistics\x126\n" + + "\asuccess\x18\x01 \x01(\v2\x1c.inference.StatisticDurationR\asuccess\x120\n" + + "\x04fail\x18\x02 \x01(\v2\x1c.inference.StatisticDurationR\x04fail\x122\n" + + "\x05queue\x18\x03 \x01(\v2\x1c.inference.StatisticDurationR\x05queue\x12A\n" + + "\rcompute_input\x18\x04 \x01(\v2\x1c.inference.StatisticDurationR\fcomputeInput\x12A\n" + + "\rcompute_infer\x18\x05 \x01(\v2\x1c.inference.StatisticDurationR\fcomputeInfer\x12C\n" + + "\x0ecompute_output\x18\x06 \x01(\v2\x1c.inference.StatisticDurationR\rcomputeOutput\x129\n" + + "\tcache_hit\x18\a \x01(\v2\x1c.inference.StatisticDurationR\bcacheHit\x12;\n" + + "\n" + + "cache_miss\x18\b \x01(\v2\x1c.inference.StatisticDurationR\tcacheMiss\"\x86\x03\n" + + "\x17InferResponseStatistics\x12A\n" + + "\rcompute_infer\x18\x01 \x01(\v2\x1c.inference.StatisticDurationR\fcomputeInfer\x12C\n" + + "\x0ecompute_output\x18\x02 \x01(\v2\x1c.inference.StatisticDurationR\rcomputeOutput\x126\n" + + "\asuccess\x18\x03 \x01(\v2\x1c.inference.StatisticDurationR\asuccess\x120\n" + + "\x04fail\x18\x04 \x01(\v2\x1c.inference.StatisticDurationR\x04fail\x12C\n" + + "\x0eempty_response\x18\x05 \x01(\v2\x1c.inference.StatisticDurationR\remptyResponse\x124\n" + + "\x06cancel\x18\x06 \x01(\v2\x1c.inference.StatisticDurationR\x06cancel\"\x80\x02\n" + + "\x14InferBatchStatistics\x12\x1d\n" + + "\n" + + "batch_size\x18\x01 \x01(\x04R\tbatchSize\x12A\n" + + "\rcompute_input\x18\x02 \x01(\v2\x1c.inference.StatisticDurationR\fcomputeInput\x12A\n" + + "\rcompute_infer\x18\x03 \x01(\v2\x1c.inference.StatisticDurationR\fcomputeInfer\x12C\n" + + "\x0ecompute_output\x18\x04 \x01(\v2\x1c.inference.StatisticDurationR\rcomputeOutput\"N\n" + + "\vMemoryUsage\x12\x12\n" + + "\x04type\x18\x01 \x01(\tR\x04type\x12\x0e\n" + + "\x02id\x18\x02 \x01(\x03R\x02id\x12\x1b\n" + + "\tbyte_size\x18\x03 \x01(\x04R\bbyteSize\"\xb6\x04\n" + + "\x0fModelStatistics\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x18\n" + + "\aversion\x18\x02 \x01(\tR\aversion\x12%\n" + + "\x0elast_inference\x18\x03 \x01(\x04R\rlastInference\x12'\n" + + "\x0finference_count\x18\x04 \x01(\x04R\x0einferenceCount\x12'\n" + + "\x0fexecution_count\x18\x05 \x01(\x04R\x0eexecutionCount\x12C\n" + + "\x0finference_stats\x18\x06 \x01(\v2\x1a.inference.InferStatisticsR\x0einferenceStats\x12@\n" + + "\vbatch_stats\x18\a \x03(\v2\x1f.inference.InferBatchStatisticsR\n" + + "batchStats\x129\n" + + "\fmemory_usage\x18\b \x03(\v2\x16.inference.MemoryUsageR\vmemoryUsage\x12T\n" + + "\x0eresponse_stats\x18\t \x03(\v2-.inference.ModelStatistics.ResponseStatsEntryR\rresponseStats\x1ad\n" + + "\x12ResponseStatsEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x128\n" + + "\x05value\x18\x02 \x01(\v2\".inference.InferResponseStatisticsR\x05value:\x028\x01\"V\n" + + "\x17ModelStatisticsResponse\x12;\n" + + "\vmodel_stats\x18\x01 \x03(\v2\x1a.inference.ModelStatisticsR\n" + + "modelStats\"\xba\x01\n" + + "\x18ModelRepositoryParameter\x12\x1f\n" + + "\n" + + "bool_param\x18\x01 \x01(\bH\x00R\tboolParam\x12!\n" + + "\vint64_param\x18\x02 \x01(\x03H\x00R\n" + + "int64Param\x12#\n" + + "\fstring_param\x18\x03 \x01(\tH\x00R\vstringParam\x12!\n" + + "\vbytes_param\x18\x04 \x01(\fH\x00R\n" + + "bytesParamB\x12\n" + + "\x10parameter_choice\"W\n" + + "\x16RepositoryIndexRequest\x12'\n" + + "\x0frepository_name\x18\x01 \x01(\tR\x0erepositoryName\x12\x14\n" + + "\x05ready\x18\x02 \x01(\bR\x05ready\"\xca\x01\n" + + "\x17RepositoryIndexResponse\x12E\n" + + "\x06models\x18\x01 \x03(\v2-.inference.RepositoryIndexResponse.ModelIndexR\x06models\x1ah\n" + + "\n" + + "ModelIndex\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x18\n" + + "\aversion\x18\x02 \x01(\tR\aversion\x12\x14\n" + + "\x05state\x18\x03 \x01(\tR\x05state\x12\x16\n" + + "\x06reason\x18\x04 \x01(\tR\x06reason\"\x9f\x02\n" + + "\x1aRepositoryModelLoadRequest\x12'\n" + + "\x0frepository_name\x18\x01 \x01(\tR\x0erepositoryName\x12\x1d\n" + + "\n" + + "model_name\x18\x02 \x01(\tR\tmodelName\x12U\n" + + "\n" + + "parameters\x18\x03 \x03(\v25.inference.RepositoryModelLoadRequest.ParametersEntryR\n" + + "parameters\x1ab\n" + + "\x0fParametersEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x129\n" + + "\x05value\x18\x02 \x01(\v2#.inference.ModelRepositoryParameterR\x05value:\x028\x01\"\x1d\n" + + "\x1bRepositoryModelLoadResponse\"\xa3\x02\n" + + "\x1cRepositoryModelUnloadRequest\x12'\n" + + "\x0frepository_name\x18\x01 \x01(\tR\x0erepositoryName\x12\x1d\n" + + "\n" + + "model_name\x18\x02 \x01(\tR\tmodelName\x12W\n" + + "\n" + + "parameters\x18\x03 \x03(\v27.inference.RepositoryModelUnloadRequest.ParametersEntryR\n" + + "parameters\x1ab\n" + + "\x0fParametersEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x129\n" + + "\x05value\x18\x02 \x01(\v2#.inference.ModelRepositoryParameterR\x05value:\x028\x01\"\x1f\n" + + "\x1dRepositoryModelUnloadResponse\"5\n" + + "\x1fSystemSharedMemoryStatusRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\"\xd7\x02\n" + + " SystemSharedMemoryStatusResponse\x12R\n" + + "\aregions\x18\x01 \x03(\v28.inference.SystemSharedMemoryStatusResponse.RegionsEntryR\aregions\x1ai\n" + + "\fRegionStatus\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x10\n" + + "\x03key\x18\x02 \x01(\tR\x03key\x12\x16\n" + + "\x06offset\x18\x03 \x01(\x04R\x06offset\x12\x1b\n" + + "\tbyte_size\x18\x04 \x01(\x04R\bbyteSize\x1at\n" + + "\fRegionsEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12N\n" + + "\x05value\x18\x02 \x01(\v28.inference.SystemSharedMemoryStatusResponse.RegionStatusR\x05value:\x028\x01\"~\n" + + "!SystemSharedMemoryRegisterRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x10\n" + + "\x03key\x18\x02 \x01(\tR\x03key\x12\x16\n" + + "\x06offset\x18\x03 \x01(\x04R\x06offset\x12\x1b\n" + + "\tbyte_size\x18\x04 \x01(\x04R\bbyteSize\"$\n" + + "\"SystemSharedMemoryRegisterResponse\"9\n" + + "#SystemSharedMemoryUnregisterRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\"&\n" + + "$SystemSharedMemoryUnregisterResponse\"3\n" + + "\x1dCudaSharedMemoryStatusRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\"\xc4\x02\n" + + "\x1eCudaSharedMemoryStatusResponse\x12P\n" + + "\aregions\x18\x01 \x03(\v26.inference.CudaSharedMemoryStatusResponse.RegionsEntryR\aregions\x1a\\\n" + + "\fRegionStatus\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x1b\n" + + "\tdevice_id\x18\x02 \x01(\x04R\bdeviceId\x12\x1b\n" + + "\tbyte_size\x18\x03 \x01(\x04R\bbyteSize\x1ar\n" + + "\fRegionsEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12L\n" + + "\x05value\x18\x02 \x01(\v26.inference.CudaSharedMemoryStatusResponse.RegionStatusR\x05value:\x028\x01\"\x8e\x01\n" + + "\x1fCudaSharedMemoryRegisterRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x1d\n" + + "\n" + + "raw_handle\x18\x02 \x01(\fR\trawHandle\x12\x1b\n" + + "\tdevice_id\x18\x03 \x01(\x03R\bdeviceId\x12\x1b\n" + + "\tbyte_size\x18\x04 \x01(\x04R\bbyteSize\"\"\n" + + " CudaSharedMemoryRegisterResponse\"7\n" + + "!CudaSharedMemoryUnregisterRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\"$\n" + + "\"CudaSharedMemoryUnregisterResponse\"\x8e\x02\n" + + "\x13TraceSettingRequest\x12H\n" + + "\bsettings\x18\x01 \x03(\v2,.inference.TraceSettingRequest.SettingsEntryR\bsettings\x12\x1d\n" + + "\n" + + "model_name\x18\x02 \x01(\tR\tmodelName\x1a$\n" + + "\fSettingValue\x12\x14\n" + + "\x05value\x18\x01 \x03(\tR\x05value\x1ah\n" + + "\rSettingsEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12A\n" + + "\x05value\x18\x02 \x01(\v2+.inference.TraceSettingRequest.SettingValueR\x05value:\x028\x01\"\xf2\x01\n" + + "\x14TraceSettingResponse\x12I\n" + + "\bsettings\x18\x01 \x03(\v2-.inference.TraceSettingResponse.SettingsEntryR\bsettings\x1a$\n" + + "\fSettingValue\x12\x14\n" + + "\x05value\x18\x01 \x03(\tR\x05value\x1ai\n" + + "\rSettingsEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12B\n" + + "\x05value\x18\x02 \x01(\v2,.inference.TraceSettingResponse.SettingValueR\x05value:\x028\x01\"\xd6\x02\n" + + "\x12LogSettingsRequest\x12G\n" + + "\bsettings\x18\x01 \x03(\v2+.inference.LogSettingsRequest.SettingsEntryR\bsettings\x1a\x8d\x01\n" + + "\fSettingValue\x12\x1f\n" + + "\n" + + "bool_param\x18\x01 \x01(\bH\x00R\tboolParam\x12#\n" + + "\fuint32_param\x18\x02 \x01(\rH\x00R\vuint32Param\x12#\n" + + "\fstring_param\x18\x03 \x01(\tH\x00R\vstringParamB\x12\n" + + "\x10parameter_choice\x1ag\n" + + "\rSettingsEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12@\n" + + "\x05value\x18\x02 \x01(\v2*.inference.LogSettingsRequest.SettingValueR\x05value:\x028\x01\"\xd9\x02\n" + + "\x13LogSettingsResponse\x12H\n" + + "\bsettings\x18\x01 \x03(\v2,.inference.LogSettingsResponse.SettingsEntryR\bsettings\x1a\x8d\x01\n" + + "\fSettingValue\x12\x1f\n" + + "\n" + + "bool_param\x18\x01 \x01(\bH\x00R\tboolParam\x12#\n" + + "\fuint32_param\x18\x02 \x01(\rH\x00R\vuint32Param\x12#\n" + + "\fstring_param\x18\x03 \x01(\tH\x00R\vstringParamB\x12\n" + + "\x10parameter_choice\x1ah\n" + + "\rSettingsEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12A\n" + + "\x05value\x18\x02 \x01(\v2+.inference.LogSettingsResponse.SettingValueR\x05value:\x028\x012\xb7\x0f\n" + + "\x14GRPCInferenceService\x12K\n" + + "\n" + + "ServerLive\x12\x1c.inference.ServerLiveRequest\x1a\x1d.inference.ServerLiveResponse\"\x00\x12N\n" + + "\vServerReady\x12\x1d.inference.ServerReadyRequest\x1a\x1e.inference.ServerReadyResponse\"\x00\x12K\n" + + "\n" + + "ModelReady\x12\x1c.inference.ModelReadyRequest\x1a\x1d.inference.ModelReadyResponse\"\x00\x12W\n" + + "\x0eServerMetadata\x12 .inference.ServerMetadataRequest\x1a!.inference.ServerMetadataResponse\"\x00\x12T\n" + + "\rModelMetadata\x12\x1f.inference.ModelMetadataRequest\x1a .inference.ModelMetadataResponse\"\x00\x12K\n" + + "\n" + + "ModelInfer\x12\x1c.inference.ModelInferRequest\x1a\x1d.inference.ModelInferResponse\"\x00\x12[\n" + + "\x10ModelStreamInfer\x12\x1c.inference.ModelInferRequest\x1a#.inference.ModelStreamInferResponse\"\x00(\x010\x01\x12N\n" + + "\vModelConfig\x12\x1d.inference.ModelConfigRequest\x1a\x1e.inference.ModelConfigResponse\"\x00\x12Z\n" + + "\x0fModelStatistics\x12!.inference.ModelStatisticsRequest\x1a\".inference.ModelStatisticsResponse\"\x00\x12Z\n" + + "\x0fRepositoryIndex\x12!.inference.RepositoryIndexRequest\x1a\".inference.RepositoryIndexResponse\"\x00\x12f\n" + + "\x13RepositoryModelLoad\x12%.inference.RepositoryModelLoadRequest\x1a&.inference.RepositoryModelLoadResponse\"\x00\x12l\n" + + "\x15RepositoryModelUnload\x12'.inference.RepositoryModelUnloadRequest\x1a(.inference.RepositoryModelUnloadResponse\"\x00\x12u\n" + + "\x18SystemSharedMemoryStatus\x12*.inference.SystemSharedMemoryStatusRequest\x1a+.inference.SystemSharedMemoryStatusResponse\"\x00\x12{\n" + + "\x1aSystemSharedMemoryRegister\x12,.inference.SystemSharedMemoryRegisterRequest\x1a-.inference.SystemSharedMemoryRegisterResponse\"\x00\x12\x81\x01\n" + + "\x1cSystemSharedMemoryUnregister\x12..inference.SystemSharedMemoryUnregisterRequest\x1a/.inference.SystemSharedMemoryUnregisterResponse\"\x00\x12o\n" + + "\x16CudaSharedMemoryStatus\x12(.inference.CudaSharedMemoryStatusRequest\x1a).inference.CudaSharedMemoryStatusResponse\"\x00\x12u\n" + + "\x18CudaSharedMemoryRegister\x12*.inference.CudaSharedMemoryRegisterRequest\x1a+.inference.CudaSharedMemoryRegisterResponse\"\x00\x12{\n" + + "\x1aCudaSharedMemoryUnregister\x12,.inference.CudaSharedMemoryUnregisterRequest\x1a-.inference.CudaSharedMemoryUnregisterResponse\"\x00\x12Q\n" + + "\fTraceSetting\x12\x1e.inference.TraceSettingRequest\x1a\x1f.inference.TraceSettingResponse\"\x00\x12N\n" + + "\vLogSettings\x12\x1d.inference.LogSettingsRequest\x1a\x1e.inference.LogSettingsResponse\"\x00b\x06proto3" + var ( - file_proto_triton_grpc_service_proto_rawDescOnce sync.Once - file_proto_triton_grpc_service_proto_rawDescData = file_proto_triton_grpc_service_proto_rawDesc + file_grpc_service_proto_rawDescOnce sync.Once + file_grpc_service_proto_rawDescData []byte ) -func file_proto_triton_grpc_service_proto_rawDescGZIP() []byte { - file_proto_triton_grpc_service_proto_rawDescOnce.Do(func() { - file_proto_triton_grpc_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_triton_grpc_service_proto_rawDescData) +func file_grpc_service_proto_rawDescGZIP() []byte { + file_grpc_service_proto_rawDescOnce.Do(func() { + file_grpc_service_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_grpc_service_proto_rawDesc), len(file_grpc_service_proto_rawDesc))) }) - return file_proto_triton_grpc_service_proto_rawDescData -} - -var file_proto_triton_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 8) -var file_proto_triton_grpc_service_proto_goTypes = []any{ - (*ModelReadyRequest)(nil), // 0: inference.ModelReadyRequest - (*ModelReadyResponse)(nil), // 1: inference.ModelReadyResponse - (*InferTensorContents)(nil), // 2: inference.InferTensorContents - (*ModelInferRequest)(nil), // 3: inference.ModelInferRequest - (*ModelInferResponse)(nil), // 4: inference.ModelInferResponse - (*ModelInferRequest_InferInputTensor)(nil), // 5: inference.ModelInferRequest.InferInputTensor - (*ModelInferRequest_InferRequestedOutputTensor)(nil), // 6: inference.ModelInferRequest.InferRequestedOutputTensor - (*ModelInferResponse_InferOutputTensor)(nil), // 7: inference.ModelInferResponse.InferOutputTensor -} -var file_proto_triton_grpc_service_proto_depIdxs = []int32{ - 5, // 0: inference.ModelInferRequest.inputs:type_name -> inference.ModelInferRequest.InferInputTensor - 6, // 1: inference.ModelInferRequest.outputs:type_name -> inference.ModelInferRequest.InferRequestedOutputTensor - 7, // 2: inference.ModelInferResponse.outputs:type_name -> inference.ModelInferResponse.InferOutputTensor - 2, // 3: inference.ModelInferRequest.InferInputTensor.contents:type_name -> inference.InferTensorContents - 2, // 4: inference.ModelInferResponse.InferOutputTensor.contents:type_name -> inference.InferTensorContents - 0, // 5: inference.GRPCInferenceService.ModelReady:input_type -> inference.ModelReadyRequest - 3, // 6: inference.GRPCInferenceService.ModelInfer:input_type -> inference.ModelInferRequest - 1, // 7: inference.GRPCInferenceService.ModelReady:output_type -> inference.ModelReadyResponse - 4, // 8: inference.GRPCInferenceService.ModelInfer:output_type -> inference.ModelInferResponse - 7, // [7:9] is the sub-list for method output_type - 5, // [5:7] is the sub-list for method input_type - 5, // [5:5] is the sub-list for extension type_name - 5, // [5:5] is the sub-list for extension extendee - 0, // [0:5] is the sub-list for field type_name -} - -func init() { file_proto_triton_grpc_service_proto_init() } -func file_proto_triton_grpc_service_proto_init() { - if File_proto_triton_grpc_service_proto != nil { + return file_grpc_service_proto_rawDescData +} + +var file_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 73) +var file_grpc_service_proto_goTypes = []any{ + (*ServerLiveRequest)(nil), // 0: inference.ServerLiveRequest + (*ServerLiveResponse)(nil), // 1: inference.ServerLiveResponse + (*ServerReadyRequest)(nil), // 2: inference.ServerReadyRequest + (*ServerReadyResponse)(nil), // 3: inference.ServerReadyResponse + (*ModelReadyRequest)(nil), // 4: inference.ModelReadyRequest + (*ModelReadyResponse)(nil), // 5: inference.ModelReadyResponse + (*ServerMetadataRequest)(nil), // 6: inference.ServerMetadataRequest + (*ServerMetadataResponse)(nil), // 7: inference.ServerMetadataResponse + (*ModelMetadataRequest)(nil), // 8: inference.ModelMetadataRequest + (*ModelMetadataResponse)(nil), // 9: inference.ModelMetadataResponse + (*InferParameter)(nil), // 10: inference.InferParameter + (*InferTensorContents)(nil), // 11: inference.InferTensorContents + (*ModelInferRequest)(nil), // 12: inference.ModelInferRequest + (*ModelInferResponse)(nil), // 13: inference.ModelInferResponse + (*ModelStreamInferResponse)(nil), // 14: inference.ModelStreamInferResponse + (*ModelConfigRequest)(nil), // 15: inference.ModelConfigRequest + (*ModelConfigResponse)(nil), // 16: inference.ModelConfigResponse + (*ModelStatisticsRequest)(nil), // 17: inference.ModelStatisticsRequest + (*StatisticDuration)(nil), // 18: inference.StatisticDuration + (*InferStatistics)(nil), // 19: inference.InferStatistics + (*InferResponseStatistics)(nil), // 20: inference.InferResponseStatistics + (*InferBatchStatistics)(nil), // 21: inference.InferBatchStatistics + (*MemoryUsage)(nil), // 22: inference.MemoryUsage + (*ModelStatistics)(nil), // 23: inference.ModelStatistics + (*ModelStatisticsResponse)(nil), // 24: inference.ModelStatisticsResponse + (*ModelRepositoryParameter)(nil), // 25: inference.ModelRepositoryParameter + (*RepositoryIndexRequest)(nil), // 26: inference.RepositoryIndexRequest + (*RepositoryIndexResponse)(nil), // 27: inference.RepositoryIndexResponse + (*RepositoryModelLoadRequest)(nil), // 28: inference.RepositoryModelLoadRequest + (*RepositoryModelLoadResponse)(nil), // 29: inference.RepositoryModelLoadResponse + (*RepositoryModelUnloadRequest)(nil), // 30: inference.RepositoryModelUnloadRequest + (*RepositoryModelUnloadResponse)(nil), // 31: inference.RepositoryModelUnloadResponse + (*SystemSharedMemoryStatusRequest)(nil), // 32: inference.SystemSharedMemoryStatusRequest + (*SystemSharedMemoryStatusResponse)(nil), // 33: inference.SystemSharedMemoryStatusResponse + (*SystemSharedMemoryRegisterRequest)(nil), // 34: inference.SystemSharedMemoryRegisterRequest + (*SystemSharedMemoryRegisterResponse)(nil), // 35: inference.SystemSharedMemoryRegisterResponse + (*SystemSharedMemoryUnregisterRequest)(nil), // 36: inference.SystemSharedMemoryUnregisterRequest + (*SystemSharedMemoryUnregisterResponse)(nil), // 37: inference.SystemSharedMemoryUnregisterResponse + (*CudaSharedMemoryStatusRequest)(nil), // 38: inference.CudaSharedMemoryStatusRequest + (*CudaSharedMemoryStatusResponse)(nil), // 39: inference.CudaSharedMemoryStatusResponse + (*CudaSharedMemoryRegisterRequest)(nil), // 40: inference.CudaSharedMemoryRegisterRequest + (*CudaSharedMemoryRegisterResponse)(nil), // 41: inference.CudaSharedMemoryRegisterResponse + (*CudaSharedMemoryUnregisterRequest)(nil), // 42: inference.CudaSharedMemoryUnregisterRequest + (*CudaSharedMemoryUnregisterResponse)(nil), // 43: inference.CudaSharedMemoryUnregisterResponse + (*TraceSettingRequest)(nil), // 44: inference.TraceSettingRequest + (*TraceSettingResponse)(nil), // 45: inference.TraceSettingResponse + (*LogSettingsRequest)(nil), // 46: inference.LogSettingsRequest + (*LogSettingsResponse)(nil), // 47: inference.LogSettingsResponse + (*ModelMetadataResponse_TensorMetadata)(nil), // 48: inference.ModelMetadataResponse.TensorMetadata + (*ModelInferRequest_InferInputTensor)(nil), // 49: inference.ModelInferRequest.InferInputTensor + (*ModelInferRequest_InferRequestedOutputTensor)(nil), // 50: inference.ModelInferRequest.InferRequestedOutputTensor + nil, // 51: inference.ModelInferRequest.ParametersEntry + nil, // 52: inference.ModelInferRequest.InferInputTensor.ParametersEntry + nil, // 53: inference.ModelInferRequest.InferRequestedOutputTensor.ParametersEntry + (*ModelInferResponse_InferOutputTensor)(nil), // 54: inference.ModelInferResponse.InferOutputTensor + nil, // 55: inference.ModelInferResponse.ParametersEntry + nil, // 56: inference.ModelInferResponse.InferOutputTensor.ParametersEntry + nil, // 57: inference.ModelStatistics.ResponseStatsEntry + (*RepositoryIndexResponse_ModelIndex)(nil), // 58: inference.RepositoryIndexResponse.ModelIndex + nil, // 59: inference.RepositoryModelLoadRequest.ParametersEntry + nil, // 60: inference.RepositoryModelUnloadRequest.ParametersEntry + (*SystemSharedMemoryStatusResponse_RegionStatus)(nil), // 61: inference.SystemSharedMemoryStatusResponse.RegionStatus + nil, // 62: inference.SystemSharedMemoryStatusResponse.RegionsEntry + (*CudaSharedMemoryStatusResponse_RegionStatus)(nil), // 63: inference.CudaSharedMemoryStatusResponse.RegionStatus + nil, // 64: inference.CudaSharedMemoryStatusResponse.RegionsEntry + (*TraceSettingRequest_SettingValue)(nil), // 65: inference.TraceSettingRequest.SettingValue + nil, // 66: inference.TraceSettingRequest.SettingsEntry + (*TraceSettingResponse_SettingValue)(nil), // 67: inference.TraceSettingResponse.SettingValue + nil, // 68: inference.TraceSettingResponse.SettingsEntry + (*LogSettingsRequest_SettingValue)(nil), // 69: inference.LogSettingsRequest.SettingValue + nil, // 70: inference.LogSettingsRequest.SettingsEntry + (*LogSettingsResponse_SettingValue)(nil), // 71: inference.LogSettingsResponse.SettingValue + nil, // 72: inference.LogSettingsResponse.SettingsEntry + (*ModelConfig)(nil), // 73: inference.ModelConfig +} +var file_grpc_service_proto_depIdxs = []int32{ + 48, // 0: inference.ModelMetadataResponse.inputs:type_name -> inference.ModelMetadataResponse.TensorMetadata + 48, // 1: inference.ModelMetadataResponse.outputs:type_name -> inference.ModelMetadataResponse.TensorMetadata + 51, // 2: inference.ModelInferRequest.parameters:type_name -> inference.ModelInferRequest.ParametersEntry + 49, // 3: inference.ModelInferRequest.inputs:type_name -> inference.ModelInferRequest.InferInputTensor + 50, // 4: inference.ModelInferRequest.outputs:type_name -> inference.ModelInferRequest.InferRequestedOutputTensor + 55, // 5: inference.ModelInferResponse.parameters:type_name -> inference.ModelInferResponse.ParametersEntry + 54, // 6: inference.ModelInferResponse.outputs:type_name -> inference.ModelInferResponse.InferOutputTensor + 13, // 7: inference.ModelStreamInferResponse.infer_response:type_name -> inference.ModelInferResponse + 73, // 8: inference.ModelConfigResponse.config:type_name -> inference.ModelConfig + 18, // 9: inference.InferStatistics.success:type_name -> inference.StatisticDuration + 18, // 10: inference.InferStatistics.fail:type_name -> inference.StatisticDuration + 18, // 11: inference.InferStatistics.queue:type_name -> inference.StatisticDuration + 18, // 12: inference.InferStatistics.compute_input:type_name -> inference.StatisticDuration + 18, // 13: inference.InferStatistics.compute_infer:type_name -> inference.StatisticDuration + 18, // 14: inference.InferStatistics.compute_output:type_name -> inference.StatisticDuration + 18, // 15: inference.InferStatistics.cache_hit:type_name -> inference.StatisticDuration + 18, // 16: inference.InferStatistics.cache_miss:type_name -> inference.StatisticDuration + 18, // 17: inference.InferResponseStatistics.compute_infer:type_name -> inference.StatisticDuration + 18, // 18: inference.InferResponseStatistics.compute_output:type_name -> inference.StatisticDuration + 18, // 19: inference.InferResponseStatistics.success:type_name -> inference.StatisticDuration + 18, // 20: inference.InferResponseStatistics.fail:type_name -> inference.StatisticDuration + 18, // 21: inference.InferResponseStatistics.empty_response:type_name -> inference.StatisticDuration + 18, // 22: inference.InferResponseStatistics.cancel:type_name -> inference.StatisticDuration + 18, // 23: inference.InferBatchStatistics.compute_input:type_name -> inference.StatisticDuration + 18, // 24: inference.InferBatchStatistics.compute_infer:type_name -> inference.StatisticDuration + 18, // 25: inference.InferBatchStatistics.compute_output:type_name -> inference.StatisticDuration + 19, // 26: inference.ModelStatistics.inference_stats:type_name -> inference.InferStatistics + 21, // 27: inference.ModelStatistics.batch_stats:type_name -> inference.InferBatchStatistics + 22, // 28: inference.ModelStatistics.memory_usage:type_name -> inference.MemoryUsage + 57, // 29: inference.ModelStatistics.response_stats:type_name -> inference.ModelStatistics.ResponseStatsEntry + 23, // 30: inference.ModelStatisticsResponse.model_stats:type_name -> inference.ModelStatistics + 58, // 31: inference.RepositoryIndexResponse.models:type_name -> inference.RepositoryIndexResponse.ModelIndex + 59, // 32: inference.RepositoryModelLoadRequest.parameters:type_name -> inference.RepositoryModelLoadRequest.ParametersEntry + 60, // 33: inference.RepositoryModelUnloadRequest.parameters:type_name -> inference.RepositoryModelUnloadRequest.ParametersEntry + 62, // 34: inference.SystemSharedMemoryStatusResponse.regions:type_name -> inference.SystemSharedMemoryStatusResponse.RegionsEntry + 64, // 35: inference.CudaSharedMemoryStatusResponse.regions:type_name -> inference.CudaSharedMemoryStatusResponse.RegionsEntry + 66, // 36: inference.TraceSettingRequest.settings:type_name -> inference.TraceSettingRequest.SettingsEntry + 68, // 37: inference.TraceSettingResponse.settings:type_name -> inference.TraceSettingResponse.SettingsEntry + 70, // 38: inference.LogSettingsRequest.settings:type_name -> inference.LogSettingsRequest.SettingsEntry + 72, // 39: inference.LogSettingsResponse.settings:type_name -> inference.LogSettingsResponse.SettingsEntry + 52, // 40: inference.ModelInferRequest.InferInputTensor.parameters:type_name -> inference.ModelInferRequest.InferInputTensor.ParametersEntry + 11, // 41: inference.ModelInferRequest.InferInputTensor.contents:type_name -> inference.InferTensorContents + 53, // 42: inference.ModelInferRequest.InferRequestedOutputTensor.parameters:type_name -> inference.ModelInferRequest.InferRequestedOutputTensor.ParametersEntry + 10, // 43: inference.ModelInferRequest.ParametersEntry.value:type_name -> inference.InferParameter + 10, // 44: inference.ModelInferRequest.InferInputTensor.ParametersEntry.value:type_name -> inference.InferParameter + 10, // 45: inference.ModelInferRequest.InferRequestedOutputTensor.ParametersEntry.value:type_name -> inference.InferParameter + 56, // 46: inference.ModelInferResponse.InferOutputTensor.parameters:type_name -> inference.ModelInferResponse.InferOutputTensor.ParametersEntry + 11, // 47: inference.ModelInferResponse.InferOutputTensor.contents:type_name -> inference.InferTensorContents + 10, // 48: inference.ModelInferResponse.ParametersEntry.value:type_name -> inference.InferParameter + 10, // 49: inference.ModelInferResponse.InferOutputTensor.ParametersEntry.value:type_name -> inference.InferParameter + 20, // 50: inference.ModelStatistics.ResponseStatsEntry.value:type_name -> inference.InferResponseStatistics + 25, // 51: inference.RepositoryModelLoadRequest.ParametersEntry.value:type_name -> inference.ModelRepositoryParameter + 25, // 52: inference.RepositoryModelUnloadRequest.ParametersEntry.value:type_name -> inference.ModelRepositoryParameter + 61, // 53: inference.SystemSharedMemoryStatusResponse.RegionsEntry.value:type_name -> inference.SystemSharedMemoryStatusResponse.RegionStatus + 63, // 54: inference.CudaSharedMemoryStatusResponse.RegionsEntry.value:type_name -> inference.CudaSharedMemoryStatusResponse.RegionStatus + 65, // 55: inference.TraceSettingRequest.SettingsEntry.value:type_name -> inference.TraceSettingRequest.SettingValue + 67, // 56: inference.TraceSettingResponse.SettingsEntry.value:type_name -> inference.TraceSettingResponse.SettingValue + 69, // 57: inference.LogSettingsRequest.SettingsEntry.value:type_name -> inference.LogSettingsRequest.SettingValue + 71, // 58: inference.LogSettingsResponse.SettingsEntry.value:type_name -> inference.LogSettingsResponse.SettingValue + 0, // 59: inference.GRPCInferenceService.ServerLive:input_type -> inference.ServerLiveRequest + 2, // 60: inference.GRPCInferenceService.ServerReady:input_type -> inference.ServerReadyRequest + 4, // 61: inference.GRPCInferenceService.ModelReady:input_type -> inference.ModelReadyRequest + 6, // 62: inference.GRPCInferenceService.ServerMetadata:input_type -> inference.ServerMetadataRequest + 8, // 63: inference.GRPCInferenceService.ModelMetadata:input_type -> inference.ModelMetadataRequest + 12, // 64: inference.GRPCInferenceService.ModelInfer:input_type -> inference.ModelInferRequest + 12, // 65: inference.GRPCInferenceService.ModelStreamInfer:input_type -> inference.ModelInferRequest + 15, // 66: inference.GRPCInferenceService.ModelConfig:input_type -> inference.ModelConfigRequest + 17, // 67: inference.GRPCInferenceService.ModelStatistics:input_type -> inference.ModelStatisticsRequest + 26, // 68: inference.GRPCInferenceService.RepositoryIndex:input_type -> inference.RepositoryIndexRequest + 28, // 69: inference.GRPCInferenceService.RepositoryModelLoad:input_type -> inference.RepositoryModelLoadRequest + 30, // 70: inference.GRPCInferenceService.RepositoryModelUnload:input_type -> inference.RepositoryModelUnloadRequest + 32, // 71: inference.GRPCInferenceService.SystemSharedMemoryStatus:input_type -> inference.SystemSharedMemoryStatusRequest + 34, // 72: inference.GRPCInferenceService.SystemSharedMemoryRegister:input_type -> inference.SystemSharedMemoryRegisterRequest + 36, // 73: inference.GRPCInferenceService.SystemSharedMemoryUnregister:input_type -> inference.SystemSharedMemoryUnregisterRequest + 38, // 74: inference.GRPCInferenceService.CudaSharedMemoryStatus:input_type -> inference.CudaSharedMemoryStatusRequest + 40, // 75: inference.GRPCInferenceService.CudaSharedMemoryRegister:input_type -> inference.CudaSharedMemoryRegisterRequest + 42, // 76: inference.GRPCInferenceService.CudaSharedMemoryUnregister:input_type -> inference.CudaSharedMemoryUnregisterRequest + 44, // 77: inference.GRPCInferenceService.TraceSetting:input_type -> inference.TraceSettingRequest + 46, // 78: inference.GRPCInferenceService.LogSettings:input_type -> inference.LogSettingsRequest + 1, // 79: inference.GRPCInferenceService.ServerLive:output_type -> inference.ServerLiveResponse + 3, // 80: inference.GRPCInferenceService.ServerReady:output_type -> inference.ServerReadyResponse + 5, // 81: inference.GRPCInferenceService.ModelReady:output_type -> inference.ModelReadyResponse + 7, // 82: inference.GRPCInferenceService.ServerMetadata:output_type -> inference.ServerMetadataResponse + 9, // 83: inference.GRPCInferenceService.ModelMetadata:output_type -> inference.ModelMetadataResponse + 13, // 84: inference.GRPCInferenceService.ModelInfer:output_type -> inference.ModelInferResponse + 14, // 85: inference.GRPCInferenceService.ModelStreamInfer:output_type -> inference.ModelStreamInferResponse + 16, // 86: inference.GRPCInferenceService.ModelConfig:output_type -> inference.ModelConfigResponse + 24, // 87: inference.GRPCInferenceService.ModelStatistics:output_type -> inference.ModelStatisticsResponse + 27, // 88: inference.GRPCInferenceService.RepositoryIndex:output_type -> inference.RepositoryIndexResponse + 29, // 89: inference.GRPCInferenceService.RepositoryModelLoad:output_type -> inference.RepositoryModelLoadResponse + 31, // 90: inference.GRPCInferenceService.RepositoryModelUnload:output_type -> inference.RepositoryModelUnloadResponse + 33, // 91: inference.GRPCInferenceService.SystemSharedMemoryStatus:output_type -> inference.SystemSharedMemoryStatusResponse + 35, // 92: inference.GRPCInferenceService.SystemSharedMemoryRegister:output_type -> inference.SystemSharedMemoryRegisterResponse + 37, // 93: inference.GRPCInferenceService.SystemSharedMemoryUnregister:output_type -> inference.SystemSharedMemoryUnregisterResponse + 39, // 94: inference.GRPCInferenceService.CudaSharedMemoryStatus:output_type -> inference.CudaSharedMemoryStatusResponse + 41, // 95: inference.GRPCInferenceService.CudaSharedMemoryRegister:output_type -> inference.CudaSharedMemoryRegisterResponse + 43, // 96: inference.GRPCInferenceService.CudaSharedMemoryUnregister:output_type -> inference.CudaSharedMemoryUnregisterResponse + 45, // 97: inference.GRPCInferenceService.TraceSetting:output_type -> inference.TraceSettingResponse + 47, // 98: inference.GRPCInferenceService.LogSettings:output_type -> inference.LogSettingsResponse + 79, // [79:99] is the sub-list for method output_type + 59, // [59:79] is the sub-list for method input_type + 59, // [59:59] is the sub-list for extension type_name + 59, // [59:59] is the sub-list for extension extendee + 0, // [0:59] is the sub-list for field type_name +} + +func init() { file_grpc_service_proto_init() } +func file_grpc_service_proto_init() { + if File_grpc_service_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_proto_triton_grpc_service_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*ModelReadyRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_triton_grpc_service_proto_msgTypes[1].Exporter = func(v any, i int) any { - switch v := v.(*ModelReadyResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_triton_grpc_service_proto_msgTypes[2].Exporter = func(v any, i int) any { - switch v := v.(*InferTensorContents); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_triton_grpc_service_proto_msgTypes[3].Exporter = func(v any, i int) any { - switch v := v.(*ModelInferRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_triton_grpc_service_proto_msgTypes[4].Exporter = func(v any, i int) any { - switch v := v.(*ModelInferResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_triton_grpc_service_proto_msgTypes[5].Exporter = func(v any, i int) any { - switch v := v.(*ModelInferRequest_InferInputTensor); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_triton_grpc_service_proto_msgTypes[6].Exporter = func(v any, i int) any { - switch v := v.(*ModelInferRequest_InferRequestedOutputTensor); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_triton_grpc_service_proto_msgTypes[7].Exporter = func(v any, i int) any { - switch v := v.(*ModelInferResponse_InferOutputTensor); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } + file_model_config_proto_init() + file_grpc_service_proto_msgTypes[10].OneofWrappers = []any{ + (*InferParameter_BoolParam)(nil), + (*InferParameter_Int64Param)(nil), + (*InferParameter_StringParam)(nil), + (*InferParameter_DoubleParam)(nil), + (*InferParameter_Uint64Param)(nil), + } + file_grpc_service_proto_msgTypes[25].OneofWrappers = []any{ + (*ModelRepositoryParameter_BoolParam)(nil), + (*ModelRepositoryParameter_Int64Param)(nil), + (*ModelRepositoryParameter_StringParam)(nil), + (*ModelRepositoryParameter_BytesParam)(nil), + } + file_grpc_service_proto_msgTypes[69].OneofWrappers = []any{ + (*LogSettingsRequest_SettingValue_BoolParam)(nil), + (*LogSettingsRequest_SettingValue_Uint32Param)(nil), + (*LogSettingsRequest_SettingValue_StringParam)(nil), + } + file_grpc_service_proto_msgTypes[71].OneofWrappers = []any{ + (*LogSettingsResponse_SettingValue_BoolParam)(nil), + (*LogSettingsResponse_SettingValue_Uint32Param)(nil), + (*LogSettingsResponse_SettingValue_StringParam)(nil), } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_proto_triton_grpc_service_proto_rawDesc, + RawDescriptor: unsafe.Slice(unsafe.StringData(file_grpc_service_proto_rawDesc), len(file_grpc_service_proto_rawDesc)), NumEnums: 0, - NumMessages: 8, + NumMessages: 73, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_proto_triton_grpc_service_proto_goTypes, - DependencyIndexes: file_proto_triton_grpc_service_proto_depIdxs, - MessageInfos: file_proto_triton_grpc_service_proto_msgTypes, + GoTypes: file_grpc_service_proto_goTypes, + DependencyIndexes: file_grpc_service_proto_depIdxs, + MessageInfos: file_grpc_service_proto_msgTypes, }.Build() - File_proto_triton_grpc_service_proto = out.File - file_proto_triton_grpc_service_proto_rawDesc = nil - file_proto_triton_grpc_service_proto_goTypes = nil - file_proto_triton_grpc_service_proto_depIdxs = nil + File_grpc_service_proto = out.File + file_grpc_service_proto_goTypes = nil + file_grpc_service_proto_depIdxs = nil } diff --git a/proto/triton/grpc_service.proto b/proto/triton/grpc_service.proto deleted file mode 100644 index c6439c4..0000000 --- a/proto/triton/grpc_service.proto +++ /dev/null @@ -1,65 +0,0 @@ -syntax = "proto3"; - -package inference; - -option go_package = "github.com/viant/mly/proto/triton"; - -service GRPCInferenceService { - rpc ModelReady(ModelReadyRequest) returns (ModelReadyResponse) {} - rpc ModelInfer(ModelInferRequest) returns (ModelInferResponse) {} -} - -message ModelReadyRequest { - string name = 1; - string version = 2; -} - -message ModelReadyResponse { - bool ready = 1; -} - -message InferTensorContents { - repeated bool bool_contents = 1; - repeated int32 int_contents = 2; - repeated int64 int64_contents = 3; - repeated uint32 uint_contents = 4; - repeated uint64 uint64_contents = 5; - repeated float fp32_contents = 6; - repeated double fp64_contents = 7; - repeated bytes bytes_contents = 8; -} - -message ModelInferRequest { - message InferInputTensor { - string name = 1; - string datatype = 2; - repeated int64 shape = 3; - InferTensorContents contents = 5; - } - - message InferRequestedOutputTensor { - string name = 1; - } - - string model_name = 1; - string model_version = 2; - string id = 3; - repeated InferInputTensor inputs = 5; - repeated InferRequestedOutputTensor outputs = 6; - repeated bytes raw_input_contents = 7; -} - -message ModelInferResponse { - message InferOutputTensor { - string name = 1; - string datatype = 2; - repeated int64 shape = 3; - InferTensorContents contents = 5; - } - - string model_name = 1; - string model_version = 2; - string id = 3; - repeated InferOutputTensor outputs = 5; - repeated bytes raw_output_contents = 6; -} diff --git a/proto/triton/grpc_service_grpc.pb.go b/proto/triton/grpc_service_grpc.pb.go index 4bc257b..182a270 100644 --- a/proto/triton/grpc_service_grpc.pb.go +++ b/proto/triton/grpc_service_grpc.pb.go @@ -1,8 +1,34 @@ +// Copyright 2020-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.5.1 -// - protoc v5.29.3 -// source: proto/triton/grpc_service.proto +// - protoc v6.32.0 +// source: grpc_service.proto package triton @@ -19,16 +45,165 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - GRPCInferenceService_ModelReady_FullMethodName = "/inference.GRPCInferenceService/ModelReady" - GRPCInferenceService_ModelInfer_FullMethodName = "/inference.GRPCInferenceService/ModelInfer" + GRPCInferenceService_ServerLive_FullMethodName = "/inference.GRPCInferenceService/ServerLive" + GRPCInferenceService_ServerReady_FullMethodName = "/inference.GRPCInferenceService/ServerReady" + GRPCInferenceService_ModelReady_FullMethodName = "/inference.GRPCInferenceService/ModelReady" + GRPCInferenceService_ServerMetadata_FullMethodName = "/inference.GRPCInferenceService/ServerMetadata" + GRPCInferenceService_ModelMetadata_FullMethodName = "/inference.GRPCInferenceService/ModelMetadata" + GRPCInferenceService_ModelInfer_FullMethodName = "/inference.GRPCInferenceService/ModelInfer" + GRPCInferenceService_ModelStreamInfer_FullMethodName = "/inference.GRPCInferenceService/ModelStreamInfer" + GRPCInferenceService_ModelConfig_FullMethodName = "/inference.GRPCInferenceService/ModelConfig" + GRPCInferenceService_ModelStatistics_FullMethodName = "/inference.GRPCInferenceService/ModelStatistics" + GRPCInferenceService_RepositoryIndex_FullMethodName = "/inference.GRPCInferenceService/RepositoryIndex" + GRPCInferenceService_RepositoryModelLoad_FullMethodName = "/inference.GRPCInferenceService/RepositoryModelLoad" + GRPCInferenceService_RepositoryModelUnload_FullMethodName = "/inference.GRPCInferenceService/RepositoryModelUnload" + GRPCInferenceService_SystemSharedMemoryStatus_FullMethodName = "/inference.GRPCInferenceService/SystemSharedMemoryStatus" + GRPCInferenceService_SystemSharedMemoryRegister_FullMethodName = "/inference.GRPCInferenceService/SystemSharedMemoryRegister" + GRPCInferenceService_SystemSharedMemoryUnregister_FullMethodName = "/inference.GRPCInferenceService/SystemSharedMemoryUnregister" + GRPCInferenceService_CudaSharedMemoryStatus_FullMethodName = "/inference.GRPCInferenceService/CudaSharedMemoryStatus" + GRPCInferenceService_CudaSharedMemoryRegister_FullMethodName = "/inference.GRPCInferenceService/CudaSharedMemoryRegister" + GRPCInferenceService_CudaSharedMemoryUnregister_FullMethodName = "/inference.GRPCInferenceService/CudaSharedMemoryUnregister" + GRPCInferenceService_TraceSetting_FullMethodName = "/inference.GRPCInferenceService/TraceSetting" + GRPCInferenceService_LogSettings_FullMethodName = "/inference.GRPCInferenceService/LogSettings" ) // GRPCInferenceServiceClient is the client API for GRPCInferenceService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +// +// @@ +// @@.. cpp:var:: service InferenceService +// @@ +// @@ Inference Server GRPC endpoints. +// @@ type GRPCInferenceServiceClient interface { + // @@ .. cpp:var:: rpc ServerLive(ServerLiveRequest) returns + // @@ (ServerLiveResponse) + // @@ + // @@ Check liveness of the inference server. + // @@ + ServerLive(ctx context.Context, in *ServerLiveRequest, opts ...grpc.CallOption) (*ServerLiveResponse, error) + // @@ .. cpp:var:: rpc ServerReady(ServerReadyRequest) returns + // @@ (ServerReadyResponse) + // @@ + // @@ Check readiness of the inference server. + // @@ + ServerReady(ctx context.Context, in *ServerReadyRequest, opts ...grpc.CallOption) (*ServerReadyResponse, error) + // @@ .. cpp:var:: rpc ModelReady(ModelReadyRequest) returns + // @@ (ModelReadyResponse) + // @@ + // @@ Check readiness of a model in the inference server. + // @@ ModelReady(ctx context.Context, in *ModelReadyRequest, opts ...grpc.CallOption) (*ModelReadyResponse, error) + // @@ .. cpp:var:: rpc ServerMetadata(ServerMetadataRequest) returns + // @@ (ServerMetadataResponse) + // @@ + // @@ Get server metadata. + // @@ + ServerMetadata(ctx context.Context, in *ServerMetadataRequest, opts ...grpc.CallOption) (*ServerMetadataResponse, error) + // @@ .. cpp:var:: rpc ModelMetadata(ModelMetadataRequest) returns + // @@ (ModelMetadataResponse) + // @@ + // @@ Get model metadata. + // @@ + ModelMetadata(ctx context.Context, in *ModelMetadataRequest, opts ...grpc.CallOption) (*ModelMetadataResponse, error) + // @@ .. cpp:var:: rpc ModelInfer(ModelInferRequest) returns + // @@ (ModelInferResponse) + // @@ + // @@ Perform inference using a specific model. + // @@ ModelInfer(ctx context.Context, in *ModelInferRequest, opts ...grpc.CallOption) (*ModelInferResponse, error) + // @@ .. cpp:var:: rpc ModelStreamInfer(stream ModelInferRequest) returns + // @@ (stream ModelStreamInferResponse) + // @@ + // @@ Perform streaming inference. + // @@ + ModelStreamInfer(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ModelInferRequest, ModelStreamInferResponse], error) + // @@ .. cpp:var:: rpc ModelConfig(ModelConfigRequest) returns + // @@ (ModelConfigResponse) + // @@ + // @@ Get model configuration. + // @@ + ModelConfig(ctx context.Context, in *ModelConfigRequest, opts ...grpc.CallOption) (*ModelConfigResponse, error) + // @@ .. cpp:var:: rpc ModelStatistics( + // @@ ModelStatisticsRequest) + // @@ returns (ModelStatisticsResponse) + // @@ + // @@ Get the cumulative inference statistics for a model. + // @@ + ModelStatistics(ctx context.Context, in *ModelStatisticsRequest, opts ...grpc.CallOption) (*ModelStatisticsResponse, error) + // @@ .. cpp:var:: rpc RepositoryIndex(RepositoryIndexRequest) returns + // @@ (RepositoryIndexResponse) + // @@ + // @@ Get the index of model repository contents. + // @@ + RepositoryIndex(ctx context.Context, in *RepositoryIndexRequest, opts ...grpc.CallOption) (*RepositoryIndexResponse, error) + // @@ .. cpp:var:: rpc RepositoryModelLoad(RepositoryModelLoadRequest) returns + // @@ (RepositoryModelLoadResponse) + // @@ + // @@ Load or reload a model from a repository. + // @@ + RepositoryModelLoad(ctx context.Context, in *RepositoryModelLoadRequest, opts ...grpc.CallOption) (*RepositoryModelLoadResponse, error) + // @@ .. cpp:var:: rpc RepositoryModelUnload(RepositoryModelUnloadRequest) + // @@ returns (RepositoryModelUnloadResponse) + // @@ + // @@ Unload a model. + // @@ + RepositoryModelUnload(ctx context.Context, in *RepositoryModelUnloadRequest, opts ...grpc.CallOption) (*RepositoryModelUnloadResponse, error) + // @@ .. cpp:var:: rpc SystemSharedMemoryStatus( + // @@ SystemSharedMemoryStatusRequest) + // @@ returns (SystemSharedMemoryStatusRespose) + // @@ + // @@ Get the status of all registered system-shared-memory regions. + // @@ + SystemSharedMemoryStatus(ctx context.Context, in *SystemSharedMemoryStatusRequest, opts ...grpc.CallOption) (*SystemSharedMemoryStatusResponse, error) + // @@ .. cpp:var:: rpc SystemSharedMemoryRegister( + // @@ SystemSharedMemoryRegisterRequest) + // @@ returns (SystemSharedMemoryRegisterResponse) + // @@ + // @@ Register a system-shared-memory region. + // @@ + SystemSharedMemoryRegister(ctx context.Context, in *SystemSharedMemoryRegisterRequest, opts ...grpc.CallOption) (*SystemSharedMemoryRegisterResponse, error) + // @@ .. cpp:var:: rpc SystemSharedMemoryUnregister( + // @@ SystemSharedMemoryUnregisterRequest) + // @@ returns (SystemSharedMemoryUnregisterResponse) + // @@ + // @@ Unregister a system-shared-memory region. + // @@ + SystemSharedMemoryUnregister(ctx context.Context, in *SystemSharedMemoryUnregisterRequest, opts ...grpc.CallOption) (*SystemSharedMemoryUnregisterResponse, error) + // @@ .. cpp:var:: rpc CudaSharedMemoryStatus( + // @@ CudaSharedMemoryStatusRequest) + // @@ returns (CudaSharedMemoryStatusRespose) + // @@ + // @@ Get the status of all registered CUDA-shared-memory regions. + // @@ + CudaSharedMemoryStatus(ctx context.Context, in *CudaSharedMemoryStatusRequest, opts ...grpc.CallOption) (*CudaSharedMemoryStatusResponse, error) + // @@ .. cpp:var:: rpc CudaSharedMemoryRegister( + // @@ CudaSharedMemoryRegisterRequest) + // @@ returns (CudaSharedMemoryRegisterResponse) + // @@ + // @@ Register a CUDA-shared-memory region. + // @@ + CudaSharedMemoryRegister(ctx context.Context, in *CudaSharedMemoryRegisterRequest, opts ...grpc.CallOption) (*CudaSharedMemoryRegisterResponse, error) + // @@ .. cpp:var:: rpc CudaSharedMemoryUnregister( + // @@ CudaSharedMemoryUnregisterRequest) + // @@ returns (CudaSharedMemoryUnregisterResponse) + // @@ + // @@ Unregister a CUDA-shared-memory region. + // @@ + CudaSharedMemoryUnregister(ctx context.Context, in *CudaSharedMemoryUnregisterRequest, opts ...grpc.CallOption) (*CudaSharedMemoryUnregisterResponse, error) + // @@ .. cpp:var:: rpc TraceSetting(TraceSettingRequest) + // @@ returns (TraceSettingResponse) + // @@ + // @@ Update and get the trace setting of the Triton server. + // @@ + TraceSetting(ctx context.Context, in *TraceSettingRequest, opts ...grpc.CallOption) (*TraceSettingResponse, error) + // @@ .. cpp:var:: rpc LogSettings(LogSettingsRequest) + // @@ returns (LogSettingsResponse) + // @@ + // @@ Update and get the log settings of the Triton server. + // @@ + LogSettings(ctx context.Context, in *LogSettingsRequest, opts ...grpc.CallOption) (*LogSettingsResponse, error) } type gRPCInferenceServiceClient struct { @@ -39,6 +214,26 @@ func NewGRPCInferenceServiceClient(cc grpc.ClientConnInterface) GRPCInferenceSer return &gRPCInferenceServiceClient{cc} } +func (c *gRPCInferenceServiceClient) ServerLive(ctx context.Context, in *ServerLiveRequest, opts ...grpc.CallOption) (*ServerLiveResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ServerLiveResponse) + err := c.cc.Invoke(ctx, GRPCInferenceService_ServerLive_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *gRPCInferenceServiceClient) ServerReady(ctx context.Context, in *ServerReadyRequest, opts ...grpc.CallOption) (*ServerReadyResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ServerReadyResponse) + err := c.cc.Invoke(ctx, GRPCInferenceService_ServerReady_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *gRPCInferenceServiceClient) ModelReady(ctx context.Context, in *ModelReadyRequest, opts ...grpc.CallOption) (*ModelReadyResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ModelReadyResponse) @@ -49,6 +244,26 @@ func (c *gRPCInferenceServiceClient) ModelReady(ctx context.Context, in *ModelRe return out, nil } +func (c *gRPCInferenceServiceClient) ServerMetadata(ctx context.Context, in *ServerMetadataRequest, opts ...grpc.CallOption) (*ServerMetadataResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ServerMetadataResponse) + err := c.cc.Invoke(ctx, GRPCInferenceService_ServerMetadata_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *gRPCInferenceServiceClient) ModelMetadata(ctx context.Context, in *ModelMetadataRequest, opts ...grpc.CallOption) (*ModelMetadataResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ModelMetadataResponse) + err := c.cc.Invoke(ctx, GRPCInferenceService_ModelMetadata_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *gRPCInferenceServiceClient) ModelInfer(ctx context.Context, in *ModelInferRequest, opts ...grpc.CallOption) (*ModelInferResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ModelInferResponse) @@ -59,12 +274,286 @@ func (c *gRPCInferenceServiceClient) ModelInfer(ctx context.Context, in *ModelIn return out, nil } +func (c *gRPCInferenceServiceClient) ModelStreamInfer(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ModelInferRequest, ModelStreamInferResponse], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &GRPCInferenceService_ServiceDesc.Streams[0], GRPCInferenceService_ModelStreamInfer_FullMethodName, cOpts...) + if err != nil { + return nil, err + } + x := &grpc.GenericClientStream[ModelInferRequest, ModelStreamInferResponse]{ClientStream: stream} + return x, nil +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type GRPCInferenceService_ModelStreamInferClient = grpc.BidiStreamingClient[ModelInferRequest, ModelStreamInferResponse] + +func (c *gRPCInferenceServiceClient) ModelConfig(ctx context.Context, in *ModelConfigRequest, opts ...grpc.CallOption) (*ModelConfigResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ModelConfigResponse) + err := c.cc.Invoke(ctx, GRPCInferenceService_ModelConfig_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *gRPCInferenceServiceClient) ModelStatistics(ctx context.Context, in *ModelStatisticsRequest, opts ...grpc.CallOption) (*ModelStatisticsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ModelStatisticsResponse) + err := c.cc.Invoke(ctx, GRPCInferenceService_ModelStatistics_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *gRPCInferenceServiceClient) RepositoryIndex(ctx context.Context, in *RepositoryIndexRequest, opts ...grpc.CallOption) (*RepositoryIndexResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(RepositoryIndexResponse) + err := c.cc.Invoke(ctx, GRPCInferenceService_RepositoryIndex_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *gRPCInferenceServiceClient) RepositoryModelLoad(ctx context.Context, in *RepositoryModelLoadRequest, opts ...grpc.CallOption) (*RepositoryModelLoadResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(RepositoryModelLoadResponse) + err := c.cc.Invoke(ctx, GRPCInferenceService_RepositoryModelLoad_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *gRPCInferenceServiceClient) RepositoryModelUnload(ctx context.Context, in *RepositoryModelUnloadRequest, opts ...grpc.CallOption) (*RepositoryModelUnloadResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(RepositoryModelUnloadResponse) + err := c.cc.Invoke(ctx, GRPCInferenceService_RepositoryModelUnload_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *gRPCInferenceServiceClient) SystemSharedMemoryStatus(ctx context.Context, in *SystemSharedMemoryStatusRequest, opts ...grpc.CallOption) (*SystemSharedMemoryStatusResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(SystemSharedMemoryStatusResponse) + err := c.cc.Invoke(ctx, GRPCInferenceService_SystemSharedMemoryStatus_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *gRPCInferenceServiceClient) SystemSharedMemoryRegister(ctx context.Context, in *SystemSharedMemoryRegisterRequest, opts ...grpc.CallOption) (*SystemSharedMemoryRegisterResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(SystemSharedMemoryRegisterResponse) + err := c.cc.Invoke(ctx, GRPCInferenceService_SystemSharedMemoryRegister_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *gRPCInferenceServiceClient) SystemSharedMemoryUnregister(ctx context.Context, in *SystemSharedMemoryUnregisterRequest, opts ...grpc.CallOption) (*SystemSharedMemoryUnregisterResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(SystemSharedMemoryUnregisterResponse) + err := c.cc.Invoke(ctx, GRPCInferenceService_SystemSharedMemoryUnregister_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *gRPCInferenceServiceClient) CudaSharedMemoryStatus(ctx context.Context, in *CudaSharedMemoryStatusRequest, opts ...grpc.CallOption) (*CudaSharedMemoryStatusResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CudaSharedMemoryStatusResponse) + err := c.cc.Invoke(ctx, GRPCInferenceService_CudaSharedMemoryStatus_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *gRPCInferenceServiceClient) CudaSharedMemoryRegister(ctx context.Context, in *CudaSharedMemoryRegisterRequest, opts ...grpc.CallOption) (*CudaSharedMemoryRegisterResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CudaSharedMemoryRegisterResponse) + err := c.cc.Invoke(ctx, GRPCInferenceService_CudaSharedMemoryRegister_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *gRPCInferenceServiceClient) CudaSharedMemoryUnregister(ctx context.Context, in *CudaSharedMemoryUnregisterRequest, opts ...grpc.CallOption) (*CudaSharedMemoryUnregisterResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CudaSharedMemoryUnregisterResponse) + err := c.cc.Invoke(ctx, GRPCInferenceService_CudaSharedMemoryUnregister_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *gRPCInferenceServiceClient) TraceSetting(ctx context.Context, in *TraceSettingRequest, opts ...grpc.CallOption) (*TraceSettingResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(TraceSettingResponse) + err := c.cc.Invoke(ctx, GRPCInferenceService_TraceSetting_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *gRPCInferenceServiceClient) LogSettings(ctx context.Context, in *LogSettingsRequest, opts ...grpc.CallOption) (*LogSettingsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(LogSettingsResponse) + err := c.cc.Invoke(ctx, GRPCInferenceService_LogSettings_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + // GRPCInferenceServiceServer is the server API for GRPCInferenceService service. // All implementations must embed UnimplementedGRPCInferenceServiceServer // for forward compatibility. +// +// @@ +// @@.. cpp:var:: service InferenceService +// @@ +// @@ Inference Server GRPC endpoints. +// @@ type GRPCInferenceServiceServer interface { + // @@ .. cpp:var:: rpc ServerLive(ServerLiveRequest) returns + // @@ (ServerLiveResponse) + // @@ + // @@ Check liveness of the inference server. + // @@ + ServerLive(context.Context, *ServerLiveRequest) (*ServerLiveResponse, error) + // @@ .. cpp:var:: rpc ServerReady(ServerReadyRequest) returns + // @@ (ServerReadyResponse) + // @@ + // @@ Check readiness of the inference server. + // @@ + ServerReady(context.Context, *ServerReadyRequest) (*ServerReadyResponse, error) + // @@ .. cpp:var:: rpc ModelReady(ModelReadyRequest) returns + // @@ (ModelReadyResponse) + // @@ + // @@ Check readiness of a model in the inference server. + // @@ ModelReady(context.Context, *ModelReadyRequest) (*ModelReadyResponse, error) + // @@ .. cpp:var:: rpc ServerMetadata(ServerMetadataRequest) returns + // @@ (ServerMetadataResponse) + // @@ + // @@ Get server metadata. + // @@ + ServerMetadata(context.Context, *ServerMetadataRequest) (*ServerMetadataResponse, error) + // @@ .. cpp:var:: rpc ModelMetadata(ModelMetadataRequest) returns + // @@ (ModelMetadataResponse) + // @@ + // @@ Get model metadata. + // @@ + ModelMetadata(context.Context, *ModelMetadataRequest) (*ModelMetadataResponse, error) + // @@ .. cpp:var:: rpc ModelInfer(ModelInferRequest) returns + // @@ (ModelInferResponse) + // @@ + // @@ Perform inference using a specific model. + // @@ ModelInfer(context.Context, *ModelInferRequest) (*ModelInferResponse, error) + // @@ .. cpp:var:: rpc ModelStreamInfer(stream ModelInferRequest) returns + // @@ (stream ModelStreamInferResponse) + // @@ + // @@ Perform streaming inference. + // @@ + ModelStreamInfer(grpc.BidiStreamingServer[ModelInferRequest, ModelStreamInferResponse]) error + // @@ .. cpp:var:: rpc ModelConfig(ModelConfigRequest) returns + // @@ (ModelConfigResponse) + // @@ + // @@ Get model configuration. + // @@ + ModelConfig(context.Context, *ModelConfigRequest) (*ModelConfigResponse, error) + // @@ .. cpp:var:: rpc ModelStatistics( + // @@ ModelStatisticsRequest) + // @@ returns (ModelStatisticsResponse) + // @@ + // @@ Get the cumulative inference statistics for a model. + // @@ + ModelStatistics(context.Context, *ModelStatisticsRequest) (*ModelStatisticsResponse, error) + // @@ .. cpp:var:: rpc RepositoryIndex(RepositoryIndexRequest) returns + // @@ (RepositoryIndexResponse) + // @@ + // @@ Get the index of model repository contents. + // @@ + RepositoryIndex(context.Context, *RepositoryIndexRequest) (*RepositoryIndexResponse, error) + // @@ .. cpp:var:: rpc RepositoryModelLoad(RepositoryModelLoadRequest) returns + // @@ (RepositoryModelLoadResponse) + // @@ + // @@ Load or reload a model from a repository. + // @@ + RepositoryModelLoad(context.Context, *RepositoryModelLoadRequest) (*RepositoryModelLoadResponse, error) + // @@ .. cpp:var:: rpc RepositoryModelUnload(RepositoryModelUnloadRequest) + // @@ returns (RepositoryModelUnloadResponse) + // @@ + // @@ Unload a model. + // @@ + RepositoryModelUnload(context.Context, *RepositoryModelUnloadRequest) (*RepositoryModelUnloadResponse, error) + // @@ .. cpp:var:: rpc SystemSharedMemoryStatus( + // @@ SystemSharedMemoryStatusRequest) + // @@ returns (SystemSharedMemoryStatusRespose) + // @@ + // @@ Get the status of all registered system-shared-memory regions. + // @@ + SystemSharedMemoryStatus(context.Context, *SystemSharedMemoryStatusRequest) (*SystemSharedMemoryStatusResponse, error) + // @@ .. cpp:var:: rpc SystemSharedMemoryRegister( + // @@ SystemSharedMemoryRegisterRequest) + // @@ returns (SystemSharedMemoryRegisterResponse) + // @@ + // @@ Register a system-shared-memory region. + // @@ + SystemSharedMemoryRegister(context.Context, *SystemSharedMemoryRegisterRequest) (*SystemSharedMemoryRegisterResponse, error) + // @@ .. cpp:var:: rpc SystemSharedMemoryUnregister( + // @@ SystemSharedMemoryUnregisterRequest) + // @@ returns (SystemSharedMemoryUnregisterResponse) + // @@ + // @@ Unregister a system-shared-memory region. + // @@ + SystemSharedMemoryUnregister(context.Context, *SystemSharedMemoryUnregisterRequest) (*SystemSharedMemoryUnregisterResponse, error) + // @@ .. cpp:var:: rpc CudaSharedMemoryStatus( + // @@ CudaSharedMemoryStatusRequest) + // @@ returns (CudaSharedMemoryStatusRespose) + // @@ + // @@ Get the status of all registered CUDA-shared-memory regions. + // @@ + CudaSharedMemoryStatus(context.Context, *CudaSharedMemoryStatusRequest) (*CudaSharedMemoryStatusResponse, error) + // @@ .. cpp:var:: rpc CudaSharedMemoryRegister( + // @@ CudaSharedMemoryRegisterRequest) + // @@ returns (CudaSharedMemoryRegisterResponse) + // @@ + // @@ Register a CUDA-shared-memory region. + // @@ + CudaSharedMemoryRegister(context.Context, *CudaSharedMemoryRegisterRequest) (*CudaSharedMemoryRegisterResponse, error) + // @@ .. cpp:var:: rpc CudaSharedMemoryUnregister( + // @@ CudaSharedMemoryUnregisterRequest) + // @@ returns (CudaSharedMemoryUnregisterResponse) + // @@ + // @@ Unregister a CUDA-shared-memory region. + // @@ + CudaSharedMemoryUnregister(context.Context, *CudaSharedMemoryUnregisterRequest) (*CudaSharedMemoryUnregisterResponse, error) + // @@ .. cpp:var:: rpc TraceSetting(TraceSettingRequest) + // @@ returns (TraceSettingResponse) + // @@ + // @@ Update and get the trace setting of the Triton server. + // @@ + TraceSetting(context.Context, *TraceSettingRequest) (*TraceSettingResponse, error) + // @@ .. cpp:var:: rpc LogSettings(LogSettingsRequest) + // @@ returns (LogSettingsResponse) + // @@ + // @@ Update and get the log settings of the Triton server. + // @@ + LogSettings(context.Context, *LogSettingsRequest) (*LogSettingsResponse, error) mustEmbedUnimplementedGRPCInferenceServiceServer() } @@ -75,12 +564,66 @@ type GRPCInferenceServiceServer interface { // pointer dereference when methods are called. type UnimplementedGRPCInferenceServiceServer struct{} +func (UnimplementedGRPCInferenceServiceServer) ServerLive(context.Context, *ServerLiveRequest) (*ServerLiveResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ServerLive not implemented") +} +func (UnimplementedGRPCInferenceServiceServer) ServerReady(context.Context, *ServerReadyRequest) (*ServerReadyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ServerReady not implemented") +} func (UnimplementedGRPCInferenceServiceServer) ModelReady(context.Context, *ModelReadyRequest) (*ModelReadyResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ModelReady not implemented") } +func (UnimplementedGRPCInferenceServiceServer) ServerMetadata(context.Context, *ServerMetadataRequest) (*ServerMetadataResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ServerMetadata not implemented") +} +func (UnimplementedGRPCInferenceServiceServer) ModelMetadata(context.Context, *ModelMetadataRequest) (*ModelMetadataResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ModelMetadata not implemented") +} func (UnimplementedGRPCInferenceServiceServer) ModelInfer(context.Context, *ModelInferRequest) (*ModelInferResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ModelInfer not implemented") } +func (UnimplementedGRPCInferenceServiceServer) ModelStreamInfer(grpc.BidiStreamingServer[ModelInferRequest, ModelStreamInferResponse]) error { + return status.Errorf(codes.Unimplemented, "method ModelStreamInfer not implemented") +} +func (UnimplementedGRPCInferenceServiceServer) ModelConfig(context.Context, *ModelConfigRequest) (*ModelConfigResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ModelConfig not implemented") +} +func (UnimplementedGRPCInferenceServiceServer) ModelStatistics(context.Context, *ModelStatisticsRequest) (*ModelStatisticsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ModelStatistics not implemented") +} +func (UnimplementedGRPCInferenceServiceServer) RepositoryIndex(context.Context, *RepositoryIndexRequest) (*RepositoryIndexResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RepositoryIndex not implemented") +} +func (UnimplementedGRPCInferenceServiceServer) RepositoryModelLoad(context.Context, *RepositoryModelLoadRequest) (*RepositoryModelLoadResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RepositoryModelLoad not implemented") +} +func (UnimplementedGRPCInferenceServiceServer) RepositoryModelUnload(context.Context, *RepositoryModelUnloadRequest) (*RepositoryModelUnloadResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RepositoryModelUnload not implemented") +} +func (UnimplementedGRPCInferenceServiceServer) SystemSharedMemoryStatus(context.Context, *SystemSharedMemoryStatusRequest) (*SystemSharedMemoryStatusResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SystemSharedMemoryStatus not implemented") +} +func (UnimplementedGRPCInferenceServiceServer) SystemSharedMemoryRegister(context.Context, *SystemSharedMemoryRegisterRequest) (*SystemSharedMemoryRegisterResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SystemSharedMemoryRegister not implemented") +} +func (UnimplementedGRPCInferenceServiceServer) SystemSharedMemoryUnregister(context.Context, *SystemSharedMemoryUnregisterRequest) (*SystemSharedMemoryUnregisterResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SystemSharedMemoryUnregister not implemented") +} +func (UnimplementedGRPCInferenceServiceServer) CudaSharedMemoryStatus(context.Context, *CudaSharedMemoryStatusRequest) (*CudaSharedMemoryStatusResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CudaSharedMemoryStatus not implemented") +} +func (UnimplementedGRPCInferenceServiceServer) CudaSharedMemoryRegister(context.Context, *CudaSharedMemoryRegisterRequest) (*CudaSharedMemoryRegisterResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CudaSharedMemoryRegister not implemented") +} +func (UnimplementedGRPCInferenceServiceServer) CudaSharedMemoryUnregister(context.Context, *CudaSharedMemoryUnregisterRequest) (*CudaSharedMemoryUnregisterResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CudaSharedMemoryUnregister not implemented") +} +func (UnimplementedGRPCInferenceServiceServer) TraceSetting(context.Context, *TraceSettingRequest) (*TraceSettingResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TraceSetting not implemented") +} +func (UnimplementedGRPCInferenceServiceServer) LogSettings(context.Context, *LogSettingsRequest) (*LogSettingsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method LogSettings not implemented") +} func (UnimplementedGRPCInferenceServiceServer) mustEmbedUnimplementedGRPCInferenceServiceServer() {} func (UnimplementedGRPCInferenceServiceServer) testEmbeddedByValue() {} @@ -102,6 +645,42 @@ func RegisterGRPCInferenceServiceServer(s grpc.ServiceRegistrar, srv GRPCInferen s.RegisterService(&GRPCInferenceService_ServiceDesc, srv) } +func _GRPCInferenceService_ServerLive_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ServerLiveRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(GRPCInferenceServiceServer).ServerLive(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: GRPCInferenceService_ServerLive_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(GRPCInferenceServiceServer).ServerLive(ctx, req.(*ServerLiveRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _GRPCInferenceService_ServerReady_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ServerReadyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(GRPCInferenceServiceServer).ServerReady(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: GRPCInferenceService_ServerReady_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(GRPCInferenceServiceServer).ServerReady(ctx, req.(*ServerReadyRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _GRPCInferenceService_ModelReady_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ModelReadyRequest) if err := dec(in); err != nil { @@ -120,6 +699,42 @@ func _GRPCInferenceService_ModelReady_Handler(srv interface{}, ctx context.Conte return interceptor(ctx, in, info, handler) } +func _GRPCInferenceService_ServerMetadata_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ServerMetadataRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(GRPCInferenceServiceServer).ServerMetadata(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: GRPCInferenceService_ServerMetadata_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(GRPCInferenceServiceServer).ServerMetadata(ctx, req.(*ServerMetadataRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _GRPCInferenceService_ModelMetadata_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ModelMetadataRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(GRPCInferenceServiceServer).ModelMetadata(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: GRPCInferenceService_ModelMetadata_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(GRPCInferenceServiceServer).ModelMetadata(ctx, req.(*ModelMetadataRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _GRPCInferenceService_ModelInfer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ModelInferRequest) if err := dec(in); err != nil { @@ -138,6 +753,247 @@ func _GRPCInferenceService_ModelInfer_Handler(srv interface{}, ctx context.Conte return interceptor(ctx, in, info, handler) } +func _GRPCInferenceService_ModelStreamInfer_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(GRPCInferenceServiceServer).ModelStreamInfer(&grpc.GenericServerStream[ModelInferRequest, ModelStreamInferResponse]{ServerStream: stream}) +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type GRPCInferenceService_ModelStreamInferServer = grpc.BidiStreamingServer[ModelInferRequest, ModelStreamInferResponse] + +func _GRPCInferenceService_ModelConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ModelConfigRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(GRPCInferenceServiceServer).ModelConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: GRPCInferenceService_ModelConfig_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(GRPCInferenceServiceServer).ModelConfig(ctx, req.(*ModelConfigRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _GRPCInferenceService_ModelStatistics_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ModelStatisticsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(GRPCInferenceServiceServer).ModelStatistics(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: GRPCInferenceService_ModelStatistics_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(GRPCInferenceServiceServer).ModelStatistics(ctx, req.(*ModelStatisticsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _GRPCInferenceService_RepositoryIndex_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RepositoryIndexRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(GRPCInferenceServiceServer).RepositoryIndex(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: GRPCInferenceService_RepositoryIndex_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(GRPCInferenceServiceServer).RepositoryIndex(ctx, req.(*RepositoryIndexRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _GRPCInferenceService_RepositoryModelLoad_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RepositoryModelLoadRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(GRPCInferenceServiceServer).RepositoryModelLoad(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: GRPCInferenceService_RepositoryModelLoad_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(GRPCInferenceServiceServer).RepositoryModelLoad(ctx, req.(*RepositoryModelLoadRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _GRPCInferenceService_RepositoryModelUnload_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RepositoryModelUnloadRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(GRPCInferenceServiceServer).RepositoryModelUnload(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: GRPCInferenceService_RepositoryModelUnload_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(GRPCInferenceServiceServer).RepositoryModelUnload(ctx, req.(*RepositoryModelUnloadRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _GRPCInferenceService_SystemSharedMemoryStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SystemSharedMemoryStatusRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(GRPCInferenceServiceServer).SystemSharedMemoryStatus(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: GRPCInferenceService_SystemSharedMemoryStatus_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(GRPCInferenceServiceServer).SystemSharedMemoryStatus(ctx, req.(*SystemSharedMemoryStatusRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _GRPCInferenceService_SystemSharedMemoryRegister_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SystemSharedMemoryRegisterRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(GRPCInferenceServiceServer).SystemSharedMemoryRegister(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: GRPCInferenceService_SystemSharedMemoryRegister_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(GRPCInferenceServiceServer).SystemSharedMemoryRegister(ctx, req.(*SystemSharedMemoryRegisterRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _GRPCInferenceService_SystemSharedMemoryUnregister_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SystemSharedMemoryUnregisterRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(GRPCInferenceServiceServer).SystemSharedMemoryUnregister(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: GRPCInferenceService_SystemSharedMemoryUnregister_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(GRPCInferenceServiceServer).SystemSharedMemoryUnregister(ctx, req.(*SystemSharedMemoryUnregisterRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _GRPCInferenceService_CudaSharedMemoryStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CudaSharedMemoryStatusRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(GRPCInferenceServiceServer).CudaSharedMemoryStatus(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: GRPCInferenceService_CudaSharedMemoryStatus_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(GRPCInferenceServiceServer).CudaSharedMemoryStatus(ctx, req.(*CudaSharedMemoryStatusRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _GRPCInferenceService_CudaSharedMemoryRegister_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CudaSharedMemoryRegisterRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(GRPCInferenceServiceServer).CudaSharedMemoryRegister(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: GRPCInferenceService_CudaSharedMemoryRegister_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(GRPCInferenceServiceServer).CudaSharedMemoryRegister(ctx, req.(*CudaSharedMemoryRegisterRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _GRPCInferenceService_CudaSharedMemoryUnregister_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CudaSharedMemoryUnregisterRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(GRPCInferenceServiceServer).CudaSharedMemoryUnregister(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: GRPCInferenceService_CudaSharedMemoryUnregister_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(GRPCInferenceServiceServer).CudaSharedMemoryUnregister(ctx, req.(*CudaSharedMemoryUnregisterRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _GRPCInferenceService_TraceSetting_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TraceSettingRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(GRPCInferenceServiceServer).TraceSetting(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: GRPCInferenceService_TraceSetting_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(GRPCInferenceServiceServer).TraceSetting(ctx, req.(*TraceSettingRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _GRPCInferenceService_LogSettings_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LogSettingsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(GRPCInferenceServiceServer).LogSettings(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: GRPCInferenceService_LogSettings_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(GRPCInferenceServiceServer).LogSettings(ctx, req.(*LogSettingsRequest)) + } + return interceptor(ctx, in, info, handler) +} + // GRPCInferenceService_ServiceDesc is the grpc.ServiceDesc for GRPCInferenceService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -145,15 +1001,90 @@ var GRPCInferenceService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "inference.GRPCInferenceService", HandlerType: (*GRPCInferenceServiceServer)(nil), Methods: []grpc.MethodDesc{ + { + MethodName: "ServerLive", + Handler: _GRPCInferenceService_ServerLive_Handler, + }, + { + MethodName: "ServerReady", + Handler: _GRPCInferenceService_ServerReady_Handler, + }, { MethodName: "ModelReady", Handler: _GRPCInferenceService_ModelReady_Handler, }, + { + MethodName: "ServerMetadata", + Handler: _GRPCInferenceService_ServerMetadata_Handler, + }, + { + MethodName: "ModelMetadata", + Handler: _GRPCInferenceService_ModelMetadata_Handler, + }, { MethodName: "ModelInfer", Handler: _GRPCInferenceService_ModelInfer_Handler, }, + { + MethodName: "ModelConfig", + Handler: _GRPCInferenceService_ModelConfig_Handler, + }, + { + MethodName: "ModelStatistics", + Handler: _GRPCInferenceService_ModelStatistics_Handler, + }, + { + MethodName: "RepositoryIndex", + Handler: _GRPCInferenceService_RepositoryIndex_Handler, + }, + { + MethodName: "RepositoryModelLoad", + Handler: _GRPCInferenceService_RepositoryModelLoad_Handler, + }, + { + MethodName: "RepositoryModelUnload", + Handler: _GRPCInferenceService_RepositoryModelUnload_Handler, + }, + { + MethodName: "SystemSharedMemoryStatus", + Handler: _GRPCInferenceService_SystemSharedMemoryStatus_Handler, + }, + { + MethodName: "SystemSharedMemoryRegister", + Handler: _GRPCInferenceService_SystemSharedMemoryRegister_Handler, + }, + { + MethodName: "SystemSharedMemoryUnregister", + Handler: _GRPCInferenceService_SystemSharedMemoryUnregister_Handler, + }, + { + MethodName: "CudaSharedMemoryStatus", + Handler: _GRPCInferenceService_CudaSharedMemoryStatus_Handler, + }, + { + MethodName: "CudaSharedMemoryRegister", + Handler: _GRPCInferenceService_CudaSharedMemoryRegister_Handler, + }, + { + MethodName: "CudaSharedMemoryUnregister", + Handler: _GRPCInferenceService_CudaSharedMemoryUnregister_Handler, + }, + { + MethodName: "TraceSetting", + Handler: _GRPCInferenceService_TraceSetting_Handler, + }, + { + MethodName: "LogSettings", + Handler: _GRPCInferenceService_LogSettings_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "ModelStreamInfer", + Handler: _GRPCInferenceService_ModelStreamInfer_Handler, + ServerStreams: true, + ClientStreams: true, + }, }, - Streams: []grpc.StreamDesc{}, - Metadata: "proto/triton/grpc_service.proto", + Metadata: "grpc_service.proto", } diff --git a/proto/triton/model_config.pb.go b/proto/triton/model_config.pb.go new file mode 100644 index 0000000..677198e --- /dev/null +++ b/proto/triton/model_config.pb.go @@ -0,0 +1,5829 @@ +// Copyright 2018-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2018, TensorFlow Authors. All rights reserved. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.32.0 +// source: model_config.proto + +package triton + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// @@ +// @@.. cpp:enum:: DataType +// @@ +// @@ Data types supported for input and output tensors. +// @@ +type DataType int32 + +const ( + // @@ .. cpp:enumerator:: DataType::INVALID = 0 + DataType_TYPE_INVALID DataType = 0 + // @@ .. cpp:enumerator:: DataType::BOOL = 1 + DataType_TYPE_BOOL DataType = 1 + // @@ .. cpp:enumerator:: DataType::UINT8 = 2 + DataType_TYPE_UINT8 DataType = 2 + // @@ .. cpp:enumerator:: DataType::UINT16 = 3 + DataType_TYPE_UINT16 DataType = 3 + // @@ .. cpp:enumerator:: DataType::UINT32 = 4 + DataType_TYPE_UINT32 DataType = 4 + // @@ .. cpp:enumerator:: DataType::UINT64 = 5 + DataType_TYPE_UINT64 DataType = 5 + // @@ .. cpp:enumerator:: DataType::INT8 = 6 + DataType_TYPE_INT8 DataType = 6 + // @@ .. cpp:enumerator:: DataType::INT16 = 7 + DataType_TYPE_INT16 DataType = 7 + // @@ .. cpp:enumerator:: DataType::INT32 = 8 + DataType_TYPE_INT32 DataType = 8 + // @@ .. cpp:enumerator:: DataType::INT64 = 9 + DataType_TYPE_INT64 DataType = 9 + // @@ .. cpp:enumerator:: DataType::FP16 = 10 + DataType_TYPE_FP16 DataType = 10 + // @@ .. cpp:enumerator:: DataType::FP32 = 11 + DataType_TYPE_FP32 DataType = 11 + // @@ .. cpp:enumerator:: DataType::FP64 = 12 + DataType_TYPE_FP64 DataType = 12 + // @@ .. cpp:enumerator:: DataType::STRING = 13 + DataType_TYPE_STRING DataType = 13 + // @@ .. cpp:enumerator:: DataType::BF16 = 14 + DataType_TYPE_BF16 DataType = 14 +) + +// Enum value maps for DataType. +var ( + DataType_name = map[int32]string{ + 0: "TYPE_INVALID", + 1: "TYPE_BOOL", + 2: "TYPE_UINT8", + 3: "TYPE_UINT16", + 4: "TYPE_UINT32", + 5: "TYPE_UINT64", + 6: "TYPE_INT8", + 7: "TYPE_INT16", + 8: "TYPE_INT32", + 9: "TYPE_INT64", + 10: "TYPE_FP16", + 11: "TYPE_FP32", + 12: "TYPE_FP64", + 13: "TYPE_STRING", + 14: "TYPE_BF16", + } + DataType_value = map[string]int32{ + "TYPE_INVALID": 0, + "TYPE_BOOL": 1, + "TYPE_UINT8": 2, + "TYPE_UINT16": 3, + "TYPE_UINT32": 4, + "TYPE_UINT64": 5, + "TYPE_INT8": 6, + "TYPE_INT16": 7, + "TYPE_INT32": 8, + "TYPE_INT64": 9, + "TYPE_FP16": 10, + "TYPE_FP32": 11, + "TYPE_FP64": 12, + "TYPE_STRING": 13, + "TYPE_BF16": 14, + } +) + +func (x DataType) Enum() *DataType { + p := new(DataType) + *p = x + return p +} + +func (x DataType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (DataType) Descriptor() protoreflect.EnumDescriptor { + return file_model_config_proto_enumTypes[0].Descriptor() +} + +func (DataType) Type() protoreflect.EnumType { + return &file_model_config_proto_enumTypes[0] +} + +func (x DataType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use DataType.Descriptor instead. +func (DataType) EnumDescriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{0} +} + +// @@ +// @@ .. cpp:enum:: Kind +// @@ +// @@ Kind of this instance group. +// @@ +type ModelInstanceGroup_Kind int32 + +const ( + // @@ .. cpp:enumerator:: Kind::KIND_AUTO = 0 + // @@ + // @@ This instance group represents instances that can run on either + // @@ CPU or GPU. If all GPUs listed in 'gpus' are available then + // @@ instances will be created on GPU(s), otherwise instances will + // @@ be created on CPU. + // @@ + ModelInstanceGroup_KIND_AUTO ModelInstanceGroup_Kind = 0 + // @@ .. cpp:enumerator:: Kind::KIND_GPU = 1 + // @@ + // @@ This instance group represents instances that must run on the + // @@ GPU. + // @@ + ModelInstanceGroup_KIND_GPU ModelInstanceGroup_Kind = 1 + // @@ .. cpp:enumerator:: Kind::KIND_CPU = 2 + // @@ + // @@ This instance group represents instances that must run on the + // @@ CPU. + // @@ + ModelInstanceGroup_KIND_CPU ModelInstanceGroup_Kind = 2 + // @@ .. cpp:enumerator:: Kind::KIND_MODEL = 3 + // @@ + // @@ This instance group represents instances that should run on the + // @@ CPU and/or GPU(s) as specified by the model or backend itself. + // @@ The inference server will not override the model/backend + // @@ settings. + // @@ + ModelInstanceGroup_KIND_MODEL ModelInstanceGroup_Kind = 3 +) + +// Enum value maps for ModelInstanceGroup_Kind. +var ( + ModelInstanceGroup_Kind_name = map[int32]string{ + 0: "KIND_AUTO", + 1: "KIND_GPU", + 2: "KIND_CPU", + 3: "KIND_MODEL", + } + ModelInstanceGroup_Kind_value = map[string]int32{ + "KIND_AUTO": 0, + "KIND_GPU": 1, + "KIND_CPU": 2, + "KIND_MODEL": 3, + } +) + +func (x ModelInstanceGroup_Kind) Enum() *ModelInstanceGroup_Kind { + p := new(ModelInstanceGroup_Kind) + *p = x + return p +} + +func (x ModelInstanceGroup_Kind) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ModelInstanceGroup_Kind) Descriptor() protoreflect.EnumDescriptor { + return file_model_config_proto_enumTypes[1].Descriptor() +} + +func (ModelInstanceGroup_Kind) Type() protoreflect.EnumType { + return &file_model_config_proto_enumTypes[1] +} + +func (x ModelInstanceGroup_Kind) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ModelInstanceGroup_Kind.Descriptor instead. +func (ModelInstanceGroup_Kind) EnumDescriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{1, 0} +} + +// @@ +// @@ .. cpp:enum:: SecondaryDeviceKind +// @@ +// @@ The kind of the secondary device. +// @@ +type ModelInstanceGroup_SecondaryDevice_SecondaryDeviceKind int32 + +const ( + // @@ .. cpp:enumerator:: SecondaryDeviceKind::KIND_NVDLA = 0 + // @@ + // @@ An NVDLA core. http://nvdla.org + // @@ Currently KIND_NVDLA is only supported by the TensorRT backend. + // @@ + ModelInstanceGroup_SecondaryDevice_KIND_NVDLA ModelInstanceGroup_SecondaryDevice_SecondaryDeviceKind = 0 +) + +// Enum value maps for ModelInstanceGroup_SecondaryDevice_SecondaryDeviceKind. +var ( + ModelInstanceGroup_SecondaryDevice_SecondaryDeviceKind_name = map[int32]string{ + 0: "KIND_NVDLA", + } + ModelInstanceGroup_SecondaryDevice_SecondaryDeviceKind_value = map[string]int32{ + "KIND_NVDLA": 0, + } +) + +func (x ModelInstanceGroup_SecondaryDevice_SecondaryDeviceKind) Enum() *ModelInstanceGroup_SecondaryDevice_SecondaryDeviceKind { + p := new(ModelInstanceGroup_SecondaryDevice_SecondaryDeviceKind) + *p = x + return p +} + +func (x ModelInstanceGroup_SecondaryDevice_SecondaryDeviceKind) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ModelInstanceGroup_SecondaryDevice_SecondaryDeviceKind) Descriptor() protoreflect.EnumDescriptor { + return file_model_config_proto_enumTypes[2].Descriptor() +} + +func (ModelInstanceGroup_SecondaryDevice_SecondaryDeviceKind) Type() protoreflect.EnumType { + return &file_model_config_proto_enumTypes[2] +} + +func (x ModelInstanceGroup_SecondaryDevice_SecondaryDeviceKind) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ModelInstanceGroup_SecondaryDevice_SecondaryDeviceKind.Descriptor instead. +func (ModelInstanceGroup_SecondaryDevice_SecondaryDeviceKind) EnumDescriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{1, 0, 0} +} + +// @@ +// @@ .. cpp:enum:: Format +// @@ +// @@ The format for the input. +// @@ +type ModelInput_Format int32 + +const ( + // @@ .. cpp:enumerator:: Format::FORMAT_NONE = 0 + // @@ + // @@ The input has no specific format. This is the default. + // @@ + ModelInput_FORMAT_NONE ModelInput_Format = 0 + // @@ .. cpp:enumerator:: Format::FORMAT_NHWC = 1 + // @@ + // @@ HWC image format. Tensors with this format require 3 dimensions + // @@ if the model does not support batching (max_batch_size = 0) or 4 + // @@ dimensions if the model does support batching (max_batch_size + // @@ >= 1). In either case the 'dims' below should only specify the + // @@ 3 non-batch dimensions (i.e. HWC or CHW). + // @@ + ModelInput_FORMAT_NHWC ModelInput_Format = 1 + // @@ .. cpp:enumerator:: Format::FORMAT_NCHW = 2 + // @@ + // @@ CHW image format. Tensors with this format require 3 dimensions + // @@ if the model does not support batching (max_batch_size = 0) or 4 + // @@ dimensions if the model does support batching (max_batch_size + // @@ >= 1). In either case the 'dims' below should only specify the + // @@ 3 non-batch dimensions (i.e. HWC or CHW). + // @@ + ModelInput_FORMAT_NCHW ModelInput_Format = 2 +) + +// Enum value maps for ModelInput_Format. +var ( + ModelInput_Format_name = map[int32]string{ + 0: "FORMAT_NONE", + 1: "FORMAT_NHWC", + 2: "FORMAT_NCHW", + } + ModelInput_Format_value = map[string]int32{ + "FORMAT_NONE": 0, + "FORMAT_NHWC": 1, + "FORMAT_NCHW": 2, + } +) + +func (x ModelInput_Format) Enum() *ModelInput_Format { + p := new(ModelInput_Format) + *p = x + return p +} + +func (x ModelInput_Format) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ModelInput_Format) Descriptor() protoreflect.EnumDescriptor { + return file_model_config_proto_enumTypes[3].Descriptor() +} + +func (ModelInput_Format) Type() protoreflect.EnumType { + return &file_model_config_proto_enumTypes[3] +} + +func (x ModelInput_Format) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ModelInput_Format.Descriptor instead. +func (ModelInput_Format) EnumDescriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{3, 0} +} + +// @@ +// @@ .. cpp:enum:: Kind +// @@ +// @@ The kind of the batch input. +// @@ +type BatchInput_Kind int32 + +const ( + // @@ .. cpp:enumerator:: Kind::BATCH_ELEMENT_COUNT = 0 + // @@ + // @@ The element count of the 'source_input' will be added as + // @@ input with shape [1]. + // @@ + BatchInput_BATCH_ELEMENT_COUNT BatchInput_Kind = 0 + // @@ .. cpp:enumerator:: Kind::BATCH_ACCUMULATED_ELEMENT_COUNT = 1 + // @@ + // @@ The accumulated element count of the 'source_input' will be + // @@ added as input with shape [1]. For example, if there is a + // @@ batch of two request, each with 2 elements, an input of value + // @@ 2 will be added to the first request, and an input of value + // @@ 4 will be added to the second request. + // @@ + BatchInput_BATCH_ACCUMULATED_ELEMENT_COUNT BatchInput_Kind = 1 + // @@ .. cpp:enumerator:: + // @@ Kind::BATCH_ACCUMULATED_ELEMENT_COUNT_WITH_ZERO = 2 + // @@ + // @@ The accumulated element count of the 'source_input' will be + // @@ added as input with shape [1], except for the first request + // @@ in the batch. For the first request in the batch, the input + // @@ will have shape [2] where the first element is value 0. + // @@ + BatchInput_BATCH_ACCUMULATED_ELEMENT_COUNT_WITH_ZERO BatchInput_Kind = 2 + // @@ .. cpp:enumerator:: Kind::BATCH_MAX_ELEMENT_COUNT_AS_SHAPE = 3 + // @@ + // @@ Among the requests in the batch, the max element count of the + // @@ 'source_input' will be added as input with shape + // @@ [max_element_count] for the first request in the batch. + // @@ For other requests, such input will be with shape [0]. + // @@ The data of the tensor will be uninitialized. + // @@ + BatchInput_BATCH_MAX_ELEMENT_COUNT_AS_SHAPE BatchInput_Kind = 3 + // @@ .. cpp:enumerator:: Kind::BATCH_ITEM_SHAPE = 4 + // @@ + // @@ Among the requests in the batch, the shape of the + // @@ 'source_input' will be added as input with shape + // @@ [batch_size, len(input_dim)]. For example, if one + // @@ batch-2 input with shape [3, 1] and batch-1 input + // @@ with shape [2, 2] are batched, the batch input will + // @@ have shape [3, 2] and value [ [3, 1], [3, 1], [2, 2]]. + // @@ + BatchInput_BATCH_ITEM_SHAPE BatchInput_Kind = 4 + // @@ .. cpp:enumerator:: Kind::BATCH_ITEM_SHAPE_FLATTEN = 5 + // @@ + // @@ Among the requests in the batch, the shape of the + // @@ 'source_input' will be added as input with single dimensional + // @@ shape [batch_size * len(input_dim)]. For example, if one + // @@ batch-2 input with shape [3, 1] and batch-1 input + // @@ with shape [2, 2] are batched, the batch input will + // @@ have shape [6] and value [3, 1, 3, 1, 2, 2]. + // @@ + BatchInput_BATCH_ITEM_SHAPE_FLATTEN BatchInput_Kind = 5 +) + +// Enum value maps for BatchInput_Kind. +var ( + BatchInput_Kind_name = map[int32]string{ + 0: "BATCH_ELEMENT_COUNT", + 1: "BATCH_ACCUMULATED_ELEMENT_COUNT", + 2: "BATCH_ACCUMULATED_ELEMENT_COUNT_WITH_ZERO", + 3: "BATCH_MAX_ELEMENT_COUNT_AS_SHAPE", + 4: "BATCH_ITEM_SHAPE", + 5: "BATCH_ITEM_SHAPE_FLATTEN", + } + BatchInput_Kind_value = map[string]int32{ + "BATCH_ELEMENT_COUNT": 0, + "BATCH_ACCUMULATED_ELEMENT_COUNT": 1, + "BATCH_ACCUMULATED_ELEMENT_COUNT_WITH_ZERO": 2, + "BATCH_MAX_ELEMENT_COUNT_AS_SHAPE": 3, + "BATCH_ITEM_SHAPE": 4, + "BATCH_ITEM_SHAPE_FLATTEN": 5, + } +) + +func (x BatchInput_Kind) Enum() *BatchInput_Kind { + p := new(BatchInput_Kind) + *p = x + return p +} + +func (x BatchInput_Kind) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (BatchInput_Kind) Descriptor() protoreflect.EnumDescriptor { + return file_model_config_proto_enumTypes[4].Descriptor() +} + +func (BatchInput_Kind) Type() protoreflect.EnumType { + return &file_model_config_proto_enumTypes[4] +} + +func (x BatchInput_Kind) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use BatchInput_Kind.Descriptor instead. +func (BatchInput_Kind) EnumDescriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{5, 0} +} + +// @@ +// @@ .. cpp:enum:: Kind +// @@ +// @@ The kind of the batch output. +// @@ +type BatchOutput_Kind int32 + +const ( + // @@ .. cpp:enumerator:: Kind::BATCH_SCATTER_WITH_INPUT_SHAPE = 0 + // @@ + // @@ The output should be scattered according to the shape of + // @@ 'source_input'. The dynamic dimension of the output will + // @@ be set to the value of the same dimension in the input. + // @@ + BatchOutput_BATCH_SCATTER_WITH_INPUT_SHAPE BatchOutput_Kind = 0 +) + +// Enum value maps for BatchOutput_Kind. +var ( + BatchOutput_Kind_name = map[int32]string{ + 0: "BATCH_SCATTER_WITH_INPUT_SHAPE", + } + BatchOutput_Kind_value = map[string]int32{ + "BATCH_SCATTER_WITH_INPUT_SHAPE": 0, + } +) + +func (x BatchOutput_Kind) Enum() *BatchOutput_Kind { + p := new(BatchOutput_Kind) + *p = x + return p +} + +func (x BatchOutput_Kind) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (BatchOutput_Kind) Descriptor() protoreflect.EnumDescriptor { + return file_model_config_proto_enumTypes[5].Descriptor() +} + +func (BatchOutput_Kind) Type() protoreflect.EnumType { + return &file_model_config_proto_enumTypes[5] +} + +func (x BatchOutput_Kind) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use BatchOutput_Kind.Descriptor instead. +func (BatchOutput_Kind) EnumDescriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{6, 0} +} + +// @@ +// @@ .. cpp:enum:: ModelPriority +// @@ +// @@ Model priorities. A model will be given scheduling and execution +// @@ preference over models at lower priorities. Current model +// @@ priorities only work for TensorRT models. +// @@ +type ModelOptimizationPolicy_ModelPriority int32 + +const ( + // @@ .. cpp:enumerator:: ModelPriority::PRIORITY_DEFAULT = 0 + // @@ + // @@ The default model priority. + // @@ + ModelOptimizationPolicy_PRIORITY_DEFAULT ModelOptimizationPolicy_ModelPriority = 0 + // @@ .. cpp:enumerator:: ModelPriority::PRIORITY_MAX = 1 + // @@ + // @@ The maximum model priority. + // @@ + ModelOptimizationPolicy_PRIORITY_MAX ModelOptimizationPolicy_ModelPriority = 1 + // @@ .. cpp:enumerator:: ModelPriority::PRIORITY_MIN = 2 + // @@ + // @@ The minimum model priority. + // @@ + ModelOptimizationPolicy_PRIORITY_MIN ModelOptimizationPolicy_ModelPriority = 2 +) + +// Enum value maps for ModelOptimizationPolicy_ModelPriority. +var ( + ModelOptimizationPolicy_ModelPriority_name = map[int32]string{ + 0: "PRIORITY_DEFAULT", + 1: "PRIORITY_MAX", + 2: "PRIORITY_MIN", + } + ModelOptimizationPolicy_ModelPriority_value = map[string]int32{ + "PRIORITY_DEFAULT": 0, + "PRIORITY_MAX": 1, + "PRIORITY_MIN": 2, + } +) + +func (x ModelOptimizationPolicy_ModelPriority) Enum() *ModelOptimizationPolicy_ModelPriority { + p := new(ModelOptimizationPolicy_ModelPriority) + *p = x + return p +} + +func (x ModelOptimizationPolicy_ModelPriority) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ModelOptimizationPolicy_ModelPriority) Descriptor() protoreflect.EnumDescriptor { + return file_model_config_proto_enumTypes[6].Descriptor() +} + +func (ModelOptimizationPolicy_ModelPriority) Type() protoreflect.EnumType { + return &file_model_config_proto_enumTypes[6] +} + +func (x ModelOptimizationPolicy_ModelPriority) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ModelOptimizationPolicy_ModelPriority.Descriptor instead. +func (ModelOptimizationPolicy_ModelPriority) EnumDescriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{8, 0} +} + +// @@ +// @@ .. cpp:enum:: TimeoutAction +// @@ +// @@ The action applied to timed-out requests. +// @@ +type ModelQueuePolicy_TimeoutAction int32 + +const ( + // @@ .. cpp:enumerator:: Action::REJECT = 0 + // @@ + // @@ Reject the request and return error message accordingly. + // @@ + ModelQueuePolicy_REJECT ModelQueuePolicy_TimeoutAction = 0 + // @@ .. cpp:enumerator:: Action::DELAY = 1 + // @@ + // @@ Delay the request until all other requests at the same + // @@ (or higher) priority levels that have not reached their timeouts + // @@ are processed. A delayed request will eventually be processed, + // @@ but may be delayed indefinitely due to newly arriving requests. + // @@ + ModelQueuePolicy_DELAY ModelQueuePolicy_TimeoutAction = 1 +) + +// Enum value maps for ModelQueuePolicy_TimeoutAction. +var ( + ModelQueuePolicy_TimeoutAction_name = map[int32]string{ + 0: "REJECT", + 1: "DELAY", + } + ModelQueuePolicy_TimeoutAction_value = map[string]int32{ + "REJECT": 0, + "DELAY": 1, + } +) + +func (x ModelQueuePolicy_TimeoutAction) Enum() *ModelQueuePolicy_TimeoutAction { + p := new(ModelQueuePolicy_TimeoutAction) + *p = x + return p +} + +func (x ModelQueuePolicy_TimeoutAction) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ModelQueuePolicy_TimeoutAction) Descriptor() protoreflect.EnumDescriptor { + return file_model_config_proto_enumTypes[7].Descriptor() +} + +func (ModelQueuePolicy_TimeoutAction) Type() protoreflect.EnumType { + return &file_model_config_proto_enumTypes[7] +} + +func (x ModelQueuePolicy_TimeoutAction) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ModelQueuePolicy_TimeoutAction.Descriptor instead. +func (ModelQueuePolicy_TimeoutAction) EnumDescriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{9, 0} +} + +// @@ +// @@ .. cpp:enum:: Kind +// @@ +// @@ The kind of the control. +// @@ +type ModelSequenceBatching_Control_Kind int32 + +const ( + // @@ .. cpp:enumerator:: Kind::CONTROL_SEQUENCE_START = 0 + // @@ + // @@ A new sequence is/is-not starting. If true a sequence is + // @@ starting, if false a sequence is continuing. Must + // @@ specify either int32_false_true, fp32_false_true or + // @@ bool_false_true for this control. This control is optional. + // @@ + ModelSequenceBatching_Control_CONTROL_SEQUENCE_START ModelSequenceBatching_Control_Kind = 0 + // @@ .. cpp:enumerator:: Kind::CONTROL_SEQUENCE_READY = 1 + // @@ + // @@ A sequence is/is-not ready for inference. If true the + // @@ input tensor data is valid and should be used. If false + // @@ the input tensor data is invalid and inferencing should + // @@ be "skipped". Must specify either int32_false_true, + // @@ fp32_false_true or bool_false_true for this control. This + // @@ control is optional. + // @@ + ModelSequenceBatching_Control_CONTROL_SEQUENCE_READY ModelSequenceBatching_Control_Kind = 1 + // @@ .. cpp:enumerator:: Kind::CONTROL_SEQUENCE_END = 2 + // @@ + // @@ A sequence is/is-not ending. If true a sequence is + // @@ ending, if false a sequence is continuing. Must specify + // @@ either int32_false_true, fp32_false_true or bool_false_true + // @@ for this control. This control is optional. + // @@ + ModelSequenceBatching_Control_CONTROL_SEQUENCE_END ModelSequenceBatching_Control_Kind = 2 + // @@ .. cpp:enumerator:: Kind::CONTROL_SEQUENCE_CORRID = 3 + // @@ + // @@ The correlation ID of the sequence. The correlation ID + // @@ is an uint64_t value that is communicated in whole or + // @@ in part by the tensor. The tensor's datatype must be + // @@ specified by data_type and must be TYPE_UINT64, TYPE_INT64, + // @@ TYPE_UINT32 or TYPE_INT32. If a 32-bit datatype is specified + // @@ the correlation ID will be truncated to the low-order 32 + // @@ bits. This control is optional. + // @@ + ModelSequenceBatching_Control_CONTROL_SEQUENCE_CORRID ModelSequenceBatching_Control_Kind = 3 +) + +// Enum value maps for ModelSequenceBatching_Control_Kind. +var ( + ModelSequenceBatching_Control_Kind_name = map[int32]string{ + 0: "CONTROL_SEQUENCE_START", + 1: "CONTROL_SEQUENCE_READY", + 2: "CONTROL_SEQUENCE_END", + 3: "CONTROL_SEQUENCE_CORRID", + } + ModelSequenceBatching_Control_Kind_value = map[string]int32{ + "CONTROL_SEQUENCE_START": 0, + "CONTROL_SEQUENCE_READY": 1, + "CONTROL_SEQUENCE_END": 2, + "CONTROL_SEQUENCE_CORRID": 3, + } +) + +func (x ModelSequenceBatching_Control_Kind) Enum() *ModelSequenceBatching_Control_Kind { + p := new(ModelSequenceBatching_Control_Kind) + *p = x + return p +} + +func (x ModelSequenceBatching_Control_Kind) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ModelSequenceBatching_Control_Kind) Descriptor() protoreflect.EnumDescriptor { + return file_model_config_proto_enumTypes[8].Descriptor() +} + +func (ModelSequenceBatching_Control_Kind) Type() protoreflect.EnumType { + return &file_model_config_proto_enumTypes[8] +} + +func (x ModelSequenceBatching_Control_Kind) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ModelSequenceBatching_Control_Kind.Descriptor instead. +func (ModelSequenceBatching_Control_Kind) EnumDescriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{11, 0, 0} +} + +// @@ +// @@ .. cpp:var:: message ModelRateLimiter +// @@ +// @@ The specifications required by the rate limiter to properly +// @@ schedule the inference requests across the different models +// @@ and their instances. +// @@ +type ModelRateLimiter struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: Resource resources (repeated) + // @@ + // @@ The resources required to execute the request on a model instance. + // @@ Resources are just names with a corresponding count. The execution + // @@ of the instance will be blocked until the specified resources are + // @@ available. By default an instance uses no rate-limiter resources. + // @@ + Resources []*ModelRateLimiter_Resource `protobuf:"bytes,1,rep,name=resources,proto3" json:"resources,omitempty"` + // @@ .. cpp:var:: uint32 priority + // @@ + // @@ The optional weighting value to be used for prioritizing across + // @@ instances. An instance with priority 2 will be given 1/2 the + // @@ number of scheduling chances as an instance_group with priority + // @@ 1. The default priority is 1. The priority of value 0 will be + // @@ treated as priority 1. + // @@ + Priority uint32 `protobuf:"varint,2,opt,name=priority,proto3" json:"priority,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelRateLimiter) Reset() { + *x = ModelRateLimiter{} + mi := &file_model_config_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelRateLimiter) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelRateLimiter) ProtoMessage() {} + +func (x *ModelRateLimiter) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelRateLimiter.ProtoReflect.Descriptor instead. +func (*ModelRateLimiter) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{0} +} + +func (x *ModelRateLimiter) GetResources() []*ModelRateLimiter_Resource { + if x != nil { + return x.Resources + } + return nil +} + +func (x *ModelRateLimiter) GetPriority() uint32 { + if x != nil { + return x.Priority + } + return 0 +} + +// @@ +// @@.. cpp:var:: message ModelInstanceGroup +// @@ +// @@ A group of one or more instances of a model and resources made +// @@ available for those instances. +// @@ +type ModelInstanceGroup struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: string name + // @@ + // @@ Optional name of this group of instances. If not specified the + // @@ name will be formed as _. The name of + // @@ individual instances will be further formed by a unique instance + // @@ number and GPU index: + // @@ + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // @@ .. cpp:var:: Kind kind + // @@ + // @@ The kind of this instance group. Default is KIND_AUTO. If + // @@ KIND_AUTO or KIND_GPU then both 'count' and 'gpu' are valid and + // @@ may be specified. If KIND_CPU or KIND_MODEL only 'count' is valid + // @@ and 'gpu' cannot be specified. + // @@ + Kind ModelInstanceGroup_Kind `protobuf:"varint,4,opt,name=kind,proto3,enum=inference.ModelInstanceGroup_Kind" json:"kind,omitempty"` + // @@ .. cpp:var:: int32 count + // @@ + // @@ For a group assigned to GPU, the number of instances created for + // @@ each GPU listed in 'gpus'. For a group assigned to CPU the number + // @@ of instances created. Default is 1. + Count int32 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"` + // @@ .. cpp:var:: ModelRateLimiter rate_limiter + // @@ + // @@ The rate limiter specific settings to be associated with this + // @@ instance group. Optional, if not specified no rate limiting + // @@ will be applied to this instance group. + // @@ + RateLimiter *ModelRateLimiter `protobuf:"bytes,6,opt,name=rate_limiter,json=rateLimiter,proto3" json:"rate_limiter,omitempty"` + // @@ .. cpp:var:: int32 gpus (repeated) + // @@ + // @@ GPU(s) where instances should be available. For each GPU listed, + // @@ 'count' instances of the model will be available. Setting 'gpus' + // @@ to empty (or not specifying at all) is equivalent to listing all + // @@ available GPUs. + // @@ + Gpus []int32 `protobuf:"varint,3,rep,packed,name=gpus,proto3" json:"gpus,omitempty"` + // @@ .. cpp:var:: SecondaryDevice secondary_devices (repeated) + // @@ + // @@ Secondary devices that are required by instances specified by this + // @@ instance group. Optional. + // @@ + SecondaryDevices []*ModelInstanceGroup_SecondaryDevice `protobuf:"bytes,8,rep,name=secondary_devices,json=secondaryDevices,proto3" json:"secondary_devices,omitempty"` + // @@ .. cpp:var:: string profile (repeated) + // @@ + // @@ For TensorRT models containing multiple optimization profile, this + // @@ parameter specifies a set of optimization profiles available to this + // @@ instance group. The inference server will choose the optimal profile + // @@ based on the shapes of the input tensors. This field should lie + // @@ between 0 and - 1 + // @@ and be specified only for TensorRT backend, otherwise an error will + // @@ be generated. If not specified, the server will select the first + // @@ optimization profile by default. + // @@ + Profile []string `protobuf:"bytes,5,rep,name=profile,proto3" json:"profile,omitempty"` + // @@ .. cpp:var:: bool passive + // @@ + // @@ Whether the instances within this instance group will be accepting + // @@ inference requests from the scheduler. If true, the instances will + // @@ not be added to the scheduler. Default value is false. + // @@ + Passive bool `protobuf:"varint,7,opt,name=passive,proto3" json:"passive,omitempty"` + // @@ .. cpp:var:: string host_policy + // @@ + // @@ The host policy name that the instance to be associated with. + // @@ The default value is set to reflect the device kind of the instance, + // @@ for instance, KIND_CPU is "cpu", KIND_MODEL is "model" and + // @@ KIND_GPU is "gpu_". + // @@ + HostPolicy string `protobuf:"bytes,9,opt,name=host_policy,json=hostPolicy,proto3" json:"host_policy,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelInstanceGroup) Reset() { + *x = ModelInstanceGroup{} + mi := &file_model_config_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelInstanceGroup) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelInstanceGroup) ProtoMessage() {} + +func (x *ModelInstanceGroup) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelInstanceGroup.ProtoReflect.Descriptor instead. +func (*ModelInstanceGroup) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{1} +} + +func (x *ModelInstanceGroup) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ModelInstanceGroup) GetKind() ModelInstanceGroup_Kind { + if x != nil { + return x.Kind + } + return ModelInstanceGroup_KIND_AUTO +} + +func (x *ModelInstanceGroup) GetCount() int32 { + if x != nil { + return x.Count + } + return 0 +} + +func (x *ModelInstanceGroup) GetRateLimiter() *ModelRateLimiter { + if x != nil { + return x.RateLimiter + } + return nil +} + +func (x *ModelInstanceGroup) GetGpus() []int32 { + if x != nil { + return x.Gpus + } + return nil +} + +func (x *ModelInstanceGroup) GetSecondaryDevices() []*ModelInstanceGroup_SecondaryDevice { + if x != nil { + return x.SecondaryDevices + } + return nil +} + +func (x *ModelInstanceGroup) GetProfile() []string { + if x != nil { + return x.Profile + } + return nil +} + +func (x *ModelInstanceGroup) GetPassive() bool { + if x != nil { + return x.Passive + } + return false +} + +func (x *ModelInstanceGroup) GetHostPolicy() string { + if x != nil { + return x.HostPolicy + } + return "" +} + +// @@ +// @@.. cpp:var:: message ModelTensorReshape +// @@ +// @@ Reshape specification for input and output tensors. +// @@ +type ModelTensorReshape struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: int64 shape (repeated) + // @@ + // @@ The shape to use for reshaping. + // @@ + Shape []int64 `protobuf:"varint,1,rep,packed,name=shape,proto3" json:"shape,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelTensorReshape) Reset() { + *x = ModelTensorReshape{} + mi := &file_model_config_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelTensorReshape) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelTensorReshape) ProtoMessage() {} + +func (x *ModelTensorReshape) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelTensorReshape.ProtoReflect.Descriptor instead. +func (*ModelTensorReshape) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{2} +} + +func (x *ModelTensorReshape) GetShape() []int64 { + if x != nil { + return x.Shape + } + return nil +} + +// @@ +// @@.. cpp:var:: message ModelInput +// @@ +// @@ An input required by the model. +// @@ +type ModelInput struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: string name + // @@ + // @@ The name of the input. + // @@ + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // @@ .. cpp:var:: DataType data_type + // @@ + // @@ The data-type of the input. + // @@ + DataType DataType `protobuf:"varint,2,opt,name=data_type,json=dataType,proto3,enum=inference.DataType" json:"data_type,omitempty"` + // @@ .. cpp:var:: Format format + // @@ + // @@ The format of the input. Optional. + // @@ + Format ModelInput_Format `protobuf:"varint,3,opt,name=format,proto3,enum=inference.ModelInput_Format" json:"format,omitempty"` + // @@ .. cpp:var:: int64 dims (repeated) + // @@ + // @@ The dimensions/shape of the input tensor that must be provided + // @@ when invoking the inference API for this model. + // @@ + Dims []int64 `protobuf:"varint,4,rep,packed,name=dims,proto3" json:"dims,omitempty"` + // @@ .. cpp:var:: ModelTensorReshape reshape + // @@ + // @@ The shape expected for this input by the backend. The input will + // @@ be reshaped to this before being presented to the backend. The + // @@ reshape must have the same number of elements as the input shape + // @@ specified by 'dims'. Optional. + // @@ + Reshape *ModelTensorReshape `protobuf:"bytes,5,opt,name=reshape,proto3" json:"reshape,omitempty"` + // @@ .. cpp:var:: bool is_shape_tensor + // @@ + // @@ Whether or not the input is a shape tensor to the model. This field + // @@ is currently supported only for the TensorRT model. An error will be + // @@ generated if this specification does not comply with underlying + // @@ model. + // @@ + IsShapeTensor bool `protobuf:"varint,6,opt,name=is_shape_tensor,json=isShapeTensor,proto3" json:"is_shape_tensor,omitempty"` + // @@ .. cpp:var:: bool allow_ragged_batch + // @@ + // @@ Whether or not the input is allowed to be "ragged" in a dynamically + // @@ created batch. Default is false indicating that two requests will + // @@ only be batched if this tensor has the same shape in both requests. + // @@ True indicates that two requests can be batched even if this tensor + // @@ has a different shape in each request. + // @@ + AllowRaggedBatch bool `protobuf:"varint,7,opt,name=allow_ragged_batch,json=allowRaggedBatch,proto3" json:"allow_ragged_batch,omitempty"` + // @@ .. cpp:var:: bool optional + // @@ + // @@ Whether or not the input is optional for the model execution. + // @@ If true, the input is not required in the inference request. + // @@ Default value is false. + // @@ + Optional bool `protobuf:"varint,8,opt,name=optional,proto3" json:"optional,omitempty"` + // @@ .. cpp:var:: bool is_non_linear_format_io + // @@ + // @@ Indicates whether the input tensor uses a non-linear IO format. This + // @@ field is currently supported only for TensorRT models. An error will + // @@ be generated if this specification does not comply with the + // @@ underlying model. + // @@ + IsNonLinearFormatIo bool `protobuf:"varint,9,opt,name=is_non_linear_format_io,json=isNonLinearFormatIo,proto3" json:"is_non_linear_format_io,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelInput) Reset() { + *x = ModelInput{} + mi := &file_model_config_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelInput) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelInput) ProtoMessage() {} + +func (x *ModelInput) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelInput.ProtoReflect.Descriptor instead. +func (*ModelInput) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{3} +} + +func (x *ModelInput) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ModelInput) GetDataType() DataType { + if x != nil { + return x.DataType + } + return DataType_TYPE_INVALID +} + +func (x *ModelInput) GetFormat() ModelInput_Format { + if x != nil { + return x.Format + } + return ModelInput_FORMAT_NONE +} + +func (x *ModelInput) GetDims() []int64 { + if x != nil { + return x.Dims + } + return nil +} + +func (x *ModelInput) GetReshape() *ModelTensorReshape { + if x != nil { + return x.Reshape + } + return nil +} + +func (x *ModelInput) GetIsShapeTensor() bool { + if x != nil { + return x.IsShapeTensor + } + return false +} + +func (x *ModelInput) GetAllowRaggedBatch() bool { + if x != nil { + return x.AllowRaggedBatch + } + return false +} + +func (x *ModelInput) GetOptional() bool { + if x != nil { + return x.Optional + } + return false +} + +func (x *ModelInput) GetIsNonLinearFormatIo() bool { + if x != nil { + return x.IsNonLinearFormatIo + } + return false +} + +// @@ +// @@.. cpp:var:: message ModelOutput +// @@ +// @@ An output produced by the model. +// @@ +type ModelOutput struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: string name + // @@ + // @@ The name of the output. + // @@ + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // @@ .. cpp:var:: DataType data_type + // @@ + // @@ The data-type of the output. + // @@ + DataType DataType `protobuf:"varint,2,opt,name=data_type,json=dataType,proto3,enum=inference.DataType" json:"data_type,omitempty"` + // @@ .. cpp:var:: int64 dims (repeated) + // @@ + // @@ The dimensions/shape of the output tensor. + // @@ + Dims []int64 `protobuf:"varint,3,rep,packed,name=dims,proto3" json:"dims,omitempty"` + // @@ .. cpp:var:: ModelTensorReshape reshape + // @@ + // @@ The shape produced for this output by the backend. The output will + // @@ be reshaped from this to the shape specified in 'dims' before being + // @@ returned in the inference response. The reshape must have the same + // @@ number of elements as the output shape specified by 'dims'. Optional. + // @@ + Reshape *ModelTensorReshape `protobuf:"bytes,5,opt,name=reshape,proto3" json:"reshape,omitempty"` + // @@ .. cpp:var:: string label_filename + // @@ + // @@ The label file associated with this output. Should be specified only + // @@ for outputs that represent classifications. Optional. + // @@ + LabelFilename string `protobuf:"bytes,4,opt,name=label_filename,json=labelFilename,proto3" json:"label_filename,omitempty"` + // @@ .. cpp:var:: bool is_shape_tensor + // @@ + // @@ Whether or not the output is a shape tensor to the model. This field + // @@ is currently supported only for the TensorRT model. An error will be + // @@ generated if this specification does not comply with underlying + // @@ model. + // @@ + IsShapeTensor bool `protobuf:"varint,6,opt,name=is_shape_tensor,json=isShapeTensor,proto3" json:"is_shape_tensor,omitempty"` + // @@ .. cpp:var:: bool is_non_linear_format_io + // @@ + // @@ Indicates whether the output tensor uses a non-linear IO format. This + // @@ field is currently supported only for TensorRT models. An error will + // @@ be generated if this specification does not comply with the + // @@ underlying model. + // @@ + IsNonLinearFormatIo bool `protobuf:"varint,7,opt,name=is_non_linear_format_io,json=isNonLinearFormatIo,proto3" json:"is_non_linear_format_io,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelOutput) Reset() { + *x = ModelOutput{} + mi := &file_model_config_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelOutput) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelOutput) ProtoMessage() {} + +func (x *ModelOutput) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelOutput.ProtoReflect.Descriptor instead. +func (*ModelOutput) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{4} +} + +func (x *ModelOutput) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ModelOutput) GetDataType() DataType { + if x != nil { + return x.DataType + } + return DataType_TYPE_INVALID +} + +func (x *ModelOutput) GetDims() []int64 { + if x != nil { + return x.Dims + } + return nil +} + +func (x *ModelOutput) GetReshape() *ModelTensorReshape { + if x != nil { + return x.Reshape + } + return nil +} + +func (x *ModelOutput) GetLabelFilename() string { + if x != nil { + return x.LabelFilename + } + return "" +} + +func (x *ModelOutput) GetIsShapeTensor() bool { + if x != nil { + return x.IsShapeTensor + } + return false +} + +func (x *ModelOutput) GetIsNonLinearFormatIo() bool { + if x != nil { + return x.IsNonLinearFormatIo + } + return false +} + +// @@ .. cpp:var:: message BatchInput +// @@ +// @@ A batch input is an additional input that must be added by +// @@ the backend based on all the requests in a batch. +// @@ +type BatchInput struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: Kind kind + // @@ + // @@ The kind of this batch input. + // @@ + Kind BatchInput_Kind `protobuf:"varint,1,opt,name=kind,proto3,enum=inference.BatchInput_Kind" json:"kind,omitempty"` + // @@ .. cpp:var:: string target_name (repeated) + // @@ + // @@ The name of the model inputs that the backend will create + // @@ for this batch input. + // @@ + TargetName []string `protobuf:"bytes,2,rep,name=target_name,json=targetName,proto3" json:"target_name,omitempty"` + // @@ .. cpp:var:: DataType data_type + // @@ + // @@ The input's datatype. The data type can be TYPE_INT32 or + // @@ TYPE_FP32. + // @@ + DataType DataType `protobuf:"varint,3,opt,name=data_type,json=dataType,proto3,enum=inference.DataType" json:"data_type,omitempty"` + // @@ .. cpp:var:: string source_input (repeated) + // @@ + // @@ The backend derives the value for each batch input from one or + // @@ more other inputs. 'source_input' gives the names of those + // @@ inputs. + // @@ + SourceInput []string `protobuf:"bytes,4,rep,name=source_input,json=sourceInput,proto3" json:"source_input,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BatchInput) Reset() { + *x = BatchInput{} + mi := &file_model_config_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BatchInput) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BatchInput) ProtoMessage() {} + +func (x *BatchInput) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BatchInput.ProtoReflect.Descriptor instead. +func (*BatchInput) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{5} +} + +func (x *BatchInput) GetKind() BatchInput_Kind { + if x != nil { + return x.Kind + } + return BatchInput_BATCH_ELEMENT_COUNT +} + +func (x *BatchInput) GetTargetName() []string { + if x != nil { + return x.TargetName + } + return nil +} + +func (x *BatchInput) GetDataType() DataType { + if x != nil { + return x.DataType + } + return DataType_TYPE_INVALID +} + +func (x *BatchInput) GetSourceInput() []string { + if x != nil { + return x.SourceInput + } + return nil +} + +// @@.. cpp:var:: message BatchOutput +// @@ +// @@ A batch output is an output produced by the model that must be handled +// @@ differently by the backend based on all the requests in a batch. +// @@ +type BatchOutput struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: string target_name (repeated) + // @@ + // @@ The name of the outputs to be produced by this batch output + // @@ specification. + // @@ + TargetName []string `protobuf:"bytes,1,rep,name=target_name,json=targetName,proto3" json:"target_name,omitempty"` + // @@ .. cpp:var:: Kind kind + // @@ + // @@ The kind of this batch output. + // @@ + Kind BatchOutput_Kind `protobuf:"varint,2,opt,name=kind,proto3,enum=inference.BatchOutput_Kind" json:"kind,omitempty"` + // @@ .. cpp:var:: string source_input (repeated) + // @@ + // @@ The backend derives each batch output from one or more inputs. + // @@ 'source_input' gives the names of those inputs. + // @@ + SourceInput []string `protobuf:"bytes,3,rep,name=source_input,json=sourceInput,proto3" json:"source_input,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BatchOutput) Reset() { + *x = BatchOutput{} + mi := &file_model_config_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BatchOutput) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BatchOutput) ProtoMessage() {} + +func (x *BatchOutput) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BatchOutput.ProtoReflect.Descriptor instead. +func (*BatchOutput) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{6} +} + +func (x *BatchOutput) GetTargetName() []string { + if x != nil { + return x.TargetName + } + return nil +} + +func (x *BatchOutput) GetKind() BatchOutput_Kind { + if x != nil { + return x.Kind + } + return BatchOutput_BATCH_SCATTER_WITH_INPUT_SHAPE +} + +func (x *BatchOutput) GetSourceInput() []string { + if x != nil { + return x.SourceInput + } + return nil +} + +// @@ +// @@.. cpp:var:: message ModelVersionPolicy +// @@ +// @@ Policy indicating which versions of a model should be made +// @@ available by the inference server. +// @@ +type ModelVersionPolicy struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: oneof policy_choice + // @@ + // @@ Each model must implement only a single version policy. The + // @@ default policy is 'Latest'. + // @@ + // + // Types that are valid to be assigned to PolicyChoice: + // + // *ModelVersionPolicy_Latest_ + // *ModelVersionPolicy_All_ + // *ModelVersionPolicy_Specific_ + PolicyChoice isModelVersionPolicy_PolicyChoice `protobuf_oneof:"policy_choice"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelVersionPolicy) Reset() { + *x = ModelVersionPolicy{} + mi := &file_model_config_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelVersionPolicy) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelVersionPolicy) ProtoMessage() {} + +func (x *ModelVersionPolicy) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelVersionPolicy.ProtoReflect.Descriptor instead. +func (*ModelVersionPolicy) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{7} +} + +func (x *ModelVersionPolicy) GetPolicyChoice() isModelVersionPolicy_PolicyChoice { + if x != nil { + return x.PolicyChoice + } + return nil +} + +func (x *ModelVersionPolicy) GetLatest() *ModelVersionPolicy_Latest { + if x != nil { + if x, ok := x.PolicyChoice.(*ModelVersionPolicy_Latest_); ok { + return x.Latest + } + } + return nil +} + +func (x *ModelVersionPolicy) GetAll() *ModelVersionPolicy_All { + if x != nil { + if x, ok := x.PolicyChoice.(*ModelVersionPolicy_All_); ok { + return x.All + } + } + return nil +} + +func (x *ModelVersionPolicy) GetSpecific() *ModelVersionPolicy_Specific { + if x != nil { + if x, ok := x.PolicyChoice.(*ModelVersionPolicy_Specific_); ok { + return x.Specific + } + } + return nil +} + +type isModelVersionPolicy_PolicyChoice interface { + isModelVersionPolicy_PolicyChoice() +} + +type ModelVersionPolicy_Latest_ struct { + // @@ .. cpp:var:: Latest latest + // @@ + // @@ Serve only latest version(s) of the model. + // @@ + Latest *ModelVersionPolicy_Latest `protobuf:"bytes,1,opt,name=latest,proto3,oneof"` +} + +type ModelVersionPolicy_All_ struct { + // @@ .. cpp:var:: All all + // @@ + // @@ Serve all versions of the model. + // @@ + All *ModelVersionPolicy_All `protobuf:"bytes,2,opt,name=all,proto3,oneof"` +} + +type ModelVersionPolicy_Specific_ struct { + // @@ .. cpp:var:: Specific specific + // @@ + // @@ Serve only specific version(s) of the model. + // @@ + Specific *ModelVersionPolicy_Specific `protobuf:"bytes,3,opt,name=specific,proto3,oneof"` +} + +func (*ModelVersionPolicy_Latest_) isModelVersionPolicy_PolicyChoice() {} + +func (*ModelVersionPolicy_All_) isModelVersionPolicy_PolicyChoice() {} + +func (*ModelVersionPolicy_Specific_) isModelVersionPolicy_PolicyChoice() {} + +// @@ +// @@.. cpp:var:: message ModelOptimizationPolicy +// @@ +// @@ Optimization settings for a model. These settings control if/how a +// @@ model is optimized and prioritized by the backend framework when +// @@ it is loaded. +// @@ +type ModelOptimizationPolicy struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: Graph graph + // @@ + // @@ The graph optimization setting for the model. Optional. + // @@ + Graph *ModelOptimizationPolicy_Graph `protobuf:"bytes,1,opt,name=graph,proto3" json:"graph,omitempty"` + // @@ .. cpp:var:: ModelPriority priority + // @@ + // @@ The priority setting for the model. Optional. + // @@ + Priority ModelOptimizationPolicy_ModelPriority `protobuf:"varint,2,opt,name=priority,proto3,enum=inference.ModelOptimizationPolicy_ModelPriority" json:"priority,omitempty"` + // @@ .. cpp:var:: Cuda cuda + // @@ + // @@ CUDA-specific optimization settings. Optional. + // @@ + Cuda *ModelOptimizationPolicy_Cuda `protobuf:"bytes,3,opt,name=cuda,proto3" json:"cuda,omitempty"` + // @@ .. cpp:var:: ExecutionAccelerators execution_accelerators + // @@ + // @@ The accelerators used for the model. Optional. + // @@ + ExecutionAccelerators *ModelOptimizationPolicy_ExecutionAccelerators `protobuf:"bytes,4,opt,name=execution_accelerators,json=executionAccelerators,proto3" json:"execution_accelerators,omitempty"` + // @@ .. cpp:var:: PinnedMemoryBuffer input_pinned_memory + // @@ + // @@ Use pinned memory buffer when the data transfer for inputs + // @@ is between GPU memory and non-pinned system memory. + // @@ Default is true. + // @@ + InputPinnedMemory *ModelOptimizationPolicy_PinnedMemoryBuffer `protobuf:"bytes,5,opt,name=input_pinned_memory,json=inputPinnedMemory,proto3" json:"input_pinned_memory,omitempty"` + // @@ .. cpp:var:: PinnedMemoryBuffer output_pinned_memory + // @@ + // @@ Use pinned memory buffer when the data transfer for outputs + // @@ is between GPU memory and non-pinned system memory. + // @@ Default is true. + // @@ + OutputPinnedMemory *ModelOptimizationPolicy_PinnedMemoryBuffer `protobuf:"bytes,6,opt,name=output_pinned_memory,json=outputPinnedMemory,proto3" json:"output_pinned_memory,omitempty"` + // @@ .. cpp:var:: uint32 gather_kernel_buffer_threshold + // @@ + // @@ The backend may use a gather kernel to gather input data if the + // @@ device has direct access to the source buffer and the destination + // @@ buffer. In such case, the gather kernel will be used only if the + // @@ number of buffers to be gathered is greater or equal to + // @@ the specified value. If 0, the gather kernel will be disabled. + // @@ Default value is 0. + // @@ Currently only recognized by TensorRT backend. + // @@ + GatherKernelBufferThreshold uint32 `protobuf:"varint,7,opt,name=gather_kernel_buffer_threshold,json=gatherKernelBufferThreshold,proto3" json:"gather_kernel_buffer_threshold,omitempty"` + // @@ .. cpp:var:: bool eager_batching + // @@ + // @@ Start preparing the next batch before the model instance is ready + // @@ for the next inference. This option can be used to overlap the + // @@ batch preparation with model execution, with the trade-off that + // @@ the next batch might be smaller than what it could have been. + // @@ Default value is false. + // @@ Currently only recognized by TensorRT backend. + // @@ + EagerBatching bool `protobuf:"varint,8,opt,name=eager_batching,json=eagerBatching,proto3" json:"eager_batching,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelOptimizationPolicy) Reset() { + *x = ModelOptimizationPolicy{} + mi := &file_model_config_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelOptimizationPolicy) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelOptimizationPolicy) ProtoMessage() {} + +func (x *ModelOptimizationPolicy) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelOptimizationPolicy.ProtoReflect.Descriptor instead. +func (*ModelOptimizationPolicy) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{8} +} + +func (x *ModelOptimizationPolicy) GetGraph() *ModelOptimizationPolicy_Graph { + if x != nil { + return x.Graph + } + return nil +} + +func (x *ModelOptimizationPolicy) GetPriority() ModelOptimizationPolicy_ModelPriority { + if x != nil { + return x.Priority + } + return ModelOptimizationPolicy_PRIORITY_DEFAULT +} + +func (x *ModelOptimizationPolicy) GetCuda() *ModelOptimizationPolicy_Cuda { + if x != nil { + return x.Cuda + } + return nil +} + +func (x *ModelOptimizationPolicy) GetExecutionAccelerators() *ModelOptimizationPolicy_ExecutionAccelerators { + if x != nil { + return x.ExecutionAccelerators + } + return nil +} + +func (x *ModelOptimizationPolicy) GetInputPinnedMemory() *ModelOptimizationPolicy_PinnedMemoryBuffer { + if x != nil { + return x.InputPinnedMemory + } + return nil +} + +func (x *ModelOptimizationPolicy) GetOutputPinnedMemory() *ModelOptimizationPolicy_PinnedMemoryBuffer { + if x != nil { + return x.OutputPinnedMemory + } + return nil +} + +func (x *ModelOptimizationPolicy) GetGatherKernelBufferThreshold() uint32 { + if x != nil { + return x.GatherKernelBufferThreshold + } + return 0 +} + +func (x *ModelOptimizationPolicy) GetEagerBatching() bool { + if x != nil { + return x.EagerBatching + } + return false +} + +// @@ +// @@.. cpp:var:: message ModelQueuePolicy +// @@ +// @@ Queue policy for inference requests. +// @@ +type ModelQueuePolicy struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ + // @@ .. cpp:var:: TimeoutAction timeout_action + // @@ + // @@ The action applied to timed-out request. + // @@ The default action is REJECT. + // @@ + TimeoutAction ModelQueuePolicy_TimeoutAction `protobuf:"varint,1,opt,name=timeout_action,json=timeoutAction,proto3,enum=inference.ModelQueuePolicy_TimeoutAction" json:"timeout_action,omitempty"` + // @@ + // @@ .. cpp:var:: uint64 default_timeout_microseconds + // @@ + // @@ The default timeout for every request, in microseconds. + // @@ The default value is 0 which indicates that no timeout is set. + // @@ + DefaultTimeoutMicroseconds uint64 `protobuf:"varint,2,opt,name=default_timeout_microseconds,json=defaultTimeoutMicroseconds,proto3" json:"default_timeout_microseconds,omitempty"` + // @@ + // @@ .. cpp:var:: bool allow_timeout_override + // @@ + // @@ Whether individual request can override the default timeout value. + // @@ When true, individual requests can set a timeout that is less than + // @@ the default timeout value but may not increase the timeout. + // @@ The default value is false. + // @@ + AllowTimeoutOverride bool `protobuf:"varint,3,opt,name=allow_timeout_override,json=allowTimeoutOverride,proto3" json:"allow_timeout_override,omitempty"` + // @@ + // @@ .. cpp:var:: uint32 max_queue_size + // @@ + // @@ The maximum queue size for holding requests. A request will be + // @@ rejected immediately if it can't be enqueued because the queue is + // @@ full. The default value is 0 which indicates that no maximum + // @@ queue size is enforced. + // @@ + MaxQueueSize uint32 `protobuf:"varint,4,opt,name=max_queue_size,json=maxQueueSize,proto3" json:"max_queue_size,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelQueuePolicy) Reset() { + *x = ModelQueuePolicy{} + mi := &file_model_config_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelQueuePolicy) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelQueuePolicy) ProtoMessage() {} + +func (x *ModelQueuePolicy) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelQueuePolicy.ProtoReflect.Descriptor instead. +func (*ModelQueuePolicy) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{9} +} + +func (x *ModelQueuePolicy) GetTimeoutAction() ModelQueuePolicy_TimeoutAction { + if x != nil { + return x.TimeoutAction + } + return ModelQueuePolicy_REJECT +} + +func (x *ModelQueuePolicy) GetDefaultTimeoutMicroseconds() uint64 { + if x != nil { + return x.DefaultTimeoutMicroseconds + } + return 0 +} + +func (x *ModelQueuePolicy) GetAllowTimeoutOverride() bool { + if x != nil { + return x.AllowTimeoutOverride + } + return false +} + +func (x *ModelQueuePolicy) GetMaxQueueSize() uint32 { + if x != nil { + return x.MaxQueueSize + } + return 0 +} + +// @@ +// @@.. cpp:var:: message ModelDynamicBatching +// @@ +// @@ Dynamic batching configuration. These settings control how dynamic +// @@ batching operates for the model. +// @@ +type ModelDynamicBatching struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: int32 preferred_batch_size (repeated) + // @@ + // @@ Preferred batch sizes for dynamic batching. If a batch of one of + // @@ these sizes can be formed it will be executed immediately. If + // @@ not specified a preferred batch size will be chosen automatically + // @@ based on model and GPU characteristics. + // @@ + PreferredBatchSize []int32 `protobuf:"varint,1,rep,packed,name=preferred_batch_size,json=preferredBatchSize,proto3" json:"preferred_batch_size,omitempty"` + // @@ .. cpp:var:: uint64 max_queue_delay_microseconds + // @@ + // @@ The maximum time, in microseconds, a request will be delayed in + // @@ the scheduling queue to wait for additional requests for + // @@ batching. Default is 0. + // @@ + MaxQueueDelayMicroseconds uint64 `protobuf:"varint,2,opt,name=max_queue_delay_microseconds,json=maxQueueDelayMicroseconds,proto3" json:"max_queue_delay_microseconds,omitempty"` + // @@ .. cpp:var:: bool preserve_ordering + // @@ + // @@ Should the dynamic batcher preserve the ordering of responses to + // @@ match the order of requests received by the scheduler. Default is + // @@ false. If true, the responses will be returned in the same order as + // @@ the order of requests sent to the scheduler. If false, the responses + // @@ may be returned in arbitrary order. This option is specifically + // @@ needed when a sequence of related inference requests (i.e. inference + // @@ requests with the same correlation ID) are sent to the dynamic + // @@ batcher to ensure that the sequence responses are in the correct + // @@ order. + // @@ + PreserveOrdering bool `protobuf:"varint,3,opt,name=preserve_ordering,json=preserveOrdering,proto3" json:"preserve_ordering,omitempty"` + // @@ .. cpp:var:: uint64 priority_levels + // @@ + // @@ The number of priority levels to be enabled for the model, + // @@ the priority level starts from 1 and 1 is the highest priority. + // @@ Requests are handled in priority order with all priority 1 requests + // @@ processed before priority 2, all priority 2 requests processed before + // @@ priority 3, etc. Requests with the same priority level will be + // @@ handled in the order that they are received. + // @@ + PriorityLevels uint64 `protobuf:"varint,4,opt,name=priority_levels,json=priorityLevels,proto3" json:"priority_levels,omitempty"` + // @@ .. cpp:var:: uint64 default_priority_level + // @@ + // @@ The priority level used for requests that don't specify their + // @@ priority. The value must be in the range [ 1, 'priority_levels' ]. + // @@ + DefaultPriorityLevel uint64 `protobuf:"varint,5,opt,name=default_priority_level,json=defaultPriorityLevel,proto3" json:"default_priority_level,omitempty"` + // @@ .. cpp:var:: ModelQueuePolicy default_queue_policy + // @@ + // @@ The default queue policy used for requests that don't require + // @@ priority handling and requests that specify priority levels where + // @@ there is no specific policy given. If not specified, a policy with + // @@ default field values will be used. + // @@ + DefaultQueuePolicy *ModelQueuePolicy `protobuf:"bytes,6,opt,name=default_queue_policy,json=defaultQueuePolicy,proto3" json:"default_queue_policy,omitempty"` + // @@ .. cpp:var:: map priority_queue_policy + // @@ + // @@ Specify the queue policy for the priority level. The default queue + // @@ policy will be used if a priority level doesn't specify a queue + // @@ policy. + // @@ + PriorityQueuePolicy map[uint64]*ModelQueuePolicy `protobuf:"bytes,7,rep,name=priority_queue_policy,json=priorityQueuePolicy,proto3" json:"priority_queue_policy,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelDynamicBatching) Reset() { + *x = ModelDynamicBatching{} + mi := &file_model_config_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelDynamicBatching) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelDynamicBatching) ProtoMessage() {} + +func (x *ModelDynamicBatching) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelDynamicBatching.ProtoReflect.Descriptor instead. +func (*ModelDynamicBatching) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{10} +} + +func (x *ModelDynamicBatching) GetPreferredBatchSize() []int32 { + if x != nil { + return x.PreferredBatchSize + } + return nil +} + +func (x *ModelDynamicBatching) GetMaxQueueDelayMicroseconds() uint64 { + if x != nil { + return x.MaxQueueDelayMicroseconds + } + return 0 +} + +func (x *ModelDynamicBatching) GetPreserveOrdering() bool { + if x != nil { + return x.PreserveOrdering + } + return false +} + +func (x *ModelDynamicBatching) GetPriorityLevels() uint64 { + if x != nil { + return x.PriorityLevels + } + return 0 +} + +func (x *ModelDynamicBatching) GetDefaultPriorityLevel() uint64 { + if x != nil { + return x.DefaultPriorityLevel + } + return 0 +} + +func (x *ModelDynamicBatching) GetDefaultQueuePolicy() *ModelQueuePolicy { + if x != nil { + return x.DefaultQueuePolicy + } + return nil +} + +func (x *ModelDynamicBatching) GetPriorityQueuePolicy() map[uint64]*ModelQueuePolicy { + if x != nil { + return x.PriorityQueuePolicy + } + return nil +} + +// @@ +// @@.. cpp:var:: message ModelSequenceBatching +// @@ +// @@ Sequence batching configuration. These settings control how sequence +// @@ batching operates for the model. +// @@ +type ModelSequenceBatching struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: oneof strategy_choice + // @@ + // @@ The strategy used by the sequence batcher. Default strategy + // @@ is 'direct'. + // @@ + // + // Types that are valid to be assigned to StrategyChoice: + // + // *ModelSequenceBatching_Direct + // *ModelSequenceBatching_Oldest + StrategyChoice isModelSequenceBatching_StrategyChoice `protobuf_oneof:"strategy_choice"` + // @@ .. cpp:var:: uint64 max_sequence_idle_microseconds + // @@ + // @@ The maximum time, in microseconds, that a sequence is allowed to + // @@ be idle before it is aborted. The inference server considers a + // @@ sequence idle when it does not have any inference request queued + // @@ for the sequence. If this limit is exceeded, the inference server + // @@ will free the sequence slot allocated by the sequence and make it + // @@ available for another sequence. If not specified (or specified as + // @@ zero) a default value of 1000000 (1 second) is used. + // @@ + MaxSequenceIdleMicroseconds uint64 `protobuf:"varint,1,opt,name=max_sequence_idle_microseconds,json=maxSequenceIdleMicroseconds,proto3" json:"max_sequence_idle_microseconds,omitempty"` + // @@ .. cpp:var:: ControlInput control_input (repeated) + // @@ + // @@ The model input(s) that the server should use to communicate + // @@ sequence start, stop, ready and similar control values to the + // @@ model. + // @@ + ControlInput []*ModelSequenceBatching_ControlInput `protobuf:"bytes,2,rep,name=control_input,json=controlInput,proto3" json:"control_input,omitempty"` + // @@ .. cpp:var:: State state (repeated) + // @@ + // @@ The optional state that can be stored in Triton for performing + // @@ inference requests on a sequence. Each sequence holds an implicit + // @@ state local to itself. The output state tensor provided by the + // @@ model in 'output_name' field of the current inference request will + // @@ be transferred as an input tensor named 'input_name' in the next + // @@ request of the same sequence. The input state of the first request + // @@ in the sequence contains garbage data. + // @@ + State []*ModelSequenceBatching_State `protobuf:"bytes,5,rep,name=state,proto3" json:"state,omitempty"` + // @@ .. cpp:var:: bool iterative_sequence + // @@ + // @@ Requests for iterative sequences are processed over a number + // @@ of iterations. An iterative sequence is initiated by a single + // @@ request and is "rescheduled" by the model until completion. + // @@ Requests for inflight requests will be batched together + // @@ and can complete independently. Note this feature + // @@ requires backend support. Default value is false. + IterativeSequence bool `protobuf:"varint,6,opt,name=iterative_sequence,json=iterativeSequence,proto3" json:"iterative_sequence,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelSequenceBatching) Reset() { + *x = ModelSequenceBatching{} + mi := &file_model_config_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelSequenceBatching) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelSequenceBatching) ProtoMessage() {} + +func (x *ModelSequenceBatching) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelSequenceBatching.ProtoReflect.Descriptor instead. +func (*ModelSequenceBatching) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{11} +} + +func (x *ModelSequenceBatching) GetStrategyChoice() isModelSequenceBatching_StrategyChoice { + if x != nil { + return x.StrategyChoice + } + return nil +} + +func (x *ModelSequenceBatching) GetDirect() *ModelSequenceBatching_StrategyDirect { + if x != nil { + if x, ok := x.StrategyChoice.(*ModelSequenceBatching_Direct); ok { + return x.Direct + } + } + return nil +} + +func (x *ModelSequenceBatching) GetOldest() *ModelSequenceBatching_StrategyOldest { + if x != nil { + if x, ok := x.StrategyChoice.(*ModelSequenceBatching_Oldest); ok { + return x.Oldest + } + } + return nil +} + +func (x *ModelSequenceBatching) GetMaxSequenceIdleMicroseconds() uint64 { + if x != nil { + return x.MaxSequenceIdleMicroseconds + } + return 0 +} + +func (x *ModelSequenceBatching) GetControlInput() []*ModelSequenceBatching_ControlInput { + if x != nil { + return x.ControlInput + } + return nil +} + +func (x *ModelSequenceBatching) GetState() []*ModelSequenceBatching_State { + if x != nil { + return x.State + } + return nil +} + +func (x *ModelSequenceBatching) GetIterativeSequence() bool { + if x != nil { + return x.IterativeSequence + } + return false +} + +type isModelSequenceBatching_StrategyChoice interface { + isModelSequenceBatching_StrategyChoice() +} + +type ModelSequenceBatching_Direct struct { + // @@ .. cpp:var:: StrategyDirect direct + // @@ + // @@ StrategyDirect scheduling strategy. + // @@ + Direct *ModelSequenceBatching_StrategyDirect `protobuf:"bytes,3,opt,name=direct,proto3,oneof"` +} + +type ModelSequenceBatching_Oldest struct { + // @@ .. cpp:var:: StrategyOldest oldest + // @@ + // @@ StrategyOldest scheduling strategy. + // @@ + Oldest *ModelSequenceBatching_StrategyOldest `protobuf:"bytes,4,opt,name=oldest,proto3,oneof"` +} + +func (*ModelSequenceBatching_Direct) isModelSequenceBatching_StrategyChoice() {} + +func (*ModelSequenceBatching_Oldest) isModelSequenceBatching_StrategyChoice() {} + +// @@ +// @@.. cpp:var:: message ModelEnsembling +// @@ +// @@ Model ensembling configuration. These settings specify the models that +// @@ compose the ensemble and how data flows between the models. +// @@ +type ModelEnsembling struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: Step step (repeated) + // @@ + // @@ The models and the input / output mappings used within the ensemble. + // @@ + Step []*ModelEnsembling_Step `protobuf:"bytes,1,rep,name=step,proto3" json:"step,omitempty"` + // @@ .. cpp:var:: uint32 max_inflight_requests + // @@ + // @@ The maximum number of concurrent inflight requests allowed at each + // @@ ensemble step per inference request. This limit prevents unbounded + // @@ memory growth when ensemble steps produce responses faster than + // @@ downstream steps can consume, e.g. decoupled models. + // @@ Default value is 0, which indicates that no limit is enforced. + // @@ + // @@ Note: Applying this limit may block upstream steps while they wait + // @@ for downstream capacity. This blocking does not cancel or internally + // @@ time out intermediate requests, but clients may experience increased + // @@ end-to-end latency. + // @@ + MaxInflightRequests uint32 `protobuf:"varint,2,opt,name=max_inflight_requests,json=maxInflightRequests,proto3" json:"max_inflight_requests,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelEnsembling) Reset() { + *x = ModelEnsembling{} + mi := &file_model_config_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelEnsembling) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelEnsembling) ProtoMessage() {} + +func (x *ModelEnsembling) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelEnsembling.ProtoReflect.Descriptor instead. +func (*ModelEnsembling) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{12} +} + +func (x *ModelEnsembling) GetStep() []*ModelEnsembling_Step { + if x != nil { + return x.Step + } + return nil +} + +func (x *ModelEnsembling) GetMaxInflightRequests() uint32 { + if x != nil { + return x.MaxInflightRequests + } + return 0 +} + +// @@ +// @@.. cpp:var:: message ModelParameter +// @@ +// @@ A model parameter. +// @@ +type ModelParameter struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: string string_value + // @@ + // @@ The string value of the parameter. + // @@ + StringValue string `protobuf:"bytes,1,opt,name=string_value,json=stringValue,proto3" json:"string_value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelParameter) Reset() { + *x = ModelParameter{} + mi := &file_model_config_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelParameter) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelParameter) ProtoMessage() {} + +func (x *ModelParameter) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[13] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelParameter.ProtoReflect.Descriptor instead. +func (*ModelParameter) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{13} +} + +func (x *ModelParameter) GetStringValue() string { + if x != nil { + return x.StringValue + } + return "" +} + +// @@ +// @@.. cpp:var:: message ModelWarmup +// @@ +// @@ Settings used to construct the request sample for model warmup. +// @@ +type ModelWarmup struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: string name + // @@ + // @@ The name of the request sample. + // @@ + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // @@ .. cpp:var:: uint32 batch_size + // @@ + // @@ The batch size of the inference request. This must be >= 1. For + // @@ models that don't support batching, batch_size must be 1. If + // @@ batch_size > 1, the 'inputs' specified below will be duplicated to + // @@ match the batch size requested. + // @@ + BatchSize uint32 `protobuf:"varint,2,opt,name=batch_size,json=batchSize,proto3" json:"batch_size,omitempty"` + // @@ .. cpp:var:: map inputs + // @@ + // @@ The warmup meta data associated with every model input, including + // @@ control tensors. + // @@ + Inputs map[string]*ModelWarmup_Input `protobuf:"bytes,3,rep,name=inputs,proto3" json:"inputs,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // @@ .. cpp:var:: uint32 count + // @@ + // @@ The number of iterations that this warmup sample will be executed. + // @@ For example, if this field is set to 2, 2 model executions using this + // @@ sample will be scheduled for warmup. Default value is 0 which + // @@ indicates that this sample will be used only once. + // @@ Note that for sequence model, 'count' may not work well + // @@ because the model often expect a valid sequence of requests which + // @@ should be represented by a series of warmup samples. 'count > 1' + // @@ essentially "resends" one of the sample, which may invalidate the + // @@ sequence and result in unexpected warmup failure. + // @@ + Count uint32 `protobuf:"varint,4,opt,name=count,proto3" json:"count,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelWarmup) Reset() { + *x = ModelWarmup{} + mi := &file_model_config_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelWarmup) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelWarmup) ProtoMessage() {} + +func (x *ModelWarmup) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[14] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelWarmup.ProtoReflect.Descriptor instead. +func (*ModelWarmup) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{14} +} + +func (x *ModelWarmup) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ModelWarmup) GetBatchSize() uint32 { + if x != nil { + return x.BatchSize + } + return 0 +} + +func (x *ModelWarmup) GetInputs() map[string]*ModelWarmup_Input { + if x != nil { + return x.Inputs + } + return nil +} + +func (x *ModelWarmup) GetCount() uint32 { + if x != nil { + return x.Count + } + return 0 +} + +// @@ +// @@ .. cpp:var:: message ModelOperations +// @@ +// @@ The metadata of libraries providing custom operations for this model. +// @@ +type ModelOperations struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: string op_library_filename (repeated) + // @@ + // @@ Optional paths of the libraries providing custom operations for + // @@ this model. Valid only for ONNX models. + // @@ + OpLibraryFilename []string `protobuf:"bytes,1,rep,name=op_library_filename,json=opLibraryFilename,proto3" json:"op_library_filename,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelOperations) Reset() { + *x = ModelOperations{} + mi := &file_model_config_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelOperations) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelOperations) ProtoMessage() {} + +func (x *ModelOperations) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[15] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelOperations.ProtoReflect.Descriptor instead. +func (*ModelOperations) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{15} +} + +func (x *ModelOperations) GetOpLibraryFilename() []string { + if x != nil { + return x.OpLibraryFilename + } + return nil +} + +// @@ +// @@ .. cpp:var:: message ModelTransactionPolicy +// @@ +// @@ The specification that describes the nature of transactions +// @@ to be expected from the model. +// @@ +type ModelTransactionPolicy struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: bool decoupled + // @@ + // @@ Indicates whether responses generated by the model are decoupled with + // @@ the requests issued to it, which means the number of responses + // @@ generated by model may differ from number of requests issued, and + // @@ that the responses may be out of order relative to the order of + // @@ requests. The default is false, which means the model will generate + // @@ exactly one response for each request. + // @@ + Decoupled bool `protobuf:"varint,1,opt,name=decoupled,proto3" json:"decoupled,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelTransactionPolicy) Reset() { + *x = ModelTransactionPolicy{} + mi := &file_model_config_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelTransactionPolicy) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelTransactionPolicy) ProtoMessage() {} + +func (x *ModelTransactionPolicy) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[16] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelTransactionPolicy.ProtoReflect.Descriptor instead. +func (*ModelTransactionPolicy) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{16} +} + +func (x *ModelTransactionPolicy) GetDecoupled() bool { + if x != nil { + return x.Decoupled + } + return false +} + +// @@ +// @@.. cpp:var:: message ModelRepositoryAgents +// @@ +// @@ The repository agents for the model. +// @@ +type ModelRepositoryAgents struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ + // @@ .. cpp:var:: Agent agents (repeated) + // @@ + // @@ The ordered list of agents for the model. These agents will be + // @@ invoked in order to respond to repository actions occurring for the + // @@ model. + // @@ + Agents []*ModelRepositoryAgents_Agent `protobuf:"bytes,1,rep,name=agents,proto3" json:"agents,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelRepositoryAgents) Reset() { + *x = ModelRepositoryAgents{} + mi := &file_model_config_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelRepositoryAgents) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelRepositoryAgents) ProtoMessage() {} + +func (x *ModelRepositoryAgents) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[17] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelRepositoryAgents.ProtoReflect.Descriptor instead. +func (*ModelRepositoryAgents) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{17} +} + +func (x *ModelRepositoryAgents) GetAgents() []*ModelRepositoryAgents_Agent { + if x != nil { + return x.Agents + } + return nil +} + +// @@ +// @@.. cpp:var:: message ModelResponseCache +// @@ +// @@ The response cache setting for the model. +// @@ +type ModelResponseCache struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ + // @@ .. cpp::var:: bool enable + // @@ + // @@ Whether or not to use response cache for the model. If True, the + // @@ responses from the model are cached and when identical request + // @@ is encountered, instead of going through the model execution, + // @@ the response from the cache is utilized. By default, response + // @@ cache is disabled for the models. + // @@ + Enable bool `protobuf:"varint,1,opt,name=enable,proto3" json:"enable,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelResponseCache) Reset() { + *x = ModelResponseCache{} + mi := &file_model_config_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelResponseCache) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelResponseCache) ProtoMessage() {} + +func (x *ModelResponseCache) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[18] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelResponseCache.ProtoReflect.Descriptor instead. +func (*ModelResponseCache) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{18} +} + +func (x *ModelResponseCache) GetEnable() bool { + if x != nil { + return x.Enable + } + return false +} + +// @@ +// @@ .. cpp:var:: message ModelMetrics +// @@ +// @@ The metrics setting of this model. +// @@ NOTE: Consider reusing this message body for backend metric custom +// @@ configuration. +// @@ +type ModelMetrics struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ + // @@ .. cpp::var:: MetricControl metric_control (repeated) + // @@ + // @@ Optional custom configuration for selected metrics. + // @@ + MetricControl []*ModelMetrics_MetricControl `protobuf:"bytes,1,rep,name=metric_control,json=metricControl,proto3" json:"metric_control,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelMetrics) Reset() { + *x = ModelMetrics{} + mi := &file_model_config_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelMetrics) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelMetrics) ProtoMessage() {} + +func (x *ModelMetrics) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[19] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelMetrics.ProtoReflect.Descriptor instead. +func (*ModelMetrics) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{19} +} + +func (x *ModelMetrics) GetMetricControl() []*ModelMetrics_MetricControl { + if x != nil { + return x.MetricControl + } + return nil +} + +// @@ +// @@.. cpp:var:: message ModelConfig +// @@ +// @@ A model configuration. +// @@ +type ModelConfig struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: string name + // @@ + // @@ The name of the model. + // @@ + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // @@ .. cpp:var:: string platform + // @@ + // @@ Additional backend-specific configuration for the model. + // @@ Please refer to the backend documentation on whether this field + // @@ should be specified. + // @@ + Platform string `protobuf:"bytes,2,opt,name=platform,proto3" json:"platform,omitempty"` + // @@ .. cpp:var:: string backend + // @@ + // @@ The backend used by the model. + // @@ + Backend string `protobuf:"bytes,17,opt,name=backend,proto3" json:"backend,omitempty"` + // @@ .. cpp:var:: string runtime + // @@ + // @@ The name of the backend library file used by the model. + // @@ + Runtime string `protobuf:"bytes,25,opt,name=runtime,proto3" json:"runtime,omitempty"` + // @@ .. cpp:var:: ModelVersionPolicy version_policy + // @@ + // @@ Policy indicating which version(s) of the model will be served. + // @@ + VersionPolicy *ModelVersionPolicy `protobuf:"bytes,3,opt,name=version_policy,json=versionPolicy,proto3" json:"version_policy,omitempty"` + // @@ .. cpp:var:: int32 max_batch_size + // @@ + // @@ Maximum batch size allowed for inference. This can only decrease + // @@ what is allowed by the model itself. A max_batch_size value of 0 + // @@ indicates that batching is not allowed for the model and the + // @@ dimension/shape of the input and output tensors must exactly + // @@ match what is specified in the input and output configuration. A + // @@ max_batch_size value > 0 indicates that batching is allowed and + // @@ so the model expects the input tensors to have an additional + // @@ initial dimension for the batching that is not specified in the + // @@ input (for example, if the model supports batched inputs of + // @@ 2-dimensional tensors then the model configuration will specify + // @@ the input shape as [ X, Y ] but the model will expect the actual + // @@ input tensors to have shape [ N, X, Y ]). For max_batch_size > 0 + // @@ returned outputs will also have an additional initial dimension + // @@ for the batch. + // @@ + MaxBatchSize int32 `protobuf:"varint,4,opt,name=max_batch_size,json=maxBatchSize,proto3" json:"max_batch_size,omitempty"` + // @@ .. cpp:var:: ModelInput input (repeated) + // @@ + // @@ The inputs request by the model. + // @@ + Input []*ModelInput `protobuf:"bytes,5,rep,name=input,proto3" json:"input,omitempty"` + // @@ .. cpp:var:: ModelOutput output (repeated) + // @@ + // @@ The outputs produced by the model. + // @@ + Output []*ModelOutput `protobuf:"bytes,6,rep,name=output,proto3" json:"output,omitempty"` + // @@ .. cpp:var:: BatchInput batch_input (repeated) + // @@ + // @@ The model input(s) that the server should use to communicate + // @@ batch related values to the model. + // @@ + BatchInput []*BatchInput `protobuf:"bytes,20,rep,name=batch_input,json=batchInput,proto3" json:"batch_input,omitempty"` + // @@ .. cpp:var:: BatchOutput batch_output (repeated) + // @@ + // @@ The outputs produced by the model that requires special handling + // @@ by the model backend. + // @@ + BatchOutput []*BatchOutput `protobuf:"bytes,21,rep,name=batch_output,json=batchOutput,proto3" json:"batch_output,omitempty"` + // @@ .. cpp:var:: ModelOptimizationPolicy optimization + // @@ + // @@ Optimization configuration for the model. If not specified + // @@ then default optimization policy is used. + // @@ + Optimization *ModelOptimizationPolicy `protobuf:"bytes,12,opt,name=optimization,proto3" json:"optimization,omitempty"` + // @@ .. cpp:var:: oneof scheduling_choice + // @@ + // @@ The scheduling policy for the model. If not specified the + // @@ default scheduling policy is used for the model. The default + // @@ policy is to execute each inference request independently. + // @@ + // + // Types that are valid to be assigned to SchedulingChoice: + // + // *ModelConfig_DynamicBatching + // *ModelConfig_SequenceBatching + // *ModelConfig_EnsembleScheduling + SchedulingChoice isModelConfig_SchedulingChoice `protobuf_oneof:"scheduling_choice"` + // @@ .. cpp:var:: ModelInstanceGroup instance_group (repeated) + // @@ + // @@ Instances of this model. If not specified, one instance + // @@ of the model will be instantiated on each available GPU. + // @@ + InstanceGroup []*ModelInstanceGroup `protobuf:"bytes,7,rep,name=instance_group,json=instanceGroup,proto3" json:"instance_group,omitempty"` + // @@ .. cpp:var:: string default_model_filename + // @@ + // @@ Optional filename of the model file to use if a + // @@ compute-capability specific model is not specified in + // @@ :cpp:var:`cc_model_filenames`. If not specified the default name + // @@ is 'model.graphdef', 'model.savedmodel', 'model.plan' or + // @@ 'model.pt' depending on the model type. + // @@ + DefaultModelFilename string `protobuf:"bytes,8,opt,name=default_model_filename,json=defaultModelFilename,proto3" json:"default_model_filename,omitempty"` + // @@ .. cpp:var:: map cc_model_filenames + // @@ + // @@ Optional map from CUDA compute capability to the filename of + // @@ the model that supports that compute capability. The filename + // @@ refers to a file within the model version directory. + // @@ + CcModelFilenames map[string]string `protobuf:"bytes,9,rep,name=cc_model_filenames,json=ccModelFilenames,proto3" json:"cc_model_filenames,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // @@ .. cpp:var:: map metric_tags + // @@ + // @@ Optional metric tags. User-specific key-value pairs for metrics + // @@ reported for this model. These tags are applied to the metrics + // @@ reported on the HTTP metrics port. + // @@ + MetricTags map[string]string `protobuf:"bytes,10,rep,name=metric_tags,json=metricTags,proto3" json:"metric_tags,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // @@ .. cpp:var:: map parameters + // @@ + // @@ Optional model parameters. User-specified parameter values. + // @@ + Parameters map[string]*ModelParameter `protobuf:"bytes,14,rep,name=parameters,proto3" json:"parameters,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // @@ .. cpp:var:: ModelWarmup model_warmup (repeated) + // @@ + // @@ Warmup setting of this model. If specified, all instances + // @@ will be run with the request samples in sequence before + // @@ serving the model. + // @@ This field can only be specified if the model is not an ensemble + // @@ model. + // @@ + ModelWarmup []*ModelWarmup `protobuf:"bytes,16,rep,name=model_warmup,json=modelWarmup,proto3" json:"model_warmup,omitempty"` + // @@ .. cpp:var:: ModelOperations model_operations + // @@ + // @@ Optional metadata of the libraries providing custom operations for + // @@ this model. + // @@ + ModelOperations *ModelOperations `protobuf:"bytes,18,opt,name=model_operations,json=modelOperations,proto3" json:"model_operations,omitempty"` + // @@ .. cpp:var:: ModelTransactionPolicy model_transaction_policy + // @@ + // @@ Optional specification that describes the nature of transactions + // @@ to be expected from the model. + // @@ + ModelTransactionPolicy *ModelTransactionPolicy `protobuf:"bytes,19,opt,name=model_transaction_policy,json=modelTransactionPolicy,proto3" json:"model_transaction_policy,omitempty"` + // @@ .. cpp:var:: ModelRepositoryAgents model_repository_agents + // @@ + // @@ Optional specification of the agent(s) that should be invoked + // @@ with repository actions are performed for this model. + // @@ + ModelRepositoryAgents *ModelRepositoryAgents `protobuf:"bytes,23,opt,name=model_repository_agents,json=modelRepositoryAgents,proto3" json:"model_repository_agents,omitempty"` + // @@ .. cpp:var:: ModelResponseCache response_cache + // @@ + // @@ Optional setting for utilizing the response cache for this + // @@ model. + // @@ + ResponseCache *ModelResponseCache `protobuf:"bytes,24,opt,name=response_cache,json=responseCache,proto3" json:"response_cache,omitempty"` + // @@ .. cpp:var:: ModelMetrics model_metrics + // @@ + // @@ Optional setting for custom metrics configuration for this model. + // @@ Application default is applied to metrics that are not specified. + // @@ + ModelMetrics *ModelMetrics `protobuf:"bytes,26,opt,name=model_metrics,json=modelMetrics,proto3" json:"model_metrics,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelConfig) Reset() { + *x = ModelConfig{} + mi := &file_model_config_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelConfig) ProtoMessage() {} + +func (x *ModelConfig) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[20] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelConfig.ProtoReflect.Descriptor instead. +func (*ModelConfig) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{20} +} + +func (x *ModelConfig) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ModelConfig) GetPlatform() string { + if x != nil { + return x.Platform + } + return "" +} + +func (x *ModelConfig) GetBackend() string { + if x != nil { + return x.Backend + } + return "" +} + +func (x *ModelConfig) GetRuntime() string { + if x != nil { + return x.Runtime + } + return "" +} + +func (x *ModelConfig) GetVersionPolicy() *ModelVersionPolicy { + if x != nil { + return x.VersionPolicy + } + return nil +} + +func (x *ModelConfig) GetMaxBatchSize() int32 { + if x != nil { + return x.MaxBatchSize + } + return 0 +} + +func (x *ModelConfig) GetInput() []*ModelInput { + if x != nil { + return x.Input + } + return nil +} + +func (x *ModelConfig) GetOutput() []*ModelOutput { + if x != nil { + return x.Output + } + return nil +} + +func (x *ModelConfig) GetBatchInput() []*BatchInput { + if x != nil { + return x.BatchInput + } + return nil +} + +func (x *ModelConfig) GetBatchOutput() []*BatchOutput { + if x != nil { + return x.BatchOutput + } + return nil +} + +func (x *ModelConfig) GetOptimization() *ModelOptimizationPolicy { + if x != nil { + return x.Optimization + } + return nil +} + +func (x *ModelConfig) GetSchedulingChoice() isModelConfig_SchedulingChoice { + if x != nil { + return x.SchedulingChoice + } + return nil +} + +func (x *ModelConfig) GetDynamicBatching() *ModelDynamicBatching { + if x != nil { + if x, ok := x.SchedulingChoice.(*ModelConfig_DynamicBatching); ok { + return x.DynamicBatching + } + } + return nil +} + +func (x *ModelConfig) GetSequenceBatching() *ModelSequenceBatching { + if x != nil { + if x, ok := x.SchedulingChoice.(*ModelConfig_SequenceBatching); ok { + return x.SequenceBatching + } + } + return nil +} + +func (x *ModelConfig) GetEnsembleScheduling() *ModelEnsembling { + if x != nil { + if x, ok := x.SchedulingChoice.(*ModelConfig_EnsembleScheduling); ok { + return x.EnsembleScheduling + } + } + return nil +} + +func (x *ModelConfig) GetInstanceGroup() []*ModelInstanceGroup { + if x != nil { + return x.InstanceGroup + } + return nil +} + +func (x *ModelConfig) GetDefaultModelFilename() string { + if x != nil { + return x.DefaultModelFilename + } + return "" +} + +func (x *ModelConfig) GetCcModelFilenames() map[string]string { + if x != nil { + return x.CcModelFilenames + } + return nil +} + +func (x *ModelConfig) GetMetricTags() map[string]string { + if x != nil { + return x.MetricTags + } + return nil +} + +func (x *ModelConfig) GetParameters() map[string]*ModelParameter { + if x != nil { + return x.Parameters + } + return nil +} + +func (x *ModelConfig) GetModelWarmup() []*ModelWarmup { + if x != nil { + return x.ModelWarmup + } + return nil +} + +func (x *ModelConfig) GetModelOperations() *ModelOperations { + if x != nil { + return x.ModelOperations + } + return nil +} + +func (x *ModelConfig) GetModelTransactionPolicy() *ModelTransactionPolicy { + if x != nil { + return x.ModelTransactionPolicy + } + return nil +} + +func (x *ModelConfig) GetModelRepositoryAgents() *ModelRepositoryAgents { + if x != nil { + return x.ModelRepositoryAgents + } + return nil +} + +func (x *ModelConfig) GetResponseCache() *ModelResponseCache { + if x != nil { + return x.ResponseCache + } + return nil +} + +func (x *ModelConfig) GetModelMetrics() *ModelMetrics { + if x != nil { + return x.ModelMetrics + } + return nil +} + +type isModelConfig_SchedulingChoice interface { + isModelConfig_SchedulingChoice() +} + +type ModelConfig_DynamicBatching struct { + // @@ .. cpp:var:: ModelDynamicBatching dynamic_batching + // @@ + // @@ If specified, enables the dynamic-batching scheduling + // @@ policy. With dynamic-batching the scheduler may group + // @@ together independent requests into a single batch to + // @@ improve inference throughput. + // @@ + DynamicBatching *ModelDynamicBatching `protobuf:"bytes,11,opt,name=dynamic_batching,json=dynamicBatching,proto3,oneof"` +} + +type ModelConfig_SequenceBatching struct { + // @@ .. cpp:var:: ModelSequenceBatching sequence_batching + // @@ + // @@ If specified, enables the sequence-batching scheduling + // @@ policy. With sequence-batching, inference requests + // @@ with the same correlation ID are routed to the same + // @@ model instance. Multiple sequences of inference requests + // @@ may be batched together into a single batch to + // @@ improve inference throughput. + // @@ + SequenceBatching *ModelSequenceBatching `protobuf:"bytes,13,opt,name=sequence_batching,json=sequenceBatching,proto3,oneof"` +} + +type ModelConfig_EnsembleScheduling struct { + // @@ .. cpp:var:: ModelEnsembling ensemble_scheduling + // @@ + // @@ If specified, enables the model-ensembling scheduling + // @@ policy. With model-ensembling, inference requests + // @@ will be processed according to the specification, such as an + // @@ execution sequence of models. The input specified in this model + // @@ config will be the input for the ensemble, and the output + // @@ specified will be the output of the ensemble. + // @@ + EnsembleScheduling *ModelEnsembling `protobuf:"bytes,15,opt,name=ensemble_scheduling,json=ensembleScheduling,proto3,oneof"` +} + +func (*ModelConfig_DynamicBatching) isModelConfig_SchedulingChoice() {} + +func (*ModelConfig_SequenceBatching) isModelConfig_SchedulingChoice() {} + +func (*ModelConfig_EnsembleScheduling) isModelConfig_SchedulingChoice() {} + +// @@ .. cpp:var:: message Resource +// @@ +// @@ The resource property. +// @@ +type ModelRateLimiter_Resource struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: string name + // @@ + // @@ The name associated with the resource. + // @@ + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // @@ .. cpp:var:: bool global + // @@ + // @@ Whether or not the resource is global. If true then the resource + // @@ is assumed to be shared among the devices otherwise specified + // @@ count of the resource is assumed for each device associated + // @@ with the instance. + // @@ + Global bool `protobuf:"varint,2,opt,name=global,proto3" json:"global,omitempty"` + // @@ .. cpp:var:: uint32 count + // @@ + // @@ The number of resources required for the execution of the model + // @@ instance. + // @@ + Count uint32 `protobuf:"varint,3,opt,name=count,proto3" json:"count,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelRateLimiter_Resource) Reset() { + *x = ModelRateLimiter_Resource{} + mi := &file_model_config_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelRateLimiter_Resource) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelRateLimiter_Resource) ProtoMessage() {} + +func (x *ModelRateLimiter_Resource) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[21] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelRateLimiter_Resource.ProtoReflect.Descriptor instead. +func (*ModelRateLimiter_Resource) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *ModelRateLimiter_Resource) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ModelRateLimiter_Resource) GetGlobal() bool { + if x != nil { + return x.Global + } + return false +} + +func (x *ModelRateLimiter_Resource) GetCount() uint32 { + if x != nil { + return x.Count + } + return 0 +} + +// @@ +// @@ .. cpp:var:: message SecondaryDevice +// @@ +// @@ A secondary device required for a model instance. +// @@ +type ModelInstanceGroup_SecondaryDevice struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: SecondaryDeviceKind kind + // @@ + // @@ The secondary device kind. + // @@ + Kind ModelInstanceGroup_SecondaryDevice_SecondaryDeviceKind `protobuf:"varint,1,opt,name=kind,proto3,enum=inference.ModelInstanceGroup_SecondaryDevice_SecondaryDeviceKind" json:"kind,omitempty"` + // @@ .. cpp:var:: int64 device_id + // @@ + // @@ Identifier for the secondary device. + // @@ + DeviceId int64 `protobuf:"varint,2,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelInstanceGroup_SecondaryDevice) Reset() { + *x = ModelInstanceGroup_SecondaryDevice{} + mi := &file_model_config_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelInstanceGroup_SecondaryDevice) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelInstanceGroup_SecondaryDevice) ProtoMessage() {} + +func (x *ModelInstanceGroup_SecondaryDevice) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[22] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelInstanceGroup_SecondaryDevice.ProtoReflect.Descriptor instead. +func (*ModelInstanceGroup_SecondaryDevice) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{1, 0} +} + +func (x *ModelInstanceGroup_SecondaryDevice) GetKind() ModelInstanceGroup_SecondaryDevice_SecondaryDeviceKind { + if x != nil { + return x.Kind + } + return ModelInstanceGroup_SecondaryDevice_KIND_NVDLA +} + +func (x *ModelInstanceGroup_SecondaryDevice) GetDeviceId() int64 { + if x != nil { + return x.DeviceId + } + return 0 +} + +// @@ .. cpp:var:: message Latest +// @@ +// @@ Serve only the latest version(s) of a model. This is +// @@ the default policy. +// @@ +type ModelVersionPolicy_Latest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: uint32 num_versions + // @@ + // @@ Serve only the 'num_versions' highest-numbered versions. T + // @@ The default value of 'num_versions' is 1, indicating that by + // @@ default only the single highest-number version of a + // @@ model will be served. + // @@ + NumVersions uint32 `protobuf:"varint,1,opt,name=num_versions,json=numVersions,proto3" json:"num_versions,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelVersionPolicy_Latest) Reset() { + *x = ModelVersionPolicy_Latest{} + mi := &file_model_config_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelVersionPolicy_Latest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelVersionPolicy_Latest) ProtoMessage() {} + +func (x *ModelVersionPolicy_Latest) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[23] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelVersionPolicy_Latest.ProtoReflect.Descriptor instead. +func (*ModelVersionPolicy_Latest) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{7, 0} +} + +func (x *ModelVersionPolicy_Latest) GetNumVersions() uint32 { + if x != nil { + return x.NumVersions + } + return 0 +} + +// @@ .. cpp:var:: message All +// @@ +// @@ Serve all versions of the model. +// @@ +type ModelVersionPolicy_All struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelVersionPolicy_All) Reset() { + *x = ModelVersionPolicy_All{} + mi := &file_model_config_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelVersionPolicy_All) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelVersionPolicy_All) ProtoMessage() {} + +func (x *ModelVersionPolicy_All) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[24] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelVersionPolicy_All.ProtoReflect.Descriptor instead. +func (*ModelVersionPolicy_All) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{7, 1} +} + +// @@ .. cpp:var:: message Specific +// @@ +// @@ Serve only specific versions of the model. +// @@ +type ModelVersionPolicy_Specific struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: int64 versions (repeated) + // @@ + // @@ The specific versions of the model that will be served. + // @@ + Versions []int64 `protobuf:"varint,1,rep,packed,name=versions,proto3" json:"versions,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelVersionPolicy_Specific) Reset() { + *x = ModelVersionPolicy_Specific{} + mi := &file_model_config_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelVersionPolicy_Specific) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelVersionPolicy_Specific) ProtoMessage() {} + +func (x *ModelVersionPolicy_Specific) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[25] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelVersionPolicy_Specific.ProtoReflect.Descriptor instead. +func (*ModelVersionPolicy_Specific) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{7, 2} +} + +func (x *ModelVersionPolicy_Specific) GetVersions() []int64 { + if x != nil { + return x.Versions + } + return nil +} + +// @@ +// @@ .. cpp:var:: message Graph +// @@ +// @@ Enable generic graph optimization of the model. If not specified +// @@ the framework's default level of optimization is used. Supports +// @@ TensorFlow graphdef and savedmodel and Onnx models. For TensorFlow +// @@ causes XLA to be enabled/disabled for the model. For Onnx defaults +// @@ to enabling all optimizations, -1 enables only basic optimizations, +// @@ +1 enables only basic and extended optimizations. +// @@ +type ModelOptimizationPolicy_Graph struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: int32 level + // @@ + // @@ The optimization level. Defaults to 0 (zero) if not specified. + // @@ + // @@ - -1: Disabled + // @@ - 0: Framework default + // @@ - 1+: Enable optimization level (greater values indicate + // @@ higher optimization levels) + // @@ + Level int32 `protobuf:"varint,1,opt,name=level,proto3" json:"level,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelOptimizationPolicy_Graph) Reset() { + *x = ModelOptimizationPolicy_Graph{} + mi := &file_model_config_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelOptimizationPolicy_Graph) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelOptimizationPolicy_Graph) ProtoMessage() {} + +func (x *ModelOptimizationPolicy_Graph) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[26] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelOptimizationPolicy_Graph.ProtoReflect.Descriptor instead. +func (*ModelOptimizationPolicy_Graph) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{8, 0} +} + +func (x *ModelOptimizationPolicy_Graph) GetLevel() int32 { + if x != nil { + return x.Level + } + return 0 +} + +// @@ +// @@ .. cpp:var:: message Cuda +// @@ +// @@ CUDA-specific optimization settings. +// @@ +type ModelOptimizationPolicy_Cuda struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: bool graphs + // @@ + // @@ Use CUDA graphs API to capture model operations and execute + // @@ them more efficiently. Default value is false. + // @@ Currently only recognized by TensorRT backend. + // @@ + Graphs bool `protobuf:"varint,1,opt,name=graphs,proto3" json:"graphs,omitempty"` + // @@ .. cpp:var:: bool busy_wait_events + // @@ + // @@ Use busy-waiting to synchronize CUDA events to achieve minimum + // @@ latency from event complete to host thread to be notified, with + // @@ the cost of high CPU load. Default value is false. + // @@ Currently only recognized by TensorRT backend. + // @@ + BusyWaitEvents bool `protobuf:"varint,2,opt,name=busy_wait_events,json=busyWaitEvents,proto3" json:"busy_wait_events,omitempty"` + // @@ .. cpp:var:: GraphSpec graph_spec (repeated) + // @@ + // @@ Specification of the CUDA graph to be captured. If not specified + // @@ and 'graphs' is true, the default CUDA graphs will be captured + // @@ based on model settings. + // @@ Currently only recognized by TensorRT backend. + // @@ + GraphSpec []*ModelOptimizationPolicy_Cuda_GraphSpec `protobuf:"bytes,3,rep,name=graph_spec,json=graphSpec,proto3" json:"graph_spec,omitempty"` + // @@ .. cpp:var:: bool output_copy_stream + // @@ + // @@ Uses a CUDA stream separate from the inference stream to copy the + // @@ output to host. However, be aware that setting this option to + // @@ true will lead to an increase in the memory consumption of the + // @@ model as Triton will allocate twice as much GPU memory for its + // @@ I/O tensor buffers. Default value is false. + // @@ Currently only recognized by TensorRT backend. + // @@ + OutputCopyStream bool `protobuf:"varint,4,opt,name=output_copy_stream,json=outputCopyStream,proto3" json:"output_copy_stream,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelOptimizationPolicy_Cuda) Reset() { + *x = ModelOptimizationPolicy_Cuda{} + mi := &file_model_config_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelOptimizationPolicy_Cuda) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelOptimizationPolicy_Cuda) ProtoMessage() {} + +func (x *ModelOptimizationPolicy_Cuda) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[27] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelOptimizationPolicy_Cuda.ProtoReflect.Descriptor instead. +func (*ModelOptimizationPolicy_Cuda) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{8, 1} +} + +func (x *ModelOptimizationPolicy_Cuda) GetGraphs() bool { + if x != nil { + return x.Graphs + } + return false +} + +func (x *ModelOptimizationPolicy_Cuda) GetBusyWaitEvents() bool { + if x != nil { + return x.BusyWaitEvents + } + return false +} + +func (x *ModelOptimizationPolicy_Cuda) GetGraphSpec() []*ModelOptimizationPolicy_Cuda_GraphSpec { + if x != nil { + return x.GraphSpec + } + return nil +} + +func (x *ModelOptimizationPolicy_Cuda) GetOutputCopyStream() bool { + if x != nil { + return x.OutputCopyStream + } + return false +} + +// @@ +// @@ .. cpp:var:: message ExecutionAccelerators +// @@ +// @@ Specify the preferred execution accelerators to be used to execute +// @@ the model. Currently only recognized by ONNX Runtime backend and +// @@ TensorFlow backend. +// @@ +// @@ For ONNX Runtime backend, it will deploy the model with the execution +// @@ accelerators by priority, the priority is determined based on the +// @@ order that they are set, i.e. the provider at the front has highest +// @@ priority. Overall, the priority will be in the following order: +// @@ (if instance is on GPU) +// @@ CUDA Execution Provider (if instance is on GPU) +// @@ +// @@ Default CPU Execution Provider +// @@ +type ModelOptimizationPolicy_ExecutionAccelerators struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: Accelerator gpu_execution_accelerator (repeated) + // @@ + // @@ The preferred execution provider to be used if the model instance + // @@ is deployed on GPU. + // @@ + // @@ For ONNX Runtime backend, possible value is "tensorrt" as name, + // @@ and no parameters are required. + // @@ + // @@ For TensorFlow backend, possible values are "tensorrt", + // @@ "auto_mixed_precision", "gpu_io". + // @@ + // @@ For "tensorrt", the following parameters can be specified: + // @@ "precision_mode": The precision used for optimization. + // @@ Allowed values are "FP32" and "FP16". Default value is "FP32". + // @@ + // @@ "max_cached_engines": The maximum number of cached TensorRT + // @@ engines in dynamic TensorRT ops. Default value is 100. + // @@ + // @@ "minimum_segment_size": The smallest model subgraph that will + // @@ be considered for optimization by TensorRT. Default value is 3. + // @@ + // @@ "max_workspace_size_bytes": The maximum GPU memory the model + // @@ can use temporarily during execution. Default value is 1GB. + // @@ + // @@ For "auto_mixed_precision", no parameters are required. If set, + // @@ the model will try to use FP16 for better performance. + // @@ This optimization can not be set with "tensorrt". + // @@ + // @@ For "gpu_io", no parameters are required. If set, the model will + // @@ be executed using TensorFlow Callable API to set input and output + // @@ tensors in GPU memory if possible, which can reduce data transfer + // @@ overhead if the model is used in ensemble. However, the Callable + // @@ object will be created on model creation and it will request all + // @@ outputs for every model execution, which may impact the + // @@ performance if a request does not require all outputs. This + // @@ optimization will only take affect if the model instance is + // @@ created with KIND_GPU. + // @@ + GpuExecutionAccelerator []*ModelOptimizationPolicy_ExecutionAccelerators_Accelerator `protobuf:"bytes,1,rep,name=gpu_execution_accelerator,json=gpuExecutionAccelerator,proto3" json:"gpu_execution_accelerator,omitempty"` + // @@ .. cpp:var:: Accelerator cpu_execution_accelerator (repeated) + // @@ + // @@ The preferred execution provider to be used if the model instance + // @@ is deployed on CPU. + // @@ + // @@ For ONNX Runtime backend, possible value is "openvino" as name, + // @@ and no parameters are required. + // @@ + CpuExecutionAccelerator []*ModelOptimizationPolicy_ExecutionAccelerators_Accelerator `protobuf:"bytes,2,rep,name=cpu_execution_accelerator,json=cpuExecutionAccelerator,proto3" json:"cpu_execution_accelerator,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelOptimizationPolicy_ExecutionAccelerators) Reset() { + *x = ModelOptimizationPolicy_ExecutionAccelerators{} + mi := &file_model_config_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelOptimizationPolicy_ExecutionAccelerators) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelOptimizationPolicy_ExecutionAccelerators) ProtoMessage() {} + +func (x *ModelOptimizationPolicy_ExecutionAccelerators) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[28] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelOptimizationPolicy_ExecutionAccelerators.ProtoReflect.Descriptor instead. +func (*ModelOptimizationPolicy_ExecutionAccelerators) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{8, 2} +} + +func (x *ModelOptimizationPolicy_ExecutionAccelerators) GetGpuExecutionAccelerator() []*ModelOptimizationPolicy_ExecutionAccelerators_Accelerator { + if x != nil { + return x.GpuExecutionAccelerator + } + return nil +} + +func (x *ModelOptimizationPolicy_ExecutionAccelerators) GetCpuExecutionAccelerator() []*ModelOptimizationPolicy_ExecutionAccelerators_Accelerator { + if x != nil { + return x.CpuExecutionAccelerator + } + return nil +} + +// @@ +// @@ .. cpp:var:: message PinnedMemoryBuffer +// @@ +// @@ Specify whether to use a pinned memory buffer when transferring data +// @@ between non-pinned system memory and GPU memory. Using a pinned +// @@ memory buffer for system from/to GPU transfers will typically provide +// @@ increased performance. For example, in the common use case where the +// @@ request provides inputs and delivers outputs via non-pinned system +// @@ memory, if the model instance accepts GPU IOs, the inputs will be +// @@ processed by two copies: from non-pinned system memory to pinned +// @@ memory, and from pinned memory to GPU memory. Similarly, pinned +// @@ memory will be used for delivering the outputs. +// @@ +type ModelOptimizationPolicy_PinnedMemoryBuffer struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: bool enable + // @@ + // @@ Use pinned memory buffer. Default is true. + // @@ + Enable bool `protobuf:"varint,1,opt,name=enable,proto3" json:"enable,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelOptimizationPolicy_PinnedMemoryBuffer) Reset() { + *x = ModelOptimizationPolicy_PinnedMemoryBuffer{} + mi := &file_model_config_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelOptimizationPolicy_PinnedMemoryBuffer) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelOptimizationPolicy_PinnedMemoryBuffer) ProtoMessage() {} + +func (x *ModelOptimizationPolicy_PinnedMemoryBuffer) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[29] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelOptimizationPolicy_PinnedMemoryBuffer.ProtoReflect.Descriptor instead. +func (*ModelOptimizationPolicy_PinnedMemoryBuffer) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{8, 3} +} + +func (x *ModelOptimizationPolicy_PinnedMemoryBuffer) GetEnable() bool { + if x != nil { + return x.Enable + } + return false +} + +// @@ .. cpp:var:: message GraphSpec +// @@ +// @@ Specification of the CUDA graph to be captured. +// @@ +type ModelOptimizationPolicy_Cuda_GraphSpec struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: int32 batch_size + // @@ + // @@ The batch size of the CUDA graph. If 'max_batch_size' is 0, + // @@ 'batch_size' must be set to 0. Otherwise, 'batch_size' must + // @@ be set to value between 1 and 'max_batch_size'. + // @@ + BatchSize int32 `protobuf:"varint,1,opt,name=batch_size,json=batchSize,proto3" json:"batch_size,omitempty"` + // @@ .. cpp:var:: map input + // @@ + // @@ The specification of the inputs. 'Shape' is the shape of the + // @@ input without batching dimension. + // @@ + Input map[string]*ModelOptimizationPolicy_Cuda_GraphSpec_Shape `protobuf:"bytes,2,rep,name=input,proto3" json:"input,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // @@ .. cpp:var:: LowerBound graph_lower_bound + // @@ + // @@ Specify the lower bound of the CUDA graph. Optional. + // @@ If specified, the graph can be used for input shapes and + // @@ batch sizes that are in closed interval between the lower + // @@ bound specification and graph specification. For dynamic + // @@ shape model, this allows CUDA graphs to be launched + // @@ frequently without capturing all possible shape combinations. + // @@ However, using graph for shape combinations different from + // @@ the one used for capturing introduces uninitialized data for + // @@ execution and it may distort the inference result if + // @@ the model is sensitive to uninitialized data. + // @@ + GraphLowerBound *ModelOptimizationPolicy_Cuda_GraphSpec_LowerBound `protobuf:"bytes,3,opt,name=graph_lower_bound,json=graphLowerBound,proto3" json:"graph_lower_bound,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelOptimizationPolicy_Cuda_GraphSpec) Reset() { + *x = ModelOptimizationPolicy_Cuda_GraphSpec{} + mi := &file_model_config_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelOptimizationPolicy_Cuda_GraphSpec) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelOptimizationPolicy_Cuda_GraphSpec) ProtoMessage() {} + +func (x *ModelOptimizationPolicy_Cuda_GraphSpec) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[30] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelOptimizationPolicy_Cuda_GraphSpec.ProtoReflect.Descriptor instead. +func (*ModelOptimizationPolicy_Cuda_GraphSpec) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{8, 1, 0} +} + +func (x *ModelOptimizationPolicy_Cuda_GraphSpec) GetBatchSize() int32 { + if x != nil { + return x.BatchSize + } + return 0 +} + +func (x *ModelOptimizationPolicy_Cuda_GraphSpec) GetInput() map[string]*ModelOptimizationPolicy_Cuda_GraphSpec_Shape { + if x != nil { + return x.Input + } + return nil +} + +func (x *ModelOptimizationPolicy_Cuda_GraphSpec) GetGraphLowerBound() *ModelOptimizationPolicy_Cuda_GraphSpec_LowerBound { + if x != nil { + return x.GraphLowerBound + } + return nil +} + +// @@ .. cpp:var:: message Dims +// @@ +// @@ Specification of tensor dimension. +// @@ +type ModelOptimizationPolicy_Cuda_GraphSpec_Shape struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: int64 dim (repeated) + // @@ + // @@ The dimension. + // @@ + Dim []int64 `protobuf:"varint,1,rep,packed,name=dim,proto3" json:"dim,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelOptimizationPolicy_Cuda_GraphSpec_Shape) Reset() { + *x = ModelOptimizationPolicy_Cuda_GraphSpec_Shape{} + mi := &file_model_config_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelOptimizationPolicy_Cuda_GraphSpec_Shape) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelOptimizationPolicy_Cuda_GraphSpec_Shape) ProtoMessage() {} + +func (x *ModelOptimizationPolicy_Cuda_GraphSpec_Shape) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[31] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelOptimizationPolicy_Cuda_GraphSpec_Shape.ProtoReflect.Descriptor instead. +func (*ModelOptimizationPolicy_Cuda_GraphSpec_Shape) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{8, 1, 0, 0} +} + +func (x *ModelOptimizationPolicy_Cuda_GraphSpec_Shape) GetDim() []int64 { + if x != nil { + return x.Dim + } + return nil +} + +type ModelOptimizationPolicy_Cuda_GraphSpec_LowerBound struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: int32 batch_size + // @@ + // @@ The batch size of the CUDA graph. If 'max_batch_size' is 0, + // @@ 'batch_size' must be set to 0. Otherwise, 'batch_size' must + // @@ be set to value between 1 and 'max_batch_size'. + // @@ + BatchSize int32 `protobuf:"varint,1,opt,name=batch_size,json=batchSize,proto3" json:"batch_size,omitempty"` + // @@ .. cpp:var:: map input + // @@ + // @@ The specification of the inputs. 'Shape' is the shape of + // @@ the input without batching dimension. + // @@ + Input map[string]*ModelOptimizationPolicy_Cuda_GraphSpec_Shape `protobuf:"bytes,2,rep,name=input,proto3" json:"input,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelOptimizationPolicy_Cuda_GraphSpec_LowerBound) Reset() { + *x = ModelOptimizationPolicy_Cuda_GraphSpec_LowerBound{} + mi := &file_model_config_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelOptimizationPolicy_Cuda_GraphSpec_LowerBound) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelOptimizationPolicy_Cuda_GraphSpec_LowerBound) ProtoMessage() {} + +func (x *ModelOptimizationPolicy_Cuda_GraphSpec_LowerBound) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[32] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelOptimizationPolicy_Cuda_GraphSpec_LowerBound.ProtoReflect.Descriptor instead. +func (*ModelOptimizationPolicy_Cuda_GraphSpec_LowerBound) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{8, 1, 0, 1} +} + +func (x *ModelOptimizationPolicy_Cuda_GraphSpec_LowerBound) GetBatchSize() int32 { + if x != nil { + return x.BatchSize + } + return 0 +} + +func (x *ModelOptimizationPolicy_Cuda_GraphSpec_LowerBound) GetInput() map[string]*ModelOptimizationPolicy_Cuda_GraphSpec_Shape { + if x != nil { + return x.Input + } + return nil +} + +// @@ +// @@ .. cpp:var:: message Accelerator +// @@ +// @@ Specify the accelerator to be used to execute the model. +// @@ Accelerator with the same name may accept different parameters +// @@ depending on the backends. +// @@ +type ModelOptimizationPolicy_ExecutionAccelerators_Accelerator struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: string name + // @@ + // @@ The name of the execution accelerator. + // @@ + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // @@ .. cpp:var:: map parameters + // @@ + // @@ Additional parameters used to configure the accelerator. + // @@ + Parameters map[string]string `protobuf:"bytes,2,rep,name=parameters,proto3" json:"parameters,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelOptimizationPolicy_ExecutionAccelerators_Accelerator) Reset() { + *x = ModelOptimizationPolicy_ExecutionAccelerators_Accelerator{} + mi := &file_model_config_proto_msgTypes[35] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelOptimizationPolicy_ExecutionAccelerators_Accelerator) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelOptimizationPolicy_ExecutionAccelerators_Accelerator) ProtoMessage() {} + +func (x *ModelOptimizationPolicy_ExecutionAccelerators_Accelerator) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[35] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelOptimizationPolicy_ExecutionAccelerators_Accelerator.ProtoReflect.Descriptor instead. +func (*ModelOptimizationPolicy_ExecutionAccelerators_Accelerator) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{8, 2, 0} +} + +func (x *ModelOptimizationPolicy_ExecutionAccelerators_Accelerator) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ModelOptimizationPolicy_ExecutionAccelerators_Accelerator) GetParameters() map[string]string { + if x != nil { + return x.Parameters + } + return nil +} + +// @@ .. cpp:var:: message Control +// @@ +// @@ A control is a signal that the sequence batcher uses to +// @@ communicate with a backend. +// @@ +type ModelSequenceBatching_Control struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: Kind kind + // @@ + // @@ The kind of this control. + // @@ + Kind ModelSequenceBatching_Control_Kind `protobuf:"varint,1,opt,name=kind,proto3,enum=inference.ModelSequenceBatching_Control_Kind" json:"kind,omitempty"` + // @@ .. cpp:var:: int32 int32_false_true (repeated) + // @@ + // @@ The control's true and false setting is indicated by setting + // @@ a value in an int32 tensor. The tensor must be a + // @@ 1-dimensional tensor with size equal to the batch size of + // @@ the request. 'int32_false_true' must have two entries: the + // @@ first the false value and the second the true value. + // @@ + Int32FalseTrue []int32 `protobuf:"varint,2,rep,packed,name=int32_false_true,json=int32FalseTrue,proto3" json:"int32_false_true,omitempty"` + // @@ .. cpp:var:: float fp32_false_true (repeated) + // @@ + // @@ The control's true and false setting is indicated by setting + // @@ a value in a fp32 tensor. The tensor must be a + // @@ 1-dimensional tensor with size equal to the batch size of + // @@ the request. 'fp32_false_true' must have two entries: the + // @@ first the false value and the second the true value. + // @@ + Fp32FalseTrue []float32 `protobuf:"fixed32,3,rep,packed,name=fp32_false_true,json=fp32FalseTrue,proto3" json:"fp32_false_true,omitempty"` + // @@ .. cpp:var:: bool bool_false_true (repeated) + // @@ + // @@ The control's true and false setting is indicated by setting + // @@ a value in a bool tensor. The tensor must be a + // @@ 1-dimensional tensor with size equal to the batch size of + // @@ the request. 'bool_false_true' must have two entries: the + // @@ first the false value and the second the true value. + // @@ + BoolFalseTrue []bool `protobuf:"varint,5,rep,packed,name=bool_false_true,json=boolFalseTrue,proto3" json:"bool_false_true,omitempty"` + // @@ .. cpp:var:: DataType data_type + // @@ + // @@ The control's datatype. + // @@ + DataType DataType `protobuf:"varint,4,opt,name=data_type,json=dataType,proto3,enum=inference.DataType" json:"data_type,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelSequenceBatching_Control) Reset() { + *x = ModelSequenceBatching_Control{} + mi := &file_model_config_proto_msgTypes[38] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelSequenceBatching_Control) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelSequenceBatching_Control) ProtoMessage() {} + +func (x *ModelSequenceBatching_Control) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[38] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelSequenceBatching_Control.ProtoReflect.Descriptor instead. +func (*ModelSequenceBatching_Control) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{11, 0} +} + +func (x *ModelSequenceBatching_Control) GetKind() ModelSequenceBatching_Control_Kind { + if x != nil { + return x.Kind + } + return ModelSequenceBatching_Control_CONTROL_SEQUENCE_START +} + +func (x *ModelSequenceBatching_Control) GetInt32FalseTrue() []int32 { + if x != nil { + return x.Int32FalseTrue + } + return nil +} + +func (x *ModelSequenceBatching_Control) GetFp32FalseTrue() []float32 { + if x != nil { + return x.Fp32FalseTrue + } + return nil +} + +func (x *ModelSequenceBatching_Control) GetBoolFalseTrue() []bool { + if x != nil { + return x.BoolFalseTrue + } + return nil +} + +func (x *ModelSequenceBatching_Control) GetDataType() DataType { + if x != nil { + return x.DataType + } + return DataType_TYPE_INVALID +} + +// @@ .. cpp:var:: message ControlInput +// @@ +// @@ The sequence control values to communicate by a model input. +// @@ +type ModelSequenceBatching_ControlInput struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: string name + // @@ + // @@ The name of the model input. + // @@ + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // @@ .. cpp:var:: Control control (repeated) + // @@ + // @@ The control value(s) that should be communicated to the + // @@ model using this model input. + // @@ + Control []*ModelSequenceBatching_Control `protobuf:"bytes,2,rep,name=control,proto3" json:"control,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelSequenceBatching_ControlInput) Reset() { + *x = ModelSequenceBatching_ControlInput{} + mi := &file_model_config_proto_msgTypes[39] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelSequenceBatching_ControlInput) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelSequenceBatching_ControlInput) ProtoMessage() {} + +func (x *ModelSequenceBatching_ControlInput) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[39] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelSequenceBatching_ControlInput.ProtoReflect.Descriptor instead. +func (*ModelSequenceBatching_ControlInput) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{11, 1} +} + +func (x *ModelSequenceBatching_ControlInput) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ModelSequenceBatching_ControlInput) GetControl() []*ModelSequenceBatching_Control { + if x != nil { + return x.Control + } + return nil +} + +// @@ +// @@ .. cpp:var:: message InitialState +// @@ +// @@ Settings used to initialize data for implicit state. +// @@ +type ModelSequenceBatching_InitialState struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: DataType data_type + // @@ + // @@ The data-type of the state. + // @@ + DataType DataType `protobuf:"varint,1,opt,name=data_type,json=dataType,proto3,enum=inference.DataType" json:"data_type,omitempty"` + // @@ .. cpp:var:: int64 dims (repeated) + // @@ + // @@ The shape of the state tensor, not including the batch + // @@ dimension. + // @@ + Dims []int64 `protobuf:"varint,2,rep,packed,name=dims,proto3" json:"dims,omitempty"` + // @@ .. cpp:var:: oneof state_data + // @@ + // @@ Specify how the initial state data is generated. + // @@ + // + // Types that are valid to be assigned to StateData: + // + // *ModelSequenceBatching_InitialState_ZeroData + // *ModelSequenceBatching_InitialState_DataFile + StateData isModelSequenceBatching_InitialState_StateData `protobuf_oneof:"state_data"` + // @@ .. cpp:var:: string name + // @@ + // @@ The name of the state initialization. + // @@ + Name string `protobuf:"bytes,5,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelSequenceBatching_InitialState) Reset() { + *x = ModelSequenceBatching_InitialState{} + mi := &file_model_config_proto_msgTypes[40] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelSequenceBatching_InitialState) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelSequenceBatching_InitialState) ProtoMessage() {} + +func (x *ModelSequenceBatching_InitialState) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[40] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelSequenceBatching_InitialState.ProtoReflect.Descriptor instead. +func (*ModelSequenceBatching_InitialState) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{11, 2} +} + +func (x *ModelSequenceBatching_InitialState) GetDataType() DataType { + if x != nil { + return x.DataType + } + return DataType_TYPE_INVALID +} + +func (x *ModelSequenceBatching_InitialState) GetDims() []int64 { + if x != nil { + return x.Dims + } + return nil +} + +func (x *ModelSequenceBatching_InitialState) GetStateData() isModelSequenceBatching_InitialState_StateData { + if x != nil { + return x.StateData + } + return nil +} + +func (x *ModelSequenceBatching_InitialState) GetZeroData() bool { + if x != nil { + if x, ok := x.StateData.(*ModelSequenceBatching_InitialState_ZeroData); ok { + return x.ZeroData + } + } + return false +} + +func (x *ModelSequenceBatching_InitialState) GetDataFile() string { + if x != nil { + if x, ok := x.StateData.(*ModelSequenceBatching_InitialState_DataFile); ok { + return x.DataFile + } + } + return "" +} + +func (x *ModelSequenceBatching_InitialState) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type isModelSequenceBatching_InitialState_StateData interface { + isModelSequenceBatching_InitialState_StateData() +} + +type ModelSequenceBatching_InitialState_ZeroData struct { + // @@ + // @@ .. cpp:var:: bool zero_data + // @@ + // @@ The identifier for using zeros as initial state data. + // @@ Note that the value of 'zero_data' will not be checked, + // @@ instead, zero data will be used as long as the field is set. + // @@ + ZeroData bool `protobuf:"varint,3,opt,name=zero_data,json=zeroData,proto3,oneof"` +} + +type ModelSequenceBatching_InitialState_DataFile struct { + // @@ .. cpp:var:: string data_file + // @@ + // @@ The file whose content will be used as the initial data for + // @@ the state in row-major order. The file must be provided in + // @@ sub-directory 'initial_state' under the model directory. + // @@ + DataFile string `protobuf:"bytes,4,opt,name=data_file,json=dataFile,proto3,oneof"` +} + +func (*ModelSequenceBatching_InitialState_ZeroData) isModelSequenceBatching_InitialState_StateData() { +} + +func (*ModelSequenceBatching_InitialState_DataFile) isModelSequenceBatching_InitialState_StateData() { +} + +// @@ .. cpp:var:: message State +// @@ +// @@ An input / output pair of tensors that carry state for the sequence. +// @@ +type ModelSequenceBatching_State struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: string input_name + // @@ + // @@ The name of the model state input. + // @@ + InputName string `protobuf:"bytes,1,opt,name=input_name,json=inputName,proto3" json:"input_name,omitempty"` + // @@ .. cpp:var:: string output_name + // @@ + // @@ The name of the model state output. + // @@ + OutputName string `protobuf:"bytes,2,opt,name=output_name,json=outputName,proto3" json:"output_name,omitempty"` + // @@ .. cpp:var:: DataType data_type + // @@ + // @@ The data-type of the state. + // @@ + DataType DataType `protobuf:"varint,3,opt,name=data_type,json=dataType,proto3,enum=inference.DataType" json:"data_type,omitempty"` + // @@ .. cpp:var:: int64 dim (repeated) + // @@ + // @@ The dimension. + // @@ + Dims []int64 `protobuf:"varint,4,rep,packed,name=dims,proto3" json:"dims,omitempty"` + // @@ .. cpp:var:: InitialState initial_state (repeated) + // @@ + // @@ The optional field to specify the initial state for the model. + // @@ + InitialState []*ModelSequenceBatching_InitialState `protobuf:"bytes,5,rep,name=initial_state,json=initialState,proto3" json:"initial_state,omitempty"` + // @@ .. cpp:var:: bool use_same_buffer_for_input_output + // @@ + // @@ The optional field to use a single buffer for both input and output + // @@ state. Without this option, Triton allocates separate buffers + // @@ for input and output state + // @@ which can be problematic if the state size is + // @@ large. This option reduces the memory usage by allocating a single + // @@ buffer. Enabling this option is recommended whenever + // @@ the input state is processed before the output state is written. + // @@ When enabled the state + // @@ will always be updated independent of whether + // @@ TRITONBACKEND_StateUpdate is called + // @@ (however TRITONBACKEND_StateUpdate should still be called for + // @@ completeness). + // @@ + // @@ The default value is false. + // @@ + UseSameBufferForInputOutput bool `protobuf:"varint,6,opt,name=use_same_buffer_for_input_output,json=useSameBufferForInputOutput,proto3" json:"use_same_buffer_for_input_output,omitempty"` + // @@ .. cpp:var:: bool use_growable_memory + // @@ + // @@ The optional field to enable an implicit state buffer to grow + // @@ without reallocating or copying existing memory. + // @@ Additional memory will be appended to the end of the buffer and + // @@ existing data will be preserved. + // @@ This option is only available for CUDA memory and requires enabling + // @@ use_same_buffer_for_input_output. When using this option, + // @@ StateBuffer call will always return CUDA memory even if CPU memory + // @@ is requested. + // @@ + // @@ The default value is false. + // @@ + UseGrowableMemory bool `protobuf:"varint,7,opt,name=use_growable_memory,json=useGrowableMemory,proto3" json:"use_growable_memory,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelSequenceBatching_State) Reset() { + *x = ModelSequenceBatching_State{} + mi := &file_model_config_proto_msgTypes[41] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelSequenceBatching_State) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelSequenceBatching_State) ProtoMessage() {} + +func (x *ModelSequenceBatching_State) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[41] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelSequenceBatching_State.ProtoReflect.Descriptor instead. +func (*ModelSequenceBatching_State) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{11, 3} +} + +func (x *ModelSequenceBatching_State) GetInputName() string { + if x != nil { + return x.InputName + } + return "" +} + +func (x *ModelSequenceBatching_State) GetOutputName() string { + if x != nil { + return x.OutputName + } + return "" +} + +func (x *ModelSequenceBatching_State) GetDataType() DataType { + if x != nil { + return x.DataType + } + return DataType_TYPE_INVALID +} + +func (x *ModelSequenceBatching_State) GetDims() []int64 { + if x != nil { + return x.Dims + } + return nil +} + +func (x *ModelSequenceBatching_State) GetInitialState() []*ModelSequenceBatching_InitialState { + if x != nil { + return x.InitialState + } + return nil +} + +func (x *ModelSequenceBatching_State) GetUseSameBufferForInputOutput() bool { + if x != nil { + return x.UseSameBufferForInputOutput + } + return false +} + +func (x *ModelSequenceBatching_State) GetUseGrowableMemory() bool { + if x != nil { + return x.UseGrowableMemory + } + return false +} + +// @@ .. cpp:var:: message StrategyDirect +// @@ +// @@ The sequence batcher uses a specific, unique batch +// @@ slot for each sequence. All inference requests in a +// @@ sequence are directed to the same batch slot in the same +// @@ model instance over the lifetime of the sequence. This +// @@ is the default strategy. +// @@ +type ModelSequenceBatching_StrategyDirect struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: uint64 max_queue_delay_microseconds + // @@ + // @@ The maximum time, in microseconds, a candidate request + // @@ will be delayed in the sequence batch scheduling queue to + // @@ wait for additional requests for batching. Default is 0. + // @@ + MaxQueueDelayMicroseconds uint64 `protobuf:"varint,1,opt,name=max_queue_delay_microseconds,json=maxQueueDelayMicroseconds,proto3" json:"max_queue_delay_microseconds,omitempty"` + // @@ .. cpp:var:: float minimum_slot_utilization + // @@ + // @@ The minimum slot utilization that must be satisfied to + // @@ execute the batch before 'max_queue_delay_microseconds' expires. + // @@ For example, a value of 0.5 indicates that the batch should be + // @@ executed as soon as 50% or more of the slots are ready even if + // @@ the 'max_queue_delay_microseconds' timeout has not expired. + // @@ The default is 0.0, indicating that a batch will be executed + // @@ before 'max_queue_delay_microseconds' timeout expires if at least + // @@ one batch slot is ready. 'max_queue_delay_microseconds' will be + // @@ ignored unless minimum_slot_utilization is set to a non-zero + // @@ value. + // @@ + MinimumSlotUtilization float32 `protobuf:"fixed32,2,opt,name=minimum_slot_utilization,json=minimumSlotUtilization,proto3" json:"minimum_slot_utilization,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelSequenceBatching_StrategyDirect) Reset() { + *x = ModelSequenceBatching_StrategyDirect{} + mi := &file_model_config_proto_msgTypes[42] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelSequenceBatching_StrategyDirect) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelSequenceBatching_StrategyDirect) ProtoMessage() {} + +func (x *ModelSequenceBatching_StrategyDirect) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[42] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelSequenceBatching_StrategyDirect.ProtoReflect.Descriptor instead. +func (*ModelSequenceBatching_StrategyDirect) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{11, 4} +} + +func (x *ModelSequenceBatching_StrategyDirect) GetMaxQueueDelayMicroseconds() uint64 { + if x != nil { + return x.MaxQueueDelayMicroseconds + } + return 0 +} + +func (x *ModelSequenceBatching_StrategyDirect) GetMinimumSlotUtilization() float32 { + if x != nil { + return x.MinimumSlotUtilization + } + return 0 +} + +// @@ .. cpp:var:: message StrategyOldest +// @@ +// @@ The sequence batcher maintains up to 'max_candidate_sequences' +// @@ candidate sequences. 'max_candidate_sequences' can be greater +// @@ than the model's 'max_batch_size'. For inferencing the batcher +// @@ chooses from the candidate sequences up to 'max_batch_size' +// @@ inference requests. Requests are chosen in an oldest-first +// @@ manner across all candidate sequences. A given sequence is +// @@ not guaranteed to be assigned to the same batch slot for +// @@ all inference requests of that sequence. +// @@ +type ModelSequenceBatching_StrategyOldest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: int32 max_candidate_sequences + // @@ + // @@ Maximum number of candidate sequences that the batcher + // @@ maintains. Excess sequences are kept in an ordered backlog + // @@ and become candidates when existing candidate sequences + // @@ complete. + // @@ + MaxCandidateSequences int32 `protobuf:"varint,1,opt,name=max_candidate_sequences,json=maxCandidateSequences,proto3" json:"max_candidate_sequences,omitempty"` + // @@ .. cpp:var:: int32 preferred_batch_size (repeated) + // @@ + // @@ Preferred batch sizes for dynamic batching of candidate + // @@ sequences. If a batch of one of these sizes can be formed + // @@ it will be executed immediately. If not specified a + // @@ preferred batch size will be chosen automatically + // @@ based on model and GPU characteristics. + // @@ + PreferredBatchSize []int32 `protobuf:"varint,2,rep,packed,name=preferred_batch_size,json=preferredBatchSize,proto3" json:"preferred_batch_size,omitempty"` + // @@ .. cpp:var:: uint64 max_queue_delay_microseconds + // @@ + // @@ The maximum time, in microseconds, a candidate request + // @@ will be delayed in the dynamic batch scheduling queue to + // @@ wait for additional requests for batching. Default is 0. + // @@ + MaxQueueDelayMicroseconds uint64 `protobuf:"varint,3,opt,name=max_queue_delay_microseconds,json=maxQueueDelayMicroseconds,proto3" json:"max_queue_delay_microseconds,omitempty"` + // @@ .. cpp:var:: bool preserve_ordering + // @@ + // @@ Should the dynamic batcher preserve the ordering of responses to + // @@ match the order of requests received by the scheduler. Default is + // @@ false. If true, the responses will be returned in the same order + // @@ as the order of requests sent to the scheduler. If false, the + // @@ responses may be returned in arbitrary order. This option is + // @@ specifically needed when a sequence of related inference requests + // @@ (i.e. inference requests with the same correlation ID) are sent + // @@ to the dynamic batcher to ensure that the sequence responses are + // @@ in the correct order. + // @@ + // @@ When using decoupled models, setting this to true may block the + // @@ responses from independent sequences from being returned to the + // @@ client until the previous request completes, hurting overall + // @@ performance. If using GRPC streaming protocol, the stream + // @@ ordering guarantee may be sufficient alone to ensure the + // @@ responses for each sequence are returned in sequence-order + // @@ without blocking based on independent requests, depending on the + // @@ use case. + // @@ + PreserveOrdering bool `protobuf:"varint,4,opt,name=preserve_ordering,json=preserveOrdering,proto3" json:"preserve_ordering,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelSequenceBatching_StrategyOldest) Reset() { + *x = ModelSequenceBatching_StrategyOldest{} + mi := &file_model_config_proto_msgTypes[43] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelSequenceBatching_StrategyOldest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelSequenceBatching_StrategyOldest) ProtoMessage() {} + +func (x *ModelSequenceBatching_StrategyOldest) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[43] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelSequenceBatching_StrategyOldest.ProtoReflect.Descriptor instead. +func (*ModelSequenceBatching_StrategyOldest) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{11, 5} +} + +func (x *ModelSequenceBatching_StrategyOldest) GetMaxCandidateSequences() int32 { + if x != nil { + return x.MaxCandidateSequences + } + return 0 +} + +func (x *ModelSequenceBatching_StrategyOldest) GetPreferredBatchSize() []int32 { + if x != nil { + return x.PreferredBatchSize + } + return nil +} + +func (x *ModelSequenceBatching_StrategyOldest) GetMaxQueueDelayMicroseconds() uint64 { + if x != nil { + return x.MaxQueueDelayMicroseconds + } + return 0 +} + +func (x *ModelSequenceBatching_StrategyOldest) GetPreserveOrdering() bool { + if x != nil { + return x.PreserveOrdering + } + return false +} + +// @@ .. cpp:var:: message Step +// @@ +// @@ Each step specifies a model included in the ensemble, +// @@ maps ensemble tensor names to the model input tensors, +// @@ and maps model output tensors to ensemble tensor names +// @@ +type ModelEnsembling_Step struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: string model_name + // @@ + // @@ The name of the model to execute for this step of the ensemble. + // @@ + ModelName string `protobuf:"bytes,1,opt,name=model_name,json=modelName,proto3" json:"model_name,omitempty"` + // @@ .. cpp:var:: int64 model_version + // @@ + // @@ The version of the model to use for inference. If -1 + // @@ the latest/most-recent version of the model is used. + // @@ + ModelVersion int64 `protobuf:"varint,2,opt,name=model_version,json=modelVersion,proto3" json:"model_version,omitempty"` + // @@ .. cpp:var:: map input_map + // @@ + // @@ Map from name of an input tensor on this step's model to ensemble + // @@ tensor name. The ensemble tensor must have the same data type and + // @@ shape as the model input. Each model input must be assigned to + // @@ one ensemble tensor, but the same ensemble tensor can be assigned + // @@ to multiple model inputs. + // @@ + InputMap map[string]string `protobuf:"bytes,3,rep,name=input_map,json=inputMap,proto3" json:"input_map,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // @@ .. cpp:var:: map output_map + // @@ + // @@ Map from name of an output tensor on this step's model to ensemble + // @@ tensor name. The data type and shape of the ensemble tensor will + // @@ be inferred from the model output. It is optional to assign all + // @@ model outputs to ensemble tensors. One ensemble tensor name + // @@ can appear in an output map only once. + // @@ + OutputMap map[string]string `protobuf:"bytes,4,rep,name=output_map,json=outputMap,proto3" json:"output_map,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // @@ .. cpp:var:: string model_namespace + // @@ + // @@ [RESERVED] currently this field is reserved for internal use, users + // @@ must not set any value to this field to avoid unexpected behavior. + // @@ + ModelNamespace string `protobuf:"bytes,5,opt,name=model_namespace,json=modelNamespace,proto3" json:"model_namespace,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelEnsembling_Step) Reset() { + *x = ModelEnsembling_Step{} + mi := &file_model_config_proto_msgTypes[44] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelEnsembling_Step) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelEnsembling_Step) ProtoMessage() {} + +func (x *ModelEnsembling_Step) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[44] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelEnsembling_Step.ProtoReflect.Descriptor instead. +func (*ModelEnsembling_Step) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{12, 0} +} + +func (x *ModelEnsembling_Step) GetModelName() string { + if x != nil { + return x.ModelName + } + return "" +} + +func (x *ModelEnsembling_Step) GetModelVersion() int64 { + if x != nil { + return x.ModelVersion + } + return 0 +} + +func (x *ModelEnsembling_Step) GetInputMap() map[string]string { + if x != nil { + return x.InputMap + } + return nil +} + +func (x *ModelEnsembling_Step) GetOutputMap() map[string]string { + if x != nil { + return x.OutputMap + } + return nil +} + +func (x *ModelEnsembling_Step) GetModelNamespace() string { + if x != nil { + return x.ModelNamespace + } + return "" +} + +// @@ +// @@ .. cpp:var:: message Input +// @@ +// @@ Meta data associated with an input. +// @@ +type ModelWarmup_Input struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: DataType data_type + // @@ + // @@ The data-type of the input. + // @@ + DataType DataType `protobuf:"varint,1,opt,name=data_type,json=dataType,proto3,enum=inference.DataType" json:"data_type,omitempty"` + // @@ .. cpp:var:: int64 dims (repeated) + // @@ + // @@ The shape of the input tensor, not including the batch dimension. + // @@ + Dims []int64 `protobuf:"varint,2,rep,packed,name=dims,proto3" json:"dims,omitempty"` + // @@ .. cpp:var:: oneof input_data_type + // @@ + // @@ Specify how the input data is generated. If the input has STRING + // @@ data type and 'random_data' is set, the data generation will fall + // @@ back to 'zero_data'. + // @@ + // + // Types that are valid to be assigned to InputDataType: + // + // *ModelWarmup_Input_ZeroData + // *ModelWarmup_Input_RandomData + // *ModelWarmup_Input_InputDataFile + InputDataType isModelWarmup_Input_InputDataType `protobuf_oneof:"input_data_type"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelWarmup_Input) Reset() { + *x = ModelWarmup_Input{} + mi := &file_model_config_proto_msgTypes[47] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelWarmup_Input) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelWarmup_Input) ProtoMessage() {} + +func (x *ModelWarmup_Input) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[47] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelWarmup_Input.ProtoReflect.Descriptor instead. +func (*ModelWarmup_Input) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{14, 0} +} + +func (x *ModelWarmup_Input) GetDataType() DataType { + if x != nil { + return x.DataType + } + return DataType_TYPE_INVALID +} + +func (x *ModelWarmup_Input) GetDims() []int64 { + if x != nil { + return x.Dims + } + return nil +} + +func (x *ModelWarmup_Input) GetInputDataType() isModelWarmup_Input_InputDataType { + if x != nil { + return x.InputDataType + } + return nil +} + +func (x *ModelWarmup_Input) GetZeroData() bool { + if x != nil { + if x, ok := x.InputDataType.(*ModelWarmup_Input_ZeroData); ok { + return x.ZeroData + } + } + return false +} + +func (x *ModelWarmup_Input) GetRandomData() bool { + if x != nil { + if x, ok := x.InputDataType.(*ModelWarmup_Input_RandomData); ok { + return x.RandomData + } + } + return false +} + +func (x *ModelWarmup_Input) GetInputDataFile() string { + if x != nil { + if x, ok := x.InputDataType.(*ModelWarmup_Input_InputDataFile); ok { + return x.InputDataFile + } + } + return "" +} + +type isModelWarmup_Input_InputDataType interface { + isModelWarmup_Input_InputDataType() +} + +type ModelWarmup_Input_ZeroData struct { + // @@ + // @@ .. cpp:var:: bool zero_data + // @@ + // @@ The identifier for using zeros as input data. Note that the + // @@ value of 'zero_data' will not be checked, instead, zero data + // @@ will be used as long as the field is set. + // @@ + ZeroData bool `protobuf:"varint,3,opt,name=zero_data,json=zeroData,proto3,oneof"` +} + +type ModelWarmup_Input_RandomData struct { + // @@ + // @@ .. cpp:var:: bool random_data + // @@ + // @@ The identifier for using random data as input data. Note that + // @@ the value of 'random_data' will not be checked, instead, + // @@ random data will be used as long as the field is set. + // @@ + RandomData bool `protobuf:"varint,4,opt,name=random_data,json=randomData,proto3,oneof"` +} + +type ModelWarmup_Input_InputDataFile struct { + // @@ .. cpp:var:: string input_data_file + // @@ + // @@ The file whose content will be used as raw input data in + // @@ row-major order. The file must be provided in a sub-directory + // @@ 'warmup' under the model directory. The file contents should be + // @@ in binary format. For TYPE_STRING data-type, an element is + // @@ represented by a 4-byte unsigned integer giving the length + // @@ followed by the actual bytes. + // @@ + InputDataFile string `protobuf:"bytes,5,opt,name=input_data_file,json=inputDataFile,proto3,oneof"` +} + +func (*ModelWarmup_Input_ZeroData) isModelWarmup_Input_InputDataType() {} + +func (*ModelWarmup_Input_RandomData) isModelWarmup_Input_InputDataType() {} + +func (*ModelWarmup_Input_InputDataFile) isModelWarmup_Input_InputDataType() {} + +// @@ +// @@ .. cpp:var:: message Agent +// @@ +// @@ A repository agent that should be invoked for the specified +// @@ repository actions for this model. +// @@ +type ModelRepositoryAgents_Agent struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: string name + // @@ + // @@ The name of the agent. + // @@ + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // @@ .. cpp:var:: map parameters + // @@ + // @@ The parameters for the agent. + // @@ + Parameters map[string]string `protobuf:"bytes,2,rep,name=parameters,proto3" json:"parameters,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelRepositoryAgents_Agent) Reset() { + *x = ModelRepositoryAgents_Agent{} + mi := &file_model_config_proto_msgTypes[49] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelRepositoryAgents_Agent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelRepositoryAgents_Agent) ProtoMessage() {} + +func (x *ModelRepositoryAgents_Agent) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[49] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelRepositoryAgents_Agent.ProtoReflect.Descriptor instead. +func (*ModelRepositoryAgents_Agent) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{17, 0} +} + +func (x *ModelRepositoryAgents_Agent) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ModelRepositoryAgents_Agent) GetParameters() map[string]string { + if x != nil { + return x.Parameters + } + return nil +} + +// @@ +// @@ .. cpp:var:: message MetricControl +// @@ +// @@ Override metrics settings of this model. +// @@ +type ModelMetrics_MetricControl struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: MetricIdentifier metric_identifier + // @@ + // @@ The identifier defining metrics to be overridden with the + // @@ metric_options. + // @@ + MetricIdentifier *ModelMetrics_MetricControl_MetricIdentifier `protobuf:"bytes,1,opt,name=metric_identifier,json=metricIdentifier,proto3" json:"metric_identifier,omitempty"` + // @@ .. cpp:var:: oneof metric_options + // @@ + // @@ The value to override the metrics defined in metric_identifier. + // @@ + // + // Types that are valid to be assigned to MetricOptions: + // + // *ModelMetrics_MetricControl_HistogramOptions_ + MetricOptions isModelMetrics_MetricControl_MetricOptions `protobuf_oneof:"metric_options"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelMetrics_MetricControl) Reset() { + *x = ModelMetrics_MetricControl{} + mi := &file_model_config_proto_msgTypes[51] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelMetrics_MetricControl) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelMetrics_MetricControl) ProtoMessage() {} + +func (x *ModelMetrics_MetricControl) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[51] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelMetrics_MetricControl.ProtoReflect.Descriptor instead. +func (*ModelMetrics_MetricControl) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{19, 0} +} + +func (x *ModelMetrics_MetricControl) GetMetricIdentifier() *ModelMetrics_MetricControl_MetricIdentifier { + if x != nil { + return x.MetricIdentifier + } + return nil +} + +func (x *ModelMetrics_MetricControl) GetMetricOptions() isModelMetrics_MetricControl_MetricOptions { + if x != nil { + return x.MetricOptions + } + return nil +} + +func (x *ModelMetrics_MetricControl) GetHistogramOptions() *ModelMetrics_MetricControl_HistogramOptions { + if x != nil { + if x, ok := x.MetricOptions.(*ModelMetrics_MetricControl_HistogramOptions_); ok { + return x.HistogramOptions + } + } + return nil +} + +type isModelMetrics_MetricControl_MetricOptions interface { + isModelMetrics_MetricControl_MetricOptions() +} + +type ModelMetrics_MetricControl_HistogramOptions_ struct { + // @@ .. cpp:var:: HistogramOptions histogram_options + // @@ + // @@ Histogram options. + // @@ + HistogramOptions *ModelMetrics_MetricControl_HistogramOptions `protobuf:"bytes,2,opt,name=histogram_options,json=histogramOptions,proto3,oneof"` +} + +func (*ModelMetrics_MetricControl_HistogramOptions_) isModelMetrics_MetricControl_MetricOptions() {} + +// @@ +// @@ .. cpp:var:: message MetricIdentifier +// @@ +// @@ Specify metrics to be overridden with metric_option. +// @@ +type ModelMetrics_MetricControl_MetricIdentifier struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: string family + // @@ + // @@ The name of the metric family to override with the custom value. + // @@ All core histogram metrics reported by Triton are customizable. + // @@ + // https://github.com/triton-inference-server/server/blob/main/docs/user_guide/metrics.md#histograms + // @@ + Family string `protobuf:"bytes,1,opt,name=family,proto3" json:"family,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelMetrics_MetricControl_MetricIdentifier) Reset() { + *x = ModelMetrics_MetricControl_MetricIdentifier{} + mi := &file_model_config_proto_msgTypes[52] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelMetrics_MetricControl_MetricIdentifier) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelMetrics_MetricControl_MetricIdentifier) ProtoMessage() {} + +func (x *ModelMetrics_MetricControl_MetricIdentifier) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[52] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelMetrics_MetricControl_MetricIdentifier.ProtoReflect.Descriptor instead. +func (*ModelMetrics_MetricControl_MetricIdentifier) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{19, 0, 0} +} + +func (x *ModelMetrics_MetricControl_MetricIdentifier) GetFamily() string { + if x != nil { + return x.Family + } + return "" +} + +// @@ .. cpp:var:: message HistogramOptions +// @@ +// @@ Histogram metrics options. +// @@ +type ModelMetrics_MetricControl_HistogramOptions struct { + state protoimpl.MessageState `protogen:"open.v1"` + // @@ .. cpp:var:: double buckets (repeated) + // @@ + // @@ Repeated double type in ascending order for histogram bucket + // @@ boundaries. Each bucket value represents a range less than or + // @@ equal to itself. The range greater than the largest bucket value + // @@ is allocated implicitly. + // @@ For example, [ -5.0, -2, 0, 3.5, 5 ]. + // @@ + Buckets []float64 `protobuf:"fixed64,1,rep,packed,name=buckets,proto3" json:"buckets,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModelMetrics_MetricControl_HistogramOptions) Reset() { + *x = ModelMetrics_MetricControl_HistogramOptions{} + mi := &file_model_config_proto_msgTypes[53] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModelMetrics_MetricControl_HistogramOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelMetrics_MetricControl_HistogramOptions) ProtoMessage() {} + +func (x *ModelMetrics_MetricControl_HistogramOptions) ProtoReflect() protoreflect.Message { + mi := &file_model_config_proto_msgTypes[53] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModelMetrics_MetricControl_HistogramOptions.ProtoReflect.Descriptor instead. +func (*ModelMetrics_MetricControl_HistogramOptions) Descriptor() ([]byte, []int) { + return file_model_config_proto_rawDescGZIP(), []int{19, 0, 1} +} + +func (x *ModelMetrics_MetricControl_HistogramOptions) GetBuckets() []float64 { + if x != nil { + return x.Buckets + } + return nil +} + +var File_model_config_proto protoreflect.FileDescriptor + +const file_model_config_proto_rawDesc = "" + + "\n" + + "\x12model_config.proto\x12\tinference\"\xc0\x01\n" + + "\x10ModelRateLimiter\x12B\n" + + "\tresources\x18\x01 \x03(\v2$.inference.ModelRateLimiter.ResourceR\tresources\x12\x1a\n" + + "\bpriority\x18\x02 \x01(\rR\bpriority\x1aL\n" + + "\bResource\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x16\n" + + "\x06global\x18\x02 \x01(\bR\x06global\x12\x14\n" + + "\x05count\x18\x03 \x01(\rR\x05count\"\xed\x04\n" + + "\x12ModelInstanceGroup\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x126\n" + + "\x04kind\x18\x04 \x01(\x0e2\".inference.ModelInstanceGroup.KindR\x04kind\x12\x14\n" + + "\x05count\x18\x02 \x01(\x05R\x05count\x12>\n" + + "\frate_limiter\x18\x06 \x01(\v2\x1b.inference.ModelRateLimiterR\vrateLimiter\x12\x12\n" + + "\x04gpus\x18\x03 \x03(\x05R\x04gpus\x12Z\n" + + "\x11secondary_devices\x18\b \x03(\v2-.inference.ModelInstanceGroup.SecondaryDeviceR\x10secondaryDevices\x12\x18\n" + + "\aprofile\x18\x05 \x03(\tR\aprofile\x12\x18\n" + + "\apassive\x18\a \x01(\bR\apassive\x12\x1f\n" + + "\vhost_policy\x18\t \x01(\tR\n" + + "hostPolicy\x1a\xac\x01\n" + + "\x0fSecondaryDevice\x12U\n" + + "\x04kind\x18\x01 \x01(\x0e2A.inference.ModelInstanceGroup.SecondaryDevice.SecondaryDeviceKindR\x04kind\x12\x1b\n" + + "\tdevice_id\x18\x02 \x01(\x03R\bdeviceId\"%\n" + + "\x13SecondaryDeviceKind\x12\x0e\n" + + "\n" + + "KIND_NVDLA\x10\x00\"A\n" + + "\x04Kind\x12\r\n" + + "\tKIND_AUTO\x10\x00\x12\f\n" + + "\bKIND_GPU\x10\x01\x12\f\n" + + "\bKIND_CPU\x10\x02\x12\x0e\n" + + "\n" + + "KIND_MODEL\x10\x03\"*\n" + + "\x12ModelTensorReshape\x12\x14\n" + + "\x05shape\x18\x01 \x03(\x03R\x05shape\"\xba\x03\n" + + "\n" + + "ModelInput\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x120\n" + + "\tdata_type\x18\x02 \x01(\x0e2\x13.inference.DataTypeR\bdataType\x124\n" + + "\x06format\x18\x03 \x01(\x0e2\x1c.inference.ModelInput.FormatR\x06format\x12\x12\n" + + "\x04dims\x18\x04 \x03(\x03R\x04dims\x127\n" + + "\areshape\x18\x05 \x01(\v2\x1d.inference.ModelTensorReshapeR\areshape\x12&\n" + + "\x0fis_shape_tensor\x18\x06 \x01(\bR\risShapeTensor\x12,\n" + + "\x12allow_ragged_batch\x18\a \x01(\bR\x10allowRaggedBatch\x12\x1a\n" + + "\boptional\x18\b \x01(\bR\boptional\x124\n" + + "\x17is_non_linear_format_io\x18\t \x01(\bR\x13isNonLinearFormatIo\";\n" + + "\x06Format\x12\x0f\n" + + "\vFORMAT_NONE\x10\x00\x12\x0f\n" + + "\vFORMAT_NHWC\x10\x01\x12\x0f\n" + + "\vFORMAT_NCHW\x10\x02\"\xa5\x02\n" + + "\vModelOutput\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x120\n" + + "\tdata_type\x18\x02 \x01(\x0e2\x13.inference.DataTypeR\bdataType\x12\x12\n" + + "\x04dims\x18\x03 \x03(\x03R\x04dims\x127\n" + + "\areshape\x18\x05 \x01(\v2\x1d.inference.ModelTensorReshapeR\areshape\x12%\n" + + "\x0elabel_filename\x18\x04 \x01(\tR\rlabelFilename\x12&\n" + + "\x0fis_shape_tensor\x18\x06 \x01(\bR\risShapeTensor\x124\n" + + "\x17is_non_linear_format_io\x18\a \x01(\bR\x13isNonLinearFormatIo\"\x82\x03\n" + + "\n" + + "BatchInput\x12.\n" + + "\x04kind\x18\x01 \x01(\x0e2\x1a.inference.BatchInput.KindR\x04kind\x12\x1f\n" + + "\vtarget_name\x18\x02 \x03(\tR\n" + + "targetName\x120\n" + + "\tdata_type\x18\x03 \x01(\x0e2\x13.inference.DataTypeR\bdataType\x12!\n" + + "\fsource_input\x18\x04 \x03(\tR\vsourceInput\"\xcd\x01\n" + + "\x04Kind\x12\x17\n" + + "\x13BATCH_ELEMENT_COUNT\x10\x00\x12#\n" + + "\x1fBATCH_ACCUMULATED_ELEMENT_COUNT\x10\x01\x12-\n" + + ")BATCH_ACCUMULATED_ELEMENT_COUNT_WITH_ZERO\x10\x02\x12$\n" + + " BATCH_MAX_ELEMENT_COUNT_AS_SHAPE\x10\x03\x12\x14\n" + + "\x10BATCH_ITEM_SHAPE\x10\x04\x12\x1c\n" + + "\x18BATCH_ITEM_SHAPE_FLATTEN\x10\x05\"\xae\x01\n" + + "\vBatchOutput\x12\x1f\n" + + "\vtarget_name\x18\x01 \x03(\tR\n" + + "targetName\x12/\n" + + "\x04kind\x18\x02 \x01(\x0e2\x1b.inference.BatchOutput.KindR\x04kind\x12!\n" + + "\fsource_input\x18\x03 \x03(\tR\vsourceInput\"*\n" + + "\x04Kind\x12\"\n" + + "\x1eBATCH_SCATTER_WITH_INPUT_SHAPE\x10\x00\"\xbe\x02\n" + + "\x12ModelVersionPolicy\x12>\n" + + "\x06latest\x18\x01 \x01(\v2$.inference.ModelVersionPolicy.LatestH\x00R\x06latest\x125\n" + + "\x03all\x18\x02 \x01(\v2!.inference.ModelVersionPolicy.AllH\x00R\x03all\x12D\n" + + "\bspecific\x18\x03 \x01(\v2&.inference.ModelVersionPolicy.SpecificH\x00R\bspecific\x1a+\n" + + "\x06Latest\x12!\n" + + "\fnum_versions\x18\x01 \x01(\rR\vnumVersions\x1a\x05\n" + + "\x03All\x1a&\n" + + "\bSpecific\x12\x1a\n" + + "\bversions\x18\x01 \x03(\x03R\bversionsB\x0f\n" + + "\rpolicy_choice\"\xe6\x10\n" + + "\x17ModelOptimizationPolicy\x12>\n" + + "\x05graph\x18\x01 \x01(\v2(.inference.ModelOptimizationPolicy.GraphR\x05graph\x12L\n" + + "\bpriority\x18\x02 \x01(\x0e20.inference.ModelOptimizationPolicy.ModelPriorityR\bpriority\x12;\n" + + "\x04cuda\x18\x03 \x01(\v2'.inference.ModelOptimizationPolicy.CudaR\x04cuda\x12o\n" + + "\x16execution_accelerators\x18\x04 \x01(\v28.inference.ModelOptimizationPolicy.ExecutionAcceleratorsR\x15executionAccelerators\x12e\n" + + "\x13input_pinned_memory\x18\x05 \x01(\v25.inference.ModelOptimizationPolicy.PinnedMemoryBufferR\x11inputPinnedMemory\x12g\n" + + "\x14output_pinned_memory\x18\x06 \x01(\v25.inference.ModelOptimizationPolicy.PinnedMemoryBufferR\x12outputPinnedMemory\x12C\n" + + "\x1egather_kernel_buffer_threshold\x18\a \x01(\rR\x1bgatherKernelBufferThreshold\x12%\n" + + "\x0eeager_batching\x18\b \x01(\bR\reagerBatching\x1a\x1d\n" + + "\x05Graph\x12\x14\n" + + "\x05level\x18\x01 \x01(\x05R\x05level\x1a\xc1\x06\n" + + "\x04Cuda\x12\x16\n" + + "\x06graphs\x18\x01 \x01(\bR\x06graphs\x12(\n" + + "\x10busy_wait_events\x18\x02 \x01(\bR\x0ebusyWaitEvents\x12P\n" + + "\n" + + "graph_spec\x18\x03 \x03(\v21.inference.ModelOptimizationPolicy.Cuda.GraphSpecR\tgraphSpec\x12,\n" + + "\x12output_copy_stream\x18\x04 \x01(\bR\x10outputCopyStream\x1a\xf6\x04\n" + + "\tGraphSpec\x12\x1d\n" + + "\n" + + "batch_size\x18\x01 \x01(\x05R\tbatchSize\x12R\n" + + "\x05input\x18\x02 \x03(\v2<.inference.ModelOptimizationPolicy.Cuda.GraphSpec.InputEntryR\x05input\x12h\n" + + "\x11graph_lower_bound\x18\x03 \x01(\v2<.inference.ModelOptimizationPolicy.Cuda.GraphSpec.LowerBoundR\x0fgraphLowerBound\x1a\x19\n" + + "\x05Shape\x12\x10\n" + + "\x03dim\x18\x01 \x03(\x03R\x03dim\x1a\xfd\x01\n" + + "\n" + + "LowerBound\x12\x1d\n" + + "\n" + + "batch_size\x18\x01 \x01(\x05R\tbatchSize\x12]\n" + + "\x05input\x18\x02 \x03(\v2G.inference.ModelOptimizationPolicy.Cuda.GraphSpec.LowerBound.InputEntryR\x05input\x1aq\n" + + "\n" + + "InputEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12M\n" + + "\x05value\x18\x02 \x01(\v27.inference.ModelOptimizationPolicy.Cuda.GraphSpec.ShapeR\x05value:\x028\x01\x1aq\n" + + "\n" + + "InputEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12M\n" + + "\x05value\x18\x02 \x01(\v27.inference.ModelOptimizationPolicy.Cuda.GraphSpec.ShapeR\x05value:\x028\x01\x1a\xf6\x03\n" + + "\x15ExecutionAccelerators\x12\x80\x01\n" + + "\x19gpu_execution_accelerator\x18\x01 \x03(\v2D.inference.ModelOptimizationPolicy.ExecutionAccelerators.AcceleratorR\x17gpuExecutionAccelerator\x12\x80\x01\n" + + "\x19cpu_execution_accelerator\x18\x02 \x03(\v2D.inference.ModelOptimizationPolicy.ExecutionAccelerators.AcceleratorR\x17cpuExecutionAccelerator\x1a\xd6\x01\n" + + "\vAccelerator\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12t\n" + + "\n" + + "parameters\x18\x02 \x03(\v2T.inference.ModelOptimizationPolicy.ExecutionAccelerators.Accelerator.ParametersEntryR\n" + + "parameters\x1a=\n" + + "\x0fParametersEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\x1a,\n" + + "\x12PinnedMemoryBuffer\x12\x16\n" + + "\x06enable\x18\x01 \x01(\bR\x06enable\"I\n" + + "\rModelPriority\x12\x14\n" + + "\x10PRIORITY_DEFAULT\x10\x00\x12\x10\n" + + "\fPRIORITY_MAX\x10\x01\x12\x10\n" + + "\fPRIORITY_MIN\x10\x02\"\xaa\x02\n" + + "\x10ModelQueuePolicy\x12P\n" + + "\x0etimeout_action\x18\x01 \x01(\x0e2).inference.ModelQueuePolicy.TimeoutActionR\rtimeoutAction\x12@\n" + + "\x1cdefault_timeout_microseconds\x18\x02 \x01(\x04R\x1adefaultTimeoutMicroseconds\x124\n" + + "\x16allow_timeout_override\x18\x03 \x01(\bR\x14allowTimeoutOverride\x12$\n" + + "\x0emax_queue_size\x18\x04 \x01(\rR\fmaxQueueSize\"&\n" + + "\rTimeoutAction\x12\n" + + "\n" + + "\x06REJECT\x10\x00\x12\t\n" + + "\x05DELAY\x10\x01\"\xb7\x04\n" + + "\x14ModelDynamicBatching\x120\n" + + "\x14preferred_batch_size\x18\x01 \x03(\x05R\x12preferredBatchSize\x12?\n" + + "\x1cmax_queue_delay_microseconds\x18\x02 \x01(\x04R\x19maxQueueDelayMicroseconds\x12+\n" + + "\x11preserve_ordering\x18\x03 \x01(\bR\x10preserveOrdering\x12'\n" + + "\x0fpriority_levels\x18\x04 \x01(\x04R\x0epriorityLevels\x124\n" + + "\x16default_priority_level\x18\x05 \x01(\x04R\x14defaultPriorityLevel\x12M\n" + + "\x14default_queue_policy\x18\x06 \x01(\v2\x1b.inference.ModelQueuePolicyR\x12defaultQueuePolicy\x12l\n" + + "\x15priority_queue_policy\x18\a \x03(\v28.inference.ModelDynamicBatching.PriorityQueuePolicyEntryR\x13priorityQueuePolicy\x1ac\n" + + "\x18PriorityQueuePolicyEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\x04R\x03key\x121\n" + + "\x05value\x18\x02 \x01(\v2\x1b.inference.ModelQueuePolicyR\x05value:\x028\x01\"\xab\x0e\n" + + "\x15ModelSequenceBatching\x12I\n" + + "\x06direct\x18\x03 \x01(\v2/.inference.ModelSequenceBatching.StrategyDirectH\x00R\x06direct\x12I\n" + + "\x06oldest\x18\x04 \x01(\v2/.inference.ModelSequenceBatching.StrategyOldestH\x00R\x06oldest\x12C\n" + + "\x1emax_sequence_idle_microseconds\x18\x01 \x01(\x04R\x1bmaxSequenceIdleMicroseconds\x12R\n" + + "\rcontrol_input\x18\x02 \x03(\v2-.inference.ModelSequenceBatching.ControlInputR\fcontrolInput\x12<\n" + + "\x05state\x18\x05 \x03(\v2&.inference.ModelSequenceBatching.StateR\x05state\x12-\n" + + "\x12iterative_sequence\x18\x06 \x01(\bR\x11iterativeSequence\x1a\xef\x02\n" + + "\aControl\x12A\n" + + "\x04kind\x18\x01 \x01(\x0e2-.inference.ModelSequenceBatching.Control.KindR\x04kind\x12(\n" + + "\x10int32_false_true\x18\x02 \x03(\x05R\x0eint32FalseTrue\x12&\n" + + "\x0ffp32_false_true\x18\x03 \x03(\x02R\rfp32FalseTrue\x12&\n" + + "\x0fbool_false_true\x18\x05 \x03(\bR\rboolFalseTrue\x120\n" + + "\tdata_type\x18\x04 \x01(\x0e2\x13.inference.DataTypeR\bdataType\"u\n" + + "\x04Kind\x12\x1a\n" + + "\x16CONTROL_SEQUENCE_START\x10\x00\x12\x1a\n" + + "\x16CONTROL_SEQUENCE_READY\x10\x01\x12\x18\n" + + "\x14CONTROL_SEQUENCE_END\x10\x02\x12\x1b\n" + + "\x17CONTROL_SEQUENCE_CORRID\x10\x03\x1af\n" + + "\fControlInput\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12B\n" + + "\acontrol\x18\x02 \x03(\v2(.inference.ModelSequenceBatching.ControlR\acontrol\x1a\xb4\x01\n" + + "\fInitialState\x120\n" + + "\tdata_type\x18\x01 \x01(\x0e2\x13.inference.DataTypeR\bdataType\x12\x12\n" + + "\x04dims\x18\x02 \x03(\x03R\x04dims\x12\x1d\n" + + "\tzero_data\x18\x03 \x01(\bH\x00R\bzeroData\x12\x1d\n" + + "\tdata_file\x18\x04 \x01(\tH\x00R\bdataFile\x12\x12\n" + + "\x04name\x18\x05 \x01(\tR\x04nameB\f\n" + + "\n" + + "state_data\x1a\xd8\x02\n" + + "\x05State\x12\x1d\n" + + "\n" + + "input_name\x18\x01 \x01(\tR\tinputName\x12\x1f\n" + + "\voutput_name\x18\x02 \x01(\tR\n" + + "outputName\x120\n" + + "\tdata_type\x18\x03 \x01(\x0e2\x13.inference.DataTypeR\bdataType\x12\x12\n" + + "\x04dims\x18\x04 \x03(\x03R\x04dims\x12R\n" + + "\rinitial_state\x18\x05 \x03(\v2-.inference.ModelSequenceBatching.InitialStateR\finitialState\x12E\n" + + " use_same_buffer_for_input_output\x18\x06 \x01(\bR\x1buseSameBufferForInputOutput\x12.\n" + + "\x13use_growable_memory\x18\a \x01(\bR\x11useGrowableMemory\x1a\x8b\x01\n" + + "\x0eStrategyDirect\x12?\n" + + "\x1cmax_queue_delay_microseconds\x18\x01 \x01(\x04R\x19maxQueueDelayMicroseconds\x128\n" + + "\x18minimum_slot_utilization\x18\x02 \x01(\x02R\x16minimumSlotUtilization\x1a\xe8\x01\n" + + "\x0eStrategyOldest\x126\n" + + "\x17max_candidate_sequences\x18\x01 \x01(\x05R\x15maxCandidateSequences\x120\n" + + "\x14preferred_batch_size\x18\x02 \x03(\x05R\x12preferredBatchSize\x12?\n" + + "\x1cmax_queue_delay_microseconds\x18\x03 \x01(\x04R\x19maxQueueDelayMicroseconds\x12+\n" + + "\x11preserve_ordering\x18\x04 \x01(\bR\x10preserveOrderingB\x11\n" + + "\x0fstrategy_choice\"\x86\x04\n" + + "\x0fModelEnsembling\x123\n" + + "\x04step\x18\x01 \x03(\v2\x1f.inference.ModelEnsembling.StepR\x04step\x122\n" + + "\x15max_inflight_requests\x18\x02 \x01(\rR\x13maxInflightRequests\x1a\x89\x03\n" + + "\x04Step\x12\x1d\n" + + "\n" + + "model_name\x18\x01 \x01(\tR\tmodelName\x12#\n" + + "\rmodel_version\x18\x02 \x01(\x03R\fmodelVersion\x12J\n" + + "\tinput_map\x18\x03 \x03(\v2-.inference.ModelEnsembling.Step.InputMapEntryR\binputMap\x12M\n" + + "\n" + + "output_map\x18\x04 \x03(\v2..inference.ModelEnsembling.Step.OutputMapEntryR\toutputMap\x12'\n" + + "\x0fmodel_namespace\x18\x05 \x01(\tR\x0emodelNamespace\x1a;\n" + + "\rInputMapEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\x1a<\n" + + "\x0eOutputMapEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"3\n" + + "\x0eModelParameter\x12!\n" + + "\fstring_value\x18\x01 \x01(\tR\vstringValue\"\xba\x03\n" + + "\vModelWarmup\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x1d\n" + + "\n" + + "batch_size\x18\x02 \x01(\rR\tbatchSize\x12:\n" + + "\x06inputs\x18\x03 \x03(\v2\".inference.ModelWarmup.InputsEntryR\x06inputs\x12\x14\n" + + "\x05count\x18\x04 \x01(\rR\x05count\x1a\xcc\x01\n" + + "\x05Input\x120\n" + + "\tdata_type\x18\x01 \x01(\x0e2\x13.inference.DataTypeR\bdataType\x12\x12\n" + + "\x04dims\x18\x02 \x03(\x03R\x04dims\x12\x1d\n" + + "\tzero_data\x18\x03 \x01(\bH\x00R\bzeroData\x12!\n" + + "\vrandom_data\x18\x04 \x01(\bH\x00R\n" + + "randomData\x12(\n" + + "\x0finput_data_file\x18\x05 \x01(\tH\x00R\rinputDataFileB\x11\n" + + "\x0finput_data_type\x1aW\n" + + "\vInputsEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x122\n" + + "\x05value\x18\x02 \x01(\v2\x1c.inference.ModelWarmup.InputR\x05value:\x028\x01\"A\n" + + "\x0fModelOperations\x12.\n" + + "\x13op_library_filename\x18\x01 \x03(\tR\x11opLibraryFilename\"6\n" + + "\x16ModelTransactionPolicy\x12\x1c\n" + + "\tdecoupled\x18\x01 \x01(\bR\tdecoupled\"\x8c\x02\n" + + "\x15ModelRepositoryAgents\x12>\n" + + "\x06agents\x18\x01 \x03(\v2&.inference.ModelRepositoryAgents.AgentR\x06agents\x1a\xb2\x01\n" + + "\x05Agent\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12V\n" + + "\n" + + "parameters\x18\x02 \x03(\v26.inference.ModelRepositoryAgents.Agent.ParametersEntryR\n" + + "parameters\x1a=\n" + + "\x0fParametersEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\",\n" + + "\x12ModelResponseCache\x12\x16\n" + + "\x06enable\x18\x01 \x01(\bR\x06enable\"\xa6\x03\n" + + "\fModelMetrics\x12L\n" + + "\x0emetric_control\x18\x01 \x03(\v2%.inference.ModelMetrics.MetricControlR\rmetricControl\x1a\xc7\x02\n" + + "\rMetricControl\x12c\n" + + "\x11metric_identifier\x18\x01 \x01(\v26.inference.ModelMetrics.MetricControl.MetricIdentifierR\x10metricIdentifier\x12e\n" + + "\x11histogram_options\x18\x02 \x01(\v26.inference.ModelMetrics.MetricControl.HistogramOptionsH\x00R\x10histogramOptions\x1a*\n" + + "\x10MetricIdentifier\x12\x16\n" + + "\x06family\x18\x01 \x01(\tR\x06family\x1a,\n" + + "\x10HistogramOptions\x12\x18\n" + + "\abuckets\x18\x01 \x03(\x01R\abucketsB\x10\n" + + "\x0emetric_options\"\xfc\r\n" + + "\vModelConfig\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x1a\n" + + "\bplatform\x18\x02 \x01(\tR\bplatform\x12\x18\n" + + "\abackend\x18\x11 \x01(\tR\abackend\x12\x18\n" + + "\aruntime\x18\x19 \x01(\tR\aruntime\x12D\n" + + "\x0eversion_policy\x18\x03 \x01(\v2\x1d.inference.ModelVersionPolicyR\rversionPolicy\x12$\n" + + "\x0emax_batch_size\x18\x04 \x01(\x05R\fmaxBatchSize\x12+\n" + + "\x05input\x18\x05 \x03(\v2\x15.inference.ModelInputR\x05input\x12.\n" + + "\x06output\x18\x06 \x03(\v2\x16.inference.ModelOutputR\x06output\x126\n" + + "\vbatch_input\x18\x14 \x03(\v2\x15.inference.BatchInputR\n" + + "batchInput\x129\n" + + "\fbatch_output\x18\x15 \x03(\v2\x16.inference.BatchOutputR\vbatchOutput\x12F\n" + + "\foptimization\x18\f \x01(\v2\".inference.ModelOptimizationPolicyR\foptimization\x12L\n" + + "\x10dynamic_batching\x18\v \x01(\v2\x1f.inference.ModelDynamicBatchingH\x00R\x0fdynamicBatching\x12O\n" + + "\x11sequence_batching\x18\r \x01(\v2 .inference.ModelSequenceBatchingH\x00R\x10sequenceBatching\x12M\n" + + "\x13ensemble_scheduling\x18\x0f \x01(\v2\x1a.inference.ModelEnsemblingH\x00R\x12ensembleScheduling\x12D\n" + + "\x0einstance_group\x18\a \x03(\v2\x1d.inference.ModelInstanceGroupR\rinstanceGroup\x124\n" + + "\x16default_model_filename\x18\b \x01(\tR\x14defaultModelFilename\x12Z\n" + + "\x12cc_model_filenames\x18\t \x03(\v2,.inference.ModelConfig.CcModelFilenamesEntryR\x10ccModelFilenames\x12G\n" + + "\vmetric_tags\x18\n" + + " \x03(\v2&.inference.ModelConfig.MetricTagsEntryR\n" + + "metricTags\x12F\n" + + "\n" + + "parameters\x18\x0e \x03(\v2&.inference.ModelConfig.ParametersEntryR\n" + + "parameters\x129\n" + + "\fmodel_warmup\x18\x10 \x03(\v2\x16.inference.ModelWarmupR\vmodelWarmup\x12E\n" + + "\x10model_operations\x18\x12 \x01(\v2\x1a.inference.ModelOperationsR\x0fmodelOperations\x12[\n" + + "\x18model_transaction_policy\x18\x13 \x01(\v2!.inference.ModelTransactionPolicyR\x16modelTransactionPolicy\x12X\n" + + "\x17model_repository_agents\x18\x17 \x01(\v2 .inference.ModelRepositoryAgentsR\x15modelRepositoryAgents\x12D\n" + + "\x0eresponse_cache\x18\x18 \x01(\v2\x1d.inference.ModelResponseCacheR\rresponseCache\x12<\n" + + "\rmodel_metrics\x18\x1a \x01(\v2\x17.inference.ModelMetricsR\fmodelMetrics\x1aC\n" + + "\x15CcModelFilenamesEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\x1a=\n" + + "\x0fMetricTagsEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\x1aX\n" + + "\x0fParametersEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12/\n" + + "\x05value\x18\x02 \x01(\v2\x19.inference.ModelParameterR\x05value:\x028\x01B\x13\n" + + "\x11scheduling_choice*\xfa\x01\n" + + "\bDataType\x12\x10\n" + + "\fTYPE_INVALID\x10\x00\x12\r\n" + + "\tTYPE_BOOL\x10\x01\x12\x0e\n" + + "\n" + + "TYPE_UINT8\x10\x02\x12\x0f\n" + + "\vTYPE_UINT16\x10\x03\x12\x0f\n" + + "\vTYPE_UINT32\x10\x04\x12\x0f\n" + + "\vTYPE_UINT64\x10\x05\x12\r\n" + + "\tTYPE_INT8\x10\x06\x12\x0e\n" + + "\n" + + "TYPE_INT16\x10\a\x12\x0e\n" + + "\n" + + "TYPE_INT32\x10\b\x12\x0e\n" + + "\n" + + "TYPE_INT64\x10\t\x12\r\n" + + "\tTYPE_FP16\x10\n" + + "\x12\r\n" + + "\tTYPE_FP32\x10\v\x12\r\n" + + "\tTYPE_FP64\x10\f\x12\x0f\n" + + "\vTYPE_STRING\x10\r\x12\r\n" + + "\tTYPE_BF16\x10\x0eb\x06proto3" + +var ( + file_model_config_proto_rawDescOnce sync.Once + file_model_config_proto_rawDescData []byte +) + +func file_model_config_proto_rawDescGZIP() []byte { + file_model_config_proto_rawDescOnce.Do(func() { + file_model_config_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_model_config_proto_rawDesc), len(file_model_config_proto_rawDesc))) + }) + return file_model_config_proto_rawDescData +} + +var file_model_config_proto_enumTypes = make([]protoimpl.EnumInfo, 9) +var file_model_config_proto_msgTypes = make([]protoimpl.MessageInfo, 57) +var file_model_config_proto_goTypes = []any{ + (DataType)(0), // 0: inference.DataType + (ModelInstanceGroup_Kind)(0), // 1: inference.ModelInstanceGroup.Kind + (ModelInstanceGroup_SecondaryDevice_SecondaryDeviceKind)(0), // 2: inference.ModelInstanceGroup.SecondaryDevice.SecondaryDeviceKind + (ModelInput_Format)(0), // 3: inference.ModelInput.Format + (BatchInput_Kind)(0), // 4: inference.BatchInput.Kind + (BatchOutput_Kind)(0), // 5: inference.BatchOutput.Kind + (ModelOptimizationPolicy_ModelPriority)(0), // 6: inference.ModelOptimizationPolicy.ModelPriority + (ModelQueuePolicy_TimeoutAction)(0), // 7: inference.ModelQueuePolicy.TimeoutAction + (ModelSequenceBatching_Control_Kind)(0), // 8: inference.ModelSequenceBatching.Control.Kind + (*ModelRateLimiter)(nil), // 9: inference.ModelRateLimiter + (*ModelInstanceGroup)(nil), // 10: inference.ModelInstanceGroup + (*ModelTensorReshape)(nil), // 11: inference.ModelTensorReshape + (*ModelInput)(nil), // 12: inference.ModelInput + (*ModelOutput)(nil), // 13: inference.ModelOutput + (*BatchInput)(nil), // 14: inference.BatchInput + (*BatchOutput)(nil), // 15: inference.BatchOutput + (*ModelVersionPolicy)(nil), // 16: inference.ModelVersionPolicy + (*ModelOptimizationPolicy)(nil), // 17: inference.ModelOptimizationPolicy + (*ModelQueuePolicy)(nil), // 18: inference.ModelQueuePolicy + (*ModelDynamicBatching)(nil), // 19: inference.ModelDynamicBatching + (*ModelSequenceBatching)(nil), // 20: inference.ModelSequenceBatching + (*ModelEnsembling)(nil), // 21: inference.ModelEnsembling + (*ModelParameter)(nil), // 22: inference.ModelParameter + (*ModelWarmup)(nil), // 23: inference.ModelWarmup + (*ModelOperations)(nil), // 24: inference.ModelOperations + (*ModelTransactionPolicy)(nil), // 25: inference.ModelTransactionPolicy + (*ModelRepositoryAgents)(nil), // 26: inference.ModelRepositoryAgents + (*ModelResponseCache)(nil), // 27: inference.ModelResponseCache + (*ModelMetrics)(nil), // 28: inference.ModelMetrics + (*ModelConfig)(nil), // 29: inference.ModelConfig + (*ModelRateLimiter_Resource)(nil), // 30: inference.ModelRateLimiter.Resource + (*ModelInstanceGroup_SecondaryDevice)(nil), // 31: inference.ModelInstanceGroup.SecondaryDevice + (*ModelVersionPolicy_Latest)(nil), // 32: inference.ModelVersionPolicy.Latest + (*ModelVersionPolicy_All)(nil), // 33: inference.ModelVersionPolicy.All + (*ModelVersionPolicy_Specific)(nil), // 34: inference.ModelVersionPolicy.Specific + (*ModelOptimizationPolicy_Graph)(nil), // 35: inference.ModelOptimizationPolicy.Graph + (*ModelOptimizationPolicy_Cuda)(nil), // 36: inference.ModelOptimizationPolicy.Cuda + (*ModelOptimizationPolicy_ExecutionAccelerators)(nil), // 37: inference.ModelOptimizationPolicy.ExecutionAccelerators + (*ModelOptimizationPolicy_PinnedMemoryBuffer)(nil), // 38: inference.ModelOptimizationPolicy.PinnedMemoryBuffer + (*ModelOptimizationPolicy_Cuda_GraphSpec)(nil), // 39: inference.ModelOptimizationPolicy.Cuda.GraphSpec + (*ModelOptimizationPolicy_Cuda_GraphSpec_Shape)(nil), // 40: inference.ModelOptimizationPolicy.Cuda.GraphSpec.Shape + (*ModelOptimizationPolicy_Cuda_GraphSpec_LowerBound)(nil), // 41: inference.ModelOptimizationPolicy.Cuda.GraphSpec.LowerBound + nil, // 42: inference.ModelOptimizationPolicy.Cuda.GraphSpec.InputEntry + nil, // 43: inference.ModelOptimizationPolicy.Cuda.GraphSpec.LowerBound.InputEntry + (*ModelOptimizationPolicy_ExecutionAccelerators_Accelerator)(nil), // 44: inference.ModelOptimizationPolicy.ExecutionAccelerators.Accelerator + nil, // 45: inference.ModelOptimizationPolicy.ExecutionAccelerators.Accelerator.ParametersEntry + nil, // 46: inference.ModelDynamicBatching.PriorityQueuePolicyEntry + (*ModelSequenceBatching_Control)(nil), // 47: inference.ModelSequenceBatching.Control + (*ModelSequenceBatching_ControlInput)(nil), // 48: inference.ModelSequenceBatching.ControlInput + (*ModelSequenceBatching_InitialState)(nil), // 49: inference.ModelSequenceBatching.InitialState + (*ModelSequenceBatching_State)(nil), // 50: inference.ModelSequenceBatching.State + (*ModelSequenceBatching_StrategyDirect)(nil), // 51: inference.ModelSequenceBatching.StrategyDirect + (*ModelSequenceBatching_StrategyOldest)(nil), // 52: inference.ModelSequenceBatching.StrategyOldest + (*ModelEnsembling_Step)(nil), // 53: inference.ModelEnsembling.Step + nil, // 54: inference.ModelEnsembling.Step.InputMapEntry + nil, // 55: inference.ModelEnsembling.Step.OutputMapEntry + (*ModelWarmup_Input)(nil), // 56: inference.ModelWarmup.Input + nil, // 57: inference.ModelWarmup.InputsEntry + (*ModelRepositoryAgents_Agent)(nil), // 58: inference.ModelRepositoryAgents.Agent + nil, // 59: inference.ModelRepositoryAgents.Agent.ParametersEntry + (*ModelMetrics_MetricControl)(nil), // 60: inference.ModelMetrics.MetricControl + (*ModelMetrics_MetricControl_MetricIdentifier)(nil), // 61: inference.ModelMetrics.MetricControl.MetricIdentifier + (*ModelMetrics_MetricControl_HistogramOptions)(nil), // 62: inference.ModelMetrics.MetricControl.HistogramOptions + nil, // 63: inference.ModelConfig.CcModelFilenamesEntry + nil, // 64: inference.ModelConfig.MetricTagsEntry + nil, // 65: inference.ModelConfig.ParametersEntry +} +var file_model_config_proto_depIdxs = []int32{ + 30, // 0: inference.ModelRateLimiter.resources:type_name -> inference.ModelRateLimiter.Resource + 1, // 1: inference.ModelInstanceGroup.kind:type_name -> inference.ModelInstanceGroup.Kind + 9, // 2: inference.ModelInstanceGroup.rate_limiter:type_name -> inference.ModelRateLimiter + 31, // 3: inference.ModelInstanceGroup.secondary_devices:type_name -> inference.ModelInstanceGroup.SecondaryDevice + 0, // 4: inference.ModelInput.data_type:type_name -> inference.DataType + 3, // 5: inference.ModelInput.format:type_name -> inference.ModelInput.Format + 11, // 6: inference.ModelInput.reshape:type_name -> inference.ModelTensorReshape + 0, // 7: inference.ModelOutput.data_type:type_name -> inference.DataType + 11, // 8: inference.ModelOutput.reshape:type_name -> inference.ModelTensorReshape + 4, // 9: inference.BatchInput.kind:type_name -> inference.BatchInput.Kind + 0, // 10: inference.BatchInput.data_type:type_name -> inference.DataType + 5, // 11: inference.BatchOutput.kind:type_name -> inference.BatchOutput.Kind + 32, // 12: inference.ModelVersionPolicy.latest:type_name -> inference.ModelVersionPolicy.Latest + 33, // 13: inference.ModelVersionPolicy.all:type_name -> inference.ModelVersionPolicy.All + 34, // 14: inference.ModelVersionPolicy.specific:type_name -> inference.ModelVersionPolicy.Specific + 35, // 15: inference.ModelOptimizationPolicy.graph:type_name -> inference.ModelOptimizationPolicy.Graph + 6, // 16: inference.ModelOptimizationPolicy.priority:type_name -> inference.ModelOptimizationPolicy.ModelPriority + 36, // 17: inference.ModelOptimizationPolicy.cuda:type_name -> inference.ModelOptimizationPolicy.Cuda + 37, // 18: inference.ModelOptimizationPolicy.execution_accelerators:type_name -> inference.ModelOptimizationPolicy.ExecutionAccelerators + 38, // 19: inference.ModelOptimizationPolicy.input_pinned_memory:type_name -> inference.ModelOptimizationPolicy.PinnedMemoryBuffer + 38, // 20: inference.ModelOptimizationPolicy.output_pinned_memory:type_name -> inference.ModelOptimizationPolicy.PinnedMemoryBuffer + 7, // 21: inference.ModelQueuePolicy.timeout_action:type_name -> inference.ModelQueuePolicy.TimeoutAction + 18, // 22: inference.ModelDynamicBatching.default_queue_policy:type_name -> inference.ModelQueuePolicy + 46, // 23: inference.ModelDynamicBatching.priority_queue_policy:type_name -> inference.ModelDynamicBatching.PriorityQueuePolicyEntry + 51, // 24: inference.ModelSequenceBatching.direct:type_name -> inference.ModelSequenceBatching.StrategyDirect + 52, // 25: inference.ModelSequenceBatching.oldest:type_name -> inference.ModelSequenceBatching.StrategyOldest + 48, // 26: inference.ModelSequenceBatching.control_input:type_name -> inference.ModelSequenceBatching.ControlInput + 50, // 27: inference.ModelSequenceBatching.state:type_name -> inference.ModelSequenceBatching.State + 53, // 28: inference.ModelEnsembling.step:type_name -> inference.ModelEnsembling.Step + 57, // 29: inference.ModelWarmup.inputs:type_name -> inference.ModelWarmup.InputsEntry + 58, // 30: inference.ModelRepositoryAgents.agents:type_name -> inference.ModelRepositoryAgents.Agent + 60, // 31: inference.ModelMetrics.metric_control:type_name -> inference.ModelMetrics.MetricControl + 16, // 32: inference.ModelConfig.version_policy:type_name -> inference.ModelVersionPolicy + 12, // 33: inference.ModelConfig.input:type_name -> inference.ModelInput + 13, // 34: inference.ModelConfig.output:type_name -> inference.ModelOutput + 14, // 35: inference.ModelConfig.batch_input:type_name -> inference.BatchInput + 15, // 36: inference.ModelConfig.batch_output:type_name -> inference.BatchOutput + 17, // 37: inference.ModelConfig.optimization:type_name -> inference.ModelOptimizationPolicy + 19, // 38: inference.ModelConfig.dynamic_batching:type_name -> inference.ModelDynamicBatching + 20, // 39: inference.ModelConfig.sequence_batching:type_name -> inference.ModelSequenceBatching + 21, // 40: inference.ModelConfig.ensemble_scheduling:type_name -> inference.ModelEnsembling + 10, // 41: inference.ModelConfig.instance_group:type_name -> inference.ModelInstanceGroup + 63, // 42: inference.ModelConfig.cc_model_filenames:type_name -> inference.ModelConfig.CcModelFilenamesEntry + 64, // 43: inference.ModelConfig.metric_tags:type_name -> inference.ModelConfig.MetricTagsEntry + 65, // 44: inference.ModelConfig.parameters:type_name -> inference.ModelConfig.ParametersEntry + 23, // 45: inference.ModelConfig.model_warmup:type_name -> inference.ModelWarmup + 24, // 46: inference.ModelConfig.model_operations:type_name -> inference.ModelOperations + 25, // 47: inference.ModelConfig.model_transaction_policy:type_name -> inference.ModelTransactionPolicy + 26, // 48: inference.ModelConfig.model_repository_agents:type_name -> inference.ModelRepositoryAgents + 27, // 49: inference.ModelConfig.response_cache:type_name -> inference.ModelResponseCache + 28, // 50: inference.ModelConfig.model_metrics:type_name -> inference.ModelMetrics + 2, // 51: inference.ModelInstanceGroup.SecondaryDevice.kind:type_name -> inference.ModelInstanceGroup.SecondaryDevice.SecondaryDeviceKind + 39, // 52: inference.ModelOptimizationPolicy.Cuda.graph_spec:type_name -> inference.ModelOptimizationPolicy.Cuda.GraphSpec + 44, // 53: inference.ModelOptimizationPolicy.ExecutionAccelerators.gpu_execution_accelerator:type_name -> inference.ModelOptimizationPolicy.ExecutionAccelerators.Accelerator + 44, // 54: inference.ModelOptimizationPolicy.ExecutionAccelerators.cpu_execution_accelerator:type_name -> inference.ModelOptimizationPolicy.ExecutionAccelerators.Accelerator + 42, // 55: inference.ModelOptimizationPolicy.Cuda.GraphSpec.input:type_name -> inference.ModelOptimizationPolicy.Cuda.GraphSpec.InputEntry + 41, // 56: inference.ModelOptimizationPolicy.Cuda.GraphSpec.graph_lower_bound:type_name -> inference.ModelOptimizationPolicy.Cuda.GraphSpec.LowerBound + 43, // 57: inference.ModelOptimizationPolicy.Cuda.GraphSpec.LowerBound.input:type_name -> inference.ModelOptimizationPolicy.Cuda.GraphSpec.LowerBound.InputEntry + 40, // 58: inference.ModelOptimizationPolicy.Cuda.GraphSpec.InputEntry.value:type_name -> inference.ModelOptimizationPolicy.Cuda.GraphSpec.Shape + 40, // 59: inference.ModelOptimizationPolicy.Cuda.GraphSpec.LowerBound.InputEntry.value:type_name -> inference.ModelOptimizationPolicy.Cuda.GraphSpec.Shape + 45, // 60: inference.ModelOptimizationPolicy.ExecutionAccelerators.Accelerator.parameters:type_name -> inference.ModelOptimizationPolicy.ExecutionAccelerators.Accelerator.ParametersEntry + 18, // 61: inference.ModelDynamicBatching.PriorityQueuePolicyEntry.value:type_name -> inference.ModelQueuePolicy + 8, // 62: inference.ModelSequenceBatching.Control.kind:type_name -> inference.ModelSequenceBatching.Control.Kind + 0, // 63: inference.ModelSequenceBatching.Control.data_type:type_name -> inference.DataType + 47, // 64: inference.ModelSequenceBatching.ControlInput.control:type_name -> inference.ModelSequenceBatching.Control + 0, // 65: inference.ModelSequenceBatching.InitialState.data_type:type_name -> inference.DataType + 0, // 66: inference.ModelSequenceBatching.State.data_type:type_name -> inference.DataType + 49, // 67: inference.ModelSequenceBatching.State.initial_state:type_name -> inference.ModelSequenceBatching.InitialState + 54, // 68: inference.ModelEnsembling.Step.input_map:type_name -> inference.ModelEnsembling.Step.InputMapEntry + 55, // 69: inference.ModelEnsembling.Step.output_map:type_name -> inference.ModelEnsembling.Step.OutputMapEntry + 0, // 70: inference.ModelWarmup.Input.data_type:type_name -> inference.DataType + 56, // 71: inference.ModelWarmup.InputsEntry.value:type_name -> inference.ModelWarmup.Input + 59, // 72: inference.ModelRepositoryAgents.Agent.parameters:type_name -> inference.ModelRepositoryAgents.Agent.ParametersEntry + 61, // 73: inference.ModelMetrics.MetricControl.metric_identifier:type_name -> inference.ModelMetrics.MetricControl.MetricIdentifier + 62, // 74: inference.ModelMetrics.MetricControl.histogram_options:type_name -> inference.ModelMetrics.MetricControl.HistogramOptions + 22, // 75: inference.ModelConfig.ParametersEntry.value:type_name -> inference.ModelParameter + 76, // [76:76] is the sub-list for method output_type + 76, // [76:76] is the sub-list for method input_type + 76, // [76:76] is the sub-list for extension type_name + 76, // [76:76] is the sub-list for extension extendee + 0, // [0:76] is the sub-list for field type_name +} + +func init() { file_model_config_proto_init() } +func file_model_config_proto_init() { + if File_model_config_proto != nil { + return + } + file_model_config_proto_msgTypes[7].OneofWrappers = []any{ + (*ModelVersionPolicy_Latest_)(nil), + (*ModelVersionPolicy_All_)(nil), + (*ModelVersionPolicy_Specific_)(nil), + } + file_model_config_proto_msgTypes[11].OneofWrappers = []any{ + (*ModelSequenceBatching_Direct)(nil), + (*ModelSequenceBatching_Oldest)(nil), + } + file_model_config_proto_msgTypes[20].OneofWrappers = []any{ + (*ModelConfig_DynamicBatching)(nil), + (*ModelConfig_SequenceBatching)(nil), + (*ModelConfig_EnsembleScheduling)(nil), + } + file_model_config_proto_msgTypes[40].OneofWrappers = []any{ + (*ModelSequenceBatching_InitialState_ZeroData)(nil), + (*ModelSequenceBatching_InitialState_DataFile)(nil), + } + file_model_config_proto_msgTypes[47].OneofWrappers = []any{ + (*ModelWarmup_Input_ZeroData)(nil), + (*ModelWarmup_Input_RandomData)(nil), + (*ModelWarmup_Input_InputDataFile)(nil), + } + file_model_config_proto_msgTypes[51].OneofWrappers = []any{ + (*ModelMetrics_MetricControl_HistogramOptions_)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_model_config_proto_rawDesc), len(file_model_config_proto_rawDesc)), + NumEnums: 9, + NumMessages: 57, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_model_config_proto_goTypes, + DependencyIndexes: file_model_config_proto_depIdxs, + EnumInfos: file_model_config_proto_enumTypes, + MessageInfos: file_model_config_proto_msgTypes, + }.Build() + File_model_config_proto = out.File + file_model_config_proto_goTypes = nil + file_model_config_proto_depIdxs = nil +} diff --git a/third_party/triton-common b/third_party/triton-common new file mode 160000 index 0000000..c09e98a --- /dev/null +++ b/third_party/triton-common @@ -0,0 +1 @@ +Subproject commit c09e98a47d721fea51913eb3737d37a45d34b431 From 17bb2d4616436efb9e7200d6f49f59ed1b74759b Mon Sep 17 00:00:00 2001 From: David Choi Date: Thu, 13 Nov 2025 14:25:22 -0800 Subject: [PATCH 05/38] Attempt to reorganize and rework gRPC client management. --- service/config/model.go | 35 +- service/config/models.go | 4 +- service/config/router.go | 2 +- service/config/triton_test.go | 3 +- service/endpoint/model.go | 6 +- service/platform/factory/factory.go | 4 +- service/platform/tensorflow.go | 61 --- service/tfmodel/batcher/service.go | 2 +- service/tfmodel/service.go | 9 +- service/triton/client.go | 15 + service/triton/grpc.go | 430 +++++++++++++++ service/triton/grpc_test.go | 719 ++++++++++++++++++++++++ service/triton/http.go | 349 ++++++++++++ service/triton/triton.go | 660 ++++------------------ service/triton/triton_test.go | 818 +--------------------------- 15 files changed, 1663 insertions(+), 1454 deletions(-) delete mode 100644 service/platform/tensorflow.go create mode 100644 service/triton/client.go create mode 100644 service/triton/grpc.go create mode 100644 service/triton/grpc_test.go create mode 100644 service/triton/http.go diff --git a/service/config/model.go b/service/config/model.go index bbe2057..4d648a2 100644 --- a/service/config/model.go +++ b/service/config/model.go @@ -18,6 +18,7 @@ type Model struct { Debug bool // Mode overrides the endpoint behavior from inference to routing. + // This primarily is used to confirm that the mode should be a router. // Can be one of "inference" or "router". // Defaults to "inference". Mode string `json:",omitempty" yaml:",omitempty"` @@ -35,6 +36,10 @@ type Model struct { Dir string // URL is the location of the model. + // If Platform is "triton", this is the HTTP prefix of the Triton server, and is deprecated. + // It is preferred to use service/endpoint.Config.TritonServers and Triton.ServerID instead. + // This will create a new connection per instance URL is used for a Triton server. + // Additionally, it is assumed that explicit model control is not enabled for that HTTP URL. URL string Batch *BatcherConfigFile `json:",omitempty" yaml:",omitempty"` @@ -61,6 +66,7 @@ type Model struct { // DataStore is the name of the datastore to use for caching. DataStore string `json:",omitempty" yaml:",omitempty"` + // Router must be provided if Mode is "router". Router *RouterConfig `json:",omitempty" yaml:",omitempty"` // Stream is a github.com/viant/tapper configuration. @@ -156,7 +162,9 @@ func (m *Model) Validate() error { return fmt.Errorf("triton model %s requires Triton configuration", m.ID) } - if err := m.Triton.Validate(m.URL != ""); err != nil { + m.Triton.Init() + + if err := m.Triton.Validate(m.Mode == "router", m.URL != ""); err != nil { return fmt.Errorf("triton model %s config invalid: %w", m.ID, err) } default: @@ -176,20 +184,32 @@ func (m *Model) Validate() error { return nil } -// TritonConfig represents Triton Inference Server specific configuration +// TritonConfig represents Triton Inference Server specific configuration. type TritonConfig struct { - // Model name in Triton + // Model name in Triton. + // Optional if Model.Mode is "router". ModelName string `json:",omitempty" yaml:",omitempty"` // ServerID is the ID of the Triton server. ServerID string `json:",omitempty" yaml:",omitempty"` - // HTTP timeout in milliseconds + // RepositoryExplicit should be true if the Model Repository is in EXPLICIT mode. + // In the case of URL-based Triton configuration, the default is to assume POLL mode. + // See https://docs.nvidia.com/deeplearning/triton-inference-server/user-guide/docs/user_guide/model_management.html + RepositoryExplicit bool `json:",omitempty" yaml:",omitempty"` + + // HTTP total timeout in milliseconds, defaults to 100 milliseconds. Timeout int `json:",omitempty" yaml:",omitempty"` } -func (t *TritonConfig) Validate(urlPresent bool) error { - if t.ModelName == "" { +func (t *TritonConfig) Init() { + if t.Timeout == 0 { + t.Timeout = 100 + } +} + +func (t *TritonConfig) Validate(isRouter bool, urlPresent bool) error { + if !isRouter && t.ModelName == "" { return fmt.Errorf("triton ModelName is required") } @@ -203,7 +223,8 @@ func (t *TritonConfig) Validate(urlPresent bool) error { // GetPlatform returns the platform with default to "tensorflow" for backward compatibility func (m *Model) GetPlatform() string { if m.Platform == "" { - return "tensorflow" + m.Platform = "tensorflow" } + return m.Platform } diff --git a/service/config/models.go b/service/config/models.go index 9300b15..b93bab0 100644 --- a/service/config/models.go +++ b/service/config/models.go @@ -17,8 +17,8 @@ func (l *ModelList) Init(bc *config.BatcherConfig) { return } - for i := range l.Models { - l.Models[i].Init(bc) + for _, model := range l.Models { + model.Init(bc) } } diff --git a/service/config/router.go b/service/config/router.go index f8186c8..818ee39 100644 --- a/service/config/router.go +++ b/service/config/router.go @@ -3,7 +3,7 @@ package config import "fmt" type RouterConfig struct { - // Required + // Required if Model.Mode is "router". ConfigURL string // Required diff --git a/service/config/triton_test.go b/service/config/triton_test.go index 6a867fc..8783028 100644 --- a/service/config/triton_test.go +++ b/service/config/triton_test.go @@ -89,7 +89,6 @@ func TestTritonModelConfigValidation(t *testing.T) { name: "default_platform_missing_url", config: &Model{ ID: "test_default_no_url", - // No platform specified, should default to tensorflow }, expectError: true, errorMsg: "URL", @@ -153,7 +152,7 @@ func TestTritonConfigValidation(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - err := tc.config.Validate(true) + err := tc.config.Validate(false, true) if tc.expectError { assert.Error(t, err) diff --git a/service/endpoint/model.go b/service/endpoint/model.go index a2258cb..d327c12 100644 --- a/service/endpoint/model.go +++ b/service/endpoint/model.go @@ -114,17 +114,13 @@ func Build(mux *http.ServeMux, config *Config, datastores map[string]*datastore. lock.Unlock() return } + log.Printf("[%s] Model configuration validated successfully", model.ID) e := func() error { var modelSrv *service.Service var err error - if model.Platform == "" { - // Default to TensorFlow for models without explicit platform - model.Platform = "tensorflow" - } - modelSrv, err = service.NewWithPlatform(context.Background(), model, fs, metrics, datastores, sema, cfge.MaxEvaluatorWait, serviceOpts...) if err != nil { diff --git a/service/platform/factory/factory.go b/service/platform/factory/factory.go index 36cd73a..45f3074 100644 --- a/service/platform/factory/factory.go +++ b/service/platform/factory/factory.go @@ -16,6 +16,7 @@ import ( // CreateEvaluator creates the appropriate platform evaluator based on the model configuration func CreateEvaluator( cfg *config.Model, + fs afs.Service, metrics *gmetric.Service, sema *semaphore.Weighted, @@ -30,8 +31,7 @@ func CreateEvaluator( return tfService, nil case "triton": - return triton.NewTritonEvaluator(cfg) - + return triton.NewTritonEvaluator(cfg, map[string]triton.TritonClient{}) default: return nil, fmt.Errorf("unsupported platform: %s for model %s", p, cfg.ID) } diff --git a/service/platform/tensorflow.go b/service/platform/tensorflow.go deleted file mode 100644 index 3b4b2f2..0000000 --- a/service/platform/tensorflow.go +++ /dev/null @@ -1,61 +0,0 @@ -package platform - -import ( - "context" - - "github.com/viant/mly/service/domain" - "github.com/viant/mly/service/tfmodel" - "github.com/viant/mly/shared/common" -) - -// TensorFlowEvaluator wraps the existing TensorFlow service to implement PlatformEvaluator -type TensorFlowEvaluator struct { - tfService *tfmodel.Service -} - -// NewTensorFlowEvaluator creates a new TensorFlow evaluator wrapper -func NewTensorFlowEvaluator(tfService *tfmodel.Service) *TensorFlowEvaluator { - return &TensorFlowEvaluator{ - tfService: tfService, - } -} - -// Predict delegates to the TensorFlow service -func (t *TensorFlowEvaluator) Predict(ctx context.Context, params []interface{}) ([]interface{}, error) { - return t.tfService.Predict(ctx, params) -} - -// Signature delegates to the TensorFlow service -func (t *TensorFlowEvaluator) Signature() *domain.Signature { - return t.tfService.Signature() -} - -// Dictionary delegates to the TensorFlow service -func (t *TensorFlowEvaluator) Dictionary() *common.Dictionary { - return t.tfService.Dictionary() -} - -// Stats delegates to the TensorFlow service -func (t *TensorFlowEvaluator) Stats(stats map[string]interface{}) { - t.tfService.Stats(stats) -} - -// Close delegates to the TensorFlow service -func (t *TensorFlowEvaluator) Close() error { - return t.tfService.Close() -} - -// Inputs returns the model inputs for request validation -func (t *TensorFlowEvaluator) Inputs() map[string]*domain.Input { - return t.tfService.Inputs() -} - -// ReloadIfNeeded performs model reload if needed for TensorFlow models -func (t *TensorFlowEvaluator) ReloadIfNeeded(ctx context.Context) error { - return t.tfService.ReloadIfNeeded(ctx) -} - -// SupportsReload returns true since TensorFlow models support reloading -func (t *TensorFlowEvaluator) SupportsReload() bool { - return true -} diff --git a/service/tfmodel/batcher/service.go b/service/tfmodel/batcher/service.go index 3f0cb13..3931cc0 100644 --- a/service/tfmodel/batcher/service.go +++ b/service/tfmodel/batcher/service.go @@ -186,7 +186,7 @@ func (s *Service) Evaluate(ctx context.Context, inputs []interface{}) ([]interfa return nil, err } - return nil, fmt.Errorf("unhandled select") + panic("unhandled select") } func (s *Service) setShedding(shedding bool) { diff --git a/service/tfmodel/service.go b/service/tfmodel/service.go index a2bf8e5..f58955b 100644 --- a/service/tfmodel/service.go +++ b/service/tfmodel/service.go @@ -426,8 +426,13 @@ func (s *Service) Close() error { // NewService creates an unprepared Service. // This service isn't ready until ReloadIfNeeded() is called. -func NewService(cfg *config.Model, fs afs.Service, metrics *gmetric.Service, sema *semaphore.Weighted, - maxEvaluatorWait time.Duration) *Service { +func NewService( + cfg *config.Model, + fs afs.Service, + metrics *gmetric.Service, + sema *semaphore.Weighted, + maxEvaluatorWait time.Duration, +) *Service { location := reflect.TypeOf(evaluator.Service{}).PkgPath() id := cfg.ID diff --git a/service/triton/client.go b/service/triton/client.go new file mode 100644 index 0000000..384e28c --- /dev/null +++ b/service/triton/client.go @@ -0,0 +1,15 @@ +package triton + +import ( + "context" +) + +type TritonClient interface { + ModelInfer(ctx context.Context, modelName string, inputs []interface{}, indexToName map[int]string) ([]interface{}, error) + + ModelReady(ctx context.Context, modelName string) (bool, error) + + ModelLoad(ctx context.Context, modelName string) error + + Close() error +} diff --git a/service/triton/grpc.go b/service/triton/grpc.go new file mode 100644 index 0000000..fc9d620 --- /dev/null +++ b/service/triton/grpc.go @@ -0,0 +1,430 @@ +package triton + +import ( + "context" + "encoding/binary" + "fmt" + "math" + "strings" + + triton "github.com/viant/mly/proto/triton" + "google.golang.org/grpc" +) + +type GRPCClient struct { + grpcConn *grpc.ClientConn + grpcClient triton.GRPCInferenceServiceClient +} + +// preparedInput represents processed input data ready for gRPC transport +type preparedInput struct { + name string + datatype string // Triton datatype: "BYTES", "INT32", "INT64", "FP32", "FP64" + shape []int64 // Shape in int64 for gRPC compatibility + data interface{} // Flattened data: []string, []int32, []int64, []float32, []float64 +} + +func (c *GRPCClient) ModelInfer(ctx context.Context, modelName string, inputs []interface{}, indexToName map[int]string) ([]interface{}, error) { + preparedInputs, err := prepareInputs(indexToName, inputs) + if err != nil { + return nil, err + } + + grpcRequest, err := buildGRPCRequest(modelName, preparedInputs) + if err != nil { + return nil, err + } + + grpcResponse, err := c.grpcClient.ModelInfer(ctx, grpcRequest) + if err != nil { + return nil, err + } + + return convertGRPCResponse(grpcResponse) +} + +func (c *GRPCClient) ModelReady(ctx context.Context, modelName string) (bool, error) { + grpcResponse, err := c.grpcClient.ModelReady(ctx, &triton.ModelReadyRequest{ + Name: modelName, + }) + if err != nil { + return false, err + } + return grpcResponse.Ready, nil +} + +func (c *GRPCClient) ModelLoad(ctx context.Context, modelName string) error { + _, err := c.grpcClient.RepositoryModelLoad(ctx, &triton.RepositoryModelLoadRequest{ + ModelName: modelName, + }) + + if err != nil { + return err + } + return nil +} + +func (c *GRPCClient) Close() error { + return c.grpcConn.Close() +} + +func parseGRPCAddress(url string) string { + addr := strings.TrimPrefix(url, "http://") + addr = strings.TrimPrefix(addr, "https://") + + if !strings.Contains(addr, ":") { + addr += ":8001" + } + + return addr +} + +func buildGRPCRequest(modelName string, preparedInputs []preparedInput) (*triton.ModelInferRequest, error) { + req := &triton.ModelInferRequest{ + ModelName: modelName, + Inputs: make([]*triton.ModelInferRequest_InferInputTensor, len(preparedInputs)), + } + + for i, input := range preparedInputs { + tensor := &triton.ModelInferRequest_InferInputTensor{ + Name: input.name, + Datatype: input.datatype, + Shape: input.shape, + Contents: &triton.InferTensorContents{}, + } + + switch data := input.data.(type) { + case []string: + tensor.Contents.BytesContents = make([][]byte, len(data)) + for j, s := range data { + tensor.Contents.BytesContents[j] = []byte(s) + } + case []int32: + tensor.Contents.IntContents = data + case []int64: + tensor.Contents.Int64Contents = data + case []float32: + tensor.Contents.Fp32Contents = data + case []float64: + tensor.Contents.Fp64Contents = data + default: + return nil, fmt.Errorf("unsupported input data type %T for %s", data, input.name) + } + + req.Inputs[i] = tensor + } + + return req, nil +} + +func parseRawOutput(rawData []byte, datatype string, batchSize int) (interface{}, error) { + switch datatype { + case "INT64": + if len(rawData) != batchSize*8 { + return nil, fmt.Errorf("INT64 raw data size mismatch: got %d bytes, expected %d", len(rawData), batchSize*8) + } + converted := make([][]int64, batchSize) + for j := 0; j < batchSize; j++ { + value := int64(binary.LittleEndian.Uint64(rawData[j*8 : (j+1)*8])) + converted[j] = []int64{value} + } + return converted, nil + + case "INT32": + if len(rawData) != batchSize*4 { + return nil, fmt.Errorf("INT32 raw data size mismatch: got %d bytes, expected %d", len(rawData), batchSize*4) + } + converted := make([][]int32, batchSize) + for j := 0; j < batchSize; j++ { + value := int32(binary.LittleEndian.Uint32(rawData[j*4 : (j+1)*4])) + converted[j] = []int32{value} + } + return converted, nil + + case "FP32": + if len(rawData) != batchSize*4 { + return nil, fmt.Errorf("FP32 raw data size mismatch: got %d bytes, expected %d", len(rawData), batchSize*4) + } + converted := make([][]float32, batchSize) + for j := 0; j < batchSize; j++ { + bits := binary.LittleEndian.Uint32(rawData[j*4 : (j+1)*4]) + value := math.Float32frombits(bits) + converted[j] = []float32{value} + } + return converted, nil + + case "FP64": + if len(rawData) != batchSize*8 { + return nil, fmt.Errorf("FP64 raw data size mismatch: got %d bytes, expected %d", len(rawData), batchSize*8) + } + converted := make([][]float64, batchSize) + for j := 0; j < batchSize; j++ { + bits := binary.LittleEndian.Uint64(rawData[j*8 : (j+1)*8]) + value := math.Float64frombits(bits) + converted[j] = []float64{value} + } + return converted, nil + + case "BYTES": + converted := make([][]string, batchSize) + offset := 0 + for j := 0; j < batchSize; j++ { + if offset+4 > len(rawData) { + return nil, fmt.Errorf("BYTES raw data truncated at element %d", j) + } + length := int(binary.LittleEndian.Uint32(rawData[offset : offset+4])) + offset += 4 + if offset+length > len(rawData) { + return nil, fmt.Errorf("BYTES raw data truncated at element %d: expected %d bytes", j, length) + } + value := string(rawData[offset : offset+length]) + offset += length + converted[j] = []string{value} + } + return converted, nil + + default: + return nil, fmt.Errorf("unsupported datatype for raw output: %s", datatype) + } +} + +func prepareInputs(indexToName map[int]string, params []interface{}) ([]preparedInput, error) { + if len(params) == 0 { + return nil, fmt.Errorf("no input parameters provided") + } + + var inputs []preparedInput + + for i, param := range params { + inputName, exists := indexToName[i] + if !exists { + return nil, fmt.Errorf("no input name found for index %d", i) + } + + switch v := param.(type) { + case [][]string: + if len(v) > 0 { + batchSize := len(v) + data := make([]string, batchSize) + for j := 0; j < batchSize; j++ { + if len(v[j]) > 0 { + data[j] = v[j][0] + } + } + inputs = append(inputs, preparedInput{ + name: inputName, + shape: []int64{int64(batchSize), 1}, + datatype: "BYTES", + data: data, + }) + } + case [][]int: + if len(v) > 0 { + batchSize := len(v) + data := make([]int32, batchSize) + for j := 0; j < batchSize; j++ { + if len(v[j]) > 0 { + data[j] = int32(v[j][0]) + } + } + inputs = append(inputs, preparedInput{ + name: inputName, + shape: []int64{int64(batchSize), 1}, + datatype: "INT32", + data: data, + }) + } + case [][]int32: + if len(v) > 0 { + batchSize := len(v) + data := make([]int32, batchSize) + for j := 0; j < batchSize; j++ { + if len(v[j]) > 0 { + data[j] = v[j][0] + } + } + inputs = append(inputs, preparedInput{ + name: inputName, + shape: []int64{int64(batchSize), 1}, + datatype: "INT32", + data: data, + }) + } + case [][]int64: + if len(v) > 0 { + batchSize := len(v) + data := make([]int64, batchSize) + for j := 0; j < batchSize; j++ { + if len(v[j]) > 0 { + data[j] = v[j][0] + } + } + inputs = append(inputs, preparedInput{ + name: inputName, + shape: []int64{int64(batchSize), 1}, + datatype: "INT64", + data: data, + }) + } + case [][]float32: + if len(v) > 0 { + batchSize := len(v) + data := make([]float32, batchSize) + for j := 0; j < batchSize; j++ { + if len(v[j]) > 0 { + data[j] = v[j][0] + } + } + inputs = append(inputs, preparedInput{ + name: inputName, + shape: []int64{int64(batchSize), 1}, + datatype: "FP32", + data: data, + }) + } + case [][]float64: + if len(v) > 0 { + batchSize := len(v) + data := make([]float64, batchSize) + for j := 0; j < batchSize; j++ { + if len(v[j]) > 0 { + data[j] = v[j][0] + } + } + inputs = append(inputs, preparedInput{ + name: inputName, + shape: []int64{int64(batchSize), 1}, + datatype: "FP64", + data: data, + }) + } + default: + return nil, fmt.Errorf("unsupported input type for %s at index %d: %T", inputName, i, param) + } + } + + return inputs, nil +} + +func convertGRPCResponse(response *triton.ModelInferResponse) ([]interface{}, error) { + if len(response.Outputs) == 0 { + return nil, fmt.Errorf("no outputs in response") + } + + result := make([]interface{}, len(response.Outputs)) + useRawContents := len(response.RawOutputContents) > 0 + + for i, output := range response.Outputs { + batchSize := 1 + if len(output.Shape) > 0 { + batchSize = int(output.Shape[0]) + } + + if useRawContents { + if i >= len(response.RawOutputContents) { + return nil, fmt.Errorf("raw output contents missing for output %d", i) + } + rawData := response.RawOutputContents[i] + parsedData, err := parseRawOutput(rawData, output.Datatype, batchSize) + if err != nil { + return nil, fmt.Errorf("failed to parse raw output %s: %w", output.Name, err) + } + result[i] = parsedData + continue + } + + if output.Contents == nil { + return nil, fmt.Errorf("output %s missing contents", output.Name) + } + + switch output.Datatype { + case "FP32": + if len(output.Contents.Fp32Contents) == 0 { + converted := make([][]float32, batchSize) + for j := 0; j < batchSize; j++ { + converted[j] = []float32{0.0} + } + result[i] = converted + } else { + converted := make([][]float32, batchSize) + for j := 0; j < batchSize && j < len(output.Contents.Fp32Contents); j++ { + converted[j] = []float32{output.Contents.Fp32Contents[j]} + } + result[i] = converted + } + + case "FP64": + if len(output.Contents.Fp64Contents) == 0 { + converted := make([][]float64, batchSize) + for j := 0; j < batchSize; j++ { + converted[j] = []float64{0.0} + } + result[i] = converted + } else { + converted := make([][]float64, batchSize) + for j := 0; j < batchSize && j < len(output.Contents.Fp64Contents); j++ { + converted[j] = []float64{output.Contents.Fp64Contents[j]} + } + result[i] = converted + } + + case "INT32": + if len(output.Contents.IntContents) == 0 { + converted := make([][]int32, batchSize) + for j := 0; j < batchSize; j++ { + converted[j] = []int32{0} + } + result[i] = converted + } else { + converted := make([][]int32, batchSize) + for j := 0; j < batchSize && j < len(output.Contents.IntContents); j++ { + converted[j] = []int32{output.Contents.IntContents[j]} + } + result[i] = converted + } + + case "INT64": + if len(output.Contents.Int64Contents) == 0 { + converted := make([][]int64, batchSize) + for j := 0; j < batchSize; j++ { + converted[j] = []int64{0} + } + result[i] = converted + } else { + converted := make([][]int64, batchSize) + for j := 0; j < batchSize && j < len(output.Contents.Int64Contents); j++ { + converted[j] = []int64{output.Contents.Int64Contents[j]} + } + result[i] = converted + } + + case "BYTES": + if len(output.Contents.BytesContents) == 0 { + converted := make([][]string, batchSize) + for j := 0; j < batchSize; j++ { + converted[j] = []string{""} + } + result[i] = converted + } else { + converted := make([][]string, batchSize) + for j := 0; j < batchSize && j < len(output.Contents.BytesContents); j++ { + converted[j] = []string{string(output.Contents.BytesContents[j])} + } + result[i] = converted + } + + default: + if len(output.Contents.Fp32Contents) > 0 { + converted := make([][]float32, batchSize) + for j := 0; j < batchSize && j < len(output.Contents.Fp32Contents); j++ { + converted[j] = []float32{output.Contents.Fp32Contents[j]} + } + result[i] = converted + } else { + return nil, fmt.Errorf("unsupported output datatype %s for %s", output.Datatype, output.Name) + } + } + } + + return result, nil +} diff --git a/service/triton/grpc_test.go b/service/triton/grpc_test.go new file mode 100644 index 0000000..7c9cb63 --- /dev/null +++ b/service/triton/grpc_test.go @@ -0,0 +1,719 @@ +package triton + +import ( + "context" + "fmt" + "net" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + triton "github.com/viant/mly/proto/triton" + "github.com/viant/mly/service/config" + "github.com/viant/mly/shared" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/test/bufconn" +) + +func TestParseGRPCAddress(t *testing.T) { + testCases := []struct { + name string + url string + expected string + }{ + { + name: "http_with_port", + url: "http://localhost:8000", + expected: "localhost:8000", // Preserves existing port + }, + { + name: "https_with_port", + url: "https://triton.example.com:8000", + expected: "triton.example.com:8000", // Preserves existing port + }, + { + name: "http_without_port", + url: "http://localhost", + expected: "localhost:8001", // Adds default gRPC port + }, + { + name: "https_without_port", + url: "https://triton.example.com", + expected: "triton.example.com:8001", // Adds default gRPC port + }, + { + name: "no_scheme", + url: "localhost:9001", + expected: "localhost:9001", // Preserves as-is + }, + { + name: "ip_address", + url: "http://192.168.1.100:8000", + expected: "192.168.1.100:8000", // Preserves existing port + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + result := parseGRPCAddress(tc.url) + assert.Equal(t, tc.expected, result) + }) + } +} + +// createMockTritonConn creates a gRPC client connected to the mock server +func createMockTritonConn(ctx context.Context, t *testing.T, listener *bufconn.Listener) *grpc.ClientConn { + conn, err := grpc.DialContext(ctx, "bufnet", + grpc.WithContextDialer(func(context.Context, string) (net.Conn, error) { + return listener.Dial() + }), + grpc.WithTransportCredentials(insecure.NewCredentials()), + ) + require.NoError(t, err) + return conn +} + +func createMockGRPCTritonEvaluator(t *testing.T, cfg *config.Model, grpcConn *grpc.ClientConn) *TritonEvaluator { + grpcClient := triton.NewGRPCInferenceServiceClient(grpcConn) + cfg.Triton.Init() + evaluator, err := NewTritonEvaluator(cfg, map[string]TritonClient{ + cfg.Triton.ServerID: &GRPCClient{ + grpcConn: grpcConn, + grpcClient: grpcClient, + }, + }) + + require.NoError(t, err) + return evaluator +} + +func TestTritonEvaluator_ReloadAndSupportsReload(t *testing.T) { + ctx := context.Background() + + // Set up mock server + mock := &mockTritonServer{ + modelReady: true, + responses: map[string]*triton.ModelInferResponse{ + "test_model": { + ModelName: "test_model", + Outputs: []*triton.ModelInferResponse_InferOutputTensor{ + { + Name: "output", + Datatype: "INT64", + Shape: []int64{2, 1}, + Contents: &triton.InferTensorContents{ + Int64Contents: []int64{42, 100}, + }, + }, + }, + }, + }, + } + + server, listener := startMockGRPCServer(t, mock) + defer server.Stop() + + cfg := &config.Model{ + ID: "test_model", + Platform: "triton", + MetaInput: shared.MetaInput{ + Inputs: []*shared.Field{ + {Name: "input1", Index: 0, DataType: "string"}, + }, + Outputs: []*shared.Field{ + {Name: "output1", Index: 0, DataType: "float32"}, + }, + }, + Triton: &config.TritonConfig{ + ModelName: "test_model", + ServerID: "test_server", + }, + } + + grpcConn := createMockTritonConn(ctx, t, listener) + evaluator := createMockGRPCTritonEvaluator(t, cfg, grpcConn) + defer evaluator.Close() + + // ReloadIfNeeded should be a no-op + err := evaluator.ReloadIfNeeded(context.Background()) + assert.NoError(t, err) +} + +func TestTritonEvaluator_PredictWithMockServer(t *testing.T) { + ctx := context.Background() + + // Set up mock server + mock := &mockTritonServer{ + modelReady: true, + responses: map[string]*triton.ModelInferResponse{ + "test_model": { + ModelName: "test_model", + Outputs: []*triton.ModelInferResponse_InferOutputTensor{ + { + Name: "output", + Datatype: "INT64", + Shape: []int64{2, 1}, + Contents: &triton.InferTensorContents{ + Int64Contents: []int64{42, 100}, + }, + }, + }, + }, + }, + } + + server, listener := startMockGRPCServer(t, mock) + defer server.Stop() + + // Create evaluator with mock connection + cfg := &config.Model{ + ID: "test_model", + Platform: "triton", + MetaInput: shared.MetaInput{ + Inputs: []*shared.Field{ + {Name: "input1", Index: 0, DataType: "string"}, + }, + Outputs: []*shared.Field{ + {Name: "output", Index: 0, DataType: "int64"}, + }, + }, + Triton: &config.TritonConfig{ + ModelName: "test_model", + ServerID: "test_server", + }, + } + grpcConn := createMockTritonConn(ctx, t, listener) + evaluator := createMockGRPCTritonEvaluator(t, cfg, grpcConn) + defer evaluator.Close() + + // Test prediction + params := []interface{}{ + [][]string{{"value1"}, {"value2"}}, // 2 batch items + } + + results, err := evaluator.Predict(ctx, params) + require.NoError(t, err) + require.Len(t, results, 1) + + // Verify output format + output, ok := results[0].([][]int64) + require.True(t, ok, "expected [][]int64, got %T", results[0]) + require.Len(t, output, 2) + assert.Equal(t, []int64{42}, output[0]) + assert.Equal(t, []int64{100}, output[1]) +} + +func TestTritonEvaluator_PredictWithRawOutputContents(t *testing.T) { + ctx := context.Background() + + // Set up mock server with raw output contents + mock := &mockTritonServer{ + modelReady: true, + responses: map[string]*triton.ModelInferResponse{ + "test_model": { + ModelName: "test_model", + Outputs: []*triton.ModelInferResponse_InferOutputTensor{ + { + Name: "output", + Datatype: "FP32", + Shape: []int64{2, 1}, + }, + }, + RawOutputContents: [][]byte{ + {0x00, 0x00, 0x20, 0x41, 0x00, 0x00, 0x48, 0x42}, // 10.0, 50.0 in float32 little-endian + }, + }, + }, + } + + server, listener := startMockGRPCServer(t, mock) + defer server.Stop() + + cfg := &config.Model{ + ID: "test_model", + Platform: "triton", + MetaInput: shared.MetaInput{ + Inputs: []*shared.Field{ + {Name: "input1", Index: 0, DataType: "string"}, + }, + Outputs: []*shared.Field{ + {Name: "output", Index: 0, DataType: "float32"}, + }, + }, + Triton: &config.TritonConfig{ + ModelName: "test_model", + ServerID: "test_server", + }, + } + + grpcConn := createMockTritonConn(ctx, t, listener) + evaluator := createMockGRPCTritonEvaluator(t, cfg, grpcConn) + defer evaluator.Close() + + params := []interface{}{ + [][]string{{"value1"}, {"value2"}}, + } + + results, err := evaluator.Predict(ctx, params) + require.NoError(t, err) + require.Len(t, results, 1) + + output, ok := results[0].([][]float32) + require.True(t, ok, "expected [][]float32, got %T", results[0]) + require.Len(t, output, 2) + assert.InDelta(t, 10.0, output[0][0], 0.01) + assert.InDelta(t, 50.0, output[1][0], 0.01) +} + +func TestTritonEvaluator_PredictAllInputTypes(t *testing.T) { + ctx := context.Background() + + testCases := []struct { + name string + inputType string + tritonType string + inputData interface{} + expectedResp *triton.ModelInferResponse + }{ + { + name: "int32_input", + inputType: "int32", + tritonType: "INT32", + inputData: [][]int32{{10}, {20}, {30}}, + expectedResp: &triton.ModelInferResponse{ + ModelName: "test_model", + Outputs: []*triton.ModelInferResponse_InferOutputTensor{ + { + Name: "output", + Datatype: "INT32", + Shape: []int64{3, 1}, + Contents: &triton.InferTensorContents{ + IntContents: []int32{100, 200, 300}, + }, + }, + }, + }, + }, + { + name: "int64_input", + inputType: "int64", + tritonType: "INT64", + inputData: [][]int64{{100}, {200}}, + expectedResp: &triton.ModelInferResponse{ + ModelName: "test_model", + Outputs: []*triton.ModelInferResponse_InferOutputTensor{ + { + Name: "output", + Datatype: "INT64", + Shape: []int64{2, 1}, + Contents: &triton.InferTensorContents{ + Int64Contents: []int64{1000, 2000}, + }, + }, + }, + }, + }, + { + name: "float32_input", + inputType: "float32", + tritonType: "FP32", + inputData: [][]float32{{1.5}, {2.5}, {3.5}, {4.5}}, + expectedResp: &triton.ModelInferResponse{ + ModelName: "test_model", + Outputs: []*triton.ModelInferResponse_InferOutputTensor{ + { + Name: "output", + Datatype: "FP32", + Shape: []int64{4, 1}, + Contents: &triton.InferTensorContents{ + Fp32Contents: []float32{10.5, 20.5, 30.5, 40.5}, + }, + }, + }, + }, + }, + { + name: "float64_input", + inputType: "float64", + tritonType: "FP64", + inputData: [][]float64{{1.111}}, + expectedResp: &triton.ModelInferResponse{ + ModelName: "test_model", + Outputs: []*triton.ModelInferResponse_InferOutputTensor{ + { + Name: "output", + Datatype: "FP64", + Shape: []int64{1, 1}, + Contents: &triton.InferTensorContents{ + Fp64Contents: []float64{11.111}, + }, + }, + }, + }, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + mock := &mockTritonServer{ + modelReady: true, + responses: map[string]*triton.ModelInferResponse{"test_model": tc.expectedResp}, + } + + server, listener := startMockGRPCServer(t, mock) + grpcConn := createMockTritonConn(ctx, t, listener) + defer server.Stop() + + cfg := &config.Model{ + ID: "test_model", + Platform: "triton", + MetaInput: shared.MetaInput{ + Inputs: []*shared.Field{ + {Name: "input1", Index: 0, DataType: tc.inputType}, + }, + Outputs: []*shared.Field{ + {Name: "output", Index: 0, DataType: tc.inputType}, + }, + }, + Triton: &config.TritonConfig{ + ModelName: "test_model", + ServerID: "test_server", + }, + } + + evaluator := createMockGRPCTritonEvaluator(t, cfg, grpcConn) + defer evaluator.Close() + + results, err := evaluator.Predict(ctx, []interface{}{tc.inputData}) + require.NoError(t, err) + require.Len(t, results, 1) + assert.NotNil(t, results[0]) + }) + } +} + +// mockTritonServer implements triton.GRPCInferenceServiceServer for testing +type mockTritonServer struct { + triton.UnimplementedGRPCInferenceServiceServer + modelReady bool + responses map[string]*triton.ModelInferResponse +} + +func (m *mockTritonServer) ModelReady(ctx context.Context, req *triton.ModelReadyRequest) (*triton.ModelReadyResponse, error) { + return &triton.ModelReadyResponse{Ready: m.modelReady}, nil +} + +func (m *mockTritonServer) ModelInfer(ctx context.Context, req *triton.ModelInferRequest) (*triton.ModelInferResponse, error) { + if resp, ok := m.responses[req.ModelName]; ok { + return resp, nil + } + // Return a default response + return &triton.ModelInferResponse{ + ModelName: req.ModelName, + Outputs: []*triton.ModelInferResponse_InferOutputTensor{ + { + Name: "output", + Datatype: "FP32", + Shape: []int64{1, 1}, + Contents: &triton.InferTensorContents{ + Fp32Contents: []float32{0.5}, + }, + }, + }, + }, nil +} + +// startMockGRPCServer starts an in-memory gRPC server for testing +func startMockGRPCServer(t *testing.T, mock *mockTritonServer) (*grpc.Server, *bufconn.Listener) { + buffer := 1024 * 1024 + listener := bufconn.Listen(buffer) + + server := grpc.NewServer() + triton.RegisterGRPCInferenceServiceServer(server, mock) + + go func() { + if err := server.Serve(listener); err != nil { + t.Logf("Server exited with error: %v", err) + } + }() + + return server, listener +} + +func TestTritonEvaluator_PredictBytesOutput(t *testing.T) { + ctx := context.Background() + + mock := &mockTritonServer{ + modelReady: true, + responses: map[string]*triton.ModelInferResponse{ + "test_model": { + ModelName: "test_model", + Outputs: []*triton.ModelInferResponse_InferOutputTensor{ + { + Name: "output", + Datatype: "BYTES", + Shape: []int64{2, 1}, + Contents: &triton.InferTensorContents{ + BytesContents: [][]byte{[]byte("result1"), []byte("result2")}, + }, + }, + }, + }, + }, + } + + server, listener := startMockGRPCServer(t, mock) + defer server.Stop() + + cfg := &config.Model{ + ID: "test_model", + Platform: "triton", + MetaInput: shared.MetaInput{ + Inputs: []*shared.Field{ + {Name: "input1", Index: 0, DataType: "string"}, + }, + Outputs: []*shared.Field{ + {Name: "output", Index: 0, DataType: "string"}, + }, + }, + Triton: &config.TritonConfig{ + ModelName: "test_model", + ServerID: "test_server", + }, + } + + grpcConn := createMockTritonConn(ctx, t, listener) + evaluator := createMockGRPCTritonEvaluator(t, cfg, grpcConn) + defer evaluator.Close() + + params := []interface{}{ + [][]string{{"input1"}, {"input2"}}, + } + + results, err := evaluator.Predict(ctx, params) + require.NoError(t, err) + require.Len(t, results, 1) + + output, ok := results[0].([][]string) + require.True(t, ok, "expected [][]string, got %T", results[0]) + require.Len(t, output, 2) + assert.Equal(t, []string{"result1"}, output[0]) + assert.Equal(t, []string{"result2"}, output[1]) +} + +func TestTritonEvaluator_PredictDifferentBatchSizes(t *testing.T) { + ctx := context.Background() + + testCases := []struct { + name string + batchSize int + }{ + {name: "single_item", batchSize: 1}, + {name: "small_batch", batchSize: 4}, + {name: "medium_batch", batchSize: 16}, + {name: "large_batch", batchSize: 64}, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + // Generate expected output + expectedOutput := make([]int64, tc.batchSize) + for i := 0; i < tc.batchSize; i++ { + expectedOutput[i] = int64(i * 10) + } + + mock := &mockTritonServer{ + modelReady: true, + responses: map[string]*triton.ModelInferResponse{ + "test_model": { + ModelName: "test_model", + Outputs: []*triton.ModelInferResponse_InferOutputTensor{ + { + Name: "output", + Datatype: "INT64", + Shape: []int64{int64(tc.batchSize), 1}, + Contents: &triton.InferTensorContents{ + Int64Contents: expectedOutput, + }, + }, + }, + }, + }, + } + + server, listener := startMockGRPCServer(t, mock) + defer server.Stop() + + cfg := &config.Model{ + ID: "test_model", + Platform: "triton", + MetaInput: shared.MetaInput{ + Inputs: []*shared.Field{ + {Name: "input1", Index: 0, DataType: "string"}, + }, + Outputs: []*shared.Field{ + {Name: "output", Index: 0, DataType: "int64"}, + }, + }, + Triton: &config.TritonConfig{ + ModelName: "test_model", + ServerID: "test_server", + }, + } + + grpcConn := createMockTritonConn(ctx, t, listener) + evaluator := createMockGRPCTritonEvaluator(t, cfg, grpcConn) + defer evaluator.Close() + + // Generate input batch + inputBatch := make([][]string, tc.batchSize) + for i := 0; i < tc.batchSize; i++ { + inputBatch[i] = []string{fmt.Sprintf("input_%d", i)} + } + + results, err := evaluator.Predict(ctx, []interface{}{inputBatch}) + require.NoError(t, err) + require.Len(t, results, 1) + + output, ok := results[0].([][]int64) + require.True(t, ok, "expected [][]int64, got %T", results[0]) + assert.Len(t, output, tc.batchSize) + }) + } +} + +func TestTritonEvaluator_PredictUnsupportedType(t *testing.T) { + ctx := context.Background() + + mock := &mockTritonServer{ + modelReady: true, + responses: map[string]*triton.ModelInferResponse{ + "test_model": { + ModelName: "test_model", + Outputs: []*triton.ModelInferResponse_InferOutputTensor{ + { + Name: "output", + Datatype: "UNKNOWN_TYPE", + Shape: []int64{1, 1}, + Contents: &triton.InferTensorContents{ + // Has contents but unsupported type + BytesContents: [][]byte{[]byte("data")}, + }, + }, + }, + }, + }, + } + + server, listener := startMockGRPCServer(t, mock) + defer server.Stop() + + cfg := &config.Model{ + ID: "test_model", + Platform: "triton", + MetaInput: shared.MetaInput{ + Inputs: []*shared.Field{ + {Name: "input1", Index: 0, DataType: "string"}, + }, + Outputs: []*shared.Field{ + {Name: "output", Index: 0, DataType: "string"}, + }, + }, + Triton: &config.TritonConfig{ + ModelName: "test_model", + ServerID: "test_server", + }, + } + + grpcConn := createMockTritonConn(ctx, t, listener) + evaluator := createMockGRPCTritonEvaluator(t, cfg, grpcConn) + defer evaluator.Close() + + params := []interface{}{ + [][]string{{"test"}}, + } + + _, err := evaluator.Predict(ctx, params) + require.Error(t, err) + assert.Contains(t, err.Error(), "unsupported") +} + +func TestTritonEvaluator_PredictEmptyBatch(t *testing.T) { + cfg := &config.Model{ + ID: "test_model", + Platform: "triton", + MetaInput: shared.MetaInput{ + Inputs: []*shared.Field{ + {Name: "input1", Index: 0, DataType: "string"}, + }, + Outputs: []*shared.Field{ + {Name: "output", Index: 0, DataType: "int64"}, + }, + }, + Triton: &config.TritonConfig{ + ModelName: "test_model", + ServerID: "test_server", + }, + } + + evaluator := createMockGRPCTritonEvaluator(t, cfg, nil) + defer evaluator.Close() + + _, err := evaluator.Predict(context.Background(), []interface{}{}) + require.Error(t, err) + assert.Contains(t, err.Error(), "no input parameters") +} + +func TestTritonEvaluator_PredictMissingOutput(t *testing.T) { + ctx := context.Background() + + mock := &mockTritonServer{ + modelReady: true, + responses: map[string]*triton.ModelInferResponse{ + "test_model": { + ModelName: "test_model", + Outputs: []*triton.ModelInferResponse_InferOutputTensor{ + { + Name: "output", + Datatype: "INT64", + Shape: []int64{1, 1}, + // Missing Contents field + }, + }, + }, + }, + } + + server, listener := startMockGRPCServer(t, mock) + defer server.Stop() + + cfg := &config.Model{ + ID: "test_model", + Platform: "triton", + MetaInput: shared.MetaInput{ + Inputs: []*shared.Field{ + {Name: "input1", Index: 0, DataType: "string"}, + }, + Outputs: []*shared.Field{ + {Name: "output", Index: 0, DataType: "int64"}, + }, + }, + Triton: &config.TritonConfig{ + ModelName: "test_model", + ServerID: "test_server", + }, + } + + grpcConn := createMockTritonConn(ctx, t, listener) + evaluator := createMockGRPCTritonEvaluator(t, cfg, grpcConn) + defer evaluator.Close() + + params := []interface{}{ + [][]string{{"test"}}, + } + + _, err := evaluator.Predict(ctx, params) + require.Error(t, err) + assert.Contains(t, err.Error(), "missing contents") +} diff --git a/service/triton/http.go b/service/triton/http.go new file mode 100644 index 0000000..6a94661 --- /dev/null +++ b/service/triton/http.go @@ -0,0 +1,349 @@ +package triton + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "io" + "net/http" + "reflect" + "time" + + "github.com/francoispqt/gojay" +) + +// Deprecated: use GRPCClient instead +type HTTPClient struct { + httpClient *http.Client + + serverURL string +} + +func (c *HTTPClient) ModelInfer(ctx context.Context, modelName string, inputs []interface{}, indexToName map[int]string) ([]interface{}, error) { + tritonRequest, err := convertToTritonRequest(inputs, indexToName) + if err != nil { + return nil, err + } + + tritonResponse, err := c.sendRequest(ctx, modelName, tritonRequest) + if err != nil { + return nil, err + } + + return convertFromTritonResponse(tritonResponse), nil +} + +func (c *HTTPClient) ModelReady(ctx context.Context, modelName string) (bool, error) { + url := c.serverURL + "/v2/models/" + modelName + "/ready" + httpReq, err := http.NewRequestWithContext(ctx, "GET", url, nil) + if err != nil { + return false, fmt.Errorf("failed to create HTTP request: %w", err) + } + resp, err := c.handleRequestWithRetry(ctx, httpReq, nil) + if err != nil { + return false, err + } + + defer resp.Body.Close() + + if resp.StatusCode == http.StatusBadRequest { + // TODO "Model version not ready" + return false, nil + } else if resp.StatusCode != http.StatusOK { + body, _ := io.ReadAll(resp.Body) + return false, fmt.Errorf("triton server returned status %d: %s", resp.StatusCode, string(body)) + } + + return true, nil +} + +func (c *HTTPClient) ModelLoad(ctx context.Context, modelName string) error { + url := c.serverURL + "/v2/repository/models/" + modelName + "/load" + httpReq, err := http.NewRequestWithContext(ctx, "POST", url, nil) + if err != nil { + return fmt.Errorf("failed to create HTTP request: %w", err) + } + resp, err := c.handleRequestWithRetry(ctx, httpReq, nil) + if err != nil { + return err + } + + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + body, _ := io.ReadAll(resp.Body) + return fmt.Errorf("triton server returned status %d: %s", resp.StatusCode, string(body)) + } + + return nil +} + +func (c *HTTPClient) Close() error { + return nil +} + +// TritonInput represents a single input tensor for Triton +type TritonInput struct { + Name string `json:"name"` + Shape []int `json:"shape"` + DataType string `json:"datatype"` + Data interface{} `json:"data"` +} + +type TritonOutput struct { + Name string `json:"name"` + Data interface{} `json:"data"` +} + +// TritonRequest represents the HTTP request format to Triton +type TritonRequest struct { + Inputs []TritonInput `json:"inputs"` +} + +// TritonResponse represents the HTTP response format from Triton +type TritonResponse struct { + Outputs []TritonOutput `json:"outputs"` +} + +func (t *TritonInput) MarshalJSONObject(enc *gojay.Encoder) { + enc.StringKey("name", t.Name) + enc.ArrayKey("shape", gojay.EncodeArrayFunc(func(enc *gojay.Encoder) { + for _, v := range t.Shape { + enc.AddInt(v) + } + })) + enc.StringKey("datatype", t.DataType) + + enc.ArrayKey("data", gojay.EncodeArrayFunc(func(enc *gojay.Encoder) { + switch data := t.Data.(type) { + case []string: + for _, v := range data { + enc.AddString(v) + } + case []int: + for _, v := range data { + enc.AddInt(v) + } + case []float32: + for _, v := range data { + enc.AddFloat32(v) + } + case []float64: + for _, v := range data { + enc.AddFloat64(v) + } + default: + for i := 0; i < reflect.ValueOf(data).Len(); i++ { + val := reflect.ValueOf(data).Index(i).Interface() + enc.AddInterface(val) + } + } + })) +} + +func (t *TritonInput) IsNil() bool { + return t == nil +} + +func (t *TritonRequest) MarshalJSONObject(enc *gojay.Encoder) { + enc.ArrayKey("inputs", (*TritonInputs)(&t.Inputs)) +} + +func (t *TritonRequest) IsNil() bool { + return t == nil +} + +type TritonInputs []TritonInput + +func (t *TritonInputs) MarshalJSONArray(enc *gojay.Encoder) { + for i := range *t { + enc.AddObject(&(*t)[i]) + } +} + +func (t *TritonInputs) IsNil() bool { + return t == nil || len(*t) == 0 +} + +func (c *HTTPClient) sendRequest(ctx context.Context, modelName string, request *TritonRequest) (*TritonResponse, error) { + url := c.serverURL + "/v2/models/" + modelName + "/infer" + + buf := bytes.NewBuffer(make([]byte, 0, 1024)) + enc := gojay.NewEncoder(buf) + if err := enc.EncodeObject(request); err != nil { + return nil, fmt.Errorf("failed to marshal Triton request: %w", err) + } + jsonData := buf.Bytes() + + // Create HTTP request + httpReq, err := http.NewRequestWithContext(ctx, "POST", url, bytes.NewBuffer(jsonData)) + if err != nil { + return nil, fmt.Errorf("failed to create HTTP request: %w", err) + } + httpReq.Header.Set("Content-Type", "application/json") + + resp, err := c.handleRequestWithRetry(ctx, httpReq, jsonData) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + body, _ := io.ReadAll(resp.Body) + return nil, fmt.Errorf("triton server returned status %d: %s", resp.StatusCode, string(body)) + } + + var tritonResponse TritonResponse + if err := json.NewDecoder(resp.Body).Decode(&tritonResponse); err != nil { + return nil, fmt.Errorf("failed to parse Triton response: %w", err) + } + + return &tritonResponse, nil +} + +func (c *HTTPClient) handleRequestWithRetry(ctx context.Context, httpReq *http.Request, jsonData []byte) (*http.Response, error) { + var resp *http.Response + var err error + + maxRetries := 3 + for attempt := 0; attempt <= maxRetries; attempt++ { + resp, err = c.httpClient.Do(httpReq) + + if err == nil { + break + } else if resp.StatusCode >= 500 { + // try again on 5xx + resp.Body.Close() + } else { + break + } + + if attempt == maxRetries { + return nil, fmt.Errorf("http request failed after %d attempts: %w", maxRetries+1, err) + } + + time.Sleep(time.Duration(5*(1< 0 { + // MLY batch format: [][]T where len(v) = batch_size + // Each v[i] contains one element: the value for batch item i + batchSize := len(v) + data := make([]string, batchSize) + for j := 0; j < batchSize; j++ { + if len(v[j]) > 0 { + data[j] = v[j][0] // Extract the value for batch item j + } + } + inputs = append(inputs, TritonInput{ + Name: inputName, + Shape: []int{batchSize, 1}, + DataType: "BYTES", + Data: data, + }) + } + case [][]int: + if len(v) > 0 { + batchSize := len(v) + data := make([]int, batchSize) + for j := 0; j < batchSize; j++ { + if len(v[j]) > 0 { + data[j] = v[j][0] + } + } + inputs = append(inputs, TritonInput{ + Name: inputName, + Shape: []int{batchSize, 1}, + DataType: "INT32", + Data: data, + }) + } + case [][]float32: + if len(v) > 0 { + batchSize := len(v) + data := make([]float32, batchSize) + for j := 0; j < batchSize; j++ { + if len(v[j]) > 0 { + data[j] = v[j][0] + } + } + inputs = append(inputs, TritonInput{ + Name: inputName, + Shape: []int{batchSize, 1}, + DataType: "FP32", + Data: data, + }) + } + case [][]float64: + if len(v) > 0 { + batchSize := len(v) + data := make([]float64, batchSize) + for j := 0; j < batchSize; j++ { + if len(v[j]) > 0 { + data[j] = v[j][0] + } + } + inputs = append(inputs, TritonInput{ + Name: inputName, + Shape: []int{batchSize, 1}, + DataType: "FP64", + Data: data, + }) + } + default: + return nil, fmt.Errorf("unsupported input type for %s at index %d: %T", inputName, i, param) + } + } + + return &TritonRequest{Inputs: inputs}, nil +} + +// convertFromTritonResponse converts Triton response to MLY format ([]interface{}) +func convertFromTritonResponse(response *TritonResponse) []interface{} { + var result []interface{} + + for _, output := range response.Outputs { + if data, ok := output.Data.([]interface{}); ok && len(data) > 0 { + batchSize := len(data) + converted := make([][]float32, batchSize) + for i, v := range data { + if f, ok := v.(float64); ok { + converted[i] = []float32{float32(f)} + } else { + converted[i] = []float32{0.0} + } + } + result = append(result, converted) + } else { + result = append(result, [][]float32{{0.0}}) + } + } + + return result +} diff --git a/service/triton/triton.go b/service/triton/triton.go index e42b3f6..ed8edbb 100644 --- a/service/triton/triton.go +++ b/service/triton/triton.go @@ -2,118 +2,77 @@ package triton import ( "context" - "encoding/binary" "fmt" - "math" + "net/http" "reflect" - "strings" - "sync" - "sync/atomic" "time" - triton "github.com/viant/mly/proto/triton" - "github.com/viant/mly/service/config" "github.com/viant/mly/service/domain" + "github.com/viant/mly/shared" "github.com/viant/mly/shared/common" - - "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" ) -// preparedInput represents processed input data ready for gRPC transport -type preparedInput struct { - name string - datatype string // Triton datatype: "BYTES", "INT32", "INT64", "FP32", "FP64" - shape []int64 // Shape in int64 for gRPC compatibility - data interface{} // Flattened data: []string, []int32, []int64, []float32, []float64 -} - // TritonEvaluator implements PlatformEvaluator for Triton Inference Server via gRPC type TritonEvaluator struct { - config *config.Model + client TritonClient - serverURL string modelName string - // gRPC-specific fields - grpcConn *grpc.ClientConn - grpcClient triton.GRPCInferenceServiceClient - timeout time.Duration + // if true, this client is used only for this instance + isPrivateClient bool + repositoryExplicit bool - signature *domain.Signature - inputs map[string]*domain.Input + timeout time.Duration - // Health reporting support - healthPtr *int32 - stopHealthCheck chan struct{} - initMonitorOnce sync.Once + signature *domain.Signature + indexToName map[int]string + + inputs map[string]*domain.Input } // NewTritonEvaluator creates a new Triton evaluator -func NewTritonEvaluator(config *config.Model) (*TritonEvaluator, error) { - serverURL := config.URL - modelName := config.ID - timeout := 100 * time.Millisecond - - if config.Triton != nil { - if config.Triton.ModelName != "" { - modelName = config.Triton.ModelName +func NewTritonEvaluator(config *config.Model, tritonClients map[string]TritonClient) (*TritonEvaluator, error) { + var client TritonClient + + isPrivateClient := config.URL != "" + timeout := time.Duration(config.Triton.Timeout) * time.Millisecond + + if isPrivateClient { + // "Private" URL configuration will only support HTTP + client = &HTTPClient{ + httpClient: &http.Client{ + Timeout: timeout, + }, + serverURL: config.URL, } - if config.Triton.Timeout > 0 { - timeout = time.Duration(config.Triton.Timeout) * time.Millisecond + } else { + client = tritonClients[config.Triton.ServerID] + if client == nil { + return nil, fmt.Errorf("client not found for Triton, server ID: %s", config.Triton.ServerID) } } - grpcAddr := parseGRPCAddress(serverURL) + evaluator := &TritonEvaluator{ + client: client, + modelName: config.Triton.ModelName, + timeout: timeout, - conn, err := grpc.NewClient(grpcAddr, - grpc.WithTransportCredentials(insecure.NewCredentials()), - ) + isPrivateClient: isPrivateClient, - if err != nil { - return nil, fmt.Errorf("failed to create Triton gRPC client at %s: %w", grpcAddr, err) + // clients defined in TritonServers are assumed to be in EXPLICIT mode + repositoryExplicit: !isPrivateClient || config.Triton.RepositoryExplicit, } - evaluator := &TritonEvaluator{ - config: config, - serverURL: grpcAddr, - modelName: modelName, - grpcConn: conn, - grpcClient: triton.NewGRPCInferenceServiceClient(conn), - timeout: timeout, - stopHealthCheck: make(chan struct{}), + if err := evaluator.handleIO(&config.MetaInput); err != nil { + return nil, err } - evaluator.signature = evaluator.computeSignature() - evaluator.inputs = evaluator.computeInputs() - return evaluator, nil } -func parseGRPCAddress(url string) string { - addr := strings.TrimPrefix(url, "http://") - addr = strings.TrimPrefix(addr, "https://") - - if !strings.Contains(addr, ":") { - addr += ":8001" - } - - return addr -} - // Predict performs inference via Triton Inference Server func (t *TritonEvaluator) Predict(ctx context.Context, params []interface{}) ([]interface{}, error) { - preparedInputs, err := t.prepareBatchInputs(params) - if err != nil { - return nil, fmt.Errorf("failed to prepare inputs: %w", err) - } - - grpcRequest, err := t.buildGRPCRequest(preparedInputs) - if err != nil { - return nil, fmt.Errorf("failed to build gRPC request: %w", err) - } - requestCtx := ctx if _, hasDeadline := ctx.Deadline(); !hasDeadline { var cancel context.CancelFunc @@ -121,435 +80,28 @@ func (t *TritonEvaluator) Predict(ctx context.Context, params []interface{}) ([] defer cancel() } - grpcResponse, err := t.grpcClient.ModelInfer(requestCtx, grpcRequest) - if err != nil { - return nil, fmt.Errorf("triton gRPC inference failed for model %s: %w", t.config.ID, err) - } - - result, err := t.convertGRPCResponse(grpcResponse) - if err != nil { - return nil, fmt.Errorf("failed to convert gRPC response: %w", err) - } - - return result, nil + return t.client.ModelInfer(requestCtx, t.modelName, params, t.indexToName) } -func (t *TritonEvaluator) prepareBatchInputs(params []interface{}) ([]preparedInput, error) { - if len(params) == 0 { - return nil, fmt.Errorf("no input parameters provided") - } - - var inputs []preparedInput - - inputDefs := t.Inputs() +func (t *TritonEvaluator) handleIO(io *shared.MetaInput) error { + var inputs []domain.Input + var outputs []domain.Output indexToName := make(map[int]string) - for name, input := range inputDefs { - if !input.Auxiliary { - indexToName[input.Index] = name - } - } - - for i, param := range params { - inputName, exists := indexToName[i] - if !exists { - return nil, fmt.Errorf("no input name found for index %d", i) - } - switch v := param.(type) { - case [][]string: - if len(v) > 0 { - batchSize := len(v) - data := make([]string, batchSize) - for j := 0; j < batchSize; j++ { - if len(v[j]) > 0 { - data[j] = v[j][0] - } - } - inputs = append(inputs, preparedInput{ - name: inputName, - shape: []int64{int64(batchSize), 1}, - datatype: "BYTES", - data: data, - }) - } - case [][]int: - if len(v) > 0 { - batchSize := len(v) - data := make([]int32, batchSize) - for j := 0; j < batchSize; j++ { - if len(v[j]) > 0 { - data[j] = int32(v[j][0]) - } - } - inputs = append(inputs, preparedInput{ - name: inputName, - shape: []int64{int64(batchSize), 1}, - datatype: "INT32", - data: data, - }) - } - case [][]int32: - if len(v) > 0 { - batchSize := len(v) - data := make([]int32, batchSize) - for j := 0; j < batchSize; j++ { - if len(v[j]) > 0 { - data[j] = v[j][0] - } - } - inputs = append(inputs, preparedInput{ - name: inputName, - shape: []int64{int64(batchSize), 1}, - datatype: "INT32", - data: data, - }) - } - case [][]int64: - if len(v) > 0 { - batchSize := len(v) - data := make([]int64, batchSize) - for j := 0; j < batchSize; j++ { - if len(v[j]) > 0 { - data[j] = v[j][0] - } - } - inputs = append(inputs, preparedInput{ - name: inputName, - shape: []int64{int64(batchSize), 1}, - datatype: "INT64", - data: data, - }) - } - case [][]float32: - if len(v) > 0 { - batchSize := len(v) - data := make([]float32, batchSize) - for j := 0; j < batchSize; j++ { - if len(v[j]) > 0 { - data[j] = v[j][0] - } - } - inputs = append(inputs, preparedInput{ - name: inputName, - shape: []int64{int64(batchSize), 1}, - datatype: "FP32", - data: data, - }) - } - case [][]float64: - if len(v) > 0 { - batchSize := len(v) - data := make([]float64, batchSize) - for j := 0; j < batchSize; j++ { - if len(v[j]) > 0 { - data[j] = v[j][0] - } - } - inputs = append(inputs, preparedInput{ - name: inputName, - shape: []int64{int64(batchSize), 1}, - datatype: "FP64", - data: data, - }) - } - default: - return nil, fmt.Errorf("unsupported input type for %s at index %d: %T", inputName, i, param) - } - } - - return inputs, nil -} - -func (t *TritonEvaluator) buildGRPCRequest(preparedInputs []preparedInput) (*triton.ModelInferRequest, error) { - req := &triton.ModelInferRequest{ - ModelName: t.modelName, - Inputs: make([]*triton.ModelInferRequest_InferInputTensor, len(preparedInputs)), - } - - for i, input := range preparedInputs { - tensor := &triton.ModelInferRequest_InferInputTensor{ - Name: input.name, - Datatype: input.datatype, - Shape: input.shape, - Contents: &triton.InferTensorContents{}, - } - - switch data := input.data.(type) { - case []string: - tensor.Contents.BytesContents = make([][]byte, len(data)) - for j, s := range data { - tensor.Contents.BytesContents[j] = []byte(s) - } - case []int32: - tensor.Contents.IntContents = data - case []int64: - tensor.Contents.Int64Contents = data - case []float32: - tensor.Contents.Fp32Contents = data - case []float64: - tensor.Contents.Fp64Contents = data - default: - return nil, fmt.Errorf("unsupported input data type %T for %s", data, input.name) - } - - req.Inputs[i] = tensor - } - - return req, nil -} - -func (t *TritonEvaluator) convertGRPCResponse(response *triton.ModelInferResponse) ([]interface{}, error) { - if len(response.Outputs) == 0 { - return nil, fmt.Errorf("no outputs in response") - } - - result := make([]interface{}, len(response.Outputs)) - useRawContents := len(response.RawOutputContents) > 0 - - for i, output := range response.Outputs { - batchSize := 1 - if len(output.Shape) > 0 { - batchSize = int(output.Shape[0]) - } - - if useRawContents { - if i >= len(response.RawOutputContents) { - return nil, fmt.Errorf("raw output contents missing for output %d", i) - } - rawData := response.RawOutputContents[i] - parsedData, err := t.parseRawOutput(rawData, output.Datatype, batchSize) - if err != nil { - return nil, fmt.Errorf("failed to parse raw output %s: %w", output.Name, err) - } - result[i] = parsedData - continue - } - - if output.Contents == nil { - return nil, fmt.Errorf("output %s missing contents", output.Name) - } - - switch output.Datatype { - case "FP32": - if len(output.Contents.Fp32Contents) == 0 { - converted := make([][]float32, batchSize) - for j := 0; j < batchSize; j++ { - converted[j] = []float32{0.0} - } - result[i] = converted - } else { - converted := make([][]float32, batchSize) - for j := 0; j < batchSize && j < len(output.Contents.Fp32Contents); j++ { - converted[j] = []float32{output.Contents.Fp32Contents[j]} - } - result[i] = converted - } - - case "FP64": - if len(output.Contents.Fp64Contents) == 0 { - converted := make([][]float64, batchSize) - for j := 0; j < batchSize; j++ { - converted[j] = []float64{0.0} - } - result[i] = converted - } else { - converted := make([][]float64, batchSize) - for j := 0; j < batchSize && j < len(output.Contents.Fp64Contents); j++ { - converted[j] = []float64{output.Contents.Fp64Contents[j]} - } - result[i] = converted - } - - case "INT32": - if len(output.Contents.IntContents) == 0 { - converted := make([][]int32, batchSize) - for j := 0; j < batchSize; j++ { - converted[j] = []int32{0} - } - result[i] = converted - } else { - converted := make([][]int32, batchSize) - for j := 0; j < batchSize && j < len(output.Contents.IntContents); j++ { - converted[j] = []int32{output.Contents.IntContents[j]} - } - result[i] = converted - } - - case "INT64": - if len(output.Contents.Int64Contents) == 0 { - converted := make([][]int64, batchSize) - for j := 0; j < batchSize; j++ { - converted[j] = []int64{0} - } - result[i] = converted - } else { - converted := make([][]int64, batchSize) - for j := 0; j < batchSize && j < len(output.Contents.Int64Contents); j++ { - converted[j] = []int64{output.Contents.Int64Contents[j]} - } - result[i] = converted - } - - case "BYTES": - if len(output.Contents.BytesContents) == 0 { - converted := make([][]string, batchSize) - for j := 0; j < batchSize; j++ { - converted[j] = []string{""} - } - result[i] = converted - } else { - converted := make([][]string, batchSize) - for j := 0; j < batchSize && j < len(output.Contents.BytesContents); j++ { - converted[j] = []string{string(output.Contents.BytesContents[j])} - } - result[i] = converted - } - - default: - if len(output.Contents.Fp32Contents) > 0 { - converted := make([][]float32, batchSize) - for j := 0; j < batchSize && j < len(output.Contents.Fp32Contents); j++ { - converted[j] = []float32{output.Contents.Fp32Contents[j]} - } - result[i] = converted - } else { - return nil, fmt.Errorf("unsupported output datatype %s for %s", output.Datatype, output.Name) - } - } - } + mappedInputs := make(map[string]*domain.Input) - return result, nil -} - -func (t *TritonEvaluator) parseRawOutput(rawData []byte, datatype string, batchSize int) (interface{}, error) { - switch datatype { - case "INT64": - if len(rawData) != batchSize*8 { - return nil, fmt.Errorf("INT64 raw data size mismatch: got %d bytes, expected %d", len(rawData), batchSize*8) - } - converted := make([][]int64, batchSize) - for j := 0; j < batchSize; j++ { - value := int64(binary.LittleEndian.Uint64(rawData[j*8 : (j+1)*8])) - converted[j] = []int64{value} - } - return converted, nil - - case "INT32": - if len(rawData) != batchSize*4 { - return nil, fmt.Errorf("INT32 raw data size mismatch: got %d bytes, expected %d", len(rawData), batchSize*4) - } - converted := make([][]int32, batchSize) - for j := 0; j < batchSize; j++ { - value := int32(binary.LittleEndian.Uint32(rawData[j*4 : (j+1)*4])) - converted[j] = []int32{value} - } - return converted, nil - - case "FP32": - if len(rawData) != batchSize*4 { - return nil, fmt.Errorf("FP32 raw data size mismatch: got %d bytes, expected %d", len(rawData), batchSize*4) - } - converted := make([][]float32, batchSize) - for j := 0; j < batchSize; j++ { - bits := binary.LittleEndian.Uint32(rawData[j*4 : (j+1)*4]) - value := math.Float32frombits(bits) - converted[j] = []float32{value} - } - return converted, nil - - case "FP64": - if len(rawData) != batchSize*8 { - return nil, fmt.Errorf("FP64 raw data size mismatch: got %d bytes, expected %d", len(rawData), batchSize*8) - } - converted := make([][]float64, batchSize) - for j := 0; j < batchSize; j++ { - bits := binary.LittleEndian.Uint64(rawData[j*8 : (j+1)*8]) - value := math.Float64frombits(bits) - converted[j] = []float64{value} - } - return converted, nil - - case "BYTES": - converted := make([][]string, batchSize) - offset := 0 - for j := 0; j < batchSize; j++ { - if offset+4 > len(rawData) { - return nil, fmt.Errorf("BYTES raw data truncated at element %d", j) - } - length := int(binary.LittleEndian.Uint32(rawData[offset : offset+4])) - offset += 4 - if offset+length > len(rawData) { - return nil, fmt.Errorf("BYTES raw data truncated at element %d: expected %d bytes", j, length) - } - value := string(rawData[offset : offset+length]) - offset += length - converted[j] = []string{value} - } - return converted, nil - - default: - return nil, fmt.Errorf("unsupported datatype for raw output: %s", datatype) - } -} - -func (t *TritonEvaluator) computeSignature() *domain.Signature { - var inputs []domain.Input - var outputs []domain.Output - - if len(t.config.Inputs) > 0 { - for _, input := range t.config.Inputs { + if len(io.Inputs) > 0 { + for _, input := range io.Inputs { if !input.Auxiliary { inputs = append(inputs, domain.Input{ Name: input.Name, Index: input.Index, }) - } - } - } else { - panic("Triton model " + t.config.ID + " requires explicit input configuration. " + - "Add 'inputs' section to your model configuration YAML with field definitions") - } - - if len(t.config.Outputs) > 0 { - for i, output := range t.config.Outputs { - outputs = append(outputs, domain.Output{ - Name: output.Name, - Index: i, - DataType: output.DataType, - }) - } - } else { - panic("Triton model " + t.config.ID + " requires explicit output configuration. " + - "Add 'outputs' section to your model configuration YAML with field definitions") - } - - return &domain.Signature{ - Inputs: inputs, - Outputs: outputs, - Output: outputs[0], - } -} - -func (t *TritonEvaluator) Signature() *domain.Signature { - return t.signature -} - -func (t *TritonEvaluator) Dictionary() *common.Dictionary { - return nil -} - -func (t *TritonEvaluator) Stats(stats map[string]interface{}) { - stats["triton_server_url"] = t.serverURL - stats["triton_model_name"] = t.modelName - stats["model_id"] = t.config.ID -} -func (t *TritonEvaluator) computeInputs() map[string]*domain.Input { - inputs := make(map[string]*domain.Input) + indexToName[input.Index] = input.Name + } - if len(t.config.Inputs) > 0 { - for _, input := range t.config.Inputs { inputType := reflect.TypeOf("") if input.DataType != "" { switch input.DataType { @@ -568,7 +120,7 @@ func (t *TritonEvaluator) computeInputs() map[string]*domain.Input { } } - inputs[input.Name] = &domain.Input{ + mappedInputs[input.Name] = &domain.Input{ Name: input.Name, Index: input.Index, Type: inputType, @@ -577,93 +129,89 @@ func (t *TritonEvaluator) computeInputs() map[string]*domain.Input { } } } else { - panic("Triton model " + t.config.ID + " requires explicit input configuration. " + + return fmt.Errorf("missing input configuration for Triton evaluator. " + "Add 'inputs' section to your model configuration YAML with field definitions") } - return inputs -} + if len(io.Outputs) > 0 { + for i, output := range io.Outputs { + outputs = append(outputs, domain.Output{ + Name: output.Name, + Index: i, + DataType: output.DataType, + }) + } + } else { + return fmt.Errorf("missing output configuration for Triton evaluator. " + + "Add 'outputs' section to your model configuration YAML with field definitions") + } -func (t *TritonEvaluator) Inputs() map[string]*domain.Input { - return t.inputs -} + t.indexToName = indexToName -func (t *TritonEvaluator) IsHealthy() bool { - if t.healthPtr == nil { - return false + t.signature = &domain.Signature{ + Inputs: inputs, + Outputs: outputs, + Output: outputs[0], } - return atomic.LoadInt32(t.healthPtr) == 1 + + t.inputs = mappedInputs + + return nil } -func (t *TritonEvaluator) SetHealthStatus(healthPtr *int32) { - t.healthPtr = healthPtr - if healthPtr != nil { - atomic.StoreInt32(healthPtr, 0) - t.initMonitorOnce.Do(func() { - go t.backgroundHealthMonitor() - }) - } +func (t *TritonEvaluator) Signature() *domain.Signature { + return t.signature } -func (t *TritonEvaluator) SupportsHealthReporting() bool { - return true +func (t *TritonEvaluator) Dictionary() *common.Dictionary { + return nil } -func (t *TritonEvaluator) checkTritonModelHealth() bool { - ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) - defer cancel() +func (t *TritonEvaluator) Stats(stats map[string]interface{}) { + // no stats +} - req := &triton.ModelReadyRequest{ - Name: t.modelName, - Version: "", - } +func (t *TritonEvaluator) Inputs() map[string]*domain.Input { + return t.inputs +} - resp, err := t.grpcClient.ModelReady(ctx, req) - if err != nil { - return false +// Close releases Triton client resources and stops health monitoring +func (t *TritonEvaluator) Close() error { + if t.isPrivateClient { + return t.client.Close() } - return resp.GetReady() + return nil } -func (t *TritonEvaluator) backgroundHealthMonitor() { - ticker := time.NewTicker(30 * time.Second) - defer ticker.Stop() +// ReloadIfNeeded for independent Triton models, reloading is not supported. +func (t *TritonEvaluator) ReloadIfNeeded(ctx context.Context) error { + ready, err := t.client.ModelReady(ctx, t.modelName) + if err != nil { + return fmt.Errorf("failed to check Triton model %s health: %w", t.modelName, err) + } - for { - select { - case <-ticker.C: - if t.healthPtr == nil { - return - } + if !t.repositoryExplicit { + return fmt.Errorf("model %s not ready and Triton is not in EXPLICIT Model Control Mode", t.modelName) + } - if t.checkTritonModelHealth() { - atomic.StoreInt32(t.healthPtr, 1) - } else { - atomic.StoreInt32(t.healthPtr, 0) - } + if ready { + return nil + } - case <-t.stopHealthCheck: - return - } + err = t.client.ModelLoad(ctx, t.modelName) + if err != nil { + return fmt.Errorf("failed to load Triton model %s: %w", t.modelName, err) } -} -// Close releases Triton client resources and stops health monitoring -func (t *TritonEvaluator) Close() error { - select { - case t.stopHealthCheck <- struct{}{}: - default: + ready, err = t.client.ModelReady(ctx, t.modelName) + if err != nil { + return fmt.Errorf("failed to check Triton model %s health after loading: %w", t.modelName, err) } - if t.grpcConn != nil { - return t.grpcConn.Close() + if !ready { + return fmt.Errorf("model %s is not ready after loading", t.modelName) } - return nil -} -// ReloadIfNeeded is a no-op for Triton models (they don't support reloading) -func (t *TritonEvaluator) ReloadIfNeeded(ctx context.Context) error { - // No-op: Triton models are managed externally return nil } diff --git a/service/triton/triton_test.go b/service/triton/triton_test.go index c98a4a4..cd16312 100644 --- a/service/triton/triton_test.go +++ b/service/triton/triton_test.go @@ -1,25 +1,17 @@ package triton import ( - "context" - "fmt" - "net" - "sync/atomic" "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - triton "github.com/viant/mly/proto/triton" "github.com/viant/mly/service/config" - "github.com/viant/mly/service/platform" "github.com/viant/mly/shared" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" - "google.golang.org/grpc/test/bufconn" ) func newTritonEvaluator(t *testing.T, cfg *config.Model) *TritonEvaluator { - evaluator, err := NewTritonEvaluator(cfg) + cfg.Triton.Init() + evaluator, err := NewTritonEvaluator(cfg, nil) require.NoError(t, err) return evaluator } @@ -29,6 +21,7 @@ func TestTritonEvaluator_Signature(t *testing.T) { ID: "test_model", Platform: "triton", URL: "http://localhost:8000", + MetaInput: shared.MetaInput{ Inputs: []*shared.Field{ {Name: "input1", Index: 0, DataType: "string"}, @@ -108,62 +101,6 @@ func TestTritonEvaluator_Dictionary(t *testing.T) { assert.Nil(t, dict) } -func TestTritonEvaluator_Stats(t *testing.T) { - cfg := &config.Model{ - ID: "test_model", - Platform: "triton", - URL: "http://localhost:8000", - MetaInput: shared.MetaInput{ - Inputs: []*shared.Field{ - {Name: "input1", Index: 0, DataType: "string"}, - }, - Outputs: []*shared.Field{ - {Name: "output1", Index: 0, DataType: "float32"}, - }, - }, - Triton: &config.TritonConfig{ - ModelName: "test_model", - }, - } - - evaluator := newTritonEvaluator(t, cfg) - defer evaluator.Close() - - stats := make(map[string]interface{}) - evaluator.Stats(stats) - - assert.Contains(t, stats, "triton_server_url") - assert.Contains(t, stats, "triton_model_name") - assert.Contains(t, stats["triton_server_url"].(string), "localhost:8000") - assert.Equal(t, "test_model", stats["triton_model_name"]) -} - -func TestTritonEvaluator_ReloadAndSupportsReload(t *testing.T) { - cfg := &config.Model{ - ID: "test_model", - Platform: "triton", - URL: "http://localhost:8000", - MetaInput: shared.MetaInput{ - Inputs: []*shared.Field{ - {Name: "input1", Index: 0, DataType: "string"}, - }, - Outputs: []*shared.Field{ - {Name: "output1", Index: 0, DataType: "float32"}, - }, - }, - Triton: &config.TritonConfig{ - ModelName: "test_model", - }, - } - - evaluator := newTritonEvaluator(t, cfg) - defer evaluator.Close() - - // ReloadIfNeeded should be a no-op - err := evaluator.ReloadIfNeeded(context.Background()) - assert.NoError(t, err) -} - func TestTritonEvaluator_InputsMapping(t *testing.T) { cfg := &config.Model{ ID: "test_model", @@ -197,752 +134,3 @@ func TestTritonEvaluator_InputsMapping(t *testing.T) { assert.Contains(t, inputs, "float32_input") assert.Contains(t, inputs, "float64_input") } - -func TestParseGRPCAddress(t *testing.T) { - testCases := []struct { - name string - url string - expected string - }{ - { - name: "http_with_port", - url: "http://localhost:8000", - expected: "localhost:8000", // Preserves existing port - }, - { - name: "https_with_port", - url: "https://triton.example.com:8000", - expected: "triton.example.com:8000", // Preserves existing port - }, - { - name: "http_without_port", - url: "http://localhost", - expected: "localhost:8001", // Adds default gRPC port - }, - { - name: "https_without_port", - url: "https://triton.example.com", - expected: "triton.example.com:8001", // Adds default gRPC port - }, - { - name: "no_scheme", - url: "localhost:9001", - expected: "localhost:9001", // Preserves as-is - }, - { - name: "ip_address", - url: "http://192.168.1.100:8000", - expected: "192.168.1.100:8000", // Preserves existing port - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - result := parseGRPCAddress(tc.url) - assert.Equal(t, tc.expected, result) - }) - } -} - -func TestConfigGetPlatform(t *testing.T) { - testCases := []struct { - name string - config *config.Model - expected string - }{ - { - name: "explicit_tensorflow", - config: &config.Model{Platform: "tensorflow"}, - expected: "tensorflow", - }, - { - name: "explicit_triton", - config: &config.Model{Platform: "triton"}, - expected: "triton", - }, - { - name: "default_platform", - config: &config.Model{}, - expected: "tensorflow", - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - result := tc.config.GetPlatform() - assert.Equal(t, tc.expected, result) - }) - } -} - -// mockTritonServer implements triton.GRPCInferenceServiceServer for testing -type mockTritonServer struct { - triton.UnimplementedGRPCInferenceServiceServer - modelReady bool - responses map[string]*triton.ModelInferResponse -} - -func (m *mockTritonServer) ModelReady(ctx context.Context, req *triton.ModelReadyRequest) (*triton.ModelReadyResponse, error) { - return &triton.ModelReadyResponse{Ready: m.modelReady}, nil -} - -func (m *mockTritonServer) ModelInfer(ctx context.Context, req *triton.ModelInferRequest) (*triton.ModelInferResponse, error) { - if resp, ok := m.responses[req.ModelName]; ok { - return resp, nil - } - // Return a default response - return &triton.ModelInferResponse{ - ModelName: req.ModelName, - Outputs: []*triton.ModelInferResponse_InferOutputTensor{ - { - Name: "output", - Datatype: "FP32", - Shape: []int64{1, 1}, - Contents: &triton.InferTensorContents{ - Fp32Contents: []float32{0.5}, - }, - }, - }, - }, nil -} - -// startMockGRPCServer starts an in-memory gRPC server for testing -func startMockGRPCServer(t *testing.T, mock *mockTritonServer) (*grpc.Server, *bufconn.Listener) { - buffer := 1024 * 1024 - listener := bufconn.Listen(buffer) - - server := grpc.NewServer() - triton.RegisterGRPCInferenceServiceServer(server, mock) - - go func() { - if err := server.Serve(listener); err != nil { - t.Logf("Server exited with error: %v", err) - } - }() - - return server, listener -} - -// createMockTritonClient creates a gRPC client connected to the mock server -func createMockTritonClient(ctx context.Context, t *testing.T, listener *bufconn.Listener) *grpc.ClientConn { - conn, err := grpc.DialContext(ctx, "bufnet", - grpc.WithContextDialer(func(context.Context, string) (net.Conn, error) { - return listener.Dial() - }), - grpc.WithTransportCredentials(insecure.NewCredentials()), - ) - require.NoError(t, err) - return conn -} - -func TestTritonEvaluator_PredictWithMockServer(t *testing.T) { - ctx := context.Background() - - // Set up mock server - mock := &mockTritonServer{ - modelReady: true, - responses: map[string]*triton.ModelInferResponse{ - "test_model": { - ModelName: "test_model", - Outputs: []*triton.ModelInferResponse_InferOutputTensor{ - { - Name: "output", - Datatype: "INT64", - Shape: []int64{2, 1}, - Contents: &triton.InferTensorContents{ - Int64Contents: []int64{42, 100}, - }, - }, - }, - }, - }, - } - - server, listener := startMockGRPCServer(t, mock) - defer server.Stop() - - // Create evaluator with mock connection - cfg := &config.Model{ - ID: "test_model", - Platform: "triton", - URL: "http://localhost:8000", - MetaInput: shared.MetaInput{ - Inputs: []*shared.Field{ - {Name: "input1", Index: 0, DataType: "string"}, - }, - Outputs: []*shared.Field{ - {Name: "output", Index: 0, DataType: "int64"}, - }, - }, - Triton: &config.TritonConfig{ - ModelName: "test_model", - }, - } - - evaluator := newTritonEvaluator(t, cfg) - defer evaluator.Close() - - // Replace the gRPC connection with mock - evaluator.grpcConn = createMockTritonClient(ctx, t, listener) - evaluator.grpcClient = triton.NewGRPCInferenceServiceClient(evaluator.grpcConn) - - // Test prediction - params := []interface{}{ - [][]string{{"value1"}, {"value2"}}, // 2 batch items - } - - results, err := evaluator.Predict(ctx, params) - require.NoError(t, err) - require.Len(t, results, 1) - - // Verify output format - output, ok := results[0].([][]int64) - require.True(t, ok, "expected [][]int64, got %T", results[0]) - require.Len(t, output, 2) - assert.Equal(t, []int64{42}, output[0]) - assert.Equal(t, []int64{100}, output[1]) -} - -func TestTritonEvaluator_PredictWithRawOutputContents(t *testing.T) { - ctx := context.Background() - - // Set up mock server with raw output contents - mock := &mockTritonServer{ - modelReady: true, - responses: map[string]*triton.ModelInferResponse{ - "test_model": { - ModelName: "test_model", - Outputs: []*triton.ModelInferResponse_InferOutputTensor{ - { - Name: "output", - Datatype: "FP32", - Shape: []int64{2, 1}, - }, - }, - RawOutputContents: [][]byte{ - {0x00, 0x00, 0x20, 0x41, 0x00, 0x00, 0x48, 0x42}, // 10.0, 50.0 in float32 little-endian - }, - }, - }, - } - - server, listener := startMockGRPCServer(t, mock) - defer server.Stop() - - cfg := &config.Model{ - ID: "test_model", - Platform: "triton", - URL: "http://localhost:8000", - MetaInput: shared.MetaInput{ - Inputs: []*shared.Field{ - {Name: "input1", Index: 0, DataType: "string"}, - }, - Outputs: []*shared.Field{ - {Name: "output", Index: 0, DataType: "float32"}, - }, - }, - Triton: &config.TritonConfig{ - ModelName: "test_model", - }, - } - - evaluator := newTritonEvaluator(t, cfg) - defer evaluator.Close() - - evaluator.grpcConn = createMockTritonClient(ctx, t, listener) - evaluator.grpcClient = triton.NewGRPCInferenceServiceClient(evaluator.grpcConn) - - params := []interface{}{ - [][]string{{"value1"}, {"value2"}}, - } - - results, err := evaluator.Predict(ctx, params) - require.NoError(t, err) - require.Len(t, results, 1) - - output, ok := results[0].([][]float32) - require.True(t, ok, "expected [][]float32, got %T", results[0]) - require.Len(t, output, 2) - assert.InDelta(t, 10.0, output[0][0], 0.01) - assert.InDelta(t, 50.0, output[1][0], 0.01) -} - -func TestTritonEvaluator_PredictAllInputTypes(t *testing.T) { - ctx := context.Background() - - testCases := []struct { - name string - inputType string - tritonType string - inputData interface{} - expectedResp *triton.ModelInferResponse - }{ - { - name: "int32_input", - inputType: "int32", - tritonType: "INT32", - inputData: [][]int32{{10}, {20}, {30}}, - expectedResp: &triton.ModelInferResponse{ - ModelName: "test_model", - Outputs: []*triton.ModelInferResponse_InferOutputTensor{ - { - Name: "output", - Datatype: "INT32", - Shape: []int64{3, 1}, - Contents: &triton.InferTensorContents{ - IntContents: []int32{100, 200, 300}, - }, - }, - }, - }, - }, - { - name: "int64_input", - inputType: "int64", - tritonType: "INT64", - inputData: [][]int64{{100}, {200}}, - expectedResp: &triton.ModelInferResponse{ - ModelName: "test_model", - Outputs: []*triton.ModelInferResponse_InferOutputTensor{ - { - Name: "output", - Datatype: "INT64", - Shape: []int64{2, 1}, - Contents: &triton.InferTensorContents{ - Int64Contents: []int64{1000, 2000}, - }, - }, - }, - }, - }, - { - name: "float32_input", - inputType: "float32", - tritonType: "FP32", - inputData: [][]float32{{1.5}, {2.5}, {3.5}, {4.5}}, - expectedResp: &triton.ModelInferResponse{ - ModelName: "test_model", - Outputs: []*triton.ModelInferResponse_InferOutputTensor{ - { - Name: "output", - Datatype: "FP32", - Shape: []int64{4, 1}, - Contents: &triton.InferTensorContents{ - Fp32Contents: []float32{10.5, 20.5, 30.5, 40.5}, - }, - }, - }, - }, - }, - { - name: "float64_input", - inputType: "float64", - tritonType: "FP64", - inputData: [][]float64{{1.111}}, - expectedResp: &triton.ModelInferResponse{ - ModelName: "test_model", - Outputs: []*triton.ModelInferResponse_InferOutputTensor{ - { - Name: "output", - Datatype: "FP64", - Shape: []int64{1, 1}, - Contents: &triton.InferTensorContents{ - Fp64Contents: []float64{11.111}, - }, - }, - }, - }, - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - mock := &mockTritonServer{ - modelReady: true, - responses: map[string]*triton.ModelInferResponse{"test_model": tc.expectedResp}, - } - - server, listener := startMockGRPCServer(t, mock) - defer server.Stop() - - cfg := &config.Model{ - ID: "test_model", - Platform: "triton", - URL: "http://localhost:8000", - MetaInput: shared.MetaInput{ - Inputs: []*shared.Field{ - {Name: "input1", Index: 0, DataType: tc.inputType}, - }, - Outputs: []*shared.Field{ - {Name: "output", Index: 0, DataType: tc.inputType}, - }, - }, - Triton: &config.TritonConfig{ - ModelName: "test_model", - }, - } - - evaluator := newTritonEvaluator(t, cfg) - defer evaluator.Close() - - evaluator.grpcConn = createMockTritonClient(ctx, t, listener) - evaluator.grpcClient = triton.NewGRPCInferenceServiceClient(evaluator.grpcConn) - - results, err := evaluator.Predict(ctx, []interface{}{tc.inputData}) - require.NoError(t, err) - require.Len(t, results, 1) - assert.NotNil(t, results[0]) - }) - } -} - -func TestTritonEvaluator_PredictBytesOutput(t *testing.T) { - ctx := context.Background() - - mock := &mockTritonServer{ - modelReady: true, - responses: map[string]*triton.ModelInferResponse{ - "test_model": { - ModelName: "test_model", - Outputs: []*triton.ModelInferResponse_InferOutputTensor{ - { - Name: "output", - Datatype: "BYTES", - Shape: []int64{2, 1}, - Contents: &triton.InferTensorContents{ - BytesContents: [][]byte{[]byte("result1"), []byte("result2")}, - }, - }, - }, - }, - }, - } - - server, listener := startMockGRPCServer(t, mock) - defer server.Stop() - - cfg := &config.Model{ - ID: "test_model", - Platform: "triton", - URL: "http://localhost:8000", - MetaInput: shared.MetaInput{ - Inputs: []*shared.Field{ - {Name: "input1", Index: 0, DataType: "string"}, - }, - Outputs: []*shared.Field{ - {Name: "output", Index: 0, DataType: "string"}, - }, - }, - Triton: &config.TritonConfig{ - ModelName: "test_model", - }, - } - - evaluator := newTritonEvaluator(t, cfg) - defer evaluator.Close() - - evaluator.grpcConn = createMockTritonClient(ctx, t, listener) - evaluator.grpcClient = triton.NewGRPCInferenceServiceClient(evaluator.grpcConn) - - params := []interface{}{ - [][]string{{"input1"}, {"input2"}}, - } - - results, err := evaluator.Predict(ctx, params) - require.NoError(t, err) - require.Len(t, results, 1) - - output, ok := results[0].([][]string) - require.True(t, ok, "expected [][]string, got %T", results[0]) - require.Len(t, output, 2) - assert.Equal(t, []string{"result1"}, output[0]) - assert.Equal(t, []string{"result2"}, output[1]) -} - -func TestTritonEvaluator_PredictDifferentBatchSizes(t *testing.T) { - ctx := context.Background() - - testCases := []struct { - name string - batchSize int - }{ - {name: "single_item", batchSize: 1}, - {name: "small_batch", batchSize: 4}, - {name: "medium_batch", batchSize: 16}, - {name: "large_batch", batchSize: 64}, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - // Generate expected output - expectedOutput := make([]int64, tc.batchSize) - for i := 0; i < tc.batchSize; i++ { - expectedOutput[i] = int64(i * 10) - } - - mock := &mockTritonServer{ - modelReady: true, - responses: map[string]*triton.ModelInferResponse{ - "test_model": { - ModelName: "test_model", - Outputs: []*triton.ModelInferResponse_InferOutputTensor{ - { - Name: "output", - Datatype: "INT64", - Shape: []int64{int64(tc.batchSize), 1}, - Contents: &triton.InferTensorContents{ - Int64Contents: expectedOutput, - }, - }, - }, - }, - }, - } - - server, listener := startMockGRPCServer(t, mock) - defer server.Stop() - - cfg := &config.Model{ - ID: "test_model", - Platform: "triton", - URL: "http://localhost:8000", - MetaInput: shared.MetaInput{ - Inputs: []*shared.Field{ - {Name: "input1", Index: 0, DataType: "string"}, - }, - Outputs: []*shared.Field{ - {Name: "output", Index: 0, DataType: "int64"}, - }, - }, - Triton: &config.TritonConfig{ - ModelName: "test_model", - }, - } - - evaluator := newTritonEvaluator(t, cfg) - defer evaluator.Close() - - evaluator.grpcConn = createMockTritonClient(ctx, t, listener) - evaluator.grpcClient = triton.NewGRPCInferenceServiceClient(evaluator.grpcConn) - - // Generate input batch - inputBatch := make([][]string, tc.batchSize) - for i := 0; i < tc.batchSize; i++ { - inputBatch[i] = []string{fmt.Sprintf("input_%d", i)} - } - - results, err := evaluator.Predict(ctx, []interface{}{inputBatch}) - require.NoError(t, err) - require.Len(t, results, 1) - - output, ok := results[0].([][]int64) - require.True(t, ok, "expected [][]int64, got %T", results[0]) - assert.Len(t, output, tc.batchSize) - }) - } -} - -func TestTritonEvaluator_PredictUnsupportedType(t *testing.T) { - ctx := context.Background() - - mock := &mockTritonServer{ - modelReady: true, - responses: map[string]*triton.ModelInferResponse{ - "test_model": { - ModelName: "test_model", - Outputs: []*triton.ModelInferResponse_InferOutputTensor{ - { - Name: "output", - Datatype: "UNKNOWN_TYPE", - Shape: []int64{1, 1}, - Contents: &triton.InferTensorContents{ - // Has contents but unsupported type - BytesContents: [][]byte{[]byte("data")}, - }, - }, - }, - }, - }, - } - - server, listener := startMockGRPCServer(t, mock) - defer server.Stop() - - cfg := &config.Model{ - ID: "test_model", - Platform: "triton", - URL: "http://localhost:8000", - MetaInput: shared.MetaInput{ - Inputs: []*shared.Field{ - {Name: "input1", Index: 0, DataType: "string"}, - }, - Outputs: []*shared.Field{ - {Name: "output", Index: 0, DataType: "string"}, - }, - }, - Triton: &config.TritonConfig{ - ModelName: "test_model", - }, - } - - evaluator := newTritonEvaluator(t, cfg) - defer evaluator.Close() - - evaluator.grpcConn = createMockTritonClient(ctx, t, listener) - evaluator.grpcClient = triton.NewGRPCInferenceServiceClient(evaluator.grpcConn) - - params := []interface{}{ - [][]string{{"test"}}, - } - - _, err := evaluator.Predict(ctx, params) - require.Error(t, err) - assert.Contains(t, err.Error(), "unsupported") -} - -func TestTritonEvaluator_PredictEmptyBatch(t *testing.T) { - cfg := &config.Model{ - ID: "test_model", - Platform: "triton", - URL: "http://localhost:8000", - MetaInput: shared.MetaInput{ - Inputs: []*shared.Field{ - {Name: "input1", Index: 0, DataType: "string"}, - }, - Outputs: []*shared.Field{ - {Name: "output", Index: 0, DataType: "int64"}, - }, - }, - Triton: &config.TritonConfig{ - ModelName: "test_model", - }, - } - - evaluator := newTritonEvaluator(t, cfg) - defer evaluator.Close() - - _, err := evaluator.Predict(context.Background(), []interface{}{}) - require.Error(t, err) - assert.Contains(t, err.Error(), "no input parameters") -} - -func TestTritonEvaluator_PredictMissingOutput(t *testing.T) { - ctx := context.Background() - - mock := &mockTritonServer{ - modelReady: true, - responses: map[string]*triton.ModelInferResponse{ - "test_model": { - ModelName: "test_model", - Outputs: []*triton.ModelInferResponse_InferOutputTensor{ - { - Name: "output", - Datatype: "INT64", - Shape: []int64{1, 1}, - // Missing Contents field - }, - }, - }, - }, - } - - server, listener := startMockGRPCServer(t, mock) - defer server.Stop() - - cfg := &config.Model{ - ID: "test_model", - Platform: "triton", - URL: "http://localhost:8000", - MetaInput: shared.MetaInput{ - Inputs: []*shared.Field{ - {Name: "input1", Index: 0, DataType: "string"}, - }, - Outputs: []*shared.Field{ - {Name: "output", Index: 0, DataType: "int64"}, - }, - }, - Triton: &config.TritonConfig{ - ModelName: "test_model", - }, - } - - evaluator := newTritonEvaluator(t, cfg) - defer evaluator.Close() - - evaluator.grpcConn = createMockTritonClient(ctx, t, listener) - evaluator.grpcClient = triton.NewGRPCInferenceServiceClient(evaluator.grpcConn) - - params := []interface{}{ - [][]string{{"test"}}, - } - - _, err := evaluator.Predict(ctx, params) - require.Error(t, err) - assert.Contains(t, err.Error(), "missing contents") -} - -func TestTritonEvaluator_Health(t *testing.T) { - t.Run("interface_compliance", func(t *testing.T) { - var _ platform.PlatformEvaluator = (*TritonEvaluator)(nil) - }) - - t.Run("supports_health_reporting", func(t *testing.T) { - cfg := &config.Model{ - ID: "test_model", - Platform: "triton", - URL: "http://localhost:8000", - MetaInput: shared.MetaInput{ - Inputs: []*shared.Field{ - {Name: "input1", Index: 0, DataType: "string"}, - }, - Outputs: []*shared.Field{ - {Name: "output1", Index: 0, DataType: "float32"}, - }, - }, - Triton: &config.TritonConfig{ - ModelName: "test_model", - }, - } - - evaluator := newTritonEvaluator(t, cfg) - defer evaluator.Close() - - assert.True(t, evaluator.SupportsHealthReporting()) - }) - - t.Run("health_status_tracking", func(t *testing.T) { - cfg := &config.Model{ - ID: "test_model", - Platform: "triton", - URL: "http://localhost:8000", - MetaInput: shared.MetaInput{ - Inputs: []*shared.Field{ - {Name: "input1", Index: 0, DataType: "string"}, - }, - Outputs: []*shared.Field{ - {Name: "output1", Index: 0, DataType: "float32"}, - }, - }, - Triton: &config.TritonConfig{ - ModelName: "test_model", - }, - } - - evaluator := newTritonEvaluator(t, cfg) - defer evaluator.Close() - - // Initially not healthy (no health pointer set) - assert.False(t, evaluator.IsHealthy()) - - // Set health pointer - var healthStatus int32 - evaluator.SetHealthStatus(&healthStatus) - - // Test health status changes - atomic.StoreInt32(&healthStatus, 1) - assert.True(t, evaluator.IsHealthy()) - - atomic.StoreInt32(&healthStatus, 0) - assert.False(t, evaluator.IsHealthy()) - }) -} From afc923f303b98354184ec2c0369755f47915c878 Mon Sep 17 00:00:00 2001 From: David Choi Date: Thu, 13 Nov 2025 16:13:04 -0800 Subject: [PATCH 06/38] Remove unused parseGRPCAddress function and its associated test cases from grpc_test.go and grpc.go files. --- service/triton/grpc.go | 12 ---------- service/triton/grpc_test.go | 46 ------------------------------------- 2 files changed, 58 deletions(-) diff --git a/service/triton/grpc.go b/service/triton/grpc.go index fc9d620..0172e41 100644 --- a/service/triton/grpc.go +++ b/service/triton/grpc.go @@ -5,7 +5,6 @@ import ( "encoding/binary" "fmt" "math" - "strings" triton "github.com/viant/mly/proto/triton" "google.golang.org/grpc" @@ -68,17 +67,6 @@ func (c *GRPCClient) Close() error { return c.grpcConn.Close() } -func parseGRPCAddress(url string) string { - addr := strings.TrimPrefix(url, "http://") - addr = strings.TrimPrefix(addr, "https://") - - if !strings.Contains(addr, ":") { - addr += ":8001" - } - - return addr -} - func buildGRPCRequest(modelName string, preparedInputs []preparedInput) (*triton.ModelInferRequest, error) { req := &triton.ModelInferRequest{ ModelName: modelName, diff --git a/service/triton/grpc_test.go b/service/triton/grpc_test.go index 7c9cb63..57e9c0c 100644 --- a/service/triton/grpc_test.go +++ b/service/triton/grpc_test.go @@ -16,52 +16,6 @@ import ( "google.golang.org/grpc/test/bufconn" ) -func TestParseGRPCAddress(t *testing.T) { - testCases := []struct { - name string - url string - expected string - }{ - { - name: "http_with_port", - url: "http://localhost:8000", - expected: "localhost:8000", // Preserves existing port - }, - { - name: "https_with_port", - url: "https://triton.example.com:8000", - expected: "triton.example.com:8000", // Preserves existing port - }, - { - name: "http_without_port", - url: "http://localhost", - expected: "localhost:8001", // Adds default gRPC port - }, - { - name: "https_without_port", - url: "https://triton.example.com", - expected: "triton.example.com:8001", // Adds default gRPC port - }, - { - name: "no_scheme", - url: "localhost:9001", - expected: "localhost:9001", // Preserves as-is - }, - { - name: "ip_address", - url: "http://192.168.1.100:8000", - expected: "192.168.1.100:8000", // Preserves existing port - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - result := parseGRPCAddress(tc.url) - assert.Equal(t, tc.expected, result) - }) - } -} - // createMockTritonConn creates a gRPC client connected to the mock server func createMockTritonConn(ctx context.Context, t *testing.T, listener *bufconn.Listener) *grpc.ClientConn { conn, err := grpc.DialContext(ctx, "bufnet", From be33ae829c4b84b0405275adbba0e2a34547bd3e Mon Sep 17 00:00:00 2001 From: David Choi Date: Thu, 13 Nov 2025 20:48:54 -0800 Subject: [PATCH 07/38] Added initial Triton client support and router functionality - Introduced Triton client management with both HTTP and gRPC implementations. - Enhanced service initialization to include Triton client health checks. - Updated platform evaluator to support routing configurations. - Added batch size determination utility for request handling. - Implemented router logic for model inference routing based on configuration. - Refactored existing code to accommodate new Triton features and improve overall structure. --- service/config/model.go | 3 +- service/config/router.go | 5 + service/config/triton.go | 64 ++- service/endpoint/config.go | 9 + service/endpoint/model.go | 14 +- service/endpoint/service.go | 22 +- service/platform/evaluator.go | 2 + service/platform/factory/factory.go | 9 +- service/platform/router/router.go | 667 +++++++++++++++++++++++++++ service/request/request.go | 4 +- service/request/shape/batch.go | 33 ++ service/service.go | 8 +- service/tfmodel/batcher/service.go | 33 +- service/tfmodel/evaluator/service.go | 2 +- service/triton/client.go | 43 ++ service/triton/grpc.go | 29 +- service/triton/http.go | 77 ++-- shared/config/router/router.go | 2 +- shared/config/router/router_test.go | 2 +- 19 files changed, 951 insertions(+), 77 deletions(-) create mode 100644 service/platform/router/router.go create mode 100644 service/request/shape/batch.go diff --git a/service/config/model.go b/service/config/model.go index 4d648a2..7cf7501 100644 --- a/service/config/model.go +++ b/service/config/model.go @@ -198,7 +198,8 @@ type TritonConfig struct { // See https://docs.nvidia.com/deeplearning/triton-inference-server/user-guide/docs/user_guide/model_management.html RepositoryExplicit bool `json:",omitempty" yaml:",omitempty"` - // HTTP total timeout in milliseconds, defaults to 100 milliseconds. + // Maximum request timeout in milliseconds. + // Defaults to 100 milliseconds. Timeout int `json:",omitempty" yaml:",omitempty"` } diff --git a/service/config/router.go b/service/config/router.go index 818ee39..9c1d89c 100644 --- a/service/config/router.go +++ b/service/config/router.go @@ -43,6 +43,7 @@ type OutputConfig struct { // If no model is used, this will be used as the model ID // If RouterConfig.Global.Exists is true, this will be ignored. + // Defaults to "none". NoModelID string `json:",omitempty" yaml:",omitempty"` } @@ -59,5 +60,9 @@ func (o *RouterConfig) Validate() error { return fmt.Errorf("global model does not exist but no rediction replacements were provided") } + if o.Output.NoModelID == "" { + o.Output.NoModelID = "none" + } + return nil } diff --git a/service/config/triton.go b/service/config/triton.go index f1219f1..ecd989b 100644 --- a/service/config/triton.go +++ b/service/config/triton.go @@ -1,5 +1,7 @@ package config +import "fmt" + type TritonServer struct { ID string @@ -7,11 +9,71 @@ type TritonServer struct { // Defaults to http://localhost:8000 HTTPBaseURL string `json:",omitempty" yaml:",omitempty"` + // HTTPClientTimeoutMs is the timeout for the Triton HTTP client to respond to a request. + // Defaults to 100 milliseconds. + HTTPClientTimeoutMs int `json:",omitempty" yaml:",omitempty"` + // GRPCBaseURL is the base URL for the Triton GRPC server. // Defaults to localhost:8001 GRPCBaseURL string `json:",omitempty" yaml:",omitempty"` + GRPCConnectParams GRPCConnectParams `json:",omitempty" yaml:",omitempty"` + // StartupTimeoutSeconds is the timeout for the Triton server to start up. - // Defaults to 30 seconds. + // Defaults to 10 seconds. StartupTimeoutSeconds int `json:",omitempty" yaml:",omitempty"` } + +// Copy of google.golang.org/grpc/backoff.Config (https://pkg.go.dev/google.golang.org/grpc/backoff#Config) + +type GRPCConnectParams struct { + // Defaults to 10 milliseconds. + BaseDelayMs int `json:",omitempty" yaml:",omitempty"` + + // Defaults to 2. + Multiplier float64 `json:",omitempty" yaml:",omitempty"` + + // Defaults to 0.1. + Jitter float64 `json:",omitempty" yaml:",omitempty"` + + // Defaults to 150 milliseconds. + MaxDelayMs int `json:",omitempty" yaml:",omitempty"` +} + +func (t *TritonServer) Init() { + if t.StartupTimeoutSeconds == 0 { + t.StartupTimeoutSeconds = 10 + } + + if t.HTTPClientTimeoutMs == 0 { + t.HTTPClientTimeoutMs = 100 + } + + if t.GRPCConnectParams.BaseDelayMs == 0 { + t.GRPCConnectParams.BaseDelayMs = 10 + } + + if t.GRPCConnectParams.Multiplier == 0 { + t.GRPCConnectParams.Multiplier = 2 + } + + if t.GRPCConnectParams.Jitter == 0 { + t.GRPCConnectParams.Jitter = 0.1 + } + + if t.GRPCConnectParams.MaxDelayMs == 0 { + t.GRPCConnectParams.MaxDelayMs = 150 + } +} + +func (t *TritonServer) Validate() error { + if t.ID == "" { + return fmt.Errorf("triton server ID is required") + } + + if t.HTTPBaseURL == "" && t.GRPCBaseURL == "" { + return fmt.Errorf("triton server HTTPBaseURL or GRPCBaseURL must be set for server %s", t.ID) + } + + return nil +} diff --git a/service/endpoint/config.go b/service/endpoint/config.go index c5ba49f..fbbbc3d 100644 --- a/service/endpoint/config.go +++ b/service/endpoint/config.go @@ -58,6 +58,9 @@ func (c *Config) Init() { c.ModelList.Init(c.GlobalBatching) c.DatastoreList.Init() c.Endpoint.Init() + for i := range c.TritonServers { + c.TritonServers[i].Init() + } } // Validate validates config @@ -70,6 +73,12 @@ func (c *Config) Validate() error { return err } + for i, tritonServer := range c.TritonServers { + if err := tritonServer.Validate(); err != nil { + return errors.Wrapf(err, "triton server number %d validation failed", i) + } + } + return nil } diff --git a/service/endpoint/model.go b/service/endpoint/model.go index d327c12..d77957b 100644 --- a/service/endpoint/model.go +++ b/service/endpoint/model.go @@ -16,6 +16,7 @@ import ( "github.com/viant/mly/service/config" serviceConfig "github.com/viant/mly/service/config" "github.com/viant/mly/service/endpoint/meta" + "github.com/viant/mly/service/triton" "github.com/viant/mly/shared/common" "github.com/viant/mly/shared/datastore" "golang.org/x/sync/semaphore" @@ -47,8 +48,15 @@ type Hook interface { Hook(*config.Model, *service.Service) } -func Build(mux *http.ServeMux, config *Config, datastores map[string]*datastore.Service, - hooks []Hook, metrics *gmetric.Service, promReg *prometheus.Registry) error { +func Build( + mux *http.ServeMux, + config *Config, + datastores map[string]*datastore.Service, + tritonClients map[string]triton.TritonClient, + hooks []Hook, + metrics *gmetric.Service, + promReg *prometheus.Registry, +) error { cfge := config.Endpoint pool := buffer.New(cfge.PoolMaxSize, cfge.BufferSize) @@ -121,7 +129,7 @@ func Build(mux *http.ServeMux, config *Config, datastores map[string]*datastore. var modelSrv *service.Service var err error - modelSrv, err = service.NewWithPlatform(context.Background(), model, fs, metrics, datastores, sema, cfge.MaxEvaluatorWait, serviceOpts...) + modelSrv, err = service.New(context.Background(), model, fs, metrics, datastores, tritonClients, sema, cfge.MaxEvaluatorWait, serviceOpts...) if err != nil { return fmt.Errorf("failed to create service for model:%v, err:%w", model.ID, err) diff --git a/service/endpoint/service.go b/service/endpoint/service.go index e53d53e..34f17c2 100644 --- a/service/endpoint/service.go +++ b/service/endpoint/service.go @@ -13,6 +13,7 @@ import ( "github.com/viant/mly/service/endpoint/checker" "github.com/viant/mly/service/endpoint/health" promh "github.com/viant/mly/service/endpoint/prometheus" + "github.com/viant/mly/service/triton" "github.com/viant/mly/shared" "github.com/viant/mly/shared/client" "github.com/viant/mly/shared/common" @@ -204,11 +205,30 @@ func New(cfg *Config) (*Service, error) { return nil, fmt.Errorf("failed to create datastores: %w", err) } + tritonClients := make(map[string]triton.TritonClient) + for _, server := range cfg.TritonServers { + tritonClient, err := triton.NewClient(server) + if err != nil { + return nil, fmt.Errorf("failed to create triton client for server %s: %w", server.ID, err) + } + + log.Printf("checking triton server %s health\n", server.ID) + ctx, cancel := context.WithTimeout(context.Background(), time.Duration(server.StartupTimeoutSeconds)*time.Second) + + err = tritonClient.ServerReady(ctx) + cancel() + if err != nil { + return nil, fmt.Errorf("failed to check triton server %s health: %w", server.ID, err) + } + + tritonClients[server.ID] = tritonClient + } + hooks := []Hook{ healthHandler, } - err = Build(mux, cfg, datastores, hooks, metrics, promReg) + err = Build(mux, cfg, datastores, tritonClients, hooks, metrics, promReg) if err != nil { return nil, err } diff --git a/service/platform/evaluator.go b/service/platform/evaluator.go index 28cb9be..bb3c1f4 100644 --- a/service/platform/evaluator.go +++ b/service/platform/evaluator.go @@ -18,6 +18,8 @@ const ( // PlatformEvaluator defines the interface that all platform-specific evaluators must implement type PlatformEvaluator interface { // Predict performs model inference with the given parameters + // params is expected to be [numInputs]([batchSize][1]T) (see service/request.Request.Feeds) + // The return value should be [numOutputs]([batchSize][1]T), but may vary depending on the model. Predict(ctx context.Context, params []interface{}) ([]interface{}, error) // Signature returns underlying model's signature diff --git a/service/platform/factory/factory.go b/service/platform/factory/factory.go index 45f3074..b9e8c37 100644 --- a/service/platform/factory/factory.go +++ b/service/platform/factory/factory.go @@ -8,6 +8,7 @@ import ( "github.com/viant/gmetric" "github.com/viant/mly/service/config" "github.com/viant/mly/service/platform" + "github.com/viant/mly/service/platform/router" "github.com/viant/mly/service/tfmodel" "github.com/viant/mly/service/triton" "golang.org/x/sync/semaphore" @@ -21,8 +22,10 @@ func CreateEvaluator( metrics *gmetric.Service, sema *semaphore.Weighted, maxEvaluatorWait time.Duration, + tritonClients map[string]triton.TritonClient, ) (platform.PlatformEvaluator, error) { p := cfg.GetPlatform() + isRouter := cfg.Mode == "router" switch p { case "tensorflow": @@ -31,7 +34,11 @@ func CreateEvaluator( return tfService, nil case "triton": - return triton.NewTritonEvaluator(cfg, map[string]triton.TritonClient{}) + if isRouter { + return router.NewRouter(cfg, fs, tritonClients) + } + + return triton.NewTritonEvaluator(cfg, tritonClients) default: return nil, fmt.Errorf("unsupported platform: %s for model %s", p, cfg.ID) } diff --git a/service/platform/router/router.go b/service/platform/router/router.go new file mode 100644 index 0000000..e5d3a62 --- /dev/null +++ b/service/platform/router/router.go @@ -0,0 +1,667 @@ +package router + +import ( + "compress/gzip" + "context" + "encoding/json" + "fmt" + "io" + "log" + "reflect" + "strings" + "sync" + + "github.com/viant/afs" + "github.com/viant/mly/service/config" + "github.com/viant/mly/service/domain" + "github.com/viant/mly/service/files" + "github.com/viant/mly/service/platform" + "github.com/viant/mly/service/request/shape" + tricli "github.com/viant/mly/service/triton" + "github.com/viant/mly/shared" + "github.com/viant/mly/shared/common" + "github.com/viant/mly/shared/config/router" + "gopkg.in/yaml.v2" +) + +// Router implements the PlatformEvaluator interface for router mode. +type Router struct { + configURL string + fs afs.Service + configLock sync.RWMutex + configModified *config.Modified + routerConfig *router.RouterConfig + + routingTableLock sync.RWMutex + routingMap map[int]string + routingTable map[string]platform.PlatformEvaluator + globalModel *platform.PlatformEvaluator + fixedEvaluator Predictor + + modelConfig *config.Model + tritonClient tricli.TritonClient + + signature *domain.Signature + indexToName map[int]string + + inputs map[string]*domain.Input + + routerInputOffset int +} + +func NewRouter(cfg *config.Model, fs afs.Service, tritonClients map[string]tricli.TritonClient) (*Router, error) { + if cfg.Router == nil { + return nil, fmt.Errorf("router configuration is required") + } + + tritonClient, ok := tritonClients[cfg.Triton.ServerID] + if !ok { + return nil, fmt.Errorf("triton client not found for server ID: %s", cfg.Triton.ServerID) + } + + r := &Router{ + configURL: cfg.Router.ConfigURL, + fs: fs, + + modelConfig: cfg, + tritonClient: tritonClient, + } + + if !cfg.Router.Global.Exists { + r.fixedEvaluator = newFixedEvaluator(cfg.Router.Global.PredictionReplacements) + } + + r.handleIO(&cfg.MetaInput) + + return r, nil +} + +type Predictor interface { + Predict(ctx context.Context, params []interface{}) ([]interface{}, error) +} + +type fixedEvaluator struct { + prepared []preparedReplacement +} + +type preparedReplacement struct { + typ string + value interface{} +} + +func newFixedEvaluator(repls []config.PredictionReplacement) *fixedEvaluator { + prepared := make([]preparedReplacement, 0, len(repls)) + for _, r := range repls { + switch r.Type { + case "string": + v, ok := r.Value.(string) + if !ok { + v = fmt.Sprintf("%v", r.Value) + } + prepared = append(prepared, preparedReplacement{typ: "string", value: v}) + case "int": + switch n := r.Value.(type) { + case int: + prepared = append(prepared, preparedReplacement{typ: "int", value: n}) + case int32: + prepared = append(prepared, preparedReplacement{typ: "int", value: int(n)}) + case int64: + prepared = append(prepared, preparedReplacement{typ: "int", value: int(n)}) + case float32: + prepared = append(prepared, preparedReplacement{typ: "int", value: int(n)}) + case float64: + prepared = append(prepared, preparedReplacement{typ: "int", value: int(n)}) + default: + panic(fmt.Errorf("router replacement %q: value %T not coercible to int", r.Name, r.Value)) + } + case "int32": + switch n := r.Value.(type) { + case int: + prepared = append(prepared, preparedReplacement{typ: "int32", value: int32(n)}) + case int32: + prepared = append(prepared, preparedReplacement{typ: "int32", value: n}) + case int64: + prepared = append(prepared, preparedReplacement{typ: "int32", value: int32(n)}) + case float32: + prepared = append(prepared, preparedReplacement{typ: "int32", value: int32(n)}) + case float64: + prepared = append(prepared, preparedReplacement{typ: "int32", value: int32(n)}) + default: + panic(fmt.Errorf("router replacement %q: value %T not coercible to int32", r.Name, r.Value)) + } + case "int64": + switch n := r.Value.(type) { + case int: + prepared = append(prepared, preparedReplacement{typ: "int64", value: int64(n)}) + case int32: + prepared = append(prepared, preparedReplacement{typ: "int64", value: int64(n)}) + case int64: + prepared = append(prepared, preparedReplacement{typ: "int64", value: n}) + case float32: + prepared = append(prepared, preparedReplacement{typ: "int64", value: int64(n)}) + case float64: + prepared = append(prepared, preparedReplacement{typ: "int64", value: int64(n)}) + default: + panic(fmt.Errorf("router replacement %q: value %T not coercible to int64", r.Name, r.Value)) + } + case "float", "float32": + switch n := r.Value.(type) { + case int: + prepared = append(prepared, preparedReplacement{typ: "float32", value: float32(n)}) + case int32: + prepared = append(prepared, preparedReplacement{typ: "float32", value: float32(n)}) + case int64: + prepared = append(prepared, preparedReplacement{typ: "float32", value: float32(n)}) + case float32: + prepared = append(prepared, preparedReplacement{typ: "float32", value: n}) + case float64: + prepared = append(prepared, preparedReplacement{typ: "float32", value: float32(n)}) + default: + panic(fmt.Errorf("router replacement %q: value %T not coercible to float32", r.Name, r.Value)) + } + case "float64": + switch n := r.Value.(type) { + case int: + prepared = append(prepared, preparedReplacement{typ: "float64", value: float64(n)}) + case int32: + prepared = append(prepared, preparedReplacement{typ: "float64", value: float64(n)}) + case int64: + prepared = append(prepared, preparedReplacement{typ: "float64", value: float64(n)}) + case float32: + prepared = append(prepared, preparedReplacement{typ: "float64", value: float64(n)}) + case float64: + prepared = append(prepared, preparedReplacement{typ: "float64", value: n}) + default: + panic(fmt.Errorf("router replacement %q: value %T not coercible to float64", r.Name, r.Value)) + } + default: + panic(fmt.Errorf("unsupported router replacement type %q for %q", r.Type, r.Name)) + } + } + return &fixedEvaluator{prepared: prepared} +} + +func (f *fixedEvaluator) Predict(ctx context.Context, params []interface{}) ([]interface{}, error) { + batchSize, err := shape.DetermineBatchSize(params) + if err != nil { + return nil, err + } + + makeString := func(v string) [][]string { + out := make([][]string, batchSize) + for i := 0; i < batchSize; i++ { + out[i] = []string{v} + } + return out + } + + makeInt32 := func(v int32) [][]int32 { + out := make([][]int32, batchSize) + for i := 0; i < batchSize; i++ { + out[i] = []int32{v} + } + return out + } + + makeInt64 := func(v int64) [][]int64 { + out := make([][]int64, batchSize) + for i := 0; i < batchSize; i++ { + out[i] = []int64{v} + } + return out + } + + makeInt := func(v int) [][]int { + out := make([][]int, batchSize) + for i := 0; i < batchSize; i++ { + out[i] = []int{v} + } + return out + } + + makeFloat32 := func(v float32) [][]float32 { + out := make([][]float32, batchSize) + for i := 0; i < batchSize; i++ { + out[i] = []float32{v} + } + return out + } + + makeFloat64 := func(v float64) [][]float64 { + out := make([][]float64, batchSize) + for i := 0; i < batchSize; i++ { + out[i] = []float64{v} + } + return out + } + + results := make([]interface{}, len(f.prepared)) + for i, repl := range f.prepared { + switch repl.typ { + case "string": + results[i] = makeString(repl.value.(string)) + case "int": + results[i] = makeInt(repl.value.(int)) + case "int32": + results[i] = makeInt32(repl.value.(int32)) + case "int64": + results[i] = makeInt64(repl.value.(int64)) + case "float": + results[i] = makeFloat32(repl.value.(float32)) + case "float32": + results[i] = makeFloat32(repl.value.(float32)) + case "float64": + results[i] = makeFloat64(repl.value.(float64)) + default: + return nil, fmt.Errorf("unsupported replacement type %q", repl.typ) + } + } + + return results, nil +} + +func (t *Router) handleIO(io *shared.MetaInput) error { + var inputs []domain.Input + var outputs []domain.Output + + indexToName := make(map[int]string) + + mappedInputs := make(map[string]*domain.Input) + + if len(io.Inputs) > 0 { + for _, input := range io.Inputs { + if !input.Auxiliary { + inputs = append(inputs, domain.Input{ + Name: input.Name, + Index: input.Index, + }) + + indexToName[input.Index] = input.Name + } + + inputType := reflect.TypeOf("") + if input.DataType != "" { + switch input.DataType { + case "string": + inputType = reflect.TypeOf("") + case "int": + inputType = reflect.TypeOf(0) + case "int32": + inputType = reflect.TypeOf(int32(0)) + case "int64": + inputType = reflect.TypeOf(int64(0)) + case "float32": + inputType = reflect.TypeOf(float32(0)) + case "float64": + inputType = reflect.TypeOf(float64(0)) + } + } + + mappedInputs[input.Name] = &domain.Input{ + Name: input.Name, + Index: input.Index, + Type: inputType, + Vocab: false, + Auxiliary: input.Auxiliary, + } + } + } else { + return fmt.Errorf("missing input configuration for Triton evaluator. " + + "Add 'inputs' section to your model configuration YAML with field definitions") + } + + if len(io.Outputs) > 0 { + for i, output := range io.Outputs { + outputs = append(outputs, domain.Output{ + Name: output.Name, + Index: i, + DataType: output.DataType, + }) + } + } else { + return fmt.Errorf("missing output configuration for Triton evaluator. " + + "Add 'outputs' section to your model configuration YAML with field definitions") + } + + t.indexToName = indexToName + + t.signature = &domain.Signature{ + Inputs: inputs, + Outputs: outputs, + Output: outputs[0], + } + + t.inputs = mappedInputs + + return nil +} + +// Predict performs model inference with the given parameters +// params is expected to be [numInputs]([batchSize][1]T) (see service/request.Request.Feeds) +func (r *Router) Predict(ctx context.Context, params []interface{}) ([]interface{}, error) { + if len(params) == 0 { + return nil, fmt.Errorf("no input parameters provided") + } + + expectedBatchSize, err := shape.DetermineBatchSize(params) + if err != nil { + return nil, err + } + + numInputs := len(params) + + allResults := make([]interface{}, 0, expectedBatchSize) + + r.routingTableLock.RLock() + defer r.routingTableLock.RUnlock() + + for batchOffset := range expectedBatchSize { + // 1 input is reserved for the router input + request := make([]interface{}, numInputs-1) + + var routingValueBatched interface{} + + for inputOffset := range numInputs { + debatched, err := debatch(params[inputOffset], batchOffset) + if err != nil { + return nil, fmt.Errorf("failed to debatch for row %d and input %d: %w", batchOffset, inputOffset, err) + } + + if inputOffset < r.routerInputOffset { + request[inputOffset] = debatched + } else if inputOffset == r.routerInputOffset { + routingValueBatched = debatched + } else { + request[inputOffset-1] = debatched + } + } + + routingValue, err := squeezeBatch(routingValueBatched) + if err != nil { + return nil, fmt.Errorf("failed to extract from batch for row %d: %w", batchOffset, err) + } + + var ok bool = true + var routingValueInt int + switch routingValue := routingValue.(type) { + case int: + routingValueInt = routingValue + case int32: + routingValueInt = int(routingValue) + case int64: + routingValueInt = int(routingValue) + default: + ok = false + } + + if !ok { + return nil, fmt.Errorf("routing value is not an int: %v, is %T, for row %d", routingValue, routingValue, batchOffset) + } + + routingValueString, ok := r.routingMap[routingValueInt] + + var evaluator Predictor + if !ok { + if r.modelConfig.Router.Global.Exists { + // fallback to global model + evaluator = *r.globalModel + } else { + evaluator = r.fixedEvaluator + } + } else { + var ok bool + evaluator, ok = r.routingTable[routingValueString] + if !ok { + return nil, fmt.Errorf("no evaluator found for routing value: %v", routingValue) + } + } + + results, err := evaluator.Predict(ctx, request) + if err != nil { + return nil, fmt.Errorf("failed to predict for row %d: %w", batchOffset, err) + } + + // TODO dynamic output batch shape detection + allResults = append(allResults, results) + } + + // TODO this is going to crash + return allResults, nil +} + +func squeezeBatch(untypedBatch interface{}) (interface{}, error) { + switch typedBatch := untypedBatch.(type) { + case [][]int32: + return typedBatch[0][0], nil + case [][]int64: + return typedBatch[0][0], nil + case [][]float32: + return typedBatch[0][0], nil + case [][]float64: + return typedBatch[0][0], nil + case [][]string: + return typedBatch[0][0], nil + } + + return nil, fmt.Errorf("unexpected batch type: %T", untypedBatch) +} + +func debatch(untypedBatch interface{}, i int) (interface{}, error) { + switch typedBatch := untypedBatch.(type) { + case [][]int32: + return [][]int32{{typedBatch[0][i]}}, nil + case [][]int64: + return [][]int64{{typedBatch[0][i]}}, nil + case [][]float32: + return [][]float32{{typedBatch[0][i]}}, nil + case [][]float64: + return [][]float64{{typedBatch[0][i]}}, nil + case [][]string: + return [][]string{{typedBatch[0][i]}}, nil + } + + return nil, fmt.Errorf("unexpected batch type: %T", untypedBatch) +} + +func (r *Router) Signature() *domain.Signature { + return nil +} + +func (r *Router) Dictionary() *common.Dictionary { + return nil +} + +func (r *Router) Inputs() map[string]*domain.Input { + return r.inputs +} + +func (r *Router) Stats(stats map[string]interface{}) { + +} + +func (r *Router) Close() error { + return nil +} + +// TODO refactor with service/tfmodel/service.isModified()? +func (r *Router) isModified(snapshot *config.Modified) bool { + if r.routerConfig == nil || r.configModified == nil { + return true + } + + if snapshot.Max.IsZero() { + return false + } + + r.configLock.RLock() + modified := r.configModified + r.configLock.RUnlock() + + return !(modified.Max.Equal(snapshot.Max) && modified.Min.Equal(snapshot.Min)) +} + +func (r *Router) ReloadIfNeeded(ctx context.Context) error { + // fetch and check router configuration file + snapshot, err := files.ModifiedSnapshot(ctx, r.fs, r.configURL, nil) + if err != nil { + return fmt.Errorf("failed to check router configuration file: %w", err) + } + + if !r.isModified(snapshot) { + var wg sync.WaitGroup + errCh := make(chan error, len(r.routingTable)) + + for m, p := range r.routingTable { + wg.Add(1) + go func(m string, p platform.PlatformEvaluator) { + defer wg.Done() + err := p.ReloadIfNeeded(ctx) + if err != nil { + errCh <- fmt.Errorf("failed to reload model %s: %w", m, err) + } + }(m, p) + } + + wg.Wait() + close(errCh) + + if len(errCh) > 0 { + var errStrings []string + for err := range errCh { + errStrings = append(errStrings, err.Error()) + } + + err = fmt.Errorf("one or more model reloading errors: %s", strings.Join(errStrings, "; ")) + } + + return err + } + + // otherwise just abandon the routing table status checks + + r.configLock.Lock() + defer r.configLock.Unlock() + + r.configModified = snapshot + + // load router configuration file + rawReader, err := r.fs.OpenURL(ctx, r.configURL) + if err != nil { + return fmt.Errorf("failed to open router configuration file: %w", err) + } + + defer rawReader.Close() + var reader io.Reader = rawReader + if strings.HasSuffix(r.configURL, ".gz") { + if reader, err = gzip.NewReader(rawReader); err != nil { + return fmt.Errorf("failed to create gzip reader for router configuration file: %w", err) + } + } + + var newConfig router.RouterConfig + + // TODO move this check earlier + if strings.Contains(r.configURL, ".yaml") { + decoder := yaml.NewDecoder(reader) + err = decoder.Decode(&newConfig) + } else if strings.Contains(r.configURL, ".json") { + err = json.NewDecoder(reader).Decode(&newConfig) + } else { + return fmt.Errorf("unsupported router configuration file type: %s", r.configURL) + } + + if err != nil { + return fmt.Errorf("failed to decode router configuration file: %w", err) + } + + modelsToLoad := make(map[string]struct{}) + modelsToUnload := make(map[string]struct{}) + + oldConfig := r.routerConfig + if oldConfig != nil { + for _, entity := range oldConfig.EntityMapping { + modelsToUnload[entity.ModelName] = struct{}{} + } + + if oldConfig.GlobalModelName != "" { + modelsToUnload[oldConfig.GlobalModelName] = struct{}{} + } + } + + for _, entity := range newConfig.EntityMapping { + if _, ok := modelsToUnload[entity.ModelName]; ok { + // don't unload + delete(modelsToUnload, entity.ModelName) + } else { + modelsToLoad[entity.ModelName] = struct{}{} + } + } + + if newConfig.GlobalModelName != "" { + if _, ok := modelsToUnload[newConfig.GlobalModelName]; ok { + // don't unload + delete(modelsToUnload, newConfig.GlobalModelName) + } else { + modelsToLoad[newConfig.GlobalModelName] = struct{}{} + } + } + + // Launch goroutines to load models concurrently, collecting errors. + errCh := make(chan error, len(modelsToLoad)) + var wg sync.WaitGroup + + for model := range modelsToLoad { + wg.Add(1) + go func(model string) { + defer wg.Done() + err := r.tritonClient.ModelLoad(ctx, model) + if err != nil { + errCh <- fmt.Errorf("failed to load model %s: %w", model, err) + } + }(model) + } + + wg.Wait() + close(errCh) + + if len(errCh) > 0 { + var errStrings []string + for err := range errCh { + errStrings = append(errStrings, err.Error()) + } + return fmt.Errorf("one or more model loading errors: %s", strings.Join(errStrings, "; ")) + } + + newRoutingTable := make(map[string]platform.PlatformEvaluator) + for model := range modelsToLoad { + evaluator, err := tricli.NewTritonEvaluator( + r.modelConfig, + map[string]tricli.TritonClient{r.modelConfig.Triton.ServerID: r.tritonClient}, + ) + if err != nil { + return fmt.Errorf("failed to create Triton evaluator for model %s: %w", model, err) + } + newRoutingTable[model] = evaluator + } + + // swap table + func() { + r.routingTableLock.Lock() + defer r.routingTableLock.Unlock() + r.routerConfig = &newConfig + r.routingTable = newRoutingTable + }() + + // unload obsolete models, ignore errors... + for model := range modelsToUnload { + go func(model string) { + defer wg.Done() + err := r.tritonClient.ModelUnload(ctx, model) + if err != nil { + log.Printf("failed to unload model %s: %v\n", model, err) + } + }(model) + } + + return nil +} diff --git a/service/request/request.go b/service/request/request.go index 0434965..92182f4 100644 --- a/service/request/request.go +++ b/service/request/request.go @@ -20,8 +20,7 @@ type Request struct { Body []byte // usually the POST JSON content // Passed through to Evaluator. - // This is expected to be [numInputs][1][batchSize]T. - // TODO consider scenario when the second slice does not have length 1. + // This is expected to be [numInputs]([batchSize][1]T). Feeds []interface{} supplied map[string]struct{} // used to check if the required inputs were provided @@ -159,6 +158,7 @@ func (r *Request) UnmarshalJSONObject(dec *gojay.Decoder, key string) error { return nil } + // non-batch mode outerr := func() error { switch input.Type.Kind() { case reflect.String: diff --git a/service/request/shape/batch.go b/service/request/shape/batch.go new file mode 100644 index 0000000..be34e8b --- /dev/null +++ b/service/request/shape/batch.go @@ -0,0 +1,33 @@ +package shape + +import "fmt" + +// DetermineBatchSize determines batch size from a service.Request.Feeds slice. +func DetermineBatchSize(inputs []interface{}) (int, error) { + var batchSize int + for _, iSlice := range inputs { + switch typedSlice := iSlice.(type) { + case [][]int32: + batchSize = len(typedSlice) + case [][]int64: + batchSize = len(typedSlice) + case [][]float32: + batchSize = len(typedSlice) + case [][]float64: + batchSize = len(typedSlice) + case [][]string: + batchSize = len(typedSlice) + default: + continue + } + + break + } + + var err error + if batchSize == 0 { + err = fmt.Errorf("could not determine batch size") + } + + return batchSize, err +} diff --git a/service/service.go b/service/service.go index fd365c3..6650045 100644 --- a/service/service.go +++ b/service/service.go @@ -23,6 +23,7 @@ import ( "github.com/viant/mly/service/stat" "github.com/viant/mly/service/stream" "github.com/viant/mly/service/transform" + "github.com/viant/mly/service/triton" "github.com/viant/mly/shared" "github.com/viant/mly/shared/common" "github.com/viant/mly/shared/common/storable" @@ -333,13 +334,14 @@ func (s *Service) initializeService(ctx context.Context, cfg *config.Model, fs a return nil } -// NewWithPlatform creates a service with platform router support -func NewWithPlatform( +// New creates a service with platform router support +func New( ctx context.Context, cfg *config.Model, fs afs.Service, metrics *gmetric.Service, datastores map[string]*datastore.Service, + tritonClients map[string]triton.TritonClient, sema *semaphore.Weighted, maxEvaluatorWait time.Duration, options ...Option, @@ -354,7 +356,7 @@ func NewWithPlatform( cfg.Init(nil) // Create platform evaluator context - evaluatorContext, err := factory.CreateEvaluator(cfg, fs, metrics, sema, maxEvaluatorWait) + evaluatorContext, err := factory.CreateEvaluator(cfg, fs, metrics, sema, maxEvaluatorWait, tritonClients) if err != nil { return nil, fmt.Errorf("failed to create platform evaluator for model %s: %w", cfg.ID, err) } diff --git a/service/tfmodel/batcher/service.go b/service/tfmodel/batcher/service.go index 3931cc0..c852ae7 100644 --- a/service/tfmodel/batcher/service.go +++ b/service/tfmodel/batcher/service.go @@ -11,6 +11,7 @@ import ( "github.com/viant/gmetric" "github.com/viant/mly/service/errors" "github.com/viant/mly/service/evaluator" + "github.com/viant/mly/service/request/shape" "github.com/viant/mly/service/tfmodel/batcher/adjust" "github.com/viant/mly/service/tfmodel/batcher/config" "github.com/viant/mly/shared/stat" @@ -217,35 +218,6 @@ func (s *Service) checkShedding() error { return nil } -func determineBatchSize(inputs []interface{}) (int, error) { - var batchSize int - for _, iSlice := range inputs { - switch typedSlice := iSlice.(type) { - case [][]int32: - batchSize = len(typedSlice) - case [][]int64: - batchSize = len(typedSlice) - case [][]float32: - batchSize = len(typedSlice) - case [][]float64: - batchSize = len(typedSlice) - case [][]string: - batchSize = len(typedSlice) - default: - continue - } - - break - } - - var err error - if batchSize == 0 { - err = fmt.Errorf("could not determine batch size") - } - - return batchSize, err -} - // queue for requests i.e. input batch func (s *Service) queue(ctx context.Context, inputs []interface{}) (*subBatch, error) { if s.closed { @@ -259,7 +231,7 @@ func (s *Service) queue(ctx context.Context, inputs []interface{}) (*subBatch, e s.Verbose.DebugFn("Queue", func() string { return fmt.Sprintf("inputs:%v", inputs) }, s.Verbose.InputEnabled()) - batchSize, err := determineBatchSize(inputs) + batchSize, err := shape.DetermineBatchSize(inputs) if err != nil { return nil, err } @@ -453,6 +425,7 @@ func (s *Service) run(batch predictionBatch) { batchResult[resOffset] = typedSlice[o:r] case [][]string: batchResult[resOffset] = typedSlice[o:r] + case []int32: batchResult[resOffset] = typedSlice[o:r] case []int64: diff --git a/service/tfmodel/evaluator/service.go b/service/tfmodel/evaluator/service.go index 416ef9a..ded608e 100644 --- a/service/tfmodel/evaluator/service.go +++ b/service/tfmodel/evaluator/service.go @@ -64,7 +64,7 @@ func (e *Service) acquire(ctx context.Context) (func(), error) { } // Evaluate runs the primary model prediction via Cgo Tensorflow. -// params is expected to be [inputs][1][batch]T - see service/request.Request.Feeds and related methods. +// params is expected to be [inputs]([batch][1]T) - see service/request.Request.Feeds and related methods. func (s *Service) Evaluate(ctx context.Context, params []interface{}) ([]interface{}, error) { s.wg.Add(1) defer s.wg.Done() diff --git a/service/triton/client.go b/service/triton/client.go index 384e28c..a9f3c56 100644 --- a/service/triton/client.go +++ b/service/triton/client.go @@ -2,14 +2,57 @@ package triton import ( "context" + "net/http" + "time" + + "github.com/viant/mly/service/config" + "google.golang.org/grpc" + "google.golang.org/grpc/backoff" + "google.golang.org/grpc/credentials/insecure" ) type TritonClient interface { + ServerReady(ctx context.Context) error + + // inputs is expected to be [numInputs]([batchSize][1]T) (see service/request.Request.Feeds) ModelInfer(ctx context.Context, modelName string, inputs []interface{}, indexToName map[int]string) ([]interface{}, error) ModelReady(ctx context.Context, modelName string) (bool, error) ModelLoad(ctx context.Context, modelName string) error + ModelUnload(ctx context.Context, modelName string) error + Close() error } + +func NewClient(server config.TritonServer) (TritonClient, error) { + if server.GRPCBaseURL != "" { + grpcConn, err := grpc.NewClient(server.GRPCBaseURL, + grpc.WithConnectParams(grpc.ConnectParams{ + Backoff: backoff.Config{ + BaseDelay: time.Duration(server.GRPCConnectParams.BaseDelayMs) * time.Millisecond, + Multiplier: server.GRPCConnectParams.Multiplier, + Jitter: server.GRPCConnectParams.Jitter, + MaxDelay: time.Duration(server.GRPCConnectParams.MaxDelayMs) * time.Millisecond, + }, + }), + grpc.WithTransportCredentials(insecure.NewCredentials()), + ) + + if err != nil { + return nil, err + } + + return NewGRPCClient(grpcConn), nil + } + + // HTTP options seem a bit bare + // TODO see if DRY with + return &HTTPClient{ + httpClient: &http.Client{ + Timeout: time.Duration(server.HTTPClientTimeoutMs) * time.Millisecond, + }, + serverURL: server.HTTPBaseURL, + }, nil +} diff --git a/service/triton/grpc.go b/service/triton/grpc.go index 0172e41..4f209b6 100644 --- a/service/triton/grpc.go +++ b/service/triton/grpc.go @@ -11,10 +11,20 @@ import ( ) type GRPCClient struct { - grpcConn *grpc.ClientConn + // Note that this is dangerous to Close if the connection is shared. + // See how TritonEvaluator handles Close(). + grpcConn *grpc.ClientConn + grpcClient triton.GRPCInferenceServiceClient } +func NewGRPCClient(grpcConn *grpc.ClientConn) *GRPCClient { + return &GRPCClient{ + grpcConn: grpcConn, + grpcClient: triton.NewGRPCInferenceServiceClient(grpcConn), + } +} + // preparedInput represents processed input data ready for gRPC transport type preparedInput struct { name string @@ -23,6 +33,11 @@ type preparedInput struct { data interface{} // Flattened data: []string, []int32, []int64, []float32, []float64 } +func (c *GRPCClient) ServerReady(ctx context.Context) error { + _, err := c.grpcClient.ServerReady(ctx, &triton.ServerReadyRequest{}) + return err +} + func (c *GRPCClient) ModelInfer(ctx context.Context, modelName string, inputs []interface{}, indexToName map[int]string) ([]interface{}, error) { preparedInputs, err := prepareInputs(indexToName, inputs) if err != nil { @@ -63,6 +78,18 @@ func (c *GRPCClient) ModelLoad(ctx context.Context, modelName string) error { return nil } +func (c *GRPCClient) ModelUnload(ctx context.Context, modelName string) error { + _, err := c.grpcClient.RepositoryModelUnload(ctx, &triton.RepositoryModelUnloadRequest{ + ModelName: modelName, + }) + + if err != nil { + return err + } + + return nil +} + func (c *GRPCClient) Close() error { return c.grpcConn.Close() } diff --git a/service/triton/http.go b/service/triton/http.go index 6a94661..dd8dff6 100644 --- a/service/triton/http.go +++ b/service/triton/http.go @@ -20,6 +20,32 @@ type HTTPClient struct { serverURL string } +func (c *HTTPClient) statusRequest(ctx context.Context, method, url string) (*http.Response, error) { + httpReq, err := http.NewRequestWithContext(ctx, method, url, nil) + if err != nil { + return nil, fmt.Errorf("failed to create HTTP request: %w", err) + } + + resp, err := c.handleRequestWithRetry(ctx, httpReq, nil) + + if err != nil { + return nil, err + } + + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + return resp, fmt.Errorf("triton server http status code: %d for %s %s", resp.StatusCode, method, url) + } + + return resp, nil +} + +func (c *HTTPClient) ServerReady(ctx context.Context) error { + url := c.serverURL + "/v2/health/ready" + _, err := c.statusRequest(ctx, "GET", url) + return err +} + func (c *HTTPClient) ModelInfer(ctx context.Context, modelName string, inputs []interface{}, indexToName map[int]string) ([]interface{}, error) { tritonRequest, err := convertToTritonRequest(inputs, indexToName) if err != nil { @@ -31,22 +57,16 @@ func (c *HTTPClient) ModelInfer(ctx context.Context, modelName string, inputs [] return nil, err } - return convertFromTritonResponse(tritonResponse), nil + return convertFromTritonResponse(tritonResponse) } func (c *HTTPClient) ModelReady(ctx context.Context, modelName string) (bool, error) { url := c.serverURL + "/v2/models/" + modelName + "/ready" - httpReq, err := http.NewRequestWithContext(ctx, "GET", url, nil) - if err != nil { - return false, fmt.Errorf("failed to create HTTP request: %w", err) - } - resp, err := c.handleRequestWithRetry(ctx, httpReq, nil) + resp, err := c.statusRequest(ctx, "GET", url) if err != nil { return false, err } - defer resp.Body.Close() - if resp.StatusCode == http.StatusBadRequest { // TODO "Model version not ready" return false, nil @@ -60,23 +80,14 @@ func (c *HTTPClient) ModelReady(ctx context.Context, modelName string) (bool, er func (c *HTTPClient) ModelLoad(ctx context.Context, modelName string) error { url := c.serverURL + "/v2/repository/models/" + modelName + "/load" - httpReq, err := http.NewRequestWithContext(ctx, "POST", url, nil) - if err != nil { - return fmt.Errorf("failed to create HTTP request: %w", err) - } - resp, err := c.handleRequestWithRetry(ctx, httpReq, nil) - if err != nil { - return err - } - - defer resp.Body.Close() - - if resp.StatusCode != http.StatusOK { - body, _ := io.ReadAll(resp.Body) - return fmt.Errorf("triton server returned status %d: %s", resp.StatusCode, string(body)) - } + _, err := c.statusRequest(ctx, "POST", url) + return err +} - return nil +func (c *HTTPClient) ModelUnload(ctx context.Context, modelName string) error { + url := c.serverURL + "/v2/repository/models/" + modelName + "/unload" + _, err := c.statusRequest(ctx, "POST", url) + return err } func (c *HTTPClient) Close() error { @@ -228,12 +239,16 @@ func (c *HTTPClient) handleRequestWithRetry(ctx context.Context, httpReq *http.R if attempt < maxRetries { httpReq.Body = io.NopCloser(bytes.NewBuffer(jsonData)) } + + if ctx.Err() != nil { + return nil, ctx.Err() + } } return resp, nil } -// convertToTritonRequest converts MLY params ([]interface{}) to Triton request format +// convertToTritonRequest converts Feeds ([numInputs]([batchSize][1]T)) to Triton request format func convertToTritonRequest(params []interface{}, indexToName map[int]string) (*TritonRequest, error) { if len(params) == 0 { return nil, fmt.Errorf("no input parameters provided") @@ -324,11 +339,11 @@ func convertToTritonRequest(params []interface{}, indexToName map[int]string) (* return &TritonRequest{Inputs: inputs}, nil } -// convertFromTritonResponse converts Triton response to MLY format ([]interface{}) -func convertFromTritonResponse(response *TritonResponse) []interface{} { +// convertFromTritonResponse converts Triton response to [numOutputs]([batchSize]D_T) - shape depends on model output. +func convertFromTritonResponse(response *TritonResponse) ([]interface{}, error) { var result []interface{} - for _, output := range response.Outputs { + for outputOffset, output := range response.Outputs { if data, ok := output.Data.([]interface{}); ok && len(data) > 0 { batchSize := len(data) converted := make([][]float32, batchSize) @@ -336,14 +351,14 @@ func convertFromTritonResponse(response *TritonResponse) []interface{} { if f, ok := v.(float64); ok { converted[i] = []float32{float32(f)} } else { - converted[i] = []float32{0.0} + return nil, fmt.Errorf("unsupported output type for %s: %T, for batch item %d of output offset %d", output.Name, v, i, outputOffset) } } result = append(result, converted) } else { - result = append(result, [][]float32{{0.0}}) + return nil, fmt.Errorf("unsupported output type for %s: %T, for output offset %d", output.Name, output.Data, outputOffset) } } - return result + return result, nil } diff --git a/shared/config/router/router.go b/shared/config/router/router.go index c57d952..58bd880 100644 --- a/shared/config/router/router.go +++ b/shared/config/router/router.go @@ -1,4 +1,4 @@ -package config +package router type RouterConfig struct { EntityMapping []EntityKV `json:"entityMapping" yaml:"entityMapping"` diff --git a/shared/config/router/router_test.go b/shared/config/router/router_test.go index 7fe3d09..e77c58b 100644 --- a/shared/config/router/router_test.go +++ b/shared/config/router/router_test.go @@ -1,4 +1,4 @@ -package config +package router import ( "encoding/json" From 8befbe6e8a3702a1c0da876690edf4cefd3375c7 Mon Sep 17 00:00:00 2001 From: David Choi Date: Thu, 13 Nov 2025 21:11:38 -0800 Subject: [PATCH 08/38] Router to return signature --- service/platform/router/router.go | 2 +- service/service.go | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/service/platform/router/router.go b/service/platform/router/router.go index e5d3a62..e7b7d5a 100644 --- a/service/platform/router/router.go +++ b/service/platform/router/router.go @@ -464,7 +464,7 @@ func debatch(untypedBatch interface{}, i int) (interface{}, error) { } func (r *Router) Signature() *domain.Signature { - return nil + return r.signature } func (r *Router) Dictionary() *common.Dictionary { diff --git a/service/service.go b/service/service.go index 6650045..9694811 100644 --- a/service/service.go +++ b/service/service.go @@ -91,10 +91,7 @@ func (s *Service) Config() *config.Model { } func (s *Service) Signature() *domain.Signature { - if s.evaluator != nil { - return s.evaluator.Signature() - } - return nil + return s.evaluator.Signature() } func (s *Service) Dictionary() *common.Dictionary { From 0e98e690a452fe1170af8377c33f477784e4473d Mon Sep 17 00:00:00 2001 From: David Choi Date: Fri, 14 Nov 2025 13:18:41 -0800 Subject: [PATCH 09/38] Flesh out self-test for manually specified batches, refactor, further improve routing, proliferate (possibly ill-advisedly) support for "float" type. --- service/config/model.go | 4 + service/config/router.go | 10 + service/endpoint/checker/gen.go | 4 +- service/endpoint/checker/self.go | 74 +++- service/platform/evaluator.go | 12 +- service/platform/router/fixed.go | 197 +++++++++++ service/platform/router/router.go | 462 ++++++++++++------------- service/platform/router/router_test.go | 90 +++++ service/service.go | 8 +- service/triton/triton.go | 10 + shared/client/message.go | 17 +- shared/common/type.go | 2 +- 12 files changed, 620 insertions(+), 270 deletions(-) create mode 100644 service/platform/router/fixed.go create mode 100644 service/platform/router/router_test.go diff --git a/service/config/model.go b/service/config/model.go index 7cf7501..4b6efe6 100644 --- a/service/config/model.go +++ b/service/config/model.go @@ -139,6 +139,10 @@ func (m *Model) Init(globalBatchConfig *batchconfig.BatcherConfig) { BatcherConfig: *globalBatchConfig, } } + + if m.Router != nil { + m.Router.Init() + } } func (m *Model) Validate() error { diff --git a/service/config/router.go b/service/config/router.go index 9c1d89c..db034cb 100644 --- a/service/config/router.go +++ b/service/config/router.go @@ -13,6 +13,10 @@ type RouterConfig struct { // If true, the router will batch the requests to the backend. BatchBackend bool `json:",omitempty" yaml:",omitempty"` + // The maximum number of concurrent requests to the backend. + // Defaults to 50. + MaxConcurrency int `json:",omitempty" yaml:",omitempty"` + Global GlobalModelConfig Output OutputConfig @@ -47,6 +51,12 @@ type OutputConfig struct { NoModelID string `json:",omitempty" yaml:",omitempty"` } +func (o *RouterConfig) Init() { + if o.MaxConcurrency == 0 { + o.MaxConcurrency = 50 + } +} + func (o *RouterConfig) Validate() error { if o.ConfigURL == "" { return fmt.Errorf("config URL is required") diff --git a/service/endpoint/checker/gen.go b/service/endpoint/checker/gen.go index 716e626..cb35207 100644 --- a/service/endpoint/checker/gen.go +++ b/service/endpoint/checker/gen.go @@ -86,7 +86,7 @@ func (g *genType) UnmarshalJSONObject(dec *gojay.Decoder, key string) error { var i int64 err = dec.Int64(&i) g.D[key] = i - case "float32": + case "float32", "float": var f float32 err = dec.Float32(&f) g.D[key] = f @@ -192,7 +192,7 @@ func (g *genType) DecodeBinary(dec *bintly.Reader) error { dec.String(&s) g.D[key] = s default: - return fmt.Errorf("unknown type") + return fmt.Errorf("unknown type %s", f.DataType) } } diff --git a/service/endpoint/checker/self.go b/service/endpoint/checker/self.go index 854bf01..8ec07cf 100644 --- a/service/endpoint/checker/self.go +++ b/service/endpoint/checker/self.go @@ -27,9 +27,66 @@ func SelfTest(host []*client.Host, timeout time.Duration, modelID string, usesTr var testData map[string]interface{} var batchSize int if len(tp.Batch) > 0 { - for k, v := range tp.Batch { - testData[k] = v - batchSize = len(v) + testData = make(map[string]interface{}) + for _, field := range inputs { + fn := field.Name + v := tp.Batch[fn] + + for _, vv := range v { + tv := vv + switch field.DataType { + case "int", "int32", "int64": + var v int + switch atv := tv.(type) { + case int: + v = atv + case int32: + case int64: + v = int(atv) + default: + return fmt.Errorf("test data malformed: %s expected int-like, found %T", fn, tv) + } + + if testData[fn] == nil { + testData[fn] = []int{v} + } else { + testData[fn] = append(testData[fn].([]int), v) + } + + case "float", "float32", "float64": + var v float32 + switch atv := tv.(type) { + case float32: + v = atv + case float64: + v = float32(atv) + default: + return fmt.Errorf("test data malformed: %s expected float32-like, found %T", fn, tv) + } + + if testData[fn] == nil { + testData[fn] = []float32{v} + } else { + testData[fn] = append(testData[fn].([]float32), v) + } + + default: + switch atv := tv.(type) { + case string: + if testData[fn] == nil { + testData[fn] = []string{atv} + } else { + testData[fn] = append(testData[fn].([]string), atv) + } + default: + return fmt.Errorf("test data malformed: %s expected string-like, found %T", fn, tv) + } + } + } + + if len(v) > batchSize { + batchSize = len(v) + } } } else { if len(tp.Single) > 0 { @@ -76,6 +133,7 @@ func SelfTest(host []*client.Host, timeout time.Duration, modelID string, usesTr } } + // testData has a single set of inputs if tp.SingleBatch { for _, field := range inputs { fn := field.Name @@ -93,8 +151,7 @@ func SelfTest(host []*client.Host, timeout time.Duration, modelID string, usesTr return fmt.Errorf("test data malformed: %s expected int-like, found %T", fn, tv) } - b := [1]int{v} - testData[fn] = b[:] + testData[fn] = []int{v} case "float", "float32", "float64": var v float32 switch atv := tv.(type) { @@ -106,13 +163,11 @@ func SelfTest(host []*client.Host, timeout time.Duration, modelID string, usesTr return fmt.Errorf("test data malformed: %s expected float32-like, found %T", fn, tv) } - b := [1]float32{v} - testData[fn] = b[:] + testData[fn] = []float32{v} default: switch atv := tv.(type) { case string: - b := [1]string{atv} - testData[fn] = b[:] + testData[fn] = []string{atv} default: return fmt.Errorf("test data malformed: %s expected string-like, found %T", fn, tv) } @@ -145,6 +200,7 @@ func SelfTest(host []*client.Host, timeout time.Duration, modelID string, usesTr rat[i] = float32(v) } msg.FloatsKey(k, rat) + case float32: msg.FloatKey(k, at) case float64: diff --git a/service/platform/evaluator.go b/service/platform/evaluator.go index bb3c1f4..0ebf621 100644 --- a/service/platform/evaluator.go +++ b/service/platform/evaluator.go @@ -17,10 +17,7 @@ const ( // PlatformEvaluator defines the interface that all platform-specific evaluators must implement type PlatformEvaluator interface { - // Predict performs model inference with the given parameters - // params is expected to be [numInputs]([batchSize][1]T) (see service/request.Request.Feeds) - // The return value should be [numOutputs]([batchSize][1]T), but may vary depending on the model. - Predict(ctx context.Context, params []interface{}) ([]interface{}, error) + Predictor // Signature returns underlying model's signature Signature() *domain.Signature @@ -42,3 +39,10 @@ type PlatformEvaluator interface { // For external models (Triton), this will check Triton models' health. ReloadIfNeeded(ctx context.Context) error } + +type Predictor interface { + // Predict performs model inference with the given parameters + // params is expected to be [numInputs]([batchSize][1]T) (see service/request.Request.Feeds) + // The return value should be [numOutputs]([batchSize][1]T), but may vary depending on the model. + Predict(ctx context.Context, params []interface{}) ([]interface{}, error) +} diff --git a/service/platform/router/fixed.go b/service/platform/router/fixed.go new file mode 100644 index 0000000..7fdc0fd --- /dev/null +++ b/service/platform/router/fixed.go @@ -0,0 +1,197 @@ +package router + +import ( + "context" + "fmt" + + "github.com/viant/mly/service/config" + "github.com/viant/mly/service/request/shape" +) + +type fixedEvaluator struct { + prepared []preparedReplacement +} + +func newFixedEvaluator(repls []config.PredictionReplacement) (*fixedEvaluator, error) { + prepared := make([]preparedReplacement, 0, len(repls)) + + err := func() error { + for _, r := range repls { + + var pr preparedReplacement + switch r.Type { + case "string": + v, ok := r.Value.(string) + if !ok { + v = fmt.Sprintf("%v", r.Value) + } + pr = preparedReplacement{typ: "string", value: v} + case "int": + switch n := r.Value.(type) { + case int: + pr = preparedReplacement{typ: "int", value: n} + case int32: + pr = preparedReplacement{typ: "int", value: int(n)} + case int64: + pr = preparedReplacement{typ: "int", value: int(n)} + case float32: + pr = preparedReplacement{typ: "int", value: int(n)} + case float64: + pr = preparedReplacement{typ: "int", value: int(n)} + default: + return fmt.Errorf("router replacement %q: value %T not coercible to int", r.Name, r.Value) + } + case "int32": + switch n := r.Value.(type) { + case int: + pr = preparedReplacement{typ: "int32", value: int32(n)} + case int32: + pr = preparedReplacement{typ: "int32", value: n} + case int64: + pr = preparedReplacement{typ: "int32", value: int32(n)} + case float32: + pr = preparedReplacement{typ: "int32", value: int32(n)} + case float64: + pr = preparedReplacement{typ: "int32", value: int32(n)} + default: + return fmt.Errorf("router replacement %q: value %T not coercible to int32", r.Name, r.Value) + } + case "int64": + switch n := r.Value.(type) { + case int: + pr = preparedReplacement{typ: "int64", value: int64(n)} + case int32: + pr = preparedReplacement{typ: "int64", value: int64(n)} + case int64: + pr = preparedReplacement{typ: "int64", value: n} + case float32: + pr = preparedReplacement{typ: "int64", value: int64(n)} + case float64: + pr = preparedReplacement{typ: "int64", value: int64(n)} + default: + return fmt.Errorf("router replacement %q: value %T not coercible to int64", r.Name, r.Value) + } + case "float", "float32": + switch n := r.Value.(type) { + case int: + pr = preparedReplacement{typ: "float32", value: float32(n)} + case int32: + pr = preparedReplacement{typ: "float32", value: float32(n)} + case int64: + pr = preparedReplacement{typ: "float32", value: float32(n)} + case float32: + pr = preparedReplacement{typ: "float32", value: n} + case float64: + pr = preparedReplacement{typ: "float32", value: float32(n)} + default: + return fmt.Errorf("router replacement %q: value %T not coercible to float32", r.Name, r.Value) + } + case "float64": + switch n := r.Value.(type) { + case int: + pr = preparedReplacement{typ: "float64", value: float64(n)} + case int32: + pr = preparedReplacement{typ: "float64", value: float64(n)} + case int64: + pr = preparedReplacement{typ: "float64", value: float64(n)} + case float32: + pr = preparedReplacement{typ: "float64", value: float64(n)} + case float64: + pr = preparedReplacement{typ: "float64", value: n} + default: + return fmt.Errorf("router replacement %q: value %T not coercible to float64", r.Name, r.Value) + } + default: + return fmt.Errorf("unsupported router replacement type %q for %q", r.Type, r.Name) + } + + prepared = append(prepared, pr) + } + + return nil + }() + if err != nil { + return nil, err + } + + return &fixedEvaluator{prepared: prepared}, nil +} + +func (f *fixedEvaluator) Predict(ctx context.Context, params []interface{}) ([]interface{}, error) { + batchSize, err := shape.DetermineBatchSize(params) + if err != nil { + return nil, err + } + + makeString := func(v string) [][]string { + out := make([][]string, batchSize) + for i := 0; i < batchSize; i++ { + out[i] = []string{v} + } + return out + } + + makeInt32 := func(v int32) [][]int32 { + out := make([][]int32, batchSize) + for i := 0; i < batchSize; i++ { + out[i] = []int32{v} + } + return out + } + + makeInt64 := func(v int64) [][]int64 { + out := make([][]int64, batchSize) + for i := 0; i < batchSize; i++ { + out[i] = []int64{v} + } + return out + } + + makeInt := func(v int) [][]int { + out := make([][]int, batchSize) + for i := 0; i < batchSize; i++ { + out[i] = []int{v} + } + return out + } + + makeFloat32 := func(v float32) [][]float32 { + out := make([][]float32, batchSize) + for i := 0; i < batchSize; i++ { + out[i] = []float32{v} + } + return out + } + + makeFloat64 := func(v float64) [][]float64 { + out := make([][]float64, batchSize) + for i := 0; i < batchSize; i++ { + out[i] = []float64{v} + } + return out + } + + results := make([]interface{}, len(f.prepared)) + for i, repl := range f.prepared { + switch repl.typ { + case "string": + results[i] = makeString(repl.value.(string)) + case "int": + results[i] = makeInt(repl.value.(int)) + case "int32": + results[i] = makeInt32(repl.value.(int32)) + case "int64": + results[i] = makeInt64(repl.value.(int64)) + case "float": + results[i] = makeFloat32(repl.value.(float32)) + case "float32": + results[i] = makeFloat32(repl.value.(float32)) + case "float64": + results[i] = makeFloat64(repl.value.(float64)) + default: + return nil, fmt.Errorf("unsupported replacement type %q", repl.typ) + } + } + + return results, nil +} diff --git a/service/platform/router/router.go b/service/platform/router/router.go index e7b7d5a..66ac115 100644 --- a/service/platform/router/router.go +++ b/service/platform/router/router.go @@ -18,7 +18,6 @@ import ( "github.com/viant/mly/service/platform" "github.com/viant/mly/service/request/shape" tricli "github.com/viant/mly/service/triton" - "github.com/viant/mly/shared" "github.com/viant/mly/shared/common" "github.com/viant/mly/shared/config/router" "gopkg.in/yaml.v2" @@ -35,17 +34,21 @@ type Router struct { routingTableLock sync.RWMutex routingMap map[int]string routingTable map[string]platform.PlatformEvaluator - globalModel *platform.PlatformEvaluator - fixedEvaluator Predictor + + maxConcurrency int + + globalModel platform.PlatformEvaluator + fixedEvaluator platform.Predictor + modelOutputName string modelConfig *config.Model tritonClient tricli.TritonClient signature *domain.Signature indexToName map[int]string + inputs map[string]*domain.Input - inputs map[string]*domain.Input - + // router input offset is the index of the router input in the inputs array routerInputOffset int } @@ -67,262 +70,138 @@ func NewRouter(cfg *config.Model, fs afs.Service, tritonClients map[string]tricl tritonClient: tritonClient, } - if !cfg.Router.Global.Exists { - r.fixedEvaluator = newFixedEvaluator(cfg.Router.Global.PredictionReplacements) + if err := r.handleIO(cfg); err != nil { + return nil, fmt.Errorf("failed to handle IO: %w", err) } - r.handleIO(&cfg.MetaInput) + if cfg.Router.MaxConcurrency != 0 { + r.maxConcurrency = cfg.Router.MaxConcurrency + } return r, nil } -type Predictor interface { - Predict(ctx context.Context, params []interface{}) ([]interface{}, error) -} - -type fixedEvaluator struct { - prepared []preparedReplacement -} - type preparedReplacement struct { typ string value interface{} } -func newFixedEvaluator(repls []config.PredictionReplacement) *fixedEvaluator { - prepared := make([]preparedReplacement, 0, len(repls)) - for _, r := range repls { - switch r.Type { - case "string": - v, ok := r.Value.(string) - if !ok { - v = fmt.Sprintf("%v", r.Value) - } - prepared = append(prepared, preparedReplacement{typ: "string", value: v}) - case "int": - switch n := r.Value.(type) { - case int: - prepared = append(prepared, preparedReplacement{typ: "int", value: n}) - case int32: - prepared = append(prepared, preparedReplacement{typ: "int", value: int(n)}) - case int64: - prepared = append(prepared, preparedReplacement{typ: "int", value: int(n)}) - case float32: - prepared = append(prepared, preparedReplacement{typ: "int", value: int(n)}) - case float64: - prepared = append(prepared, preparedReplacement{typ: "int", value: int(n)}) - default: - panic(fmt.Errorf("router replacement %q: value %T not coercible to int", r.Name, r.Value)) - } - case "int32": - switch n := r.Value.(type) { - case int: - prepared = append(prepared, preparedReplacement{typ: "int32", value: int32(n)}) - case int32: - prepared = append(prepared, preparedReplacement{typ: "int32", value: n}) - case int64: - prepared = append(prepared, preparedReplacement{typ: "int32", value: int32(n)}) - case float32: - prepared = append(prepared, preparedReplacement{typ: "int32", value: int32(n)}) - case float64: - prepared = append(prepared, preparedReplacement{typ: "int32", value: int32(n)}) - default: - panic(fmt.Errorf("router replacement %q: value %T not coercible to int32", r.Name, r.Value)) - } - case "int64": - switch n := r.Value.(type) { - case int: - prepared = append(prepared, preparedReplacement{typ: "int64", value: int64(n)}) - case int32: - prepared = append(prepared, preparedReplacement{typ: "int64", value: int64(n)}) - case int64: - prepared = append(prepared, preparedReplacement{typ: "int64", value: n}) - case float32: - prepared = append(prepared, preparedReplacement{typ: "int64", value: int64(n)}) - case float64: - prepared = append(prepared, preparedReplacement{typ: "int64", value: int64(n)}) - default: - panic(fmt.Errorf("router replacement %q: value %T not coercible to int64", r.Name, r.Value)) - } - case "float", "float32": - switch n := r.Value.(type) { - case int: - prepared = append(prepared, preparedReplacement{typ: "float32", value: float32(n)}) - case int32: - prepared = append(prepared, preparedReplacement{typ: "float32", value: float32(n)}) - case int64: - prepared = append(prepared, preparedReplacement{typ: "float32", value: float32(n)}) - case float32: - prepared = append(prepared, preparedReplacement{typ: "float32", value: n}) - case float64: - prepared = append(prepared, preparedReplacement{typ: "float32", value: float32(n)}) - default: - panic(fmt.Errorf("router replacement %q: value %T not coercible to float32", r.Name, r.Value)) - } - case "float64": - switch n := r.Value.(type) { - case int: - prepared = append(prepared, preparedReplacement{typ: "float64", value: float64(n)}) - case int32: - prepared = append(prepared, preparedReplacement{typ: "float64", value: float64(n)}) - case int64: - prepared = append(prepared, preparedReplacement{typ: "float64", value: float64(n)}) - case float32: - prepared = append(prepared, preparedReplacement{typ: "float64", value: float64(n)}) - case float64: - prepared = append(prepared, preparedReplacement{typ: "float64", value: n}) - default: - panic(fmt.Errorf("router replacement %q: value %T not coercible to float64", r.Name, r.Value)) - } - default: - panic(fmt.Errorf("unsupported router replacement type %q for %q", r.Type, r.Name)) - } - } - return &fixedEvaluator{prepared: prepared} -} +func (t *Router) handleIO(cfg *config.Model) error { + io := &cfg.MetaInput -func (f *fixedEvaluator) Predict(ctx context.Context, params []interface{}) ([]interface{}, error) { - batchSize, err := shape.DetermineBatchSize(params) - if err != nil { - return nil, err + if len(io.Inputs) == 0 { + return fmt.Errorf("input configuration is required for a router") } - makeString := func(v string) [][]string { - out := make([][]string, batchSize) - for i := 0; i < batchSize; i++ { - out[i] = []string{v} - } - return out + if len(io.Outputs) == 0 { + return fmt.Errorf("output configuration is required for a router") } - makeInt32 := func(v int32) [][]int32 { - out := make([][]int32, batchSize) - for i := 0; i < batchSize; i++ { - out[i] = []int32{v} - } - return out - } + var inputs []domain.Input - makeInt64 := func(v int64) [][]int64 { - out := make([][]int64, batchSize) - for i := 0; i < batchSize; i++ { - out[i] = []int64{v} - } - return out - } + // for declaring the router's inputs + mappedInputs := make(map[string]*domain.Input) - makeInt := func(v int) [][]int { - out := make([][]int, batchSize) - for i := 0; i < batchSize; i++ { - out[i] = []int{v} - } - return out - } + // generate backend input + indexToName := make(map[int]string) + + i := 0 + for _, input := range io.Inputs { + if !input.Auxiliary && input.Name != cfg.Router.InputName { + inputs = append(inputs, domain.Input{ + Name: input.Name, + Index: input.Index, + }) - makeFloat32 := func(v float32) [][]float32 { - out := make([][]float32, batchSize) - for i := 0; i < batchSize; i++ { - out[i] = []float32{v} + indexToName[i] = input.Name + i++ } - return out - } - makeFloat64 := func(v float64) [][]float64 { - out := make([][]float64, batchSize) - for i := 0; i < batchSize; i++ { - out[i] = []float64{v} + inputType := reflect.TypeOf("") + if input.DataType != "" { + switch input.DataType { + case "string": + inputType = reflect.TypeOf("") + case "int": + inputType = reflect.TypeOf(0) + case "int32": + inputType = reflect.TypeOf(int32(0)) + case "int64": + inputType = reflect.TypeOf(int64(0)) + case "float32": + inputType = reflect.TypeOf(float32(0)) + case "float64": + inputType = reflect.TypeOf(float64(0)) + } } - return out - } - - results := make([]interface{}, len(f.prepared)) - for i, repl := range f.prepared { - switch repl.typ { - case "string": - results[i] = makeString(repl.value.(string)) - case "int": - results[i] = makeInt(repl.value.(int)) - case "int32": - results[i] = makeInt32(repl.value.(int32)) - case "int64": - results[i] = makeInt64(repl.value.(int64)) - case "float": - results[i] = makeFloat32(repl.value.(float32)) - case "float32": - results[i] = makeFloat32(repl.value.(float32)) - case "float64": - results[i] = makeFloat64(repl.value.(float64)) - default: - return nil, fmt.Errorf("unsupported replacement type %q", repl.typ) + + mappedInputs[input.Name] = &domain.Input{ + Name: input.Name, + Index: input.Index, + Type: inputType, + Vocab: false, + Auxiliary: input.Auxiliary, } } - return results, nil -} - -func (t *Router) handleIO(io *shared.MetaInput) error { - var inputs []domain.Input var outputs []domain.Output + outputByName := make(map[string]domain.Output) - indexToName := make(map[int]string) + for i, output := range io.Outputs { + outputs = append(outputs, domain.Output{ + Name: output.Name, + Index: i, + DataType: output.DataType, + }) - mappedInputs := make(map[string]*domain.Input) + outputByName[output.Name] = outputs[i] + } - if len(io.Inputs) > 0 { - for _, input := range io.Inputs { - if !input.Auxiliary { - inputs = append(inputs, domain.Input{ - Name: input.Name, - Index: input.Index, - }) + modelOutputName := cfg.Router.Output.FieldName + hasModelOutputName := modelOutputName != "" - indexToName[input.Index] = input.Name - } + if !cfg.Router.Global.Exists { + replacementsByName := make(map[string]config.PredictionReplacement) + for _, repl := range cfg.Router.Global.PredictionReplacements { + replacementsByName[repl.Name] = repl + } - inputType := reflect.TypeOf("") - if input.DataType != "" { - switch input.DataType { - case "string": - inputType = reflect.TypeOf("") - case "int": - inputType = reflect.TypeOf(0) - case "int32": - inputType = reflect.TypeOf(int32(0)) - case "int64": - inputType = reflect.TypeOf(int64(0)) - case "float32": - inputType = reflect.TypeOf(float32(0)) - case "float64": - inputType = reflect.TypeOf(float64(0)) - } + replacementOutputs := make([]config.PredictionReplacement, 0, len(outputs)) + for _, output := range outputs { + if hasModelOutputName && output.Name == modelOutputName { + // model-used output field name is handled in a different way + continue } - mappedInputs[input.Name] = &domain.Input{ - Name: input.Name, - Index: input.Index, - Type: inputType, - Vocab: false, - Auxiliary: input.Auxiliary, + if _, ok := replacementsByName[output.Name]; !ok { + return fmt.Errorf("replacement for output %s not found", output.Name) } + + replacementOutputs = append(replacementOutputs, replacementsByName[output.Name]) } - } else { - return fmt.Errorf("missing input configuration for Triton evaluator. " + - "Add 'inputs' section to your model configuration YAML with field definitions") - } - if len(io.Outputs) > 0 { - for i, output := range io.Outputs { - outputs = append(outputs, domain.Output{ - Name: output.Name, - Index: i, - DataType: output.DataType, - }) + fixedEvaluator, err := newFixedEvaluator(replacementOutputs) + if err != nil { + return fmt.Errorf("failed to create fixed evaluator: %w", err) } - } else { - return fmt.Errorf("missing output configuration for Triton evaluator. " + - "Add 'outputs' section to your model configuration YAML with field definitions") + + t.fixedEvaluator = fixedEvaluator + } + + var modelOutputInOutputs bool + if hasModelOutputName { + _, modelOutputInOutputs = outputByName[modelOutputName] } + if !modelOutputInOutputs { + outputs = append(outputs, domain.Output{ + Name: modelOutputName, + DataType: "string", + }) + } + + t.modelOutputName = modelOutputName + t.indexToName = indexToName t.signature = &domain.Signature{ @@ -350,7 +229,7 @@ func (r *Router) Predict(ctx context.Context, params []interface{}) ([]interface numInputs := len(params) - allResults := make([]interface{}, 0, expectedBatchSize) + allResults := make([]interface{}, len(r.signature.Outputs)) r.routingTableLock.RLock() defer r.routingTableLock.RUnlock() @@ -400,11 +279,11 @@ func (r *Router) Predict(ctx context.Context, params []interface{}) ([]interface routingValueString, ok := r.routingMap[routingValueInt] - var evaluator Predictor + var evaluator platform.Predictor if !ok { if r.modelConfig.Router.Global.Exists { // fallback to global model - evaluator = *r.globalModel + evaluator = r.globalModel } else { evaluator = r.fixedEvaluator } @@ -421,14 +300,78 @@ func (r *Router) Predict(ctx context.Context, params []interface{}) ([]interface return nil, fmt.Errorf("failed to predict for row %d: %w", batchOffset, err) } + if r.modelOutputName != "" { + // TODO ensure ordering + + results = append(results, []interface{}{[][]string{{routingValueString}}}) + } + // TODO dynamic output batch shape detection - allResults = append(allResults, results) + allResults, err = concatAxis0(allResults, results) + if err != nil { + return nil, fmt.Errorf("failed to concatenate results for row %d: %w", batchOffset, err) + } } - // TODO this is going to crash return allResults, nil } +// concatAxis0 concatenates two tensors along axis 0 (batch dimension). +func concatAxis0(x []interface{}, y []interface{}) ([]interface{}, error) { + if len(x) != len(y) { + return nil, fmt.Errorf("x and y must have the same length: %d vs %d", len(x), len(y)) + } + + result := make([]interface{}, len(x)) + for i := range x { + xt := x[i] + yt := y[i] + + if xt == nil { + result[i] = yt + continue + } + + switch xv := xt.(type) { + case [][]int32: + yv, ok := yt.([][]int32) + if !ok { + return nil, fmt.Errorf("type mismatch at index %d: %T vs %T", i, xt, yt) + } + + result[i] = append(xv, yv...) + case [][]int64: + yv, ok := yt.([][]int64) + if !ok { + return nil, fmt.Errorf("type mismatch at index %d: %T vs %T", i, xt, yt) + } + result[i] = append(xv, yv...) + case [][]float32: + yv, ok := yt.([][]float32) + if !ok { + return nil, fmt.Errorf("type mismatch at index %d: %T vs %T", i, xt, yt) + } + result[i] = append(xv, yv...) + case [][]float64: + yv, ok := yt.([][]float64) + if !ok { + return nil, fmt.Errorf("type mismatch at index %d: %T vs %T", i, xt, yt) + } + result[i] = append(xv, yv...) + case [][]string: + yv, ok := yt.([][]string) + if !ok { + return nil, fmt.Errorf("type mismatch at index %d: %T vs %T", i, xt, yt) + } + result[i] = append(xv, yv...) + default: + return nil, fmt.Errorf("unexpected output tensor type at index %d: %T", i, xt) + } + } + + return result, nil +} + func squeezeBatch(untypedBatch interface{}) (interface{}, error) { switch typedBatch := untypedBatch.(type) { case [][]int32: @@ -449,15 +392,15 @@ func squeezeBatch(untypedBatch interface{}) (interface{}, error) { func debatch(untypedBatch interface{}, i int) (interface{}, error) { switch typedBatch := untypedBatch.(type) { case [][]int32: - return [][]int32{{typedBatch[0][i]}}, nil + return [][]int32{{typedBatch[i][0]}}, nil case [][]int64: - return [][]int64{{typedBatch[0][i]}}, nil + return [][]int64{{typedBatch[i][0]}}, nil case [][]float32: - return [][]float32{{typedBatch[0][i]}}, nil + return [][]float32{{typedBatch[i][0]}}, nil case [][]float64: - return [][]float64{{typedBatch[0][i]}}, nil + return [][]float64{{typedBatch[i][0]}}, nil case [][]string: - return [][]string{{typedBatch[0][i]}}, nil + return [][]string{{typedBatch[i][0]}}, nil } return nil, fmt.Errorf("unexpected batch type: %T", untypedBatch) @@ -508,8 +451,26 @@ func (r *Router) ReloadIfNeeded(ctx context.Context) error { } if !r.isModified(snapshot) { + // check health of all underlying models var wg sync.WaitGroup - errCh := make(chan error, len(r.routingTable)) + + errChannels := len(r.routingTable) + if r.globalModel != nil { + errChannels++ + } + + errCh := make(chan error, errChannels) + + if r.globalModel != nil { + wg.Add(1) + go func() { + defer wg.Done() + err := r.globalModel.ReloadIfNeeded(ctx) + if err != nil { + errCh <- fmt.Errorf("failed to reload global model: %w", err) + } + }() + } for m, p := range r.routingTable { wg.Add(1) @@ -588,13 +549,11 @@ func (r *Router) ReloadIfNeeded(ctx context.Context) error { } } + newModelMapping := make(map[int]string) for _, entity := range newConfig.EntityMapping { - if _, ok := modelsToUnload[entity.ModelName]; ok { - // don't unload - delete(modelsToUnload, entity.ModelName) - } else { - modelsToLoad[entity.ModelName] = struct{}{} - } + newModelMapping[entity.EntityID] = entity.ModelName + delete(modelsToUnload, entity.ModelName) + modelsToLoad[entity.ModelName] = struct{}{} } if newConfig.GlobalModelName != "" { @@ -634,20 +593,39 @@ func (r *Router) ReloadIfNeeded(ctx context.Context) error { newRoutingTable := make(map[string]platform.PlatformEvaluator) for model := range modelsToLoad { - evaluator, err := tricli.NewTritonEvaluator( - r.modelConfig, - map[string]tricli.TritonClient{r.modelConfig.Triton.ServerID: r.tritonClient}, + evaluator, err := tricli.NewRoutedTritonEvaluator( + model, + r.tritonClient, + r.modelConfig.Triton.Timeout, + r.indexToName, ) if err != nil { return fmt.Errorf("failed to create Triton evaluator for model %s: %w", model, err) } + newRoutingTable[model] = evaluator } + var globalEvaluator platform.PlatformEvaluator + if newConfig.GlobalModelName != "" { + globalEvaluator, err = tricli.NewRoutedTritonEvaluator( + newConfig.GlobalModelName, + r.tritonClient, + r.modelConfig.Triton.Timeout, + r.indexToName, + ) + + if err != nil { + return fmt.Errorf("failed to create Triton evaluator for global model %s: %w", newConfig.GlobalModelName, err) + } + } + // swap table func() { r.routingTableLock.Lock() defer r.routingTableLock.Unlock() + r.globalModel = globalEvaluator + r.routingMap = newModelMapping r.routerConfig = &newConfig r.routingTable = newRoutingTable }() diff --git a/service/platform/router/router_test.go b/service/platform/router/router_test.go new file mode 100644 index 0000000..281bcf8 --- /dev/null +++ b/service/platform/router/router_test.go @@ -0,0 +1,90 @@ +package router + +import ( + "reflect" + "testing" +) + +func TestConcatAxis0_Int32(t *testing.T) { + x := []interface{}{ + [][]int32{{1}, {2}}, + } + y := []interface{}{ + [][]int32{{3}}, + } + + got, err := concatAxis0(x, y) + if err != nil { + t.Fatalf("concatAxis0 returned error: %v", err) + } + + want := []interface{}{ + [][]int32{{1}, {2}, {3}}, + } + + if !reflect.DeepEqual(got, want) { + t.Errorf("concatAxis0() mismatch:\n got: %#v\nwant: %#v", got, want) + } +} + +func TestConcatAxis0_String(t *testing.T) { + x := []interface{}{ + [][]string{{"a"}}, + } + y := []interface{}{ + [][]string{{"b"}, {"c"}}, + } + + got, err := concatAxis0(x, y) + if err != nil { + t.Fatalf("concatAxis0 returned error: %v", err) + } + + want := []interface{}{ + [][]string{{"a"}, {"b"}, {"c"}}, + } + + if !reflect.DeepEqual(got, want) { + t.Errorf("concatAxis0() mismatch:\n got: %#v\nwant: %#v", got, want) + } +} + +func TestConcatAxis0_TypeMismatch(t *testing.T) { + x := []interface{}{ + [][]int64{{1}}, + } + y := []interface{}{ + [][]int32{{2}}, + } + + _, err := concatAxis0(x, y) + if err == nil { + t.Fatalf("expected type mismatch error, got nil") + } +} + +func TestDebatchAndSqueezeBatch_Int64(t *testing.T) { + // batch of 3, single-column + batch := [][]int64{{10}, {20}, {30}} + + // pick index 1 + debatched, err := debatch(batch, 1) + if err != nil { + t.Fatalf("debatch returned error: %v", err) + } + + wantDebatched := [][]int64{{20}} + if !reflect.DeepEqual(debatched, wantDebatched) { + t.Errorf("debatch() mismatch:\n got: %#v\nwant: %#v", debatched, wantDebatched) + } + + // squeeze should return the scalar 20 + scalar, err := squeezeBatch(debatched) + if err != nil { + t.Fatalf("squeezeBatch returned error: %v", err) + } + + if v, ok := scalar.(int64); !ok || v != 20 { + t.Errorf("squeezeBatch() got %v (%T), want 20 (int64)", scalar, scalar) + } +} diff --git a/service/service.go b/service/service.go index 9694811..086b7e8 100644 --- a/service/service.go +++ b/service/service.go @@ -385,15 +385,11 @@ func New( // NewRequest should be used for Do() func (s *Service) NewRequest() *request.Request { numKeyInputs := s.config.KeysLen() + // This may change mid-request, but that only matters // under exceptional circumstances. - var inputs map[string]*domain.Input - - if s.evaluator != nil { - inputs = s.evaluator.Inputs() - } - + inputs := s.evaluator.Inputs() return request.NewRequest(numKeyInputs, inputs) } diff --git a/service/triton/triton.go b/service/triton/triton.go index ed8edbb..162cf40 100644 --- a/service/triton/triton.go +++ b/service/triton/triton.go @@ -71,6 +71,16 @@ func NewTritonEvaluator(config *config.Model, tritonClients map[string]TritonCli return evaluator, nil } +func NewRoutedTritonEvaluator(modelName string, client TritonClient, timeoutMs int, indexToName map[int]string) (*TritonEvaluator, error) { + return &TritonEvaluator{ + client: client, + modelName: modelName, + timeout: time.Duration(timeoutMs) * time.Millisecond, + repositoryExplicit: true, + indexToName: indexToName, + }, nil +} + // Predict performs inference via Triton Inference Server func (t *TritonEvaluator) Predict(ctx context.Context, params []interface{}) ([]interface{}, error) { requestCtx := ctx diff --git a/shared/client/message.go b/shared/client/message.go index 692645e..d8b9bdb 100644 --- a/shared/client/message.go +++ b/shared/client/message.go @@ -17,21 +17,26 @@ import ( // There are 2 "modes" for building the message: single and batch modes. // For single mode, the JSON object contents are written to Message.buf per method call. // Single mode functions include: -// (*Message).StringKey(string, string) -// (*Message).IntKey(string, int) -// (*Message).FloatKey(string, float32) +// +// (*Message).StringKey(string, string) +// (*Message).IntKey(string, int) +// (*Message).FloatKey(string, float32) +// // Batch mode is initiated by called (*Message).SetBatchSize() to a value greater than 0. // For batch mode, the JSON payload is generated when (*Message).end() is called. // Batch mode functions include (the type name is plural): -// (*Message).StringsKey(string, []string) -// (*Message).IntsKey(string, []int) -// (*Message).FloatsKey(string, []float32) +// +// (*Message).StringsKey(string, []string) +// (*Message).IntsKey(string, []int) +// (*Message).FloatsKey(string, []float32) +// // There is no strict struct for request payload since some of the keys of the request are dynamically generated based on the model inputs. // The resulting JSON will have property keys that are set based on the model, and two optional keys, "batch_size" and "cache_key". // Depending on if single or batch mode, the property values will be scalars or arrays. // See service.Request for server-side perspective. // TODO separate out single and batch sized request to their respective calls endpoints; the abstracted polymorphism currently is more // painful than convenient. +// Implements shared/client.Cachable type ( Message struct { mux sync.RWMutex // locks pool diff --git a/shared/common/type.go b/shared/common/type.go index 3e8d34b..f0cf627 100644 --- a/shared/common/type.go +++ b/shared/common/type.go @@ -14,7 +14,7 @@ func DataType(dataType string) (reflect.Type, error) { return reflect.TypeOf(""), nil case "float64": return reflect.TypeOf(float64(0)), nil - case "float32": + case "float32", "float": return reflect.TypeOf(float32(0)), nil case "int": return reflect.TypeOf(int(0)), nil From e0f36329e05c7b19a120bb478ab64640d02831a0 Mon Sep 17 00:00:00 2001 From: David Choi Date: Fri, 14 Nov 2025 13:43:04 -0800 Subject: [PATCH 10/38] Fix bug with model output name, add unit tests. --- service/platform/router/router.go | 5 +- service/platform/router/router_test.go | 195 +++++++++++++++++++++++++ 2 files changed, 198 insertions(+), 2 deletions(-) diff --git a/service/platform/router/router.go b/service/platform/router/router.go index 66ac115..7aa5ac1 100644 --- a/service/platform/router/router.go +++ b/service/platform/router/router.go @@ -188,7 +188,7 @@ func (t *Router) handleIO(cfg *config.Model) error { t.fixedEvaluator = fixedEvaluator } - var modelOutputInOutputs bool + var modelOutputInOutputs bool = !hasModelOutputName if hasModelOutputName { _, modelOutputInOutputs = outputByName[modelOutputName] } @@ -197,6 +197,7 @@ func (t *Router) handleIO(cfg *config.Model) error { outputs = append(outputs, domain.Output{ Name: modelOutputName, DataType: "string", + Index: len(outputs), }) } @@ -303,7 +304,7 @@ func (r *Router) Predict(ctx context.Context, params []interface{}) ([]interface if r.modelOutputName != "" { // TODO ensure ordering - results = append(results, []interface{}{[][]string{{routingValueString}}}) + results = append(results, [][]string{{routingValueString}}) } // TODO dynamic output batch shape detection diff --git a/service/platform/router/router_test.go b/service/platform/router/router_test.go index 281bcf8..b58e1fa 100644 --- a/service/platform/router/router_test.go +++ b/service/platform/router/router_test.go @@ -1,10 +1,205 @@ package router import ( + "context" "reflect" "testing" + + "github.com/viant/mly/service/config" + "github.com/viant/mly/service/domain" + "github.com/viant/mly/service/platform" + tricli "github.com/viant/mly/service/triton" + "github.com/viant/mly/shared" + "github.com/viant/mly/shared/common" ) +// --- Router Predict scaffolds --- + +type mockPredictOnly struct{} + +func (m *mockPredictOnly) Predict(ctx context.Context, params []interface{}) ([]interface{}, error) { + // params is expected to have a single non-router input in this test: [][]string with shape [1][1] + var v string + switch typed := params[0].(type) { + case [][]string: + v = typed[0][0] + default: + tval := reflect.TypeOf(params[0]) + panic("unexpected input type in mockPredictOnly: " + tval.String()) + } + // simple function: length of string as float32 + out := [][]float32{{float32(len(v))}} + return []interface{}{out}, nil +} + +func (m *mockPredictOnly) Signature() *domain.Signature { return nil } +func (m *mockPredictOnly) Dictionary() *common.Dictionary { return nil } +func (m *mockPredictOnly) Inputs() map[string]*domain.Input { return nil } +func (m *mockPredictOnly) Stats(map[string]interface{}) {} +func (m *mockPredictOnly) Close() error { return nil } +func (m *mockPredictOnly) ReloadIfNeeded(ctx context.Context) error { + return nil +} + +type mockTritonClient struct{} + +func (m *mockTritonClient) ServerReady(ctx context.Context) error { return nil } +func (m *mockTritonClient) ModelInfer(ctx context.Context, modelName string, inputs []interface{}, indexToName map[int]string) ([]interface{}, error) { + return nil, nil +} +func (m *mockTritonClient) ModelReady(ctx context.Context, modelName string) (bool, error) { + return true, nil +} +func (m *mockTritonClient) ModelLoad(ctx context.Context, modelName string) error { return nil } +func (m *mockTritonClient) ModelUnload(ctx context.Context, modelName string) error { return nil } +func (m *mockTritonClient) Close() error { return nil } + +func TestRouter_Predict_RoutesAndConcats(t *testing.T) { + ctx := context.Background() + + tests := []struct { + name string + routerConfig *config.RouterConfig + verifier func(t *testing.T, results []interface{}) + }{ + { + name: "with global model", + routerConfig: &config.RouterConfig{ + ConfigURL: "memory://router-config", + InputName: "router_id", + Global: config.GlobalModelConfig{ + Exists: true, // avoid fixed replacements path + }, + }, + verifier: func(t *testing.T, results []interface{}) { + if len(results) != 1 { + t.Fatalf("expected 1 output, got %d", len(results)) + } + out, ok := results[0].([][]float32) + if !ok { + t.Fatalf("expected [][]float32, got %T", results[0]) + } + want := [][]float32{{1}, {4}} + if !reflect.DeepEqual(out, want) { + t.Errorf("output mismatch: got %#v, want %#v", out, want) + } + }, + }, + { + name: "without global model", + routerConfig: &config.RouterConfig{ + ConfigURL: "memory://router-config", + InputName: "router_id", + Global: config.GlobalModelConfig{ + PredictionReplacements: []config.PredictionReplacement{ + { + Name: "score", + Type: "float32", + Value: 1.0, + }, + }, + }, + }, + verifier: func(t *testing.T, results []interface{}) { + if len(results) != 1 { + t.Fatalf("expected 1 output, got %d", len(results)) + } + out, ok := results[0].([][]float32) + if !ok { + t.Fatalf("expected [][]float32, got %T", results[0]) + } + want := [][]float32{{1}, {4}} + if !reflect.DeepEqual(out, want) { + t.Errorf("output mismatch: got %#v, want %#v", out, want) + } + }, + }, + { + name: "with model output name", + routerConfig: &config.RouterConfig{ + ConfigURL: "memory://router-config", + InputName: "router_id", + Global: config.GlobalModelConfig{ + Exists: true, // avoid fixed replacements path + }, + Output: config.OutputConfig{ + FieldName: "model_output", + }, + }, + verifier: func(t *testing.T, results []interface{}) { + if len(results) != 2 { + t.Fatalf("expected 1 output, got %d", len(results)) + } + out, ok := results[0].([][]float32) + if !ok { + t.Fatalf("expected [][]float32, got %T", results[0]) + } + want := [][]float32{{1}, {4}} + if !reflect.DeepEqual(out, want) { + t.Errorf("output mismatch: got %#v, want %#v", out, want) + } + }, + }, + } + + for _, test := range tests { + + t.Run(test.name, func(t *testing.T) { + cfg := &config.Model{ + ID: "router_test", + Mode: "router", + Platform: "triton", + MetaInput: shared.MetaInput{ + Inputs: []*shared.Field{ + // router input first (default offset 0) + {Name: "router_id", Index: 0, DataType: "int64"}, + // single backend input + {Name: "text", Index: 1, DataType: "string"}, + }, + Outputs: []*shared.Field{ + {Name: "score", Index: 0, DataType: "float32"}, + }, + }, + Router: test.routerConfig, + Triton: &config.TritonConfig{ + ServerID: "test_server", + }, + } + + router, err := NewRouter(cfg, nil, map[string]tricli.TritonClient{ + "test_server": &mockTritonClient{}, + }) + + if err != nil { + t.Fatalf("NewRouter error: %v", err) + } + + router.routingMap = map[int]string{ + 1: "model1", + 2: "model2", + } + mockEval := &mockPredictOnly{} + router.routingTable = map[string]platform.PlatformEvaluator{ + "model1": mockEval, + "model2": mockEval, + } + + // batch of 2 + params := []interface{}{ + [][]int64{{1}, {2}}, // router id + [][]string{{"a"}, {"abcd"}}, // backend input + } + + results, err := router.Predict(ctx, params) + if err != nil { + t.Fatalf("Predict error: %v", err) + } + + test.verifier(t, results) + }) + } +} + func TestConcatAxis0_Int32(t *testing.T) { x := []interface{}{ [][]int32{{1}, {2}}, From 0072317e9234b2647dce38098e433eb273cf8db4 Mon Sep 17 00:00:00 2001 From: David Choi Date: Fri, 14 Nov 2025 14:01:36 -0800 Subject: [PATCH 11/38] Move Feeds related type matchers to service/request/shape --- service/platform/router/router.go | 99 ++------------------- service/platform/router/router_test.go | 114 +++++-------------------- service/request/shape/batch.go | 90 +++++++++++++++++++ service/request/shape/batch_test.go | 90 +++++++++++++++++++ 4 files changed, 207 insertions(+), 186 deletions(-) create mode 100644 service/request/shape/batch_test.go diff --git a/service/platform/router/router.go b/service/platform/router/router.go index 7aa5ac1..b10d875 100644 --- a/service/platform/router/router.go +++ b/service/platform/router/router.go @@ -128,7 +128,7 @@ func (t *Router) handleIO(cfg *config.Model) error { inputType = reflect.TypeOf(int32(0)) case "int64": inputType = reflect.TypeOf(int64(0)) - case "float32": + case "float32", "float": inputType = reflect.TypeOf(float32(0)) case "float64": inputType = reflect.TypeOf(float64(0)) @@ -242,7 +242,7 @@ func (r *Router) Predict(ctx context.Context, params []interface{}) ([]interface var routingValueBatched interface{} for inputOffset := range numInputs { - debatched, err := debatch(params[inputOffset], batchOffset) + debatched, err := shape.Debatch(params[inputOffset], batchOffset) if err != nil { return nil, fmt.Errorf("failed to debatch for row %d and input %d: %w", batchOffset, inputOffset, err) } @@ -256,7 +256,7 @@ func (r *Router) Predict(ctx context.Context, params []interface{}) ([]interface } } - routingValue, err := squeezeBatch(routingValueBatched) + routingValue, err := shape.SqueezeBatch(routingValueBatched) if err != nil { return nil, fmt.Errorf("failed to extract from batch for row %d: %w", batchOffset, err) } @@ -296,6 +296,7 @@ func (r *Router) Predict(ctx context.Context, params []interface{}) ([]interface } } + results, err := evaluator.Predict(ctx, request) if err != nil { return nil, fmt.Errorf("failed to predict for row %d: %w", batchOffset, err) @@ -308,7 +309,7 @@ func (r *Router) Predict(ctx context.Context, params []interface{}) ([]interface } // TODO dynamic output batch shape detection - allResults, err = concatAxis0(allResults, results) + allResults, err = shape.ConcatAxis0(allResults, results) if err != nil { return nil, fmt.Errorf("failed to concatenate results for row %d: %w", batchOffset, err) } @@ -317,96 +318,6 @@ func (r *Router) Predict(ctx context.Context, params []interface{}) ([]interface return allResults, nil } -// concatAxis0 concatenates two tensors along axis 0 (batch dimension). -func concatAxis0(x []interface{}, y []interface{}) ([]interface{}, error) { - if len(x) != len(y) { - return nil, fmt.Errorf("x and y must have the same length: %d vs %d", len(x), len(y)) - } - - result := make([]interface{}, len(x)) - for i := range x { - xt := x[i] - yt := y[i] - - if xt == nil { - result[i] = yt - continue - } - - switch xv := xt.(type) { - case [][]int32: - yv, ok := yt.([][]int32) - if !ok { - return nil, fmt.Errorf("type mismatch at index %d: %T vs %T", i, xt, yt) - } - - result[i] = append(xv, yv...) - case [][]int64: - yv, ok := yt.([][]int64) - if !ok { - return nil, fmt.Errorf("type mismatch at index %d: %T vs %T", i, xt, yt) - } - result[i] = append(xv, yv...) - case [][]float32: - yv, ok := yt.([][]float32) - if !ok { - return nil, fmt.Errorf("type mismatch at index %d: %T vs %T", i, xt, yt) - } - result[i] = append(xv, yv...) - case [][]float64: - yv, ok := yt.([][]float64) - if !ok { - return nil, fmt.Errorf("type mismatch at index %d: %T vs %T", i, xt, yt) - } - result[i] = append(xv, yv...) - case [][]string: - yv, ok := yt.([][]string) - if !ok { - return nil, fmt.Errorf("type mismatch at index %d: %T vs %T", i, xt, yt) - } - result[i] = append(xv, yv...) - default: - return nil, fmt.Errorf("unexpected output tensor type at index %d: %T", i, xt) - } - } - - return result, nil -} - -func squeezeBatch(untypedBatch interface{}) (interface{}, error) { - switch typedBatch := untypedBatch.(type) { - case [][]int32: - return typedBatch[0][0], nil - case [][]int64: - return typedBatch[0][0], nil - case [][]float32: - return typedBatch[0][0], nil - case [][]float64: - return typedBatch[0][0], nil - case [][]string: - return typedBatch[0][0], nil - } - - return nil, fmt.Errorf("unexpected batch type: %T", untypedBatch) -} - -func debatch(untypedBatch interface{}, i int) (interface{}, error) { - switch typedBatch := untypedBatch.(type) { - case [][]int32: - return [][]int32{{typedBatch[i][0]}}, nil - case [][]int64: - return [][]int64{{typedBatch[i][0]}}, nil - case [][]float32: - return [][]float32{{typedBatch[i][0]}}, nil - case [][]float64: - return [][]float64{{typedBatch[i][0]}}, nil - case [][]string: - return [][]string{{typedBatch[i][0]}}, nil - } - - return nil, fmt.Errorf("unexpected batch type: %T", untypedBatch) -} - func (r *Router) Signature() *domain.Signature { return r.signature } diff --git a/service/platform/router/router_test.go b/service/platform/router/router_test.go index b58e1fa..c9b9618 100644 --- a/service/platform/router/router_test.go +++ b/service/platform/router/router_test.go @@ -130,14 +130,28 @@ func TestRouter_Predict_RoutesAndConcats(t *testing.T) { if len(results) != 2 { t.Fatalf("expected 1 output, got %d", len(results)) } - out, ok := results[0].([][]float32) - if !ok { - t.Fatalf("expected [][]float32, got %T", results[0]) - } - want := [][]float32{{1}, {4}} - if !reflect.DeepEqual(out, want) { - t.Errorf("output mismatch: got %#v, want %#v", out, want) - } + + func() { + out, ok := results[0].([][]float32) + if !ok { + t.Fatalf("expected [][]float32, got %T", results[0]) + } + want := [][]float32{{1}, {4}} + if !reflect.DeepEqual(out, want) { + t.Errorf("output mismatch: got %#v, want %#v", out, want) + } + }() + + func() { + out, ok := results[1].([][]string) + if !ok { + t.Fatalf("expected [][]string, got %T", results[1]) + } + want := [][]string{{"model1"}, {"model2"}} + if !reflect.DeepEqual(out, want) { + t.Errorf("output mismatch: got %#v, want %#v", out, want) + } + }() }, }, } @@ -199,87 +213,3 @@ func TestRouter_Predict_RoutesAndConcats(t *testing.T) { }) } } - -func TestConcatAxis0_Int32(t *testing.T) { - x := []interface{}{ - [][]int32{{1}, {2}}, - } - y := []interface{}{ - [][]int32{{3}}, - } - - got, err := concatAxis0(x, y) - if err != nil { - t.Fatalf("concatAxis0 returned error: %v", err) - } - - want := []interface{}{ - [][]int32{{1}, {2}, {3}}, - } - - if !reflect.DeepEqual(got, want) { - t.Errorf("concatAxis0() mismatch:\n got: %#v\nwant: %#v", got, want) - } -} - -func TestConcatAxis0_String(t *testing.T) { - x := []interface{}{ - [][]string{{"a"}}, - } - y := []interface{}{ - [][]string{{"b"}, {"c"}}, - } - - got, err := concatAxis0(x, y) - if err != nil { - t.Fatalf("concatAxis0 returned error: %v", err) - } - - want := []interface{}{ - [][]string{{"a"}, {"b"}, {"c"}}, - } - - if !reflect.DeepEqual(got, want) { - t.Errorf("concatAxis0() mismatch:\n got: %#v\nwant: %#v", got, want) - } -} - -func TestConcatAxis0_TypeMismatch(t *testing.T) { - x := []interface{}{ - [][]int64{{1}}, - } - y := []interface{}{ - [][]int32{{2}}, - } - - _, err := concatAxis0(x, y) - if err == nil { - t.Fatalf("expected type mismatch error, got nil") - } -} - -func TestDebatchAndSqueezeBatch_Int64(t *testing.T) { - // batch of 3, single-column - batch := [][]int64{{10}, {20}, {30}} - - // pick index 1 - debatched, err := debatch(batch, 1) - if err != nil { - t.Fatalf("debatch returned error: %v", err) - } - - wantDebatched := [][]int64{{20}} - if !reflect.DeepEqual(debatched, wantDebatched) { - t.Errorf("debatch() mismatch:\n got: %#v\nwant: %#v", debatched, wantDebatched) - } - - // squeeze should return the scalar 20 - scalar, err := squeezeBatch(debatched) - if err != nil { - t.Fatalf("squeezeBatch returned error: %v", err) - } - - if v, ok := scalar.(int64); !ok || v != 20 { - t.Errorf("squeezeBatch() got %v (%T), want 20 (int64)", scalar, scalar) - } -} diff --git a/service/request/shape/batch.go b/service/request/shape/batch.go index be34e8b..3f62604 100644 --- a/service/request/shape/batch.go +++ b/service/request/shape/batch.go @@ -31,3 +31,93 @@ func DetermineBatchSize(inputs []interface{}) (int, error) { return batchSize, err } + +func SqueezeBatch(untypedBatch interface{}) (interface{}, error) { + switch typedBatch := untypedBatch.(type) { + case [][]int32: + return typedBatch[0][0], nil + case [][]int64: + return typedBatch[0][0], nil + case [][]float32: + return typedBatch[0][0], nil + case [][]float64: + return typedBatch[0][0], nil + case [][]string: + return typedBatch[0][0], nil + } + + return nil, fmt.Errorf("unexpected batch type: %T", untypedBatch) +} + +func Debatch(untypedBatch interface{}, i int) (interface{}, error) { + switch typedBatch := untypedBatch.(type) { + case [][]int32: + return [][]int32{{typedBatch[i][0]}}, nil + case [][]int64: + return [][]int64{{typedBatch[i][0]}}, nil + case [][]float32: + return [][]float32{{typedBatch[i][0]}}, nil + case [][]float64: + return [][]float64{{typedBatch[i][0]}}, nil + case [][]string: + return [][]string{{typedBatch[i][0]}}, nil + } + + return nil, fmt.Errorf("unexpected batch type: %T", untypedBatch) +} + +// concatAxis0 concatenates two tensors along axis 0 (batch dimension). +func ConcatAxis0(x []interface{}, y []interface{}) ([]interface{}, error) { + if len(x) != len(y) { + return nil, fmt.Errorf("x and y must have the same length: %d vs %d", len(x), len(y)) + } + + result := make([]interface{}, len(x)) + for i := range x { + xt := x[i] + yt := y[i] + + if xt == nil { + result[i] = yt + continue + } + + switch xv := xt.(type) { + case [][]int32: + yv, ok := yt.([][]int32) + if !ok { + return nil, fmt.Errorf("type mismatch at index %d: %T vs %T", i, xt, yt) + } + + result[i] = append(xv, yv...) + case [][]int64: + yv, ok := yt.([][]int64) + if !ok { + return nil, fmt.Errorf("type mismatch at index %d: %T vs %T", i, xt, yt) + } + result[i] = append(xv, yv...) + case [][]float32: + yv, ok := yt.([][]float32) + if !ok { + return nil, fmt.Errorf("type mismatch at index %d: %T vs %T", i, xt, yt) + } + result[i] = append(xv, yv...) + case [][]float64: + yv, ok := yt.([][]float64) + if !ok { + return nil, fmt.Errorf("type mismatch at index %d: %T vs %T", i, xt, yt) + } + result[i] = append(xv, yv...) + case [][]string: + yv, ok := yt.([][]string) + if !ok { + return nil, fmt.Errorf("type mismatch at index %d: %T vs %T", i, xt, yt) + } + result[i] = append(xv, yv...) + default: + return nil, fmt.Errorf("unexpected output tensor type at index %d: %T", i, xt) + } + } + + return result, nil +} diff --git a/service/request/shape/batch_test.go b/service/request/shape/batch_test.go new file mode 100644 index 0000000..9b43628 --- /dev/null +++ b/service/request/shape/batch_test.go @@ -0,0 +1,90 @@ +package shape + +import ( + "reflect" + "testing" +) + +func TestConcatAxis0_Int32(t *testing.T) { + x := []interface{}{ + [][]int32{{1}, {2}}, + } + y := []interface{}{ + [][]int32{{3}}, + } + + got, err := ConcatAxis0(x, y) + if err != nil { + t.Fatalf("concatAxis0 returned error: %v", err) + } + + want := []interface{}{ + [][]int32{{1}, {2}, {3}}, + } + + if !reflect.DeepEqual(got, want) { + t.Errorf("concatAxis0() mismatch:\n got: %#v\nwant: %#v", got, want) + } +} + +func TestConcatAxis0_String(t *testing.T) { + x := []interface{}{ + [][]string{{"a"}}, + } + y := []interface{}{ + [][]string{{"b"}, {"c"}}, + } + + got, err := ConcatAxis0(x, y) + if err != nil { + t.Fatalf("concatAxis0 returned error: %v", err) + } + + want := []interface{}{ + [][]string{{"a"}, {"b"}, {"c"}}, + } + + if !reflect.DeepEqual(got, want) { + t.Errorf("concatAxis0() mismatch:\n got: %#v\nwant: %#v", got, want) + } +} + +func TestConcatAxis0_TypeMismatch(t *testing.T) { + x := []interface{}{ + [][]int64{{1}}, + } + y := []interface{}{ + [][]int32{{2}}, + } + + _, err := ConcatAxis0(x, y) + if err == nil { + t.Fatalf("expected type mismatch error, got nil") + } +} + +func TestDebatchAndSqueezeBatch_Int64(t *testing.T) { + // batch of 3, single-column + batch := [][]int64{{10}, {20}, {30}} + + // pick index 1 + debatched, err := Debatch(batch, 1) + if err != nil { + t.Fatalf("debatch returned error: %v", err) + } + + wantDebatched := [][]int64{{20}} + if !reflect.DeepEqual(debatched, wantDebatched) { + t.Errorf("debatch() mismatch:\n got: %#v\nwant: %#v", debatched, wantDebatched) + } + + // squeeze should return the scalar 20 + scalar, err := SqueezeBatch(debatched) + if err != nil { + t.Fatalf("squeezeBatch returned error: %v", err) + } + + if v, ok := scalar.(int64); !ok || v != 20 { + t.Errorf("squeezeBatch() got %v (%T), want 20 (int64)", scalar, scalar) + } +} From 5b1eef3ffe5c82e3c5e53c6c9d5652c67c89ea05 Mon Sep 17 00:00:00 2001 From: David Choi Date: Fri, 14 Nov 2025 15:06:02 -0800 Subject: [PATCH 12/38] Add caveat about Router.Output.FieldName. Breaking changes to API for self-test. --- service/config/router.go | 1 + service/endpoint/checker/self.go | 6 +++--- service/endpoint/service.go | 7 +++---- service/platform/router/router.go | 1 - 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/service/config/router.go b/service/config/router.go index db034cb..4366f52 100644 --- a/service/config/router.go +++ b/service/config/router.go @@ -39,6 +39,7 @@ type PredictionReplacement struct { type OutputConfig struct { // The name of the output field that contains the model ID. // If this is blank, then the model ID will not be part of the outputs. + // The Output must exist in Model.MetaInput.Outputs. FieldName string `json:",omitempty" yaml:",omitempty"` // If the global model is used, this will be used as the global model name diff --git a/service/endpoint/checker/self.go b/service/endpoint/checker/self.go index 8ec07cf..e48dbdc 100644 --- a/service/endpoint/checker/self.go +++ b/service/endpoint/checker/self.go @@ -9,12 +9,11 @@ import ( "time" "github.com/viant/mly/service/config" - "github.com/viant/mly/shared" "github.com/viant/mly/shared/client" "github.com/viant/toolbox" ) -func SelfTest(host []*client.Host, timeout time.Duration, modelID string, usesTransformer bool, inputs_ []*shared.Field, tp config.TestPayload, outputs []*shared.Field, debug bool) error { +func SelfTest(host []*client.Host, timeout time.Duration, modelID string, usesTransformer bool, tp config.TestPayload, debug bool) error { cli, err := client.New(modelID, host, client.WithDebug(true)) if err != nil { return fmt.Errorf("%s:%w", modelID, err) @@ -239,9 +238,10 @@ func SelfTest(host []*client.Host, timeout time.Duration, modelID string, usesTr } resp := new(client.Response) + // see if there is a transform // if there is, trigger the transform with mock data? - resp.Data = Generated(outputs, batchSize, usesTransformer)() + resp.Data = Generated(cli.Datastore.MetaInput.Outputs, batchSize, usesTransformer)() ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() diff --git a/service/endpoint/service.go b/service/endpoint/service.go index 34f17c2..78f1103 100644 --- a/service/endpoint/service.go +++ b/service/endpoint/service.go @@ -14,7 +14,6 @@ import ( "github.com/viant/mly/service/endpoint/health" promh "github.com/viant/mly/service/endpoint/prometheus" "github.com/viant/mly/service/triton" - "github.com/viant/mly/shared" "github.com/viant/mly/shared/client" "github.com/viant/mly/shared/common" "github.com/viant/mly/shared/datastore" @@ -112,7 +111,7 @@ func (s *Service) SelfTest() error { }() for _, m := range s.config.ModelList.Models { - go func(modelID string, transformer string, inputs []*shared.Field, tp srvConfig.TestPayload, outputs []*shared.Field, debug bool) { + go func(modelID string, transformer string, tp srvConfig.TestPayload, debug bool) { defer waitGroup.Done() // for backwards compatibility, skip tests if not specified if !tp.Test && !tp.SingleBatch && len(tp.Single) == 0 && len(tp.Batch) == 0 { @@ -121,14 +120,14 @@ func (s *Service) SelfTest() error { } start := time.Now() - err := checker.SelfTest(hosts, timeout, modelID, transformer != "", inputs, tp, outputs, debug) + err := checker.SelfTest(hosts, timeout, modelID, transformer != "", tp, debug) if err != nil { errHandler <- err return } log.Printf("tested %s %s", modelID, time.Now().Sub(start)) - }(m.ID, m.Transformer, m.Inputs, m.Test, m.Outputs, m.Debug) + }(m.ID, m.Transformer, m.Test, m.Debug) } waitGroup.Wait() diff --git a/service/platform/router/router.go b/service/platform/router/router.go index b10d875..3a5f6ee 100644 --- a/service/platform/router/router.go +++ b/service/platform/router/router.go @@ -296,7 +296,6 @@ func (r *Router) Predict(ctx context.Context, params []interface{}) ([]interface } } - results, err := evaluator.Predict(ctx, request) if err != nil { return nil, fmt.Errorf("failed to predict for row %d: %w", batchOffset, err) From cf86de44c58cf3b36ad78d07124c34e89aa2fd06 Mon Sep 17 00:00:00 2001 From: David Choi Date: Fri, 14 Nov 2025 16:20:14 -0800 Subject: [PATCH 13/38] Implement primitive concurrency for router --- service/platform/router/router.go | 70 ++++++++++++++++++++++++------- 1 file changed, 55 insertions(+), 15 deletions(-) diff --git a/service/platform/router/router.go b/service/platform/router/router.go index 3a5f6ee..71ca000 100644 --- a/service/platform/router/router.go +++ b/service/platform/router/router.go @@ -216,6 +216,11 @@ func (t *Router) handleIO(cfg *config.Model) error { return nil } +type offsetResults struct { + offset int + results []interface{} +} + // Predict performs model inference with the given parameters // params is expected to be [numInputs]([batchSize][1]T) (see service/request.Request.Feeds) func (r *Router) Predict(ctx context.Context, params []interface{}) ([]interface{}, error) { @@ -230,11 +235,19 @@ func (r *Router) Predict(ctx context.Context, params []interface{}) ([]interface numInputs := len(params) - allResults := make([]interface{}, len(r.signature.Outputs)) - r.routingTableLock.RLock() defer r.routingTableLock.RUnlock() + globalExists := r.modelConfig.Router.Global.Exists + reportedGlobalModelName := r.modelConfig.Router.Output.GlobalModelOverride + noModelName := r.modelConfig.Router.Output.NoModelID + + predictWaitGroup := sync.WaitGroup{} + predictWaitGroup.Add(expectedBatchSize) + + errCh := make(chan error, expectedBatchSize) + resultsCh := make(chan offsetResults, expectedBatchSize) + for batchOffset := range expectedBatchSize { // 1 input is reserved for the router input request := make([]interface{}, numInputs-1) @@ -282,10 +295,16 @@ func (r *Router) Predict(ctx context.Context, params []interface{}) ([]interface var evaluator platform.Predictor if !ok { - if r.modelConfig.Router.Global.Exists { + if globalExists { // fallback to global model evaluator = r.globalModel + + // override model name + if reportedGlobalModelName != "" { + routingValueString = reportedGlobalModelName + } } else { + routingValueString = noModelName evaluator = r.fixedEvaluator } } else { @@ -296,25 +315,46 @@ func (r *Router) Predict(ctx context.Context, params []interface{}) ([]interface } } - results, err := evaluator.Predict(ctx, request) - if err != nil { - return nil, fmt.Errorf("failed to predict for row %d: %w", batchOffset, err) - } + go func(batchOffset int, request []interface{}, routingValueString string, evaluator platform.Predictor) { + defer predictWaitGroup.Done() + + results, err := evaluator.Predict(ctx, request) + if err != nil { + errCh <- fmt.Errorf("failed to predict for row %d: %w", batchOffset, err) + } - if r.modelOutputName != "" { - // TODO ensure ordering + if r.modelOutputName != "" { + // TODO ensure ordering - results = append(results, [][]string{{routingValueString}}) - } + results = append(results, [][]string{{routingValueString}}) + } + + resultsCh <- offsetResults{offset: batchOffset, results: results} + }(batchOffset, request, routingValueString, evaluator) + } + + predictWaitGroup.Wait() + close(errCh) + close(resultsCh) + + for err := range errCh { + return nil, err + } + + allResults := make([][]interface{}, expectedBatchSize) + for results := range resultsCh { + allResults[results.offset] = results.results + } - // TODO dynamic output batch shape detection - allResults, err = shape.ConcatAxis0(allResults, results) + endResults := make([]interface{}, len(r.signature.Outputs)) + for i, results := range allResults { + endResults, err = shape.ConcatAxis0(endResults, results) if err != nil { - return nil, fmt.Errorf("failed to concatenate results for row %d: %w", batchOffset, err) + return nil, fmt.Errorf("failed to concatenate results for row %d: %w", i, err) } } - return allResults, nil + return endResults, nil } func (r *Router) Signature() *domain.Signature { From 6020c63e4c9e2a6d285467a5a3812b9ffffe0bed Mon Sep 17 00:00:00 2001 From: David Choi Date: Mon, 17 Nov 2025 12:24:02 -0800 Subject: [PATCH 14/38] Breaking - Use RunAppWithConfigError. --- example/server/app.go | 7 +++++-- example/server/mly/mly.go | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/example/server/app.go b/example/server/app.go index 6ca7460..52236da 100644 --- a/example/server/app.go +++ b/example/server/app.go @@ -11,7 +11,8 @@ import ( "github.com/viant/mly/shared/common/storable" ) -func RunApp(Version string, args []string) { +// RunApp shows an example of how to register a Transformer +func RunApp(Version string, args []string) error { ctx := context.Background() storableSrv := storable.Singleton() @@ -19,7 +20,7 @@ func RunApp(Version string, args []string) { return new(slfmodel.Segmented) }) - endpoint.RunAppWithConfig(Version, args, func(options *endpoint.Options) (*endpoint.Config, error) { + err := endpoint.RunAppWithConfigError(Version, args, func(options *endpoint.Options) (*endpoint.Config, error) { config, err := NewConfigFromURL(ctx, options.ConfigURL) if err != nil { return nil, err @@ -29,4 +30,6 @@ func RunApp(Version string, args []string) { return &config.Config, err }) + + return err } diff --git a/example/server/mly/mly.go b/example/server/mly/mly.go index 30fab51..e25cf08 100644 --- a/example/server/mly/mly.go +++ b/example/server/mly/mly.go @@ -11,5 +11,8 @@ var Version = "dev" func main() { log.SetFlags(log.LstdFlags | log.Lmicroseconds) - server.RunApp(Version, os.Args[1:]) + err := server.RunApp(Version, os.Args[1:]) + if err != nil { + log.Fatal(err) + } } From 09d51c2a4876275792ebbfe308ba30bf68b771ce Mon Sep 17 00:00:00 2001 From: David Choi Date: Mon, 17 Nov 2025 12:25:43 -0800 Subject: [PATCH 15/38] Add profiling support via ProfilerPort; deprecate EnableMemProf and EnableCPUProf --- service/endpoint/app.go | 8 ++++++++ service/endpoint/config.go | 5 +++++ service/endpoint/prof.go | 9 +++++++++ 3 files changed, 22 insertions(+) diff --git a/service/endpoint/app.go b/service/endpoint/app.go index c70eb05..f9a848c 100644 --- a/service/endpoint/app.go +++ b/service/endpoint/app.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "log" + "net/http" "sync" "time" @@ -69,6 +70,13 @@ func runApp(config *Config, wg *sync.WaitGroup) error { return err } + if config.ProfilerPort > 0 { + go func() { + log.Printf("!!! starting profile server on port %d !!!\n", config.ProfilerPort) + log.Println(http.ListenAndServe(fmt.Sprintf("localhost:%d", config.ProfilerPort), nil)) + }() + } + start := time.Now() srv, err := New(config) diff --git a/service/endpoint/config.go b/service/endpoint/config.go index fbbbc3d..d0dcb81 100644 --- a/service/endpoint/config.go +++ b/service/endpoint/config.go @@ -41,9 +41,14 @@ type Config struct { Endpoint econfig.Endpoint + // Deprecated, use ProfilerPort instead EnableMemProf bool + + // Deprecated, use ProfilerPort instead EnableCPUProf bool + ProfilerPort int + TLS *TLSConfig AllowedSubnet []string `json:",omitempty" yaml:",omitempty"` diff --git a/service/endpoint/prof.go b/service/endpoint/prof.go index b8b6f6b..cf271f2 100644 --- a/service/endpoint/prof.go +++ b/service/endpoint/prof.go @@ -6,13 +6,22 @@ import ( "sync" ) +// Deprecated - all profiling endpoints are on a separate port const memProfURI = "/v1/api/debug/memprof" +// Deprecated const cpuProfIndexURI = "/v1/api/debug/pprof/" +// Deprecated const cpuProfCmdlineURI = "/v1/api/debug/pprof/cmdline" + +// Deprecated const cpuProfProfileURI = "/v1/api/debug/pprof/profile" + +// Deprecated const cpuProfSymbolURI = "/v1/api/debug/pprof/symbol" + +// Deprecated const cpuProfTraceURI = "/v1/api/debug/pprof/trace" type memProfHandler struct { From 5852c9728c1d006a66481006e1884c263d1e07af Mon Sep 17 00:00:00 2001 From: David Choi Date: Mon, 17 Nov 2025 12:26:26 -0800 Subject: [PATCH 16/38] Fix bug on unload with WaitGroup --- service/platform/router/router.go | 1 + 1 file changed, 1 insertion(+) diff --git a/service/platform/router/router.go b/service/platform/router/router.go index 71ca000..691ac6e 100644 --- a/service/platform/router/router.go +++ b/service/platform/router/router.go @@ -583,6 +583,7 @@ func (r *Router) ReloadIfNeeded(ctx context.Context) error { // unload obsolete models, ignore errors... for model := range modelsToUnload { + wg.Add(1) go func(model string) { defer wg.Done() err := r.tritonClient.ModelUnload(ctx, model) From edf79cb5d09c2d8158493d449a79a8978bc004ef Mon Sep 17 00:00:00 2001 From: David Choi Date: Mon, 17 Nov 2025 12:26:52 -0800 Subject: [PATCH 17/38] Add Prometheus metrics support for Triton client - Introduced new metrics for monitoring Triton ModelInfer, ServerReady, ModelReady, ModelLoad, and ModelUnload RPCs. - Updated existing code to utilize Prometheus's DefaultRegisterer for metric registration. - Added helper functions for observing durations of RPC calls. - Created common bucket definitions for Prometheus metrics in a new package. - Refactored endpoint and service files to integrate Prometheus metrics registration and handling. --- service/endpoint/model.go | 4 +- service/endpoint/prom.go | 15 +++ service/endpoint/prometheus/handler.go | 10 +- service/endpoint/service.go | 7 +- service/prometheus.go | 1 + service/triton/client.go | 11 +- service/triton/grpc.go | 10 +- service/triton/metrics.go | 173 +++++++++++++++++++++++++ shared/stat/buckets/prometheus.go | 35 +++++ shared/stat/metric/metric.go | 1 + 10 files changed, 249 insertions(+), 18 deletions(-) create mode 100644 service/endpoint/prom.go create mode 100644 service/prometheus.go create mode 100644 service/triton/metrics.go create mode 100644 shared/stat/buckets/prometheus.go diff --git a/service/endpoint/model.go b/service/endpoint/model.go index d77957b..46f1812 100644 --- a/service/endpoint/model.go +++ b/service/endpoint/model.go @@ -55,7 +55,7 @@ func Build( tritonClients map[string]triton.TritonClient, hooks []Hook, metrics *gmetric.Service, - promReg *prometheus.Registry, + promReg prometheus.Registerer, ) error { cfge := config.Endpoint @@ -85,7 +85,7 @@ func Build( Subsystem: "model", Name: "idletime", - Help: "measured time between requests", + Help: "measured time between requests in nanoseconds", Buckets: buckets, }, []string{"model"}) diff --git a/service/endpoint/prom.go b/service/endpoint/prom.go new file mode 100644 index 0000000..47afb56 --- /dev/null +++ b/service/endpoint/prom.go @@ -0,0 +1,15 @@ +package endpoint + +import ( + "github.com/prometheus/client_golang/prometheus" +) + +func registerPrometheusMetrics(promReg prometheus.Registerer) { + // promReg.Register(prometheus.NewHistogram(prometheus.HistogramOpts{ + // Namespace: "mly", + // Subsystem: "endpoint", + // Name: "request_duration_seconds", + // Help: "Request duration", + // Buckets: []float64{0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10}, + // })) +} diff --git a/service/endpoint/prometheus/handler.go b/service/endpoint/prometheus/handler.go index 47f3b91..e06f347 100644 --- a/service/endpoint/prometheus/handler.go +++ b/service/endpoint/prometheus/handler.go @@ -2,18 +2,12 @@ package prometheus import ( "net/http" - "regexp" prom "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/client_golang/prometheus/collectors" "github.com/prometheus/client_golang/prometheus/promhttp" ) -func Handler(pr *prom.Registry) http.HandlerFunc { - r := regexp.MustCompile("\\/sched.*") - collOpts := collectors.WithGoCollectorRuntimeMetrics(collectors.GoRuntimeMetricsRule{r}) - pr.MustRegister(collectors.NewGoCollector(collOpts)) - - promHandler := promhttp.HandlerFor(pr, promhttp.HandlerOpts{}) +func Handler(gatherer prom.Gatherer) http.HandlerFunc { + promHandler := promhttp.HandlerFor(gatherer, promhttp.HandlerOpts{}) return promHandler.ServeHTTP } diff --git a/service/endpoint/service.go b/service/endpoint/service.go index 78f1103..f191c9e 100644 --- a/service/endpoint/service.go +++ b/service/endpoint/service.go @@ -196,8 +196,11 @@ func New(cfg *Config) (*Service, error) { metricHandler := gmetric.NewHandler(common.MetricURI, metrics) mux.Handle(common.MetricURI, metricHandler) - promReg := prometheus.NewRegistry() - mux.Handle("/v1/prometheus", promh.Handler(promReg)) + // We use the default Prometheus registry here because go-grpc-prometheus seems to force us to use it. + promReg := prometheus.DefaultRegisterer + + registerPrometheusMetrics(promReg) + mux.Handle("/v1/prometheus", promh.Handler(prometheus.DefaultGatherer)) datastores, err := datastore.NewStoresV2(&cfg.DatastoreList, metrics, true) if err != nil { diff --git a/service/prometheus.go b/service/prometheus.go new file mode 100644 index 0000000..6d43c33 --- /dev/null +++ b/service/prometheus.go @@ -0,0 +1 @@ +package service diff --git a/service/triton/client.go b/service/triton/client.go index a9f3c56..3d01add 100644 --- a/service/triton/client.go +++ b/service/triton/client.go @@ -5,6 +5,7 @@ import ( "net/http" "time" + grpcProm "github.com/grpc-ecosystem/go-grpc-prometheus" "github.com/viant/mly/service/config" "google.golang.org/grpc" "google.golang.org/grpc/backoff" @@ -26,6 +27,7 @@ type TritonClient interface { Close() error } +// NewClient creates either an HTTP or gRPC client. func NewClient(server config.TritonServer) (TritonClient, error) { if server.GRPCBaseURL != "" { grpcConn, err := grpc.NewClient(server.GRPCBaseURL, @@ -38,21 +40,24 @@ func NewClient(server config.TritonServer) (TritonClient, error) { }, }), grpc.WithTransportCredentials(insecure.NewCredentials()), + + grpc.WithUnaryInterceptor(grpcProm.UnaryClientInterceptor), + grpc.WithStreamInterceptor(grpcProm.StreamClientInterceptor), ) if err != nil { return nil, err } - return NewGRPCClient(grpcConn), nil + return NewMeteredTritonClient(NewGRPCClient(grpcConn)), nil } // HTTP options seem a bit bare // TODO see if DRY with - return &HTTPClient{ + return NewMeteredTritonClient(&HTTPClient{ httpClient: &http.Client{ Timeout: time.Duration(server.HTTPClientTimeoutMs) * time.Millisecond, }, serverURL: server.HTTPBaseURL, - }, nil + }), nil } diff --git a/service/triton/grpc.go b/service/triton/grpc.go index 4f209b6..820238b 100644 --- a/service/triton/grpc.go +++ b/service/triton/grpc.go @@ -13,8 +13,7 @@ import ( type GRPCClient struct { // Note that this is dangerous to Close if the connection is shared. // See how TritonEvaluator handles Close(). - grpcConn *grpc.ClientConn - + grpcConn *grpc.ClientConn grpcClient triton.GRPCInferenceServiceClient } @@ -54,7 +53,12 @@ func (c *GRPCClient) ModelInfer(ctx context.Context, modelName string, inputs [] return nil, err } - return convertGRPCResponse(grpcResponse) + result, err := convertGRPCResponse(grpcResponse) + if err != nil { + return nil, err + } + + return result, nil } func (c *GRPCClient) ModelReady(ctx context.Context, modelName string) (bool, error) { diff --git a/service/triton/metrics.go b/service/triton/metrics.go new file mode 100644 index 0000000..fc4bb85 --- /dev/null +++ b/service/triton/metrics.go @@ -0,0 +1,173 @@ +package triton + +import ( + "context" + "time" + + grpcProm "github.com/grpc-ecosystem/go-grpc-prometheus" + "github.com/prometheus/client_golang/prometheus" + "github.com/viant/mly/shared/stat/buckets" +) + +var ( + inferDurationMicrosHist = prometheus.NewHistogramVec( + prometheus.HistogramOpts{ + Namespace: "mly", + Subsystem: "triton", + Name: "infer_duration_histogram_us", + Help: "Duration of Triton ModelInfer RPCs, labeled by model name, successful only.", + Buckets: buckets.MicrosecondBuckets, + }, + []string{"model"}, + ) + + inferDurationMicrosSummary = prometheus.NewSummaryVec( + prometheus.SummaryOpts{ + Namespace: "mly", + Subsystem: "triton", + Name: "infer_duration_summary_us", + Help: "Duration of Triton ModelInfer RPCs, labeled by model name, successful only.", + Objectives: buckets.CommonSummaryObjectives, + }, + []string{"model"}, + ) + + serverReadyDurationMicrosSummary = prometheus.NewSummaryVec( + prometheus.SummaryOpts{ + Namespace: "mly", + Subsystem: "triton", + Name: "server_ready_duration_summary_us", + Help: "Duration of Triton ServerReady RPCs, labeled by model name, successful only.", + Objectives: buckets.CommonSummaryObjectives, + }, + []string{}, + ) + + modelReadyDurationMicrosSummary = prometheus.NewSummaryVec( + prometheus.SummaryOpts{ + Namespace: "mly", + Subsystem: "triton", + Name: "model_ready_duration_summary_us", + Help: "Duration of Triton ModelReady RPCs, labeled by model name, successful only.", + Objectives: buckets.CommonSummaryObjectives, + }, + []string{"model"}, + ) + + modelLoadDurationMicrosSummary = prometheus.NewSummaryVec( + prometheus.SummaryOpts{ + Namespace: "mly", + Subsystem: "triton", + Name: "model_load_duration_summary_us", + Help: "Duration of Triton ModelLoad RPCs, labeled by model name, successful only.", + Objectives: buckets.CommonSummaryObjectives, + }, + []string{"model"}, + ) + + modelUnloadDurationMicrosSummary = prometheus.NewSummaryVec( + prometheus.SummaryOpts{ + Namespace: "mly", + Subsystem: "triton", + Name: "model_unload_duration_summary_us", + Help: "Duration of Triton ModelUnload RPCs, labeled by model name, successful only.", + Objectives: buckets.CommonSummaryObjectives, + }, + []string{"model"}, + ) +) + +func init() { + // go-grpc-prometheus seems to force us to use Prometheus's DefaultRegisterer. + grpcProm.EnableClientHandlingTimeHistogram(grpcProm.WithHistogramBuckets(buckets.SecondBuckets)) + + prometheus.MustRegister(inferDurationMicrosHist) + prometheus.MustRegister(inferDurationMicrosSummary) + prometheus.MustRegister(serverReadyDurationMicrosSummary) + prometheus.MustRegister(modelReadyDurationMicrosSummary) + prometheus.MustRegister(modelLoadDurationMicrosSummary) + prometheus.MustRegister(modelUnloadDurationMicrosSummary) +} + +type MeteredTritonClient struct { + client TritonClient +} + +func NewMeteredTritonClient(client TritonClient) *MeteredTritonClient { + return &MeteredTritonClient{ + client: client, + } +} + +func withGatherers(fn func() error, fnObserve func(float64)) error { + startTime := time.Now() + + err := fn() + if err != nil { + return err + } + + duration := float64(time.Since(startTime).Microseconds()) + fnObserve(duration) + return nil +} + +func (c *MeteredTritonClient) ModelInfer(ctx context.Context, modelName string, inputs []interface{}, indexToName map[int]string) ([]interface{}, error) { + var result []interface{} + var err error + + err = withGatherers(func() error { + result, err = c.client.ModelInfer(ctx, modelName, inputs, indexToName) + return err + }, func(duration float64) { + inferDurationMicrosHist.WithLabelValues(modelName).Observe(duration) + inferDurationMicrosSummary.WithLabelValues(modelName).Observe(duration) + }) + + return result, err +} + +func (c *MeteredTritonClient) ServerReady(ctx context.Context) error { + err := withGatherers(func() error { + return c.client.ServerReady(ctx) + }, func(duration float64) { + serverReadyDurationMicrosSummary.WithLabelValues().Observe(duration) + }) + + return err +} + +func (c *MeteredTritonClient) ModelReady(ctx context.Context, modelName string) (bool, error) { + var ready bool + var err error + err = withGatherers(func() error { + ready, err = c.client.ModelReady(ctx, modelName) + return err + }, func(duration float64) { + modelReadyDurationMicrosSummary.WithLabelValues(modelName).Observe(duration) + }) + + return ready, err +} + +func (c *MeteredTritonClient) ModelLoad(ctx context.Context, modelName string) error { + err := withGatherers(func() error { + return c.client.ModelLoad(ctx, modelName) + }, func(duration float64) { + modelLoadDurationMicrosSummary.WithLabelValues(modelName).Observe(duration) + }) + return err +} + +func (c *MeteredTritonClient) ModelUnload(ctx context.Context, modelName string) error { + err := withGatherers(func() error { + return c.client.ModelUnload(ctx, modelName) + }, func(duration float64) { + modelUnloadDurationMicrosSummary.WithLabelValues(modelName).Observe(duration) + }) + return err +} + +func (c *MeteredTritonClient) Close() error { + return c.client.Close() +} diff --git a/shared/stat/buckets/prometheus.go b/shared/stat/buckets/prometheus.go new file mode 100644 index 0000000..24f2b64 --- /dev/null +++ b/shared/stat/buckets/prometheus.go @@ -0,0 +1,35 @@ +package buckets + +// This contains common buckets for Prometheus metrics. +// We generally observe smaller models in 300 microsecond ranges, with most common occurring between 500 and 1000 microseconds. +// For inference, we usually do not care about inferences that take longer than 1 second, as we operate in RTB and the maximum acceptable latency is around 120 milliseconds. + +var MicrosecondBuckets []float64 = []float64{ + 100, 500, + 1000, 2000, 3000, 5000, 7500, + 10000, 20000, 30000, 50000, 75000, + 100000, 200000, 400000, 800000, + 1000000, +} + +var MillisecondBuckets []float64 = []float64{ + 1, 2, 3, 5, 8, + 10, 20, 40, 80, + 100, 200, 400, 800, + 1000, 2000, 4000, 8000, +} + +var SecondBuckets []float64 = []float64{ + 1e-4, 5e-4, + 1e-3, 2e-3, 3e-3, 5e-3, 7.5e-3, + 1e-2, 2e-2, 4e-2, 8e-2, + 1e-1, 2e-1, 4e-1, 8e-1, + 1, +} + +var CommonSummaryObjectives = map[float64]float64{ + 0.5: 0.05, + 0.9: 0.01, + 0.95: 0.005, + 0.99: 0.001, +} diff --git a/shared/stat/metric/metric.go b/shared/stat/metric/metric.go index 989617d..73de2ab 100644 --- a/shared/stat/metric/metric.go +++ b/shared/stat/metric/metric.go @@ -6,6 +6,7 @@ import ( "github.com/viant/gmetric" ) +// EnterThenExit is a helper function to increment the metric on enter and decrement on exit. func EnterThenExit(metric *gmetric.Operation, start time.Time, enterValue interface{}, exitValue interface{}) func() { metric.IncrementValue(enterValue) From f9dcdd175fd0961f9ae38ef772954874e54598ee Mon Sep 17 00:00:00 2001 From: David Choi Date: Mon, 17 Nov 2025 12:41:50 -0800 Subject: [PATCH 18/38] Refactor router configuration handling in ReloadIfNeeded. --- service/platform/router/router.go | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/service/platform/router/router.go b/service/platform/router/router.go index 691ac6e..c559f9a 100644 --- a/service/platform/router/router.go +++ b/service/platform/router/router.go @@ -470,14 +470,14 @@ func (r *Router) ReloadIfNeeded(ctx context.Context) error { } } - var newConfig router.RouterConfig + newConfig := new(router.RouterConfig) // TODO move this check earlier if strings.Contains(r.configURL, ".yaml") { decoder := yaml.NewDecoder(reader) - err = decoder.Decode(&newConfig) + err = decoder.Decode(newConfig) } else if strings.Contains(r.configURL, ".json") { - err = json.NewDecoder(reader).Decode(&newConfig) + err = json.NewDecoder(reader).Decode(newConfig) } else { return fmt.Errorf("unsupported router configuration file type: %s", r.configURL) } @@ -486,6 +486,14 @@ func (r *Router) ReloadIfNeeded(ctx context.Context) error { return fmt.Errorf("failed to decode router configuration file: %w", err) } + if err := r.applyRouterConfig(ctx, newConfig); err != nil { + return err + } + + return nil +} + +func (r *Router) applyRouterConfig(ctx context.Context, newConfig *router.RouterConfig) error { modelsToLoad := make(map[string]struct{}) modelsToUnload := make(map[string]struct{}) @@ -509,14 +517,12 @@ func (r *Router) ReloadIfNeeded(ctx context.Context) error { if newConfig.GlobalModelName != "" { if _, ok := modelsToUnload[newConfig.GlobalModelName]; ok { - // don't unload delete(modelsToUnload, newConfig.GlobalModelName) } else { modelsToLoad[newConfig.GlobalModelName] = struct{}{} } } - // Launch goroutines to load models concurrently, collecting errors. errCh := make(chan error, len(modelsToLoad)) var wg sync.WaitGroup @@ -524,8 +530,7 @@ func (r *Router) ReloadIfNeeded(ctx context.Context) error { wg.Add(1) go func(model string) { defer wg.Done() - err := r.tritonClient.ModelLoad(ctx, model) - if err != nil { + if err := r.tritonClient.ModelLoad(ctx, model); err != nil { errCh <- fmt.Errorf("failed to load model %s: %w", model, err) } }(model) @@ -559,13 +564,13 @@ func (r *Router) ReloadIfNeeded(ctx context.Context) error { var globalEvaluator platform.PlatformEvaluator if newConfig.GlobalModelName != "" { + var err error globalEvaluator, err = tricli.NewRoutedTritonEvaluator( newConfig.GlobalModelName, r.tritonClient, r.modelConfig.Triton.Timeout, r.indexToName, ) - if err != nil { return fmt.Errorf("failed to create Triton evaluator for global model %s: %w", newConfig.GlobalModelName, err) } @@ -577,17 +582,15 @@ func (r *Router) ReloadIfNeeded(ctx context.Context) error { defer r.routingTableLock.Unlock() r.globalModel = globalEvaluator r.routingMap = newModelMapping - r.routerConfig = &newConfig + r.routerConfig = newConfig r.routingTable = newRoutingTable }() - // unload obsolete models, ignore errors... for model := range modelsToUnload { wg.Add(1) go func(model string) { defer wg.Done() - err := r.tritonClient.ModelUnload(ctx, model) - if err != nil { + if err := r.tritonClient.ModelUnload(ctx, model); err != nil { log.Printf("failed to unload model %s: %v\n", model, err) } }(model) From ecd03139985d78d67cc67337930710e1f195a0e4 Mon Sep 17 00:00:00 2001 From: David Choi Date: Mon, 17 Nov 2025 12:47:03 -0800 Subject: [PATCH 19/38] Add read lock when reloading individual models. Add unit tests for router reload. --- service/platform/router/router.go | 2 + service/platform/router/router_test.go | 236 ++++++++++++++++++++++++- 2 files changed, 234 insertions(+), 4 deletions(-) diff --git a/service/platform/router/router.go b/service/platform/router/router.go index c559f9a..07e8999 100644 --- a/service/platform/router/router.go +++ b/service/platform/router/router.go @@ -405,6 +405,7 @@ func (r *Router) ReloadIfNeeded(ctx context.Context) error { // check health of all underlying models var wg sync.WaitGroup + r.configLock.RLock() errChannels := len(r.routingTable) if r.globalModel != nil { errChannels++ @@ -446,6 +447,7 @@ func (r *Router) ReloadIfNeeded(ctx context.Context) error { err = fmt.Errorf("one or more model reloading errors: %s", strings.Join(errStrings, "; ")) } + r.configLock.RUnlock() return err } diff --git a/service/platform/router/router_test.go b/service/platform/router/router_test.go index c9b9618..16efbb8 100644 --- a/service/platform/router/router_test.go +++ b/service/platform/router/router_test.go @@ -2,8 +2,12 @@ package router import ( "context" + "errors" "reflect" + "strings" + "sync" "testing" + "time" "github.com/viant/mly/service/config" "github.com/viant/mly/service/domain" @@ -11,6 +15,7 @@ import ( tricli "github.com/viant/mly/service/triton" "github.com/viant/mly/shared" "github.com/viant/mly/shared/common" + sharedrouter "github.com/viant/mly/shared/config/router" ) // --- Router Predict scaffolds --- @@ -41,7 +46,13 @@ func (m *mockPredictOnly) ReloadIfNeeded(ctx context.Context) error { return nil } -type mockTritonClient struct{} +type mockTritonClient struct { + mu sync.Mutex + loadCalls []string + unloadCalls []string + unloadCh chan string + modelLoadErr map[string]error +} func (m *mockTritonClient) ServerReady(ctx context.Context) error { return nil } func (m *mockTritonClient) ModelInfer(ctx context.Context, modelName string, inputs []interface{}, indexToName map[int]string) ([]interface{}, error) { @@ -50,9 +61,52 @@ func (m *mockTritonClient) ModelInfer(ctx context.Context, modelName string, inp func (m *mockTritonClient) ModelReady(ctx context.Context, modelName string) (bool, error) { return true, nil } -func (m *mockTritonClient) ModelLoad(ctx context.Context, modelName string) error { return nil } -func (m *mockTritonClient) ModelUnload(ctx context.Context, modelName string) error { return nil } -func (m *mockTritonClient) Close() error { return nil } +func (m *mockTritonClient) ModelLoad(ctx context.Context, modelName string) error { + m.mu.Lock() + defer m.mu.Unlock() + m.loadCalls = append(m.loadCalls, modelName) + if err := m.modelLoadErr[modelName]; err != nil { + return err + } + return nil +} +func (m *mockTritonClient) ModelUnload(ctx context.Context, modelName string) error { + m.mu.Lock() + m.unloadCalls = append(m.unloadCalls, modelName) + ch := m.unloadCh + m.mu.Unlock() + if ch != nil { + ch <- modelName + } + return nil +} +func (m *mockTritonClient) Close() error { return nil } + +func (m *mockTritonClient) snapshotLoadCalls() []string { + m.mu.Lock() + defer m.mu.Unlock() + return append([]string(nil), m.loadCalls...) +} + +func (m *mockTritonClient) snapshotUnloadCalls() []string { + m.mu.Lock() + defer m.mu.Unlock() + return append([]string(nil), m.unloadCalls...) +} + +func waitForCalls(t *testing.T, ch <-chan string, count int) []string { + t.Helper() + var out []string + for i := 0; i < count; i++ { + select { + case v := <-ch: + out = append(out, v) + case <-time.After(time.Second): + t.Fatalf("timeout waiting for call %d/%d", i+1, count) + } + } + return out +} func TestRouter_Predict_RoutesAndConcats(t *testing.T) { ctx := context.Background() @@ -213,3 +267,177 @@ func TestRouter_Predict_RoutesAndConcats(t *testing.T) { }) } } + +func TestRouter_applyRouterConfig_LoadsAndSwaps(t *testing.T) { + ctx := context.Background() + mockClient := &mockTritonClient{ + unloadCh: make(chan string, 2), + } + + oldConfig := &sharedrouter.RouterConfig{ + EntityMapping: []sharedrouter.EntityKV{ + {EntityID: 1, ModelName: "modelA"}, + {EntityID: 2, ModelName: "modelB"}, + }, + GlobalModelName: "global-old", + } + + router := &Router{ + tritonClient: mockClient, + modelConfig: &config.Model{ + Triton: &config.TritonConfig{ + Timeout: 100, + }, + }, + indexToName: map[int]string{ + 0: "text", + }, + routerConfig: oldConfig, + routingMap: map[int]string{ + 1: "modelA", + 2: "modelB", + }, + routingTable: map[string]platform.PlatformEvaluator{ + "modelA": &mockPredictOnly{}, + "modelB": &mockPredictOnly{}, + }, + globalModel: &mockPredictOnly{}, + } + + newConfig := &sharedrouter.RouterConfig{ + EntityMapping: []sharedrouter.EntityKV{ + {EntityID: 1, ModelName: "modelB"}, + {EntityID: 3, ModelName: "modelC"}, + }, + GlobalModelName: "global-new", + } + + if err := router.applyRouterConfig(ctx, newConfig); err != nil { + t.Fatalf("applyRouterConfig returned error: %v", err) + } + + loadCalls := router.tritonClient.(*mockTritonClient).snapshotLoadCalls() + if len(loadCalls) != 3 { + t.Fatalf("expected 3 model loads, got %d (%v)", len(loadCalls), loadCalls) + } + + expectedLoads := map[string]bool{ + "modelB": false, + "modelC": false, + "global-new": false, + } + for _, call := range loadCalls { + if _, ok := expectedLoads[call]; ok { + expectedLoads[call] = true + } + } + for model, seen := range expectedLoads { + if !seen { + t.Fatalf("expected load for %s was not observed; calls=%v", model, loadCalls) + } + } + + waitForCalls(t, mockClient.unloadCh, 2) + unloadCalls := mockClient.snapshotUnloadCalls() + expectedUnloads := map[string]bool{ + "modelA": false, + "global-old": false, + } + for _, call := range unloadCalls { + if _, ok := expectedUnloads[call]; ok { + expectedUnloads[call] = true + } + } + for model, seen := range expectedUnloads { + if !seen { + t.Fatalf("expected unload for %s was not observed; calls=%v", model, unloadCalls) + } + } + + if router.routerConfig != newConfig { + t.Fatalf("routerConfig pointer not updated") + } + + expectedRouting := map[int]string{ + 1: "modelB", + 3: "modelC", + } + if !reflect.DeepEqual(router.routingMap, expectedRouting) { + t.Fatalf("routingMap mismatch, got %#v", router.routingMap) + } + + if router.globalModel == nil { + t.Fatalf("globalModel was not set") + } + + if _, ok := router.routingTable["modelB"]; !ok { + t.Fatalf("routingTable missing modelB") + } + if _, ok := router.routingTable["modelC"]; !ok { + t.Fatalf("routingTable missing modelC") + } + if _, ok := router.routingTable["modelA"]; ok { + t.Fatalf("routingTable still contains modelA") + } +} + +func TestRouter_applyRouterConfig_LoadError(t *testing.T) { + ctx := context.Background() + loadErr := errors.New("load failure") + mockClient := &mockTritonClient{ + modelLoadErr: map[string]error{ + "modelX": loadErr, + }, + } + + oldConfig := &sharedrouter.RouterConfig{ + EntityMapping: []sharedrouter.EntityKV{ + {EntityID: 1, ModelName: "modelA"}, + }, + } + + router := &Router{ + tritonClient: mockClient, + modelConfig: &config.Model{ + Triton: &config.TritonConfig{ + Timeout: 50, + }, + }, + indexToName: map[int]string{}, + routerConfig: oldConfig, + routingMap: map[int]string{ + 1: "modelA", + }, + } + + newConfig := &sharedrouter.RouterConfig{ + EntityMapping: []sharedrouter.EntityKV{ + {EntityID: 2, ModelName: "modelX"}, + }, + } + + err := router.applyRouterConfig(ctx, newConfig) + if err == nil { + t.Fatalf("expected error but got nil") + } + if !strings.Contains(err.Error(), "modelX") { + t.Fatalf("expected error mentioning modelX, got %v", err) + } + + if router.routerConfig != oldConfig { + t.Fatalf("routerConfig should remain unchanged on error") + } + + if !reflect.DeepEqual(router.routingMap, map[int]string{1: "modelA"}) { + t.Fatalf("routingMap should remain unchanged on error") + } + + if router.routingTable != nil { + t.Fatalf("routingTable should not be replaced on error") + } + + loadCalls := mockClient.snapshotLoadCalls() + if len(loadCalls) != 1 || loadCalls[0] != "modelX" { + t.Fatalf("expected single load attempt for modelX, got %v", loadCalls) + } +} From cb29be07f3305a8e477c618fb8dd6c10e9a6e155 Mon Sep 17 00:00:00 2001 From: David Choi Date: Mon, 17 Nov 2025 14:16:26 -0800 Subject: [PATCH 20/38] Add Prometheus metrics for router performance and model management - Introduced new Prometheus metrics to track router reload durations and model prediction durations. - Added a counter for the number of routed models and a gauge for currently unloading models. - Enhanced the router's model unloading mechanism with a dedicated goroutine for asynchronous unloading. - Updated unit tests to verify the new metrics and model readiness checks. --- service/platform/router/prometheus.go | 56 +++++++ service/platform/router/router.go | 208 ++++++++++++++++++------- service/platform/router/router_test.go | 112 ++++++++++++- service/triton/metrics.go | 3 +- 4 files changed, 322 insertions(+), 57 deletions(-) create mode 100644 service/platform/router/prometheus.go diff --git a/service/platform/router/prometheus.go b/service/platform/router/prometheus.go new file mode 100644 index 0000000..dc12b97 --- /dev/null +++ b/service/platform/router/prometheus.go @@ -0,0 +1,56 @@ +package router + +import ( + "github.com/prometheus/client_golang/prometheus" + "github.com/viant/mly/shared/stat/buckets" +) + +var ( + routerReloadDurationMicrosSummary = prometheus.NewSummaryVec( + prometheus.SummaryOpts{ + Namespace: "mly", + Subsystem: "router", + Name: "reload_duration_summary_us", + Help: "Duration of router reloads.", + Objectives: buckets.CommonSummaryObjectives, + }, + []string{"router", "mode"}, + ) + + routerPredictDurationMicrosSummary = prometheus.NewSummaryVec( + prometheus.SummaryOpts{ + Namespace: "mly", + Subsystem: "router", + Name: "predict_duration_summary_us", + Help: "Duration of router predictions.", + Objectives: buckets.CommonSummaryObjectives, + }, + []string{"router", "fixed_only"}, + ) + + routerRoutedModelsCounter = prometheus.NewCounterVec( + prometheus.CounterOpts{ + Namespace: "mly", + Subsystem: "router", + Name: "routed_models_counter", + Help: "Number of models routed, labeled by model name.", + }, + []string{"model", "router"}, + ) + + routerModelUnloadGauge = prometheus.NewGauge( + prometheus.GaugeOpts{ + Namespace: "mly", + Subsystem: "router", + Name: "model_unloading", + Help: "Number of models currently being unloaded.", + }, + ) +) + +func init() { + prometheus.MustRegister(routerPredictDurationMicrosSummary) + prometheus.MustRegister(routerRoutedModelsCounter) + prometheus.MustRegister(routerReloadDurationMicrosSummary) + prometheus.MustRegister(routerModelUnloadGauge) +} diff --git a/service/platform/router/router.go b/service/platform/router/router.go index 07e8999..1f16c7d 100644 --- a/service/platform/router/router.go +++ b/service/platform/router/router.go @@ -10,6 +10,7 @@ import ( "reflect" "strings" "sync" + "time" "github.com/viant/afs" "github.com/viant/mly/service/config" @@ -31,6 +32,9 @@ type Router struct { configModified *config.Modified routerConfig *router.RouterConfig + modelUnloadCh chan string + modelUnloadStopCh chan struct{} + routingTableLock sync.RWMutex routingMap map[int]string routingTable map[string]platform.PlatformEvaluator @@ -42,6 +46,7 @@ type Router struct { modelOutputName string modelConfig *config.Model + routerName string tritonClient tricli.TritonClient signature *domain.Signature @@ -63,9 +68,9 @@ func NewRouter(cfg *config.Model, fs afs.Service, tritonClients map[string]tricl } r := &Router{ - configURL: cfg.Router.ConfigURL, - fs: fs, - + configURL: cfg.Router.ConfigURL, + fs: fs, + routerName: cfg.ID, modelConfig: cfg, tritonClient: tritonClient, } @@ -78,6 +83,29 @@ func NewRouter(cfg *config.Model, fs afs.Service, tritonClients map[string]tricl r.maxConcurrency = cfg.Router.MaxConcurrency } + stopUnload := make(chan struct{}) + modelUnloadCh := make(chan string) + + r.modelUnloadCh = modelUnloadCh + r.modelUnloadStopCh = stopUnload + + go func() { + for { + select { + case modelName := <-modelUnloadCh: + unloadCtx, unloadCtxCancel := context.WithTimeout(context.Background(), 10*time.Second) + + if err := r.unloadModel(unloadCtx, modelName); err != nil { + log.Printf("failed to unload model %s: %v\n", modelName, err) + } + + unloadCtxCancel() + case <-stopUnload: + return + } + } + }() + return r, nil } @@ -228,6 +256,19 @@ func (r *Router) Predict(ctx context.Context, params []interface{}) ([]interface return nil, fmt.Errorf("no input parameters provided") } + metricFixedOnly := true + start := time.Now() + defer func() { + var fos string + if metricFixedOnly { + fos = "true" + } else { + fos = "false" + } + + routerPredictDurationMicrosSummary.WithLabelValues(r.routerName, fos).Observe(float64(time.Since(start).Microseconds())) + }() + expectedBatchSize, err := shape.DetermineBatchSize(params) if err != nil { return nil, err @@ -293,9 +334,13 @@ func (r *Router) Predict(ctx context.Context, params []interface{}) ([]interface routingValueString, ok := r.routingMap[routingValueInt] + var metricModelName string var evaluator platform.Predictor if !ok { + + metricModelName = "global" if globalExists { + metricFixedOnly = false // fallback to global model evaluator = r.globalModel @@ -308,6 +353,10 @@ func (r *Router) Predict(ctx context.Context, params []interface{}) ([]interface evaluator = r.fixedEvaluator } } else { + metricFixedOnly = false + + metricModelName = routingValueString + var ok bool evaluator, ok = r.routingTable[routingValueString] if !ok { @@ -315,6 +364,8 @@ func (r *Router) Predict(ctx context.Context, params []interface{}) ([]interface } } + routerRoutedModelsCounter.WithLabelValues(metricModelName, r.routerName).Inc() + go func(batchOffset int, request []interface{}, routingValueString string, evaluator platform.Predictor) { defer predictWaitGroup.Done() @@ -374,6 +425,9 @@ func (r *Router) Stats(stats map[string]interface{}) { } func (r *Router) Close() error { + r.modelUnloadStopCh <- struct{}{} + close(r.modelUnloadStopCh) + close(r.modelUnloadCh) return nil } @@ -395,6 +449,18 @@ func (r *Router) isModified(snapshot *config.Modified) bool { } func (r *Router) ReloadIfNeeded(ctx context.Context) error { + start := time.Now() + isFullReload := false + defer func() { + var mode string + if isFullReload { + mode = "full" + } else { + mode = "checks" + } + routerReloadDurationMicrosSummary.WithLabelValues(r.routerName, mode).Observe(float64(time.Since(start).Microseconds())) + }() + // fetch and check router configuration file snapshot, err := files.ModifiedSnapshot(ctx, r.fs, r.configURL, nil) if err != nil { @@ -451,6 +517,8 @@ func (r *Router) ReloadIfNeeded(ctx context.Context) error { return err } + isFullReload = true + // otherwise just abandon the routing table status checks r.configLock.Lock() @@ -496,17 +564,22 @@ func (r *Router) ReloadIfNeeded(ctx context.Context) error { } func (r *Router) applyRouterConfig(ctx context.Context, newConfig *router.RouterConfig) error { - modelsToLoad := make(map[string]struct{}) modelsToUnload := make(map[string]struct{}) + reuseEvaluators := make(map[string]platform.PlatformEvaluator) + var reuseGlobal platform.PlatformEvaluator oldConfig := r.routerConfig if oldConfig != nil { for _, entity := range oldConfig.EntityMapping { modelsToUnload[entity.ModelName] = struct{}{} + if evaluator, ok := r.routingTable[entity.ModelName]; ok { + reuseEvaluators[entity.ModelName] = evaluator + } } if oldConfig.GlobalModelName != "" { modelsToUnload[oldConfig.GlobalModelName] = struct{}{} + reuseGlobal = r.globalModel } } @@ -514,49 +587,32 @@ func (r *Router) applyRouterConfig(ctx context.Context, newConfig *router.Router for _, entity := range newConfig.EntityMapping { newModelMapping[entity.EntityID] = entity.ModelName delete(modelsToUnload, entity.ModelName) - modelsToLoad[entity.ModelName] = struct{}{} } - if newConfig.GlobalModelName != "" { - if _, ok := modelsToUnload[newConfig.GlobalModelName]; ok { - delete(modelsToUnload, newConfig.GlobalModelName) - } else { - modelsToLoad[newConfig.GlobalModelName] = struct{}{} - } - } - - errCh := make(chan error, len(modelsToLoad)) - var wg sync.WaitGroup - - for model := range modelsToLoad { - wg.Add(1) - go func(model string) { - defer wg.Done() - if err := r.tritonClient.ModelLoad(ctx, model); err != nil { - errCh <- fmt.Errorf("failed to load model %s: %w", model, err) - } - }(model) + globalModelName := newConfig.GlobalModelName + if globalModelName != "" { + delete(modelsToUnload, globalModelName) } - wg.Wait() - close(errCh) + newRoutingTable := make(map[string]platform.PlatformEvaluator) + for _, entity := range newConfig.EntityMapping { + model := entity.ModelName + if _, ok := newRoutingTable[model]; ok { + continue + } - if len(errCh) > 0 { - var errStrings []string - for err := range errCh { - errStrings = append(errStrings, err.Error()) + if evaluator, ok := reuseEvaluators[model]; ok { + newRoutingTable[model] = evaluator + continue } - return fmt.Errorf("one or more model loading errors: %s", strings.Join(errStrings, "; ")) - } - newRoutingTable := make(map[string]platform.PlatformEvaluator) - for model := range modelsToLoad { evaluator, err := tricli.NewRoutedTritonEvaluator( model, r.tritonClient, r.modelConfig.Triton.Timeout, r.indexToName, ) + if err != nil { return fmt.Errorf("failed to create Triton evaluator for model %s: %w", model, err) } @@ -565,23 +621,68 @@ func (r *Router) applyRouterConfig(ctx context.Context, newConfig *router.Router } var globalEvaluator platform.PlatformEvaluator - if newConfig.GlobalModelName != "" { - var err error - globalEvaluator, err = tricli.NewRoutedTritonEvaluator( - newConfig.GlobalModelName, - r.tritonClient, - r.modelConfig.Triton.Timeout, - r.indexToName, - ) - if err != nil { - return fmt.Errorf("failed to create Triton evaluator for global model %s: %w", newConfig.GlobalModelName, err) + if globalModelName != "" { + if oldConfig != nil && globalModelName == oldConfig.GlobalModelName && reuseGlobal != nil { + globalEvaluator = reuseGlobal + } else if evaluator, ok := newRoutingTable[globalModelName]; ok { + globalEvaluator = evaluator + } else if evaluator, ok := reuseEvaluators[globalModelName]; ok { + globalEvaluator = evaluator + } else { + var err error + globalEvaluator, err = tricli.NewRoutedTritonEvaluator( + globalModelName, + r.tritonClient, + r.modelConfig.Triton.Timeout, + r.indexToName, + ) + + if err != nil { + return fmt.Errorf("failed to create Triton evaluator for global model %s: %w", globalModelName, err) + } + } + } + + wg := sync.WaitGroup{} + errCh := make(chan error, 1) + if globalEvaluator != nil { + wg.Add(1) + go func() { + defer wg.Done() + if err := globalEvaluator.ReloadIfNeeded(ctx); err != nil { + errCh <- fmt.Errorf("failed to reload global model %s: %w", globalModelName, err) + } + }() + } + + for model := range newRoutingTable { + wg.Add(1) + go func(model string) { + defer wg.Done() + if err := newRoutingTable[model].ReloadIfNeeded(ctx); err != nil { + errCh <- fmt.Errorf("failed to reload model %s: %w", model, err) + } + }(model) + } + wg.Wait() + close(errCh) + + if len(errCh) > 0 { + var errStrings []string + for err := range errCh { + errStrings = append(errStrings, err.Error()) } + return fmt.Errorf("one or more model reloading errors: %s", strings.Join(errStrings, "; ")) } - // swap table func() { r.routingTableLock.Lock() defer r.routingTableLock.Unlock() + if globalEvaluator != nil { + if _, exists := newRoutingTable[globalModelName]; !exists { + newRoutingTable[globalModelName] = globalEvaluator + } + } r.globalModel = globalEvaluator r.routingMap = newModelMapping r.routerConfig = newConfig @@ -589,14 +690,17 @@ func (r *Router) applyRouterConfig(ctx context.Context, newConfig *router.Router }() for model := range modelsToUnload { - wg.Add(1) - go func(model string) { - defer wg.Done() - if err := r.tritonClient.ModelUnload(ctx, model); err != nil { - log.Printf("failed to unload model %s: %v\n", model, err) - } - }(model) + routerModelUnloadGauge.Inc() + r.modelUnloadCh <- model } return nil } + +func (r *Router) unloadModel(ctx context.Context, modelName string) error { + defer routerModelUnloadGauge.Dec() + if err := r.tritonClient.ModelUnload(ctx, modelName); err != nil { + return fmt.Errorf("failed to unload model %s: %w", modelName, err) + } + return nil +} diff --git a/service/platform/router/router_test.go b/service/platform/router/router_test.go index 16efbb8..40fff5f 100644 --- a/service/platform/router/router_test.go +++ b/service/platform/router/router_test.go @@ -50,6 +50,8 @@ type mockTritonClient struct { mu sync.Mutex loadCalls []string unloadCalls []string + readyCalls []string + readyState map[string]bool unloadCh chan string modelLoadErr map[string]error } @@ -59,6 +61,12 @@ func (m *mockTritonClient) ModelInfer(ctx context.Context, modelName string, inp return nil, nil } func (m *mockTritonClient) ModelReady(ctx context.Context, modelName string) (bool, error) { + m.mu.Lock() + defer m.mu.Unlock() + m.readyCalls = append(m.readyCalls, modelName) + if ready, ok := m.readyState[modelName]; ok { + return ready, nil + } return true, nil } func (m *mockTritonClient) ModelLoad(ctx context.Context, modelName string) error { @@ -68,6 +76,10 @@ func (m *mockTritonClient) ModelLoad(ctx context.Context, modelName string) erro if err := m.modelLoadErr[modelName]; err != nil { return err } + if m.readyState == nil { + m.readyState = make(map[string]bool) + } + m.readyState[modelName] = true return nil } func (m *mockTritonClient) ModelUnload(ctx context.Context, modelName string) error { @@ -94,6 +106,12 @@ func (m *mockTritonClient) snapshotUnloadCalls() []string { return append([]string(nil), m.unloadCalls...) } +func (m *mockTritonClient) snapshotReadyCalls() []string { + m.mu.Lock() + defer m.mu.Unlock() + return append([]string(nil), m.readyCalls...) +} + func waitForCalls(t *testing.T, ch <-chan string, count int) []string { t.Helper() var out []string @@ -272,6 +290,10 @@ func TestRouter_applyRouterConfig_LoadsAndSwaps(t *testing.T) { ctx := context.Background() mockClient := &mockTritonClient{ unloadCh: make(chan string, 2), + readyState: map[string]bool{ + "modelC": false, + "global-new": false, + }, } oldConfig := &sharedrouter.RouterConfig{ @@ -304,6 +326,8 @@ func TestRouter_applyRouterConfig_LoadsAndSwaps(t *testing.T) { globalModel: &mockPredictOnly{}, } + reusedModelB := router.routingTable["modelB"] + newConfig := &sharedrouter.RouterConfig{ EntityMapping: []sharedrouter.EntityKV{ {EntityID: 1, ModelName: "modelB"}, @@ -316,13 +340,13 @@ func TestRouter_applyRouterConfig_LoadsAndSwaps(t *testing.T) { t.Fatalf("applyRouterConfig returned error: %v", err) } - loadCalls := router.tritonClient.(*mockTritonClient).snapshotLoadCalls() - if len(loadCalls) != 3 { - t.Fatalf("expected 3 model loads, got %d (%v)", len(loadCalls), loadCalls) + loadCalls := mockClient.snapshotLoadCalls() + if len(loadCalls) != 2 { + // global-new and modelC + t.Fatalf("expected 2 model loads, got %d (%v), ready=%v", len(loadCalls), loadCalls, mockClient.snapshotReadyCalls()) } expectedLoads := map[string]bool{ - "modelB": false, "modelC": false, "global-new": false, } @@ -337,6 +361,22 @@ func TestRouter_applyRouterConfig_LoadsAndSwaps(t *testing.T) { } } + readyCalls := mockClient.snapshotReadyCalls() + expectedReady := map[string]bool{ + "modelC": false, + "global-new": false, + } + for _, call := range readyCalls { + if _, ok := expectedReady[call]; ok { + expectedReady[call] = true + } + } + for model, seen := range expectedReady { + if !seen { + t.Fatalf("expected readiness check for %s was not observed; calls=%v", model, readyCalls) + } + } + waitForCalls(t, mockClient.unloadCh, 2) unloadCalls := mockClient.snapshotUnloadCalls() expectedUnloads := map[string]bool{ @@ -373,6 +413,9 @@ func TestRouter_applyRouterConfig_LoadsAndSwaps(t *testing.T) { if _, ok := router.routingTable["modelB"]; !ok { t.Fatalf("routingTable missing modelB") } + if router.routingTable["modelB"] != reusedModelB { + t.Fatalf("modelB evaluator was not reused") + } if _, ok := router.routingTable["modelC"]; !ok { t.Fatalf("routingTable missing modelC") } @@ -385,6 +428,9 @@ func TestRouter_applyRouterConfig_LoadError(t *testing.T) { ctx := context.Background() loadErr := errors.New("load failure") mockClient := &mockTritonClient{ + readyState: map[string]bool{ + "modelX": false, + }, modelLoadErr: map[string]error{ "modelX": loadErr, }, @@ -441,3 +487,61 @@ func TestRouter_applyRouterConfig_LoadError(t *testing.T) { t.Fatalf("expected single load attempt for modelX, got %v", loadCalls) } } + +func TestRouter_applyRouterConfig_SkipsLoadWhenReady(t *testing.T) { + ctx := context.Background() + mockClient := &mockTritonClient{ + readyState: map[string]bool{ + "modelC": true, + }, + } + + oldConfig := &sharedrouter.RouterConfig{ + EntityMapping: []sharedrouter.EntityKV{ + {EntityID: 1, ModelName: "modelA"}, + }, + } + + router := &Router{ + tritonClient: mockClient, + modelConfig: &config.Model{ + Triton: &config.TritonConfig{ + Timeout: 10, + }, + }, + indexToName: map[int]string{ + 0: "text", + }, + routerConfig: oldConfig, + routingMap: map[int]string{ + 1: "modelA", + }, + routingTable: map[string]platform.PlatformEvaluator{ + "modelA": &mockPredictOnly{}, + }, + } + + newConfig := &sharedrouter.RouterConfig{ + EntityMapping: []sharedrouter.EntityKV{ + {EntityID: 1, ModelName: "modelA"}, + {EntityID: 2, ModelName: "modelC"}, + }, + } + + if err := router.applyRouterConfig(ctx, newConfig); err != nil { + t.Fatalf("applyRouterConfig returned error: %v", err) + } + + if loads := mockClient.snapshotLoadCalls(); len(loads) != 0 { + t.Fatalf("expected no loads when model is ready, got %v", loads) + } + + readyCalls := mockClient.snapshotReadyCalls() + if len(readyCalls) != 1 || readyCalls[0] != "modelC" { + t.Fatalf("expected readiness check for modelC, got %v", readyCalls) + } + + if _, ok := router.routingTable["modelC"]; !ok { + t.Fatalf("routingTable missing modelC after reload") + } +} diff --git a/service/triton/metrics.go b/service/triton/metrics.go index fc4bb85..73cfe49 100644 --- a/service/triton/metrics.go +++ b/service/triton/metrics.go @@ -16,7 +16,7 @@ var ( Subsystem: "triton", Name: "infer_duration_histogram_us", Help: "Duration of Triton ModelInfer RPCs, labeled by model name, successful only.", - Buckets: buckets.MicrosecondBuckets, + Buckets: []float64{100, 1000, 10000}, }, []string{"model"}, ) @@ -75,6 +75,7 @@ var ( }, []string{"model"}, ) + ) func init() { From 9251eace296fb29081c1c3d119e4305207e1a281 Mon Sep 17 00:00:00 2001 From: David Choi Date: Mon, 17 Nov 2025 15:39:45 -0800 Subject: [PATCH 21/38] Add reload configuration parameters to Service and Model - Introduced ReloadPollIntervalSeconds and ReloadTimeoutSeconds to the Model struct for configurable reload behavior. - Updated the Service struct to utilize these new parameters for polling and timeout settings. --- service/config/model.go | 24 ++++++++++++++++++++++++ service/service.go | 17 +++++++++++------ 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/service/config/model.go b/service/config/model.go index 4b6efe6..7bfa297 100644 --- a/service/config/model.go +++ b/service/config/model.go @@ -79,6 +79,14 @@ type Model struct { // Modified shows the state of the model files. Modified *Modified `json:",omitempty" yaml:",omitempty"` + // ReloadPollIntervalSeconds is the interval at which the model will be polled for reloads. + // Defaults to 60 seconds. + ReloadPollIntervalSeconds int `json:",omitempty" yaml:",omitempty"` + + // ReloadTimeoutSeconds is the timeout for reloads. + // Defaults to 300 seconds. + ReloadTimeoutSeconds int `json:",omitempty" yaml:",omitempty"` + DictMeta DictionaryMeta // Test is used to test the model on startup. @@ -114,6 +122,14 @@ func (m *Model) Init(globalBatchConfig *batchconfig.BatcherConfig) { m.Location = path.Join(os.TempDir(), m.ID+m.Dir) } + if m.ReloadPollIntervalSeconds == 0 { + m.ReloadPollIntervalSeconds = 60 + } + + if m.ReloadTimeoutSeconds == 0 { + m.ReloadTimeoutSeconds = 300 + } + _ = os.MkdirAll(m.Location, file.DefaultDirOsMode) m.Modified = &Modified{} @@ -150,6 +166,14 @@ func (m *Model) Validate() error { return fmt.Errorf("model.ID was empty") } + if m.ReloadPollIntervalSeconds <= 0 { + return fmt.Errorf("model.ReloadPollIntervalSeconds must be greater than 0") + } + + if m.ReloadTimeoutSeconds <= 0 { + return fmt.Errorf("model.ReloadTimeoutSeconds must be greater than 0") + } + // Platform-specific validation platform := m.GetPlatform() switch platform { diff --git a/service/service.go b/service/service.go index 086b7e8..7564d20 100644 --- a/service/service.go +++ b/service/service.go @@ -52,6 +52,9 @@ type Service struct { // Deprecated: use GetHealth() instead ReloadOK int32 + reloadPollTicker *time.Ticker + reloadTimeout time.Duration + // Platform evaluator context for multi-platform support evaluator platform.PlatformEvaluator @@ -359,10 +362,12 @@ func New( } srv := &Service{ - config: cfg, - evaluator: evaluatorContext, - useDatastore: cfg.UseDictionary() && cfg.DataStore != "", - serviceMetric: metrics.MultiOperationCounter(location, cfg.ID+"Perf", cfg.ID+" service performance", time.Microsecond, time.Minute, 2, stat.NewProvider()), + config: cfg, + evaluator: evaluatorContext, + useDatastore: cfg.UseDictionary() && cfg.DataStore != "", + serviceMetric: metrics.MultiOperationCounter(location, cfg.ID+"Perf", cfg.ID+" service performance", time.Microsecond, time.Minute, 2, stat.NewProvider()), + reloadPollTicker: time.NewTicker(time.Duration(cfg.ReloadPollIntervalSeconds) * time.Second), + reloadTimeout: time.Duration(cfg.ReloadTimeoutSeconds) * time.Second, } // Set up reload metrics for platforms that support reloading @@ -440,8 +445,8 @@ func (s *Service) GetHealth() int32 { } func (s *Service) pollModelReload() { - for range time.Tick(time.Minute) { - ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) + for range s.reloadPollTicker.C { + ctx, cancel := context.WithTimeout(context.Background(), s.reloadTimeout) defer cancel() stats := sstat.NewValues() From b8fde243eb73dd96cc2bd1cfe85f035377f36305 Mon Sep 17 00:00:00 2001 From: David Choi Date: Mon, 17 Nov 2025 15:56:58 -0800 Subject: [PATCH 22/38] Add grpc-prometheus dependency --- go.mod | 1 + go.sum | 2 ++ 2 files changed, 3 insertions(+) diff --git a/go.mod b/go.mod index 4e93f28..fc48d53 100644 --- a/go.mod +++ b/go.mod @@ -31,6 +31,7 @@ require ( require ( github.com/cyningsun/heavy-hitters v0.0.0-20230601160639-238b21a6ddce + github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 github.com/migotom/heavykeeper v0.0.0-20230118182531-d6958b4bb326 github.com/prometheus/client_golang v1.16.0 golang.org/x/sync v0.8.0 diff --git a/go.sum b/go.sum index 7393ab7..38a98c1 100644 --- a/go.sum +++ b/go.sum @@ -111,6 +111,8 @@ github.com/googleapis/gax-go/v2 v2.7.0 h1:IcsPKeInNvYi7eqSaDjiZqDDKu5rsmunY0Y1Yu github.com/googleapis/gax-go/v2 v2.7.0/go.mod h1:TEop28CZZQ2y+c0VxMUmu1lV+fQx57QpBWsYpwqHJx8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= From a9d5fb5392b32fe73f895a9ec59bf9f60d195ae0 Mon Sep 17 00:00:00 2001 From: David Choi Date: Mon, 17 Nov 2025 15:57:14 -0800 Subject: [PATCH 23/38] Add notes and update documentation. --- .gitignore | 5 ++ BREAKING_CHANGES.md | 7 +++ CONFIG.md | 138 ++++++++++++++++++++++++++++---------------- DEVTODO.md | 25 ++++++++ 4 files changed, 126 insertions(+), 49 deletions(-) create mode 100644 BREAKING_CHANGES.md create mode 100644 DEVTODO.md diff --git a/.gitignore b/.gitignore index d3d7624..9eea4ed 100644 --- a/.gitignore +++ b/.gitignore @@ -2,11 +2,16 @@ *.swp .DS_Cache .DS_Store + +/devdata /vendor + /example/e2e/logs + # binaries /example/client/mlyc/mlyc /example/server/mly/mly + /toolsv2/aerospike/aerospike /toolsv2/smasher/cmd/cmd /toolsv2/toolsv2 \ No newline at end of file diff --git a/BREAKING_CHANGES.md b/BREAKING_CHANGES.md new file mode 100644 index 0000000..53eea84 --- /dev/null +++ b/BREAKING_CHANGES.md @@ -0,0 +1,7 @@ +# Breaking Changes + +See [wiki](https://github.com/viant/mly/wiki) for older entries and non-breaking changes. + +## `v0.19.x` to `v0.20.x` + +`example/server.RunApp` return changes from none to `error`. diff --git a/CONFIG.md b/CONFIG.md index e15b172..e157e98 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -2,62 +2,102 @@ ## Server -See [`service/endpoint/config.go`](service/endpoint/config.go). -The server accepts configuration with the following options: - -* `Models` : list of models - see [`service/config/model.go`](service/config/model.go) for all options. - - `ID`: `string` - required - model ID, used to generate the URLs. - - `Debug`: `bool` - optional - enables further output and debugging. - - `URL`: `string` - required - model location source. - * to use S3, set environment variable `AWS_SDK_LOAD_CONFIG=true` - * to use GCS, set environment variable `GOOGLE_APPLICATION_CREDENTIALS=true` - - `DataStore`: `string` - optional - name of Datastore to cache, should match `Datastores[].ID`. - - `Transformer`: `string` - optional - name of model output transformer. See [#Transformer](#Transformer). - - `Batch`: optional - enables or overrides server-side batching configuration. See [`service/tfmodel/batcher/config/config.go`](service/tfmodel/batcher/config/config.go). - - `Test`: optional - enables a client request to send to self on start up. +See [`service/endpoint/config.go`](service/endpoint/config.go) for a more thorough description. + +## Root Property `Models` + +This contains a list of models (i.e. TensorFlow SavedModel package, Triton Model, or Router) that mly will set up endpoints for. + +See [`service/config/model.go`](service/config/model.go) for all options. + +Properties: + +- `ID`: `string` - required - model ID, used to generate the URLs. +- `Debug`: `bool` - optional - enables further output and debugging. +- `URL`: `string` - required - model location source. + * to use S3, set environment variable `AWS_SDK_LOAD_CONFIG=true` + * to use GCS, set environment variable `GOOGLE_APPLICATION_CREDENTIALS=true` +- `DataStore`: `string` - optional - name of Datastore to cache, should match `Datastores[].ID`. +- `Transformer`: `string` - optional - name of model output transformer. See [#Transformer](#Transformer). +- `Batch`: optional - enables or overrides server-side batching configuration. See [`service/tfmodel/batcher/config/config.go`](service/tfmodel/batcher/config/config.go). +- `UseDict`: `bool` - optional - if true, enables capabilities designed to shrink the cache key space by replacing out-of-vocabulary inputs from cache keys with a special token. +- `Inputs`: used to further provide or define inputs, a list of `shared.Field`. For TensorFlow models, this is automatically populated, but further caching configurations need to be specified. + * `Name`: `string` - required - input name, only required if an entry is provided. + * `Index`: `int` - optional - used to maintain cache key ordering. + * `Auxiliary`: `bool` - optional - the input is permitted to be provided in an evaluation request. Mainly used for logging. + * `Wildcard`: `bool` - conditionally required - if enabled this input will not have a vocabulary for lookup. If `UseDict` is true and `Wildcard` is false, the service will refuse to start if it cannot guess the vocabulary extraction Operation. + * `Precision`: `int` - conditionally required - if the input is a float type and dictionary is enabled, this can be used to round the value to a lower precision which can improve cache hit rates. If `UseDict` is true, the service will refuse to start if it encounters a float input without a `Precision`. +- `KeyFields`: `[]string` - optional - list of fields used to generate caching key (by default, all model inputs, sorted alphabetically). Can be used to order and add valid inputs that can be used as a cache key but not used as prediction input. +- `Platform`: `string` - optional, defaults to `tensorflow`. Can be `tensorflow` or `triton`. See below for more information. +- `Mode`: `string` - optional, defaults to `inference`. Can be `inference` or `router`. See below for more information. +- `Auxiliary`: `[]string` - **deprecated**, optional - list of additional fields that are acceptable for eval server call. Deprecated, use `Field.Auxiliary`. +- `Outputs`: `[]shared.Field` - optional - model outputs are automatically pulled from the model. Required for Triton backends. +- `Test`: optional - enables a client request to send to self on start up. * `Test`: `bool` - if `true`, a client will generate a non-batch request with random values based on the model input signature. - * `Single`: `map[string]interface{}` - if present, will use the provided values for certain input keys, otherwise randomly generated based on model input signature. + * `Single`: `map[string]any` - if present, will use the provided values for certain input keys, otherwise randomly generated based on model input signature. * `SingleBatch`: `bool` - if `true`, a client will generate a batch request with random values based on the model input signature; if `Single` is set, values will be used for provided keys. - * `Batch`: `map[string][]interface{}` - if present, will be used to generate a batch of requests for the self-test. - - `Inputs`: optional - used to further provide or define inputs, a list of `shared.Field`. - * `Name`: `string` - required - input name, only required if an entry is provided. - * `Index`: `int` - optional - used to maintain cache key ordering. - * `Auxiliary`: `bool` - optional - the input is permitted to be provided in an evaluation request. - * `Wildcard`: `bool` - conditionally required - if enabled this input will not have a vocabulary for lookup; if `UseDict` is true, the service will refuse to start if it cannot guess the vocabulary extraction Operation. - * `Precision`: `int` - conditionally required - if the input is a float type and dictionary is enabled, this can be used to round the value to a lower precision which can improve cache hit rates; if `UseDict` is true, the service will refuse to start if it encounters a float input without a `Precision`. - - `KeyFields`: `[]string` - optional - list of fields used to generate caching key (by default, all model inputs, sorted alphabetically). Can be used to order and add valid inputs that can be used as a cache key but not used as prediction input. - - `Auxiliary`: `[]string` - deprecated, optional - list of additional fields that are acceptable for eval server call. Deprecated, use `Field.Auxiliary`. - - `Outputs`: `[]shared.Field` - deprecated, optional - model outputs are automatically pulled from the model. - -* `Connection`: optional - list of external Aerospike connections. - - `ID`: `string` - required - connection ID - - `Hostnames`: `string` - required - Aerospike hostnames - -* `Datastores` : list of datastore caches - - `ID`: `string` - required - datastore ID (to be matched with `Models[].DataStores[].ID`) - - `Connection`: `string` - optional - connection ID - - `Namespace`: `string` - optional - Aerospike namespace - - `Dataset`: `string` - optional - Aerospike dataset - - `Storable`: `string` - optional - name of registered `storable` provider - - `Cache`: optional - in-memory cache setting - * `SizeMB`: `int` - optional - cache size in MB - -* `Endpoint`: some special administrative options - - `Port`: `int` - optional - used in `addr` for `http.Server`, default `8080`. - - `ReadTimeoutMs`, `WriteTimeoutMs`: `int` - optional - additional settings for `http.Server`, default `5000` for both. - - `MaxHeaderBytes`: `int` - optional - additional settings for `http.Server`, default `8192` (`8 * 1024`). - - `WriteTimeout`: `int` - optional - maximum request timeout. - - `PoolMaxSize`, `BufferSize`: `int` - optional - controls implementation of `net/http/httputil`, default `512` and `131072` (`128 * 1024`), respectively. - - `MaxEvaluatorConcurrency`: `int` - optional - controls semaphore that prevents too many CGo goroutines from spawning, default `5000`. - -* `EnableMemProf`: `bool` - optional - enables endpoint for memory profiling. + * `Batch`: `map[string][]any` - if present, will be used to generate a batch of requests for the self-test. + +### Model Property `Platform` + +The `Platform` property specifies where inference actually happens. +Currently supported values are `tensorflow` and `triton`, with `tensorflow` being the default if unspecified. + +If the `Platform` is `triton`, then mly will route requests to a configured [Triton Inference Server](https://docs.nvidia.com/deeplearning/triton-inference-server/user-guide/docs/introduction/index.html). + +### Model Property `Mode` + +The `Mode` property enables a specific inference mode. +Currently supported values are `inference` and `router`, with `inference` being the default if unspecified. + +The `inference` mode operates as expected - the inference request is processed using the model in the backend and a prediction is generated. + +The `router` mode operates with a nuance - this will route input rows to a specific backend model. + +Currently, only the `Platform` `triton` is supported. + +## Root Property `Connections` + +Can be empty - a list of external Aerospike connections. + +Properties: + +- `ID`: `string` - required - connection ID +- `Hostnames`: `string` - required - Aerospike hostnames + +## Root Property `Datastores` + +Can be empty - represent a list of caching data stores. + +Properties: + +- `ID`: `string` - required - datastore ID (to be matched with `Models[].DataStores[].ID`) +- `Connection`: `string` - optional - connection ID +- `Namespace`: `string` - optional - Aerospike namespace +- `Dataset`: `string` - optional - Aerospike dataset +- `Storable`: `string` - optional - name of registered `storable` provider +- `Cache`: optional - in-memory cache setting + * `SizeMB`: `int` - optional - cache size in MB + +## Root Property `Endpoint` + +Contains some special administrative options. + +- `Port`: `int` - optional - used in `addr` for `http.Server`, default `8080`. +- `ReadTimeoutMs`, `WriteTimeoutMs`: `int` - optional - additional settings for `http.Server`, default `5000` for both. +- `MaxHeaderBytes`: `int` - optional - additional settings for `http.Server`, default `8192` (`8 * 1024`). +- `WriteTimeout`: `int` - optional - maximum request timeout. +- `PoolMaxSize`, `BufferSize`: `int` - optional - controls implementation of `net/http/httputil`, default `512` and `131072` (`128 * 1024`), respectively. +- `MaxEvaluatorConcurrency`: `int` - optional - controls semaphore that prevents too many CGo goroutines from spawning, default `5000`. + +* `EnableMemProf`: `bool` - **deprecated**, optional - enables endpoint for memory profiling - use `ProfilerPort` instead * `EnableCPUProf`: `bool` - optional - enables endpoint for cpu profiling. * `AllowedSubnet`: `bool` - optional - restricts administrative endpoints to IP string prefixes. - Restricts the system configuration, memory profile, CPU profile, and health endpoints. * `ContinueOnRecover`: `bool` - optional - panics will not bubble up. ## Client - + `mly` client does not come with an external config file. To create a client, use the following snippet: @@ -75,7 +115,7 @@ See [`shared/client/option.go`](shared/client/option.go) for more options. Since v0.16.0, there have been added options for Aerospike behavior. -Since each `shared/client.Service` instance operates on 1 model, there was an added option to share Aerospike connections via [`WithConnectionSharing()`](shared/client/option.go). +Since each `shared/client.Service` instance is encapsulated for 1 model, there was an added option to share Aerospike connections via [`WithConnectionSharing()`](shared/client/option.go). Additionally, Aerospike client `Policy` override options were provided. Use `WithClientOptions()` to provide `shared/datastore/client.Option` options. diff --git a/DEVTODO.md b/DEVTODO.md new file mode 100644 index 0000000..6542d1e --- /dev/null +++ b/DEVTODO.md @@ -0,0 +1,25 @@ +# Notes about Incoherent or Inconsistent Architecture and Design + +## 1 `service/domain` + +`service/domain.Input` and `service/domain.Ouput` have dependencies on TensorFlow but are part of the generalized `service/platform.PlatformEvaluator` interface. +This is an unnecessary coupling and should be removed. +The usage in the `service` module is mainly for type mapping from JSON to Go to Go-type for TensorFlow. + + +## 2 `service/request.Request.Feeds` + +This seems too tailored towards TensorFlow inference. +A common operation in Triton is to convert the offset-based slice data back into name-based slice data. +Might see cognitive improvement if we reduce that back-and-forth. + +## 3 Input Validation + +Incorrect batch size results in panic. + + +## 4 Triton Management Frequency + +Higher frequency model load frequency. +Mainly useful during development, but may be useful in production environments where Triton server dies or is restarted? +No, seems like that would be a separate issue in it of itself. \ No newline at end of file From 1f71ae3dd7fd886effa01c7abdba165a3b16064d Mon Sep 17 00:00:00 2001 From: David Choi Date: Mon, 17 Nov 2025 16:54:09 -0800 Subject: [PATCH 24/38] Refactor router and endpoint configurations - Replaced MaxConcurrency with Workers in RouterConfig and updated default initialization. - Introduced MaxQueueSize to manage request queuing in RouterConfig. - Added worker handling in the Router to process requests concurrently using a channel. - Created a new worker.go file to manage work requests and processing logic. --- service/config/router.go | 14 +++++-- service/endpoint/config/endpoint.go | 13 +++++-- service/platform/router/router.go | 42 ++++++++++----------- service/platform/router/worker.go | 57 +++++++++++++++++++++++++++++ 4 files changed, 98 insertions(+), 28 deletions(-) create mode 100644 service/platform/router/worker.go diff --git a/service/config/router.go b/service/config/router.go index 4366f52..33bfa33 100644 --- a/service/config/router.go +++ b/service/config/router.go @@ -15,7 +15,11 @@ type RouterConfig struct { // The maximum number of concurrent requests to the backend. // Defaults to 50. - MaxConcurrency int `json:",omitempty" yaml:",omitempty"` + Workers int `json:",omitempty" yaml:",omitempty"` + + // The maximum number of requests to queue. + // Defaults to 1000. + MaxQueueSize int `json:",omitempty" yaml:",omitempty"` Global GlobalModelConfig @@ -53,8 +57,12 @@ type OutputConfig struct { } func (o *RouterConfig) Init() { - if o.MaxConcurrency == 0 { - o.MaxConcurrency = 50 + if o.Workers == 0 { + o.Workers = 50 + } + + if o.MaxQueueSize == 0 { + o.MaxQueueSize = 1000 } } diff --git a/service/endpoint/config/endpoint.go b/service/endpoint/config/endpoint.go index dd0ba8b..50d5a6a 100644 --- a/service/endpoint/config/endpoint.go +++ b/service/endpoint/config/endpoint.go @@ -8,11 +8,16 @@ const defaultMaxEvaluatorWait = 50 // Endpoint represents an endpoint type Endpoint struct { - Port int - ReadTimeoutMs int `json:",omitempty" yaml:",omitempty"` + Port int + ReadTimeoutMs int `json:",omitempty" yaml:",omitempty"` + + // WriteTimeoutMs (and WriteTimeout) are the timeout for writing a response to the client. + // Each request is given a maximum timeout of WriteTiemout - 1 millisecond. + // Defaults to 5000 milliseconds. WriteTimeoutMs int `json:",omitempty" yaml:",omitempty"` WriteTimeout time.Duration `json:",omitempty" yaml:",omitempty"` - MaxHeaderBytes int `json:",omitempty" yaml:",omitempty"` + + MaxHeaderBytes int `json:",omitempty" yaml:",omitempty"` // HTTP data buffer pool - used when reading a payload, for saving memory PoolMaxSize int `json:",omitempty" yaml:",omitempty"` @@ -24,7 +29,7 @@ type Endpoint struct { MaxEvaluatorConcurrency int64 `json:",omitempty" yaml:",omitempty"` } -//Init init applied default settings +// Init init applied default settings func (e *Endpoint) Init() { if e.Port == 0 { e.Port = 8080 diff --git a/service/platform/router/router.go b/service/platform/router/router.go index 1f16c7d..cfbc36a 100644 --- a/service/platform/router/router.go +++ b/service/platform/router/router.go @@ -39,7 +39,7 @@ type Router struct { routingMap map[int]string routingTable map[string]platform.PlatformEvaluator - maxConcurrency int + workCh chan *workRequest globalModel platform.PlatformEvaluator fixedEvaluator platform.Predictor @@ -79,8 +79,9 @@ func NewRouter(cfg *config.Model, fs afs.Service, tritonClients map[string]tricl return nil, fmt.Errorf("failed to handle IO: %w", err) } - if cfg.Router.MaxConcurrency != 0 { - r.maxConcurrency = cfg.Router.MaxConcurrency + r.workCh = make(chan *workRequest, cfg.Router.MaxQueueSize) + for i := 0; i < cfg.Router.Workers; i++ { + go handleWorkRequests(r.workCh) } stopUnload := make(chan struct{}) @@ -244,11 +245,6 @@ func (t *Router) handleIO(cfg *config.Model) error { return nil } -type offsetResults struct { - offset int - results []interface{} -} - // Predict performs model inference with the given parameters // params is expected to be [numInputs]([batchSize][1]T) (see service/request.Request.Feeds) func (r *Router) Predict(ctx context.Context, params []interface{}) ([]interface{}, error) { @@ -366,25 +362,29 @@ func (r *Router) Predict(ctx context.Context, params []interface{}) ([]interface routerRoutedModelsCounter.WithLabelValues(metricModelName, r.routerName).Inc() - go func(batchOffset int, request []interface{}, routingValueString string, evaluator platform.Predictor) { - defer predictWaitGroup.Done() + select { + case r.workCh <- &workRequest{ + wg: &predictWaitGroup, - results, err := evaluator.Predict(ctx, request) - if err != nil { - errCh <- fmt.Errorf("failed to predict for row %d: %w", batchOffset, err) - } + predictor: evaluator, + ctx: ctx, + request: request, - if r.modelOutputName != "" { - // TODO ensure ordering + offset: batchOffset, + modelOutputEnabled: r.modelOutputName != "", + routingValueString: routingValueString, - results = append(results, [][]string{{routingValueString}}) - } - - resultsCh <- offsetResults{offset: batchOffset, results: results} - }(batchOffset, request, routingValueString, evaluator) + responseCh: resultsCh, + errCh: errCh, + }: + // continue + default: + return nil, fmt.Errorf("work channel is full") + } } predictWaitGroup.Wait() + close(errCh) close(resultsCh) diff --git a/service/platform/router/worker.go b/service/platform/router/worker.go new file mode 100644 index 0000000..6e45026 --- /dev/null +++ b/service/platform/router/worker.go @@ -0,0 +1,57 @@ +package router + +import ( + "context" + "fmt" + "log" + "sync" + + "github.com/viant/mly/service/platform" +) + +type workRequest struct { + wg *sync.WaitGroup + + predictor platform.Predictor + ctx context.Context + request []interface{} + + offset int + modelOutputEnabled bool + routingValueString string + + responseCh chan offsetResults + errCh chan error +} + +type offsetResults struct { + offset int + results []interface{} +} + +func handleWorkRequests(workCh chan *workRequest) { + for request := range workCh { + if request == nil { + log.Println("work request is nil, breaking") + break + } + + func(request workRequest) { + defer request.wg.Done() + results, err := request.predictor.Predict(request.ctx, request.request) + if err != nil { + request.errCh <- fmt.Errorf("failed to predict for row %d: %w", request.offset, err) + return + } + + if request.modelOutputEnabled { + results = append(results, [][]string{{request.routingValueString}}) + } + + request.responseCh <- offsetResults{ + offset: request.offset, + results: results, + } + }(*request) + } +} From 0b2afff8eee8c3647295a4818ca3f098fdc0db90 Mon Sep 17 00:00:00 2001 From: David Choi Date: Mon, 17 Nov 2025 17:11:47 -0800 Subject: [PATCH 25/38] Removed Prometheus metrics for routed models from the router implementation, did not provide new information. --- service/platform/router/prometheus.go | 11 ----------- service/platform/router/router.go | 7 ------- 2 files changed, 18 deletions(-) diff --git a/service/platform/router/prometheus.go b/service/platform/router/prometheus.go index dc12b97..e2cee1e 100644 --- a/service/platform/router/prometheus.go +++ b/service/platform/router/prometheus.go @@ -28,16 +28,6 @@ var ( []string{"router", "fixed_only"}, ) - routerRoutedModelsCounter = prometheus.NewCounterVec( - prometheus.CounterOpts{ - Namespace: "mly", - Subsystem: "router", - Name: "routed_models_counter", - Help: "Number of models routed, labeled by model name.", - }, - []string{"model", "router"}, - ) - routerModelUnloadGauge = prometheus.NewGauge( prometheus.GaugeOpts{ Namespace: "mly", @@ -50,7 +40,6 @@ var ( func init() { prometheus.MustRegister(routerPredictDurationMicrosSummary) - prometheus.MustRegister(routerRoutedModelsCounter) prometheus.MustRegister(routerReloadDurationMicrosSummary) prometheus.MustRegister(routerModelUnloadGauge) } diff --git a/service/platform/router/router.go b/service/platform/router/router.go index cfbc36a..600dfe8 100644 --- a/service/platform/router/router.go +++ b/service/platform/router/router.go @@ -330,11 +330,8 @@ func (r *Router) Predict(ctx context.Context, params []interface{}) ([]interface routingValueString, ok := r.routingMap[routingValueInt] - var metricModelName string var evaluator platform.Predictor if !ok { - - metricModelName = "global" if globalExists { metricFixedOnly = false // fallback to global model @@ -351,8 +348,6 @@ func (r *Router) Predict(ctx context.Context, params []interface{}) ([]interface } else { metricFixedOnly = false - metricModelName = routingValueString - var ok bool evaluator, ok = r.routingTable[routingValueString] if !ok { @@ -360,8 +355,6 @@ func (r *Router) Predict(ctx context.Context, params []interface{}) ([]interface } } - routerRoutedModelsCounter.WithLabelValues(metricModelName, r.routerName).Inc() - select { case r.workCh <- &workRequest{ wg: &predictWaitGroup, From 7bb4e36a7ecff571ef9ed00cd255ed543a896f61 Mon Sep 17 00:00:00 2001 From: David Choi Date: Mon, 17 Nov 2025 17:49:49 -0800 Subject: [PATCH 26/38] Add Prometheus metrics for router prediction handling - Introduced a summary metric for tracking the number of predictions queued in the worker channel. - Added a counter for monitoring the number of dropped predictions when the work channel is full. - Updated the worker request handling to observe the queued time for metrics reporting. --- service/platform/router/prometheus.go | 20 ++++++++++++++++++++ service/platform/router/router.go | 3 +++ service/platform/router/worker.go | 6 +++++- 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/service/platform/router/prometheus.go b/service/platform/router/prometheus.go index e2cee1e..12d676a 100644 --- a/service/platform/router/prometheus.go +++ b/service/platform/router/prometheus.go @@ -28,6 +28,24 @@ var ( []string{"router", "fixed_only"}, ) + routerWorkerChannelQueuedSummary = prometheus.NewSummary( + prometheus.SummaryOpts{ + Namespace: "mly", + Subsystem: "router", + Name: "worker_channel_queued_summary", + Help: "Number of router predictions queued in the worker channel.", + }, + ) + + routerPredictDroppedCounter = prometheus.NewCounter( + prometheus.CounterOpts{ + Namespace: "mly", + Subsystem: "router", + Name: "predict_dropped_counter", + Help: "Number of router predictions dropped.", + }, + ) + routerModelUnloadGauge = prometheus.NewGauge( prometheus.GaugeOpts{ Namespace: "mly", @@ -42,4 +60,6 @@ func init() { prometheus.MustRegister(routerPredictDurationMicrosSummary) prometheus.MustRegister(routerReloadDurationMicrosSummary) prometheus.MustRegister(routerModelUnloadGauge) + prometheus.MustRegister(routerPredictDroppedCounter) + prometheus.MustRegister(routerWorkerChannelQueuedSummary) } diff --git a/service/platform/router/router.go b/service/platform/router/router.go index 600dfe8..8c4c23b 100644 --- a/service/platform/router/router.go +++ b/service/platform/router/router.go @@ -363,6 +363,7 @@ func (r *Router) Predict(ctx context.Context, params []interface{}) ([]interface ctx: ctx, request: request, + queuedTime: time.Now(), offset: batchOffset, modelOutputEnabled: r.modelOutputName != "", routingValueString: routingValueString, @@ -370,8 +371,10 @@ func (r *Router) Predict(ctx context.Context, params []interface{}) ([]interface responseCh: resultsCh, errCh: errCh, }: + // continue default: + routerPredictDroppedCounter.Inc() return nil, fmt.Errorf("work channel is full") } } diff --git a/service/platform/router/worker.go b/service/platform/router/worker.go index 6e45026..0876043 100644 --- a/service/platform/router/worker.go +++ b/service/platform/router/worker.go @@ -5,6 +5,7 @@ import ( "fmt" "log" "sync" + "time" "github.com/viant/mly/service/platform" ) @@ -16,6 +17,7 @@ type workRequest struct { ctx context.Context request []interface{} + queuedTime time.Time offset int modelOutputEnabled bool routingValueString string @@ -32,11 +34,13 @@ type offsetResults struct { func handleWorkRequests(workCh chan *workRequest) { for request := range workCh { if request == nil { - log.Println("work request is nil, breaking") + log.Println("work request is nil, stopping") break } func(request workRequest) { + routerWorkerChannelQueuedSummary.Observe(float64(time.Since(request.queuedTime).Microseconds())) + defer request.wg.Done() results, err := request.predictor.Predict(request.ctx, request.request) if err != nil { From 5ee418a73b147ba272fd2115f193571c85fc95d1 Mon Sep 17 00:00:00 2001 From: David Choi Date: Mon, 17 Nov 2025 17:58:07 -0800 Subject: [PATCH 27/38] Added Objectives to the worker_channel_queued_summary metric --- service/platform/router/prometheus.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/service/platform/router/prometheus.go b/service/platform/router/prometheus.go index 12d676a..47fe92e 100644 --- a/service/platform/router/prometheus.go +++ b/service/platform/router/prometheus.go @@ -30,10 +30,11 @@ var ( routerWorkerChannelQueuedSummary = prometheus.NewSummary( prometheus.SummaryOpts{ - Namespace: "mly", - Subsystem: "router", - Name: "worker_channel_queued_summary", - Help: "Number of router predictions queued in the worker channel.", + Namespace: "mly", + Subsystem: "router", + Name: "worker_channel_queued_summary", + Help: "Number of router predictions queued in the worker channel.", + Objectives: buckets.CommonSummaryObjectives, }, ) From a92e1d802099031c44058a9bae4e27648aed45e1 Mon Sep 17 00:00:00 2001 From: David Choi Date: Mon, 17 Nov 2025 18:01:06 -0800 Subject: [PATCH 28/38] Add labels to router Prometheus metrics --- service/platform/router/prometheus.go | 9 ++++++--- service/platform/router/router.go | 8 ++++---- service/platform/router/worker.go | 5 +++-- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/service/platform/router/prometheus.go b/service/platform/router/prometheus.go index 47fe92e..9809a5d 100644 --- a/service/platform/router/prometheus.go +++ b/service/platform/router/prometheus.go @@ -28,7 +28,7 @@ var ( []string{"router", "fixed_only"}, ) - routerWorkerChannelQueuedSummary = prometheus.NewSummary( + routerWorkerChannelQueuedSummary = prometheus.NewSummaryVec( prometheus.SummaryOpts{ Namespace: "mly", Subsystem: "router", @@ -36,24 +36,27 @@ var ( Help: "Number of router predictions queued in the worker channel.", Objectives: buckets.CommonSummaryObjectives, }, + []string{"router"}, ) - routerPredictDroppedCounter = prometheus.NewCounter( + routerPredictDroppedCounter = prometheus.NewCounterVec( prometheus.CounterOpts{ Namespace: "mly", Subsystem: "router", Name: "predict_dropped_counter", Help: "Number of router predictions dropped.", }, + []string{"router"}, ) - routerModelUnloadGauge = prometheus.NewGauge( + routerModelUnloadGauge = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Namespace: "mly", Subsystem: "router", Name: "model_unloading", Help: "Number of models currently being unloaded.", }, + []string{"router"}, ) ) diff --git a/service/platform/router/router.go b/service/platform/router/router.go index 8c4c23b..cf02440 100644 --- a/service/platform/router/router.go +++ b/service/platform/router/router.go @@ -81,7 +81,7 @@ func NewRouter(cfg *config.Model, fs afs.Service, tritonClients map[string]tricl r.workCh = make(chan *workRequest, cfg.Router.MaxQueueSize) for i := 0; i < cfg.Router.Workers; i++ { - go handleWorkRequests(r.workCh) + go handleWorkRequests(r.workCh, routerWorkerChannelQueuedSummary.WithLabelValues(r.routerName)) } stopUnload := make(chan struct{}) @@ -374,7 +374,7 @@ func (r *Router) Predict(ctx context.Context, params []interface{}) ([]interface // continue default: - routerPredictDroppedCounter.Inc() + routerPredictDroppedCounter.WithLabelValues(r.routerName).Inc() return nil, fmt.Errorf("work channel is full") } } @@ -686,7 +686,7 @@ func (r *Router) applyRouterConfig(ctx context.Context, newConfig *router.Router }() for model := range modelsToUnload { - routerModelUnloadGauge.Inc() + routerModelUnloadGauge.WithLabelValues(r.routerName).Inc() r.modelUnloadCh <- model } @@ -694,7 +694,7 @@ func (r *Router) applyRouterConfig(ctx context.Context, newConfig *router.Router } func (r *Router) unloadModel(ctx context.Context, modelName string) error { - defer routerModelUnloadGauge.Dec() + defer routerModelUnloadGauge.WithLabelValues(r.routerName).Dec() if err := r.tritonClient.ModelUnload(ctx, modelName); err != nil { return fmt.Errorf("failed to unload model %s: %w", modelName, err) } diff --git a/service/platform/router/worker.go b/service/platform/router/worker.go index 0876043..4acc056 100644 --- a/service/platform/router/worker.go +++ b/service/platform/router/worker.go @@ -7,6 +7,7 @@ import ( "sync" "time" + "github.com/prometheus/client_golang/prometheus" "github.com/viant/mly/service/platform" ) @@ -31,7 +32,7 @@ type offsetResults struct { results []interface{} } -func handleWorkRequests(workCh chan *workRequest) { +func handleWorkRequests(workCh chan *workRequest, observer prometheus.Observer) { for request := range workCh { if request == nil { log.Println("work request is nil, stopping") @@ -39,7 +40,7 @@ func handleWorkRequests(workCh chan *workRequest) { } func(request workRequest) { - routerWorkerChannelQueuedSummary.Observe(float64(time.Since(request.queuedTime).Microseconds())) + observer.Observe(float64(time.Since(request.queuedTime).Microseconds())) defer request.wg.Done() results, err := request.predictor.Predict(request.ctx, request.request) From 9acfc4b15f3118c6cebdc746e169fb6bb6556ae1 Mon Sep 17 00:00:00 2001 From: David Choi Date: Tue, 18 Nov 2025 10:26:05 -0800 Subject: [PATCH 29/38] Remove router unload worker, spawn goroutines instead. Fix configuration required issues. --- service/config/router.go | 8 +++++ service/config/triton_test.go | 1 + service/platform/router/router.go | 45 +++++++++----------------- service/platform/router/router_test.go | 4 +++ 4 files changed, 28 insertions(+), 30 deletions(-) diff --git a/service/config/router.go b/service/config/router.go index 33bfa33..e5e9e73 100644 --- a/service/config/router.go +++ b/service/config/router.go @@ -71,6 +71,14 @@ func (o *RouterConfig) Validate() error { return fmt.Errorf("config URL is required") } + if o.Workers == 0 { + return fmt.Errorf("workers must be greater than 0") + } + + if o.MaxQueueSize == 0 { + return fmt.Errorf("max queue size must be greater than 0") + } + if o.InputName == "" { return fmt.Errorf("input name is required") } diff --git a/service/config/triton_test.go b/service/config/triton_test.go index 8783028..5c5cba3 100644 --- a/service/config/triton_test.go +++ b/service/config/triton_test.go @@ -97,6 +97,7 @@ func TestTritonModelConfigValidation(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { + tc.config.Init(nil) err := tc.config.Validate() if tc.expectError { diff --git a/service/platform/router/router.go b/service/platform/router/router.go index cf02440..ef6b09d 100644 --- a/service/platform/router/router.go +++ b/service/platform/router/router.go @@ -32,9 +32,6 @@ type Router struct { configModified *config.Modified routerConfig *router.RouterConfig - modelUnloadCh chan string - modelUnloadStopCh chan struct{} - routingTableLock sync.RWMutex routingMap map[int]string routingTable map[string]platform.PlatformEvaluator @@ -62,6 +59,11 @@ func NewRouter(cfg *config.Model, fs afs.Service, tritonClients map[string]tricl return nil, fmt.Errorf("router configuration is required") } + if err := cfg.Router.Validate(); err != nil { + return nil, fmt.Errorf("router configuration is invalid: %w", err) + + } + tritonClient, ok := tritonClients[cfg.Triton.ServerID] if !ok { return nil, fmt.Errorf("triton client not found for server ID: %s", cfg.Triton.ServerID) @@ -84,29 +86,6 @@ func NewRouter(cfg *config.Model, fs afs.Service, tritonClients map[string]tricl go handleWorkRequests(r.workCh, routerWorkerChannelQueuedSummary.WithLabelValues(r.routerName)) } - stopUnload := make(chan struct{}) - modelUnloadCh := make(chan string) - - r.modelUnloadCh = modelUnloadCh - r.modelUnloadStopCh = stopUnload - - go func() { - for { - select { - case modelName := <-modelUnloadCh: - unloadCtx, unloadCtxCancel := context.WithTimeout(context.Background(), 10*time.Second) - - if err := r.unloadModel(unloadCtx, modelName); err != nil { - log.Printf("failed to unload model %s: %v\n", modelName, err) - } - - unloadCtxCancel() - case <-stopUnload: - return - } - } - }() - return r, nil } @@ -421,9 +400,6 @@ func (r *Router) Stats(stats map[string]interface{}) { } func (r *Router) Close() error { - r.modelUnloadStopCh <- struct{}{} - close(r.modelUnloadStopCh) - close(r.modelUnloadCh) return nil } @@ -687,7 +663,16 @@ func (r *Router) applyRouterConfig(ctx context.Context, newConfig *router.Router for model := range modelsToUnload { routerModelUnloadGauge.WithLabelValues(r.routerName).Inc() - r.modelUnloadCh <- model + + go func(modelName string) { + defer routerModelUnloadGauge.WithLabelValues(r.routerName).Dec() + + ctxTo, cancel := context.WithTimeout(context.Background(), 10*time.Second) + defer cancel() + if err := r.unloadModel(ctxTo, modelName); err != nil { + log.Printf("failed to unload model %s: %v\n", modelName, err) + } + }(model) } return nil diff --git a/service/platform/router/router_test.go b/service/platform/router/router_test.go index 40fff5f..a5baa16 100644 --- a/service/platform/router/router_test.go +++ b/service/platform/router/router_test.go @@ -252,6 +252,10 @@ func TestRouter_Predict_RoutesAndConcats(t *testing.T) { }, } + cfg.Init(nil) + cfg.Router.MaxQueueSize = 1000 + cfg.Router.Workers = 3 + router, err := NewRouter(cfg, nil, map[string]tricli.TritonClient{ "test_server": &mockTritonClient{}, }) From 139d1d00b70901ec638b9e756cf9b196e4c062d7 Mon Sep 17 00:00:00 2001 From: David Choi Date: Tue, 18 Nov 2025 10:46:02 -0800 Subject: [PATCH 30/38] Copy TensorFlow PB files to third_party. Fix bug with with-cog.sh to return errors. --- example/e2e/build-tensorflow-go/Dockerfile | 14 - .../install-dependencies.sh | 17 - .../build-tensorflow-go/vendor-tensorflow.sh | 9 - example/e2e/build-tensorflow-go/with-cgo.sh | 4 +- example/e2e/compat/README.md | 15 - go.mod | 6 +- go.sum | 2 - .../build-tf-protoc.sh | 11 +- third_party/README.md | 15 + third_party/TENSORFLOW.md | 25 + TRITON.md => third_party/TRITON.md | 15 +- third_party/go-tensorflow/.gitignore | 49 + third_party/go-tensorflow/go.mod | 8 + third_party/go-tensorflow/go.sum | 14 + third_party/go-tensorflow/tensorflow/go/BUILD | 41 + .../go-tensorflow/tensorflow/go/README.md | 103 + .../go-tensorflow/tensorflow/go/android.go | 20 + .../go-tensorflow/tensorflow/go/attrs.go | 246 + .../go-tensorflow/tensorflow/go/attrs_test.go | 193 + .../go-tensorflow/tensorflow/go/context.go | 109 + .../tensorflow/go/context_test.go | 57 + .../allocation_description.pb.go | 175 + .../framework/api_def_go_proto/api_def.pb.go | 630 + .../attr_value_go_proto/attr_value.pb.go | 517 + .../cost_graph_go_proto/cost_graph.pb.go | 549 + .../device_attributes.pb.go | 363 + .../function_go_proto/function.pb.go | 431 + .../core/framework/graph_go_proto/graph.pb.go | 197 + .../graph_transfer_info.pb.go | 734 + .../kernel_def_go_proto/kernel_def.pb.go | 295 + .../log_memory_go_proto/log_memory.pb.go | 537 + .../node_def_go_proto/node_def.pb.go | 292 + .../framework/op_def_go_proto/op_def.pb.go | 623 + .../reader_base_go_proto/reader_base.pb.go | 153 + .../remote_fused_graph_execute_info.pb.go | 259 + .../resource_handle.pb.go | 244 + .../step_stats_go_proto/step_stats.pb.go | 722 + .../framework/summary_go_proto/summary.pb.go | 895 + .../tensor_description.pb.go | 154 + .../framework/tensor_go_proto/tensor.pb.go | 382 + .../tensor_shape_go_proto/tensor_shape.pb.go | 216 + .../tensor_slice_go_proto/tensor_slice.pb.go | 224 + .../core/framework/types_go_proto/types.pb.go | 376 + .../variable_go_proto/variable.pb.go | 428 + .../versions_go_proto/versions.pb.go | 158 + .../for_core_protos_go_proto/autotuning.pb.go | 714 + .../bfc_memory_map.pb.go | 510 + .../for_core_protos_go_proto/cluster.pb.go | 212 + .../for_core_protos_go_proto/config.pb.go | 2496 + .../control_flow.pb.go | 505 + .../conv_autotuning.pb.go | 254 + .../critical_section.pb.go | 186 + .../for_core_protos_go_proto/debug.pb.go | 410 + .../debug_event.pb.go | 1282 + .../device_filters.pb.go | 255 + .../device_properties.pb.go | 327 + .../eager_service.pb.go | 1920 + .../error_codes.pb.go | 297 + .../graph_debug_info.pb.go | 295 + .../for_core_protos_go_proto/master.pb.go | 1408 + .../master_service.pb.go | 128 + .../for_core_protos_go_proto/meta_graph.pb.go | 1343 + .../named_tensor.pb.go | 144 + .../queue_runner.pb.go | 171 + .../remote_tensor_handle.pb.go | 241 + .../for_core_protos_go_proto/replay_log.pb.go | 645 + .../rewriter_config.pb.go | 926 + .../saved_model.pb.go | 144 + .../saved_object_graph.pb.go | 1175 + .../for_core_protos_go_proto/saver.pb.go | 254 + .../for_core_protos_go_proto/struct.pb.go | 1083 + .../tensor_bundle.pb.go | 340 + .../tensorflow_server.pb.go | 220 + .../trackable_object_graph.pb.go | 412 + .../transport_options.pb.go | 124 + .../verifier_config.pb.go | 194 + .../for_core_protos_go_proto/worker.pb.go | 2752 + .../worker_service.pb.go | 155 + .../go-tensorflow/tensorflow/go/doc.go | 26 + .../go/example_inception_inference_test.go | 291 + .../tensorflow/go/genop/.gitignore | 2 + .../tensorflow/go/genop/generate.go | 21 + .../tensorflow/go/genop/generate.sh | 72 + .../tensorflow/go/genop/generate.win.go | 21 + .../go/genop/internal/api_def_map.go | 128 + .../tensorflow/go/genop/internal/genop.go | 590 + .../go/genop/internal/genop_test.go | 820 + .../tensorflow/go/genop/internal/lib.go | 22 + .../go-tensorflow/tensorflow/go/genop/main.go | 70 + .../go-tensorflow/tensorflow/go/graph.go | 528 + .../go-tensorflow/tensorflow/go/graph_test.go | 407 + .../go-tensorflow/tensorflow/go/lib.go | 21 + .../tensorflow/go/op/generate.go | 20 + .../tensorflow/go/op/gradients.go | 49 + .../tensorflow/go/op/gradients_test.go | 246 + .../go-tensorflow/tensorflow/go/op/op.go | 51 + .../go-tensorflow/tensorflow/go/op/op_test.go | 133 + .../go-tensorflow/tensorflow/go/op/scope.go | 185 + .../tensorflow/go/op/scope_test.go | 201 + .../tensorflow/go/op/wrappers.go | 54391 ++++++++++++++++ .../go-tensorflow/tensorflow/go/operation.go | 216 + .../tensorflow/go/operation_test.go | 269 + .../tensorflow/go/saved_model.go | 100 + .../tensorflow/go/saved_model_test.go | 41 + .../go-tensorflow/tensorflow/go/session.go | 449 + .../tensorflow/go/session_test.go | 433 + .../go-tensorflow/tensorflow/go/shape.go | 104 + .../go-tensorflow/tensorflow/go/shape_test.go | 85 + .../go-tensorflow/tensorflow/go/signature.go | 119 + .../tensorflow/go/signature_test.go | 207 + .../go-tensorflow/tensorflow/go/status.go | 67 + .../tensorflow/go/stream_executor/dnn.pb.go | 820 + .../go-tensorflow/tensorflow/go/tensor.go | 541 + .../tensorflow/go/tensor_handle.go | 170 + .../tensorflow/go/tensor_handle_test.go | 127 + .../tensorflow/go/tensor_test.go | 352 + .../go-tensorflow/tensorflow/go/test.sh | 76 + .../go-tensorflow/tensorflow/go/util_test.go | 65 + .../allocation_description.pb.go | 175 + .../framework/api_def_go_proto/api_def.pb.go | 630 + .../attr_value_go_proto/attr_value.pb.go | 517 + .../cost_graph_go_proto/cost_graph.pb.go | 549 + .../device_attributes.pb.go | 363 + .../function_go_proto/function.pb.go | 431 + .../core/framework/graph_go_proto/graph.pb.go | 197 + .../graph_transfer_info.pb.go | 734 + .../kernel_def_go_proto/kernel_def.pb.go | 295 + .../log_memory_go_proto/log_memory.pb.go | 537 + .../node_def_go_proto/node_def.pb.go | 292 + .../framework/op_def_go_proto/op_def.pb.go | 623 + .../reader_base_go_proto/reader_base.pb.go | 153 + .../remote_fused_graph_execute_info.pb.go | 259 + .../resource_handle.pb.go | 244 + .../step_stats_go_proto/step_stats.pb.go | 722 + .../framework/summary_go_proto/summary.pb.go | 895 + .../tensor_description.pb.go | 154 + .../framework/tensor_go_proto/tensor.pb.go | 382 + .../tensor_shape_go_proto/tensor_shape.pb.go | 216 + .../tensor_slice_go_proto/tensor_slice.pb.go | 224 + .../core/framework/types_go_proto/types.pb.go | 376 + .../variable_go_proto/variable.pb.go | 428 + .../versions_go_proto/versions.pb.go | 158 + .../for_core_protos_go_proto/autotuning.pb.go | 714 + .../bfc_memory_map.pb.go | 510 + .../for_core_protos_go_proto/cluster.pb.go | 212 + .../for_core_protos_go_proto/config.pb.go | 2496 + .../control_flow.pb.go | 505 + .../conv_autotuning.pb.go | 254 + .../critical_section.pb.go | 186 + .../for_core_protos_go_proto/debug.pb.go | 410 + .../debug_event.pb.go | 1282 + .../device_filters.pb.go | 255 + .../device_properties.pb.go | 327 + .../eager_service.pb.go | 1920 + .../error_codes.pb.go | 297 + .../graph_debug_info.pb.go | 295 + .../for_core_protos_go_proto/master.pb.go | 1408 + .../master_service.pb.go | 128 + .../for_core_protos_go_proto/meta_graph.pb.go | 1343 + .../named_tensor.pb.go | 144 + .../queue_runner.pb.go | 171 + .../remote_tensor_handle.pb.go | 241 + .../for_core_protos_go_proto/replay_log.pb.go | 645 + .../rewriter_config.pb.go | 926 + .../saved_model.pb.go | 144 + .../saved_object_graph.pb.go | 1175 + .../for_core_protos_go_proto/saver.pb.go | 254 + .../for_core_protos_go_proto/struct.pb.go | 1083 + .../tensor_bundle.pb.go | 340 + .../tensorflow_server.pb.go | 220 + .../trackable_object_graph.pb.go | 412 + .../transport_options.pb.go | 124 + .../verifier_config.pb.go | 194 + .../for_core_protos_go_proto/worker.pb.go | 2752 + .../worker_service.pb.go | 155 + .../tensorflow/go/stream_executor/dnn.pb.go | 820 + .../go-tensorflow/tensorflow/go/version.go | 25 + 177 files changed, 126438 insertions(+), 68 deletions(-) delete mode 100644 example/e2e/build-tensorflow-go/Dockerfile delete mode 100644 example/e2e/build-tensorflow-go/vendor-tensorflow.sh delete mode 100644 example/e2e/compat/README.md rename {example/e2e/build-tensorflow-go => scripts}/build-tf-protoc.sh (78%) create mode 100644 third_party/README.md create mode 100644 third_party/TENSORFLOW.md rename TRITON.md => third_party/TRITON.md (93%) create mode 100644 third_party/go-tensorflow/.gitignore create mode 100644 third_party/go-tensorflow/go.mod create mode 100644 third_party/go-tensorflow/go.sum create mode 100644 third_party/go-tensorflow/tensorflow/go/BUILD create mode 100644 third_party/go-tensorflow/tensorflow/go/README.md create mode 100644 third_party/go-tensorflow/tensorflow/go/android.go create mode 100644 third_party/go-tensorflow/tensorflow/go/attrs.go create mode 100644 third_party/go-tensorflow/tensorflow/go/attrs_test.go create mode 100644 third_party/go-tensorflow/tensorflow/go/context.go create mode 100644 third_party/go-tensorflow/tensorflow/go/context_test.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/framework/allocation_description_go_proto/allocation_description.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/framework/api_def_go_proto/api_def.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/framework/attr_value_go_proto/attr_value.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/framework/cost_graph_go_proto/cost_graph.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/framework/device_attributes_go_proto/device_attributes.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/framework/function_go_proto/function.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/framework/graph_go_proto/graph.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/framework/graph_transfer_info_go_proto/graph_transfer_info.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/framework/kernel_def_go_proto/kernel_def.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/framework/log_memory_go_proto/log_memory.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/framework/node_def_go_proto/node_def.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/framework/op_def_go_proto/op_def.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/framework/reader_base_go_proto/reader_base.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/framework/remote_fused_graph_execute_info_go_proto/remote_fused_graph_execute_info.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/framework/resource_handle_go_proto/resource_handle.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/framework/step_stats_go_proto/step_stats.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/framework/summary_go_proto/summary.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/framework/tensor_description_go_proto/tensor_description.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/framework/tensor_go_proto/tensor.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/framework/tensor_shape_go_proto/tensor_shape.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/framework/tensor_slice_go_proto/tensor_slice.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/framework/types_go_proto/types.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/framework/variable_go_proto/variable.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/framework/versions_go_proto/versions.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/autotuning.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/bfc_memory_map.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/cluster.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/config.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/control_flow.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/conv_autotuning.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/critical_section.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/debug.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/debug_event.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/device_filters.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/device_properties.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/eager_service.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/error_codes.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/graph_debug_info.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/master.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/master_service.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/meta_graph.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/named_tensor.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/queue_runner.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/remote_tensor_handle.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/replay_log.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/rewriter_config.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/saved_model.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/saved_object_graph.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/saver.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/struct.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/tensor_bundle.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/tensorflow_server.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/trackable_object_graph.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/transport_options.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/verifier_config.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/worker.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/worker_service.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/doc.go create mode 100644 third_party/go-tensorflow/tensorflow/go/example_inception_inference_test.go create mode 100644 third_party/go-tensorflow/tensorflow/go/genop/.gitignore create mode 100644 third_party/go-tensorflow/tensorflow/go/genop/generate.go create mode 100644 third_party/go-tensorflow/tensorflow/go/genop/generate.sh create mode 100644 third_party/go-tensorflow/tensorflow/go/genop/generate.win.go create mode 100644 third_party/go-tensorflow/tensorflow/go/genop/internal/api_def_map.go create mode 100644 third_party/go-tensorflow/tensorflow/go/genop/internal/genop.go create mode 100644 third_party/go-tensorflow/tensorflow/go/genop/internal/genop_test.go create mode 100644 third_party/go-tensorflow/tensorflow/go/genop/internal/lib.go create mode 100644 third_party/go-tensorflow/tensorflow/go/genop/main.go create mode 100644 third_party/go-tensorflow/tensorflow/go/graph.go create mode 100644 third_party/go-tensorflow/tensorflow/go/graph_test.go create mode 100644 third_party/go-tensorflow/tensorflow/go/lib.go create mode 100644 third_party/go-tensorflow/tensorflow/go/op/generate.go create mode 100644 third_party/go-tensorflow/tensorflow/go/op/gradients.go create mode 100644 third_party/go-tensorflow/tensorflow/go/op/gradients_test.go create mode 100644 third_party/go-tensorflow/tensorflow/go/op/op.go create mode 100644 third_party/go-tensorflow/tensorflow/go/op/op_test.go create mode 100644 third_party/go-tensorflow/tensorflow/go/op/scope.go create mode 100644 third_party/go-tensorflow/tensorflow/go/op/scope_test.go create mode 100644 third_party/go-tensorflow/tensorflow/go/op/wrappers.go create mode 100644 third_party/go-tensorflow/tensorflow/go/operation.go create mode 100644 third_party/go-tensorflow/tensorflow/go/operation_test.go create mode 100644 third_party/go-tensorflow/tensorflow/go/saved_model.go create mode 100644 third_party/go-tensorflow/tensorflow/go/saved_model_test.go create mode 100644 third_party/go-tensorflow/tensorflow/go/session.go create mode 100644 third_party/go-tensorflow/tensorflow/go/session_test.go create mode 100644 third_party/go-tensorflow/tensorflow/go/shape.go create mode 100644 third_party/go-tensorflow/tensorflow/go/shape_test.go create mode 100644 third_party/go-tensorflow/tensorflow/go/signature.go create mode 100644 third_party/go-tensorflow/tensorflow/go/signature_test.go create mode 100644 third_party/go-tensorflow/tensorflow/go/status.go create mode 100644 third_party/go-tensorflow/tensorflow/go/stream_executor/dnn.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/tensor.go create mode 100644 third_party/go-tensorflow/tensorflow/go/tensor_handle.go create mode 100644 third_party/go-tensorflow/tensorflow/go/tensor_handle_test.go create mode 100644 third_party/go-tensorflow/tensorflow/go/tensor_test.go create mode 100755 third_party/go-tensorflow/tensorflow/go/test.sh create mode 100644 third_party/go-tensorflow/tensorflow/go/util_test.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/allocation_description_go_proto/allocation_description.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/api_def_go_proto/api_def.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/attr_value_go_proto/attr_value.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/cost_graph_go_proto/cost_graph.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/device_attributes_go_proto/device_attributes.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/function_go_proto/function.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/graph_go_proto/graph.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/graph_transfer_info_go_proto/graph_transfer_info.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/kernel_def_go_proto/kernel_def.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/log_memory_go_proto/log_memory.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/node_def_go_proto/node_def.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/op_def_go_proto/op_def.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/reader_base_go_proto/reader_base.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/remote_fused_graph_execute_info_go_proto/remote_fused_graph_execute_info.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/resource_handle_go_proto/resource_handle.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/step_stats_go_proto/step_stats.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/summary_go_proto/summary.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_description_go_proto/tensor_description.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_go_proto/tensor.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_shape_go_proto/tensor_shape.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_slice_go_proto/tensor_slice.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/types_go_proto/types.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/variable_go_proto/variable.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/versions_go_proto/versions.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/autotuning.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/bfc_memory_map.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/cluster.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/config.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/control_flow.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/conv_autotuning.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/critical_section.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/debug.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/debug_event.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/device_filters.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/device_properties.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/eager_service.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/error_codes.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/graph_debug_info.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/master.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/master_service.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/meta_graph.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/named_tensor.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/queue_runner.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/remote_tensor_handle.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/replay_log.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/rewriter_config.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/saved_model.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/saved_object_graph.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/saver.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/struct.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/tensor_bundle.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/tensorflow_server.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/trackable_object_graph.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/transport_options.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/verifier_config.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/worker.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/worker_service.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/stream_executor/dnn.pb.go create mode 100644 third_party/go-tensorflow/tensorflow/go/version.go diff --git a/example/e2e/build-tensorflow-go/Dockerfile b/example/e2e/build-tensorflow-go/Dockerfile deleted file mode 100644 index e0bd74c..0000000 --- a/example/e2e/build-tensorflow-go/Dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -ARG GO_VERSION=1.17 -FROM golang:${GO_VERSION}-bullseye -RUN apt-get update && apt-get -y install --no-install-recommends libprotobuf-dev protobuf-compiler - -COPY install-dependencies.sh /opt/bin/install-dependencies.sh -RUN /bin/bash /opt/bin/install-dependencies.sh - -COPY with-cgo.sh /opt/bin/with-cgo.sh -COPY build-tf-protoc.sh /opt/bin/build-tf-protoc.sh -RUN /bin/bash /opt/bin/build-tf-protoc.sh - -COPY vendor-tensorflow.sh /opt/bin/vendor-tensorflow.sh -WORKDIR /opt/src -CMD ["/bin/bash", "/opt/bin/vendor-tensorflow.sh"] \ No newline at end of file diff --git a/example/e2e/build-tensorflow-go/install-dependencies.sh b/example/e2e/build-tensorflow-go/install-dependencies.sh index c30ef86..0c05671 100644 --- a/example/e2e/build-tensorflow-go/install-dependencies.sh +++ b/example/e2e/build-tensorflow-go/install-dependencies.sh @@ -11,25 +11,8 @@ goVersion=${goVersion:-1.22} export LIBTENSORFLOW_VERSION=2.4.2 if [ -n "$IS_MACOS" ]; then - brew install protobuf brew install libtensorflow - - bash ${appPath}/example/e2e/build-tensorflow-go/build-tf-protoc.sh - - ( - cd ${appPath} - bash ${appPath}/example/e2e/build-tensorflow-go/vendor-tensorflow.sh - ) else # download and install libtensorflow curl https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-2.4.2.tar.gz | sudo tar -xmzv -C /usr/local - - # build tensorflow-go module in docker - docker build -t mly-docker-build-tensorflow-go:1.0 \ - --build-arg GO_VERSION=${goVersion} \ - -f ${appPath}/example/e2e/build-tensorflow-go/Dockerfile \ - ${appPath}/example/e2e/build-tensorflow-go - - # run go mod vendor in the container to pull correct tensorflow module - docker run --rm -v ${appPath}:/opt/src mly-docker-build-tensorflow-go:1.0 fi diff --git a/example/e2e/build-tensorflow-go/vendor-tensorflow.sh b/example/e2e/build-tensorflow-go/vendor-tensorflow.sh deleted file mode 100644 index 189489a..0000000 --- a/example/e2e/build-tensorflow-go/vendor-tensorflow.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -set -x -set -e - -LIBTENSORFLOW_VERSION=${LIBTENSORFLOW_VERSION:-2.4.2} - -go mod edit -require github.com/tensorflow/tensorflow@v${LIBTENSORFLOW_VERSION}+incompatible -go mod vendor \ No newline at end of file diff --git a/example/e2e/build-tensorflow-go/with-cgo.sh b/example/e2e/build-tensorflow-go/with-cgo.sh index f9a34db..3426c77 100755 --- a/example/e2e/build-tensorflow-go/with-cgo.sh +++ b/example/e2e/build-tensorflow-go/with-cgo.sh @@ -7,4 +7,6 @@ goenv_cgo::push /usr/local/lib /opt/homebrew/lib "$@" -goenv_cgo::pop \ No newline at end of file +RET=$? +goenv_cgo::pop +exit $RET \ No newline at end of file diff --git a/example/e2e/compat/README.md b/example/e2e/compat/README.md deleted file mode 100644 index 0f8ae6b..0000000 --- a/example/e2e/compat/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# Backwards compatibility e2e testing - -1. Find latest tagged revision(s). - - Should also be parameterizable. - - If multiple occur, select largest. - - TODO: major version backwards compatibility matrix. - - If the current commit is the the latest tagged revision, search for an older tagged revision. -2. Create build using tagged revision. Run using tagged revision's configuration. -3. Create build using latest revision. Run using latest revision's configuration. -4. Run e2e tests using a 2x2 (until full matrix) of tagged client, latest client, tagged server, latest server. - - Need monitoring of cache thrashing. - - Need to ensure no strict backwards compatibility errors. - - Currently the only dedictated API will be for the HTTP endpoints. - - Since as of v0.8.3 we don't leverage [`internal`](https://go.dev/doc/go1.4#internalpackages), we will mark all available Golang API as unstable. - diff --git a/go.mod b/go.mod index fc48d53..b218d2b 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,6 @@ module github.com/viant/mly -go 1.22 - -toolchain go1.23.3 +go 1.23.6 require ( github.com/aerospike/aerospike-client-go v4.5.2+incompatible @@ -29,6 +27,8 @@ require ( gopkg.in/yaml.v3 v3.0.1 ) +replace github.com/tensorflow/tensorflow => ./third_party/go-tensorflow + require ( github.com/cyningsun/heavy-hitters v0.0.0-20230601160639-238b21a6ddce github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 diff --git a/go.sum b/go.sum index 38a98c1..85920a8 100644 --- a/go.sum +++ b/go.sum @@ -215,8 +215,6 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= -github.com/tensorflow/tensorflow v2.4.2+incompatible h1:v6E2LxMHubd9rljvm0sU6v3yRMO5an00VMoRjlzqSKA= -github.com/tensorflow/tensorflow v2.4.2+incompatible/go.mod h1:itOSERT4trABok4UOoG+X4BoKds9F3rIsySdn+Lvu90= github.com/viant/afs v1.0.0/go.mod h1:wdiEDffZKJwj1ZSFasy7hHoxLQdSpFZkd3XOWNt1aN0= github.com/viant/afs v1.16.1-0.20221201181023-455837320ec5 h1:roScADfArV4sxN0CB14BQbMlPRf4PpVeX3dx9lMQFC4= github.com/viant/afs v1.16.1-0.20221201181023-455837320ec5/go.mod h1:bo/jkTH8sBUhG0PQcPsuskvjb/5uEzgiwygGwtaDw8Q= diff --git a/example/e2e/build-tensorflow-go/build-tf-protoc.sh b/scripts/build-tf-protoc.sh similarity index 78% rename from example/e2e/build-tensorflow-go/build-tf-protoc.sh rename to scripts/build-tf-protoc.sh index 62918a8..0a3862e 100644 --- a/example/e2e/build-tensorflow-go/build-tf-protoc.sh +++ b/scripts/build-tf-protoc.sh @@ -2,15 +2,22 @@ set -x set -e script_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)" + +set +x source $script_dir/goenv_cgo.lib.sh +set -x LIBTENSORFLOW_VERSION=${LIBTENSORFLOW_VERSION:-2.4.2} RESOLVED_GOPATH=$(go env GOPATH) TENSORFLOW_GIT_REPO=$RESOLVED_GOPATH/src/github.com/tensorflow/tensorflow -mkdir -p $TENSORFLOW_GIT_REPO -git clone --depth 1 --branch v${LIBTENSORFLOW_VERSION} https://github.com/tensorflow/tensorflow.git $TENSORFLOW_GIT_REPO || true +TFGIT_DIR_EXISTS=$(ls -A $TENSORFLOW_GIT_REPO | head -n 1) +if [ -z "$TFGIT_DIR_EXISTS" ]; then + mkdir -p $TENSORFLOW_GIT_REPO + git clone --depth 1 --branch v${LIBTENSORFLOW_VERSION} https://github.com/tensorflow/tensorflow.git $TENSORFLOW_GIT_REPO || true +fi + pushd $TENSORFLOW_GIT_REPO if [ ! -f go.mod ]; then diff --git a/third_party/README.md b/third_party/README.md new file mode 100644 index 0000000..996f66c --- /dev/null +++ b/third_party/README.md @@ -0,0 +1,15 @@ +# Third Party Libraries + +# Triton Protocol Buffers + +Directory `triton-common` is mainly used to generate protocol buffer generated files for Triton. + +See (TRITON.md)[TRITON.md] for more information. + +# TensorFlow Protocol Buffers + +The Directory `go-tensorflow` contains protocol buffer generated files as expected by Go for `libtensorflow`. + +See (TENSORFLOW.md)[TENSORFLOW.md] for more information. + + diff --git a/third_party/TENSORFLOW.md b/third_party/TENSORFLOW.md new file mode 100644 index 0000000..a3496c7 --- /dev/null +++ b/third_party/TENSORFLOW.md @@ -0,0 +1,25 @@ +# TensorFlow + +Directory `go-tensorflow`. + +The official TensorFlow team `libtensorflow` no longer provides up to date bindings for CGo. + +We keep the 2.4.2 bindings, as their graph, operations, and kernel API has not changed since then. + +# Construction Notes + +How this was "vendored" into the `third_party` directory: + +1. Use `scripts/build-tf-protoc.sh` to generate Go files from protocol buffer files. + 1. Use `brew` to install `tensorflow` and `protobuf`. + 1. Get `tensorflow/tensorflow` v2.4.2 from Github. + 2. Setup protocol buffer compiler requirements. + 3. Mock pushing to Go mod cache +2. Copy from Go mod cache to `third_party/go-tensorflow`. +3. Strip out files unneeded for Go + 1. Go to `third_party/go-tensorflow` + 2. Remove files except `tensorflow` (`rm -rv $(ls . | grep -v tensorflow)`). + 3. Remove dot files manually. + 4. Go to `tensorflow` + 5. Remove files except under `go` (`rm -rv $(ls . | grep -v '^go$')`). +4. Add `replace` in `viant/mly`'s `go.mod`. diff --git a/TRITON.md b/third_party/TRITON.md similarity index 93% rename from TRITON.md rename to third_party/TRITON.md index 56ee0a1..13951d3 100644 --- a/TRITON.md +++ b/third_party/TRITON.md @@ -47,20 +47,25 @@ which protoc-gen-go-grpc Initialize submodule in `third_party/triton-common`. ```bash -# 1. Delete old generated files (ensures clean regeneration) +git submodule update --init --recursive +``` + +Deleted old generated files, which ensures clean regeneration. + +```bash rm -f proto/triton/grpc_service.pb.go rm -f proto/triton/grpc_service_grpc.pb.go +``` + +Regenerate the files. -# 2. Regenerate +```bash protoc \ -I "$PWD/third_party/triton-common/protobuf" \ --go_out=paths=source_relative,Mgrpc_service.proto=github.com/viant/mly/proto/triton,Mmodel_config.proto=github.com/viant/mly/proto/triton:"$PWD/proto/triton" \ --go-grpc_out=paths=source_relative,Mgrpc_service.proto=github.com/viant/mly/proto/triton,Mmodel_config.proto=github.com/viant/mly/proto/triton:"$PWD/proto/triton" \ "$PWD/third_party/triton-common/protobuf/model_config.proto" \ "$PWD/third_party/triton-common/protobuf/grpc_service.proto" - -# 4. Verify generation succeeded -ls -lh proto/triton/*.pb.go ``` # Verification diff --git a/third_party/go-tensorflow/.gitignore b/third_party/go-tensorflow/.gitignore new file mode 100644 index 0000000..0cfe6fc --- /dev/null +++ b/third_party/go-tensorflow/.gitignore @@ -0,0 +1,49 @@ +.DS_Store +.ipynb_checkpoints +node_modules +/.bazelrc.user +/.tf_configure.bazelrc +/bazel-* +/bazel_pip +/tools/python_bin_path.sh +/tensorflow/tools/git/gen +/pip_test +/_python_build +*.pyc +__pycache__ +*.swp +.vscode/ +cmake_build/ +tensorflow/contrib/cmake/_build/ +.idea/** +/build/ +[Bb]uild/ +/tensorflow/core/util/version_info.cc +/tensorflow/python/framework/fast_tensor_util.cpp +/tensorflow/lite/gen/** +/tensorflow/lite/tools/make/downloads/** +/tensorflow/lite/tools/make/gen/** +/api_init_files_list.txt +/estimator_api_init_files_list.txt +*.whl + +# Android +.gradle +.idea +*.iml +local.properties +gradleBuild + +# iOS +*.pbxproj +*.xcworkspace +/*.podspec +/tensorflow/lite/**/coreml/**/BUILD +/tensorflow/lite/**/ios/BUILD +/tensorflow/lite/**/objc/BUILD +/tensorflow/lite/**/swift/BUILD +/tensorflow/lite/examples/ios/simple/data/*.tflite +/tensorflow/lite/examples/ios/simple/data/*.txt +Podfile.lock +Pods +xcuserdata diff --git a/third_party/go-tensorflow/go.mod b/third_party/go-tensorflow/go.mod new file mode 100644 index 0000000..65f2c04 --- /dev/null +++ b/third_party/go-tensorflow/go.mod @@ -0,0 +1,8 @@ +module github.com/tensorflow/tensorflow + +go 1.23.6 + +require ( + github.com/golang/protobuf v1.5.4 + google.golang.org/protobuf v1.33.0 +) diff --git a/third_party/go-tensorflow/go.sum b/third_party/go-tensorflow/go.sum new file mode 100644 index 0000000..5e3e715 --- /dev/null +++ b/third_party/go-tensorflow/go.sum @@ -0,0 +1,14 @@ +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= diff --git a/third_party/go-tensorflow/tensorflow/go/BUILD b/third_party/go-tensorflow/tensorflow/go/BUILD new file mode 100644 index 0000000..bae3173 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/BUILD @@ -0,0 +1,41 @@ +# Description: +# Go API for TensorFlow. + +package( + default_visibility = ["//visibility:private"], +) + +licenses(["notice"]) # Apache 2.0 + +exports_files(["LICENSE"]) + +load( + "//tensorflow:tensorflow.bzl", + "tf_shared_library_deps", +) + +sh_test( + name = "test", + size = "small", + srcs = ["test.sh"], + data = [ + ":all_files", # Go sources + "//tensorflow/c:headers", # C library header + "//tensorflow/c/eager:headers", # Eager C library header + "//tensorflow/cc/saved_model:saved_model_half_plus_two", # Testdata for LoadSavedModel + ] + tf_shared_library_deps(), + # TODO: Enable this test again once protos are supported by bazel. + tags = ["manual"], +) + +filegroup( + name = "all_files", + srcs = glob( + ["**/*"], + exclude = [ + "**/METADATA", + "**/OWNERS", + ], + ), + visibility = ["//tensorflow:__subpackages__"], +) diff --git a/third_party/go-tensorflow/tensorflow/go/README.md b/third_party/go-tensorflow/tensorflow/go/README.md new file mode 100644 index 0000000..21513b9 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/README.md @@ -0,0 +1,103 @@ +# TensorFlow in Go + +Construct and execute TensorFlow graphs in Go. + +[![GoDoc](https://godoc.org/github.com/tensorflow/tensorflow/tensorflow/go?status.svg)](https://godoc.org/github.com/tensorflow/tensorflow/tensorflow/go) + +> *WARNING*: The API defined in this package is not stable and can change +> without notice. The same goes for the package path: +> (`github.com/tensorflow/tensorflow/tensorflow/go`). + +## Quickstart + +Refer to [Installing TensorFlow for Go](https://www.tensorflow.org/install/lang_go) + +## Building the TensorFlow C library from source + +If the "Quickstart" instructions above do not work (perhaps the release archives +are not available for your operating system or architecture, or you're using a +different version of CUDA/cuDNN), then the TensorFlow C library must be built +from source. + +### Prerequisites + +- [bazel](https://www.bazel.build/versions/master/docs/install.html) +- Environment to build TensorFlow from source code + ([Linux or macOS](https://www.tensorflow.org/install/source)). If you don't + need GPU support, then try the following: + + ```sh + sudo apt-get install python swig python-numpy # Linux + brew install swig # OS X with homebrew + ``` +- [Protocol buffer compiler (protoc) 3.x](https://github.com/google/protobuf/releases/) + +### Build + +1. Download the source code + + ```sh + go get -d github.com/tensorflow/tensorflow/tensorflow/go + ``` + +2. Build the TensorFlow C library: + + ```sh + cd ${GOPATH}/src/github.com/tensorflow/tensorflow + ./configure + bazel build -c opt //tensorflow:libtensorflow.so + ``` + + This can take a while (tens of minutes, more if also building for GPU). + +3. Make `libtensorflow.so` and `libtensorflow_framework.so` available to the + linker. This can be done by either: + + a. Copying it to a system location, e.g., + + ```sh + sudo cp ${GOPATH}/src/github.com/tensorflow/tensorflow/bazel-bin/tensorflow/libtensorflow.so /usr/local/lib + sudo cp ${GOPATH}/src/github.com/tensorflow/tensorflow/bazel-bin/tensorflow/libtensorflow_framework.so /usr/local/lib + ``` + + OR + + b. Setting environment variables: + + ```sh + export LIBRARY_PATH=${GOPATH}/src/github.com/tensorflow/tensorflow/bazel-bin/tensorflow + # Linux + export LD_LIBRARY_PATH=${GOPATH}/src/github.com/tensorflow/tensorflow/bazel-bin/tensorflow + # OS X + export DYLD_LIBRARY_PATH=${GOPATH}/src/github.com/tensorflow/tensorflow/bazel-bin/tensorflow + ``` + +4. Build and test: + + ```sh + go generate github.com/tensorflow/tensorflow/tensorflow/go/op + go test github.com/tensorflow/tensorflow/tensorflow/go + ``` + +### Generate wrapper functions for ops + +Go functions corresponding to TensorFlow operations are generated in `op/wrappers.go`. To regenerate them: + +Prerequisites: +- [Protocol buffer compiler (protoc) 3.x](https://github.com/google/protobuf/releases/) +- The TensorFlow repository under GOPATH + +```sh +go generate github.com/tensorflow/tensorflow/tensorflow/go/op +``` + +## Support + +Use [stackoverflow](http://stackoverflow.com/questions/tagged/tensorflow) and/or +[Github issues](https://github.com/tensorflow/tensorflow/issues). + +## Contributions + +Contributions are welcome. If making any signification changes, probably best to +discuss on a [Github issue](https://github.com/tensorflow/tensorflow/issues) +before investing too much time. Github pull requests are used for contributions. diff --git a/third_party/go-tensorflow/tensorflow/go/android.go b/third_party/go-tensorflow/tensorflow/go/android.go new file mode 100644 index 0000000..3db3ddf --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/android.go @@ -0,0 +1,20 @@ +// Copyright 2016 The TensorFlow Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +build android + +package tensorflow + +// #cgo LDFLAGS: -landroid -llog -lm -lz -ldl +import "C" diff --git a/third_party/go-tensorflow/tensorflow/go/attrs.go b/third_party/go-tensorflow/tensorflow/go/attrs.go new file mode 100644 index 0000000..ed1a1f0 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/attrs.go @@ -0,0 +1,246 @@ +/* +Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package tensorflow + +// #include +// #include "tensorflow/c/c_api.h" +import "C" +import ( + "fmt" + "unsafe" +) + +// makeCShape converts a shape specified in C.int64_t into a Shape. +func makeCShape(shape []C.int64_t) Shape { + s := Shape{dims: make([]int64, len(shape))} + for i, n := range shape { + s.dims[i] = int64(n) + } + return s +} + +// Attr returns the value of an attribute on op. It returns an error if the +// attribute does not exist. +func (op *Operation) Attr(name string) (interface{}, error) { + cname := C.CString(name) + defer C.free(unsafe.Pointer(cname)) + + status := newStatus() + meta := C.TF_OperationGetAttrMetadata(op.c, cname, status.c) + if err := status.Err(); err != nil { + return nil, err + } + + if meta.is_list == 1 { + return listAttribute(op, cname, meta) + } + return scalarAttribute(op, cname, meta) +} + +func listAttribute(op *Operation, cname *C.char, meta C.TF_AttrMetadata) (interface{}, error) { + status := newStatus() + + switch meta._type { + case C.TF_ATTR_STRING: + if meta.list_size == 0 { + return []string(nil), nil + } + values := make([]unsafe.Pointer, meta.list_size) + lengths := make([]C.size_t, meta.list_size) + // Add one element in case total_size is zero. + storage := make([]C.char, meta.total_size+1) + C.TF_OperationGetAttrStringList(op.c, cname, &values[0], &lengths[0], C.int(meta.list_size), unsafe.Pointer(&storage[0]), C.size_t(meta.total_size), status.c) + if err := status.Err(); err != nil { + return nil, err + } + list := make([]string, meta.list_size) + for i, val := range values { + length := lengths[i] + list[i] = C.GoStringN((*C.char)(val), C.int(length)) + } + return list, nil + + case C.TF_ATTR_INT: + if meta.list_size == 0 { + return []int64(nil), nil + } + list := make([]C.int64_t, meta.list_size) + C.TF_OperationGetAttrIntList(op.c, cname, &list[0], C.int(meta.list_size), status.c) + if err := status.Err(); err != nil { + return nil, err + } + vals := make([]int64, meta.list_size) + for i, val := range list { + vals[i] = int64(val) + } + return vals, nil + + case C.TF_ATTR_FLOAT: + if meta.list_size == 0 { + return []float32(nil), nil + } + list := make([]C.float, meta.list_size) + C.TF_OperationGetAttrFloatList(op.c, cname, &list[0], C.int(meta.list_size), status.c) + if err := status.Err(); err != nil { + return nil, err + } + vals := make([]float32, meta.list_size) + for i, val := range list { + vals[i] = float32(val) + } + return vals, nil + + case C.TF_ATTR_BOOL: + if meta.list_size == 0 { + return []bool(nil), nil + } + list := make([]C.uchar, meta.list_size) + C.TF_OperationGetAttrBoolList(op.c, cname, &list[0], C.int(meta.list_size), status.c) + if err := status.Err(); err != nil { + return nil, err + } + vals := make([]bool, meta.list_size) + for i, val := range list { + vals[i] = val == 1 + } + return vals, nil + + case C.TF_ATTR_TYPE: + if meta.list_size == 0 { + return []DataType(nil), nil + } + list := make([]C.TF_DataType, meta.list_size) + C.TF_OperationGetAttrTypeList(op.c, cname, &list[0], C.int(meta.list_size), status.c) + if err := status.Err(); err != nil { + return nil, err + } + vals := make([]DataType, meta.list_size) + for i, val := range list { + vals[i] = DataType(val) + } + return vals, nil + + case C.TF_ATTR_TENSOR: + if meta.list_size == 0 { + return []*Tensor(nil), nil + } + list := make([]*C.TF_Tensor, meta.list_size) + C.TF_OperationGetAttrTensorList(op.c, cname, &list[0], C.int(meta.list_size), status.c) + if err := status.Err(); err != nil { + return nil, err + } + vals := make([]*Tensor, meta.list_size) + for i, t := range list { + vals[i] = newTensorFromC(t) + } + return vals, nil + + case C.TF_ATTR_SHAPE: + if meta.list_size == 0 { + return []Shape(nil), nil + } + dims := make([]*C.int64_t, meta.list_size) + numDims := make([]C.int, meta.list_size) + // Add one element in case total_size is zero. + storage := make([]C.int64_t, meta.total_size+1) + C.TF_OperationGetAttrShapeList(op.c, cname, &dims[0], &numDims[0], C.int(meta.list_size), &storage[0], C.int(meta.total_size), status.c) + if err := status.Err(); err != nil { + return nil, err + } + list := make([]Shape, meta.list_size) + for i, dim := range dims { + numDim := numDims[i] + // If the number of dimensions is unknown, default to empty shape. + if numDim < 0 { + continue + } + // A []C.int64_t slice backed by C memory. + // See: https://github.com/golang/go/wiki/cgo#turning-c-arrays-into-go-slices + // Using [1<<27] instead of [1<<30] so it works on 32-bit architecture + slice := (*[1 << 27]C.int64_t)(unsafe.Pointer(dim))[:numDim:numDim] + list[i] = makeCShape(slice) + } + return list, nil + + default: + return nil, fmt.Errorf("list type %v not supported", meta._type) + } +} + +func scalarAttribute(op *Operation, cname *C.char, meta C.TF_AttrMetadata) (interface{}, error) { + status := newStatus() + + switch meta._type { + case C.TF_ATTR_STRING: + if meta.total_size == 0 { + return "", nil + } + v := make([]C.char, meta.total_size) + C.TF_OperationGetAttrString(op.c, cname, unsafe.Pointer(&v[0]), C.size_t(meta.total_size), status.c) + if err := status.Err(); err != nil { + return nil, err + } + return C.GoStringN(&v[0], C.int(meta.total_size)), nil + + case C.TF_ATTR_INT: + var v C.int64_t + C.TF_OperationGetAttrInt(op.c, cname, &v, status.c) + return int64(v), status.Err() + + case C.TF_ATTR_FLOAT: + var v C.float + C.TF_OperationGetAttrFloat(op.c, cname, &v, status.c) + return float32(v), status.Err() + + case C.TF_ATTR_BOOL: + var v C.uchar + C.TF_OperationGetAttrBool(op.c, cname, &v, status.c) + return v == 1, status.Err() + + case C.TF_ATTR_TYPE: + var v C.TF_DataType + C.TF_OperationGetAttrType(op.c, cname, &v, status.c) + return DataType(v), status.Err() + + case C.TF_ATTR_TENSOR: + var v *C.TF_Tensor + C.TF_OperationGetAttrTensor(op.c, cname, &v, status.c) + if err := status.Err(); err != nil { + return nil, err + } + return newTensorFromC(v), nil + + case C.TF_ATTR_SHAPE: + numDims := meta.total_size + // If number of dims is unknown return empty shape to indicate that. + if numDims < 0 { + return Shape{}, nil + } + if numDims == 0 { + return ScalarShape(), nil + } + dims := make([]C.int64_t, numDims) + C.TF_OperationGetAttrShape(op.c, cname, (*C.int64_t)(unsafe.Pointer(&dims[0])), C.int(numDims), status.c) + if err := status.Err(); err != nil { + return nil, err + } + return makeCShape(dims), nil + + default: + return nil, fmt.Errorf("type %v not supported", meta._type) + } +} diff --git a/third_party/go-tensorflow/tensorflow/go/attrs_test.go b/third_party/go-tensorflow/tensorflow/go/attrs_test.go new file mode 100644 index 0000000..ea8af22 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/attrs_test.go @@ -0,0 +1,193 @@ +/* +Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package tensorflow + +import ( + "fmt" + "reflect" + "testing" +) + +func TestOperationAttrs(t *testing.T) { + g := NewGraph() + + i := 0 + makeConst := func(v interface{}) Output { + op, err := Const(g, fmt.Sprintf("const/%d/%+v", i, v), v) + i++ + if err != nil { + t.Fatal(err) + } + return op + } + + makeTensor := func(v interface{}) *Tensor { + tensor, err := NewTensor(v) + if err != nil { + t.Fatal(err) + } + return tensor + } + + cases := []OpSpec{ + { + Name: "type", + Type: "Placeholder", + Attrs: map[string]interface{}{ + "dtype": Float, + }, + }, + { + Name: "list(float)", + Type: "Bucketize", + Input: []Input{ + makeConst([]float32{1, 2, 3, 4}), + }, + Attrs: map[string]interface{}{ + "boundaries": []float32{0, 1, 2, 3, 4, 5}, + }, + }, + { + Name: "list(float) empty", + Type: "Bucketize", + Input: []Input{ + makeConst([]float32{}), + }, + Attrs: map[string]interface{}{ + "boundaries": []float32(nil), + }, + }, + /* TODO(ashankar): debug this issue and add it back later. + { + Name: "list(type),list(shape)", + Type: "InfeedEnqueueTuple", + Input: []Input{ + OutputList([]Output{ + makeConst(float32(1)), + makeConst([][]int32{{2}}), + }), + }, + Attrs: map[string]interface{}{ + "dtypes": []DataType{Float, Int32}, + "shapes": []Shape{ScalarShape(), MakeShape(1, 1)}, + }, + }, + { + Name: "list(type),list(shape) empty", + Type: "InfeedEnqueueTuple", + Input: []Input{ + OutputList([]Output{ + makeConst([][]int32{{2}}), + }), + }, + Attrs: map[string]interface{}{ + "dtypes": []DataType{Int32}, + "shapes": []Shape(nil), + }, + }, + { + Name: "list(type) empty,string empty,int", + Type: "_XlaSendFromHost", + Input: []Input{ + OutputList([]Output{}), + makeConst(""), + }, + Attrs: map[string]interface{}{ + "Tinputs": []DataType(nil), + "key": "", + "device_ordinal": int64(0), + }, + }, + */ + { + Name: "list(int),int", + Type: "StringToHashBucketStrong", + Input: []Input{ + makeConst(""), + }, + Attrs: map[string]interface{}{ + "num_buckets": int64(2), + "key": []int64{1, 2}, + }, + }, + { + Name: "list(int) empty,int", + Type: "StringToHashBucketStrong", + Input: []Input{ + makeConst(""), + }, + Attrs: map[string]interface{}{ + "num_buckets": int64(2), + "key": ([]int64)(nil), + }, + }, + { + Name: "list(string),type", + Type: "TensorSummary", + Input: []Input{ + makeConst(""), + }, + Attrs: map[string]interface{}{ + "T": String, + "labels": []string{"foo", "bar"}, + }, + }, + { + Name: "list(string) empty,type", + Type: "TensorSummary", + Input: []Input{ + makeConst(""), + }, + Attrs: map[string]interface{}{ + "T": String, + "labels": ([]string)(nil), + }, + }, + { + Name: "tensor", + Type: "Const", + Attrs: map[string]interface{}{ + "dtype": String, + "value": makeTensor("foo"), + }, + }, + } + + for i, spec := range cases { + op, err := g.AddOperation(spec) + if err != nil { + t.Fatal(err) + } + for key, want := range spec.Attrs { + out, err := op.Attr(key) + if err != nil { + t.Fatal(err) + } + if !reflect.DeepEqual(out, want) { + t.Fatalf("%d. %q: Got %#v, wanted %#v", i, key, out, want) + } + wantT, ok := want.(*Tensor) + if ok { + wantVal := wantT.Value() + outVal := out.(*Tensor).Value() + if !reflect.DeepEqual(outVal, wantVal) { + t.Fatalf("%d. %q: Got %#v, wanted %#v", i, key, outVal, wantVal) + } + } + } + } +} diff --git a/third_party/go-tensorflow/tensorflow/go/context.go b/third_party/go-tensorflow/tensorflow/go/context.go new file mode 100644 index 0000000..04f8628 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/context.go @@ -0,0 +1,109 @@ +/* +Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package tensorflow + +// #include +// #include "tensorflow/c/c_api.h" +// #include "tensorflow/c/eager/c_api.h" +import "C" +import ( + "fmt" + "runtime" +) + +// ContextOptions contains configuration information for a session +type ContextOptions struct { + // Config is a binary-serialized representation of the + // tensorflow.ConfigProto protocol message + // (https://www.tensorflow.org/code/tensorflow/core/protobuf/config.proto). + Config []byte + + // Sets the default execution mode + Async bool +} + +// c converts the ContextOptions to the C API's TF_ContextOptions. +// Caller takes ownership of returned object. +func (o *ContextOptions) c() (*C.TFE_ContextOptions, error) { + opt := C.TFE_NewContextOptions() + if o == nil { + return opt, nil + } + + if sz := len(o.Config); sz > 0 { + status := newStatus() + cConfig := C.CBytes(o.Config) + C.TFE_ContextOptionsSetConfig(opt, cConfig, C.size_t(sz), status.c) + C.free(cConfig) + if err := status.Err(); err != nil { + C.TFE_DeleteContextOptions(opt) + return nil, fmt.Errorf("invalid ContextOptions.Config: %v", err) + } + } + + var async uint8 + if o.Async { + async = 1 + } + C.TFE_ContextOptionsSetAsync(opt, C.uchar(async)) + + return opt, nil +} + +// Context for executing operations eagerly. +// +// A Context allows operations to be executed immediately. It encapsulates +// information such as the available devices, resource manager etc. It also +// allows the user to configure execution using a ConfigProto, as they can +// configure a Session when executing a Graph. +type Context struct { + c *C.TFE_Context +} + +// NewContext creates a new context for eager execution. +// options may be nil to use the default options. +func NewContext(options *ContextOptions) (*Context, error) { + status := newStatus() + cOpt, err := options.c() + if err != nil { + return nil, err + } + defer C.TFE_DeleteContextOptions(cOpt) + cContext := C.TFE_NewContext(cOpt, status.c) + if err := status.Err(); err != nil { + return nil, err + } + + c := &Context{c: cContext} + runtime.SetFinalizer(c, (*Context).finalizer) + return c, nil +} + +func (c *Context) finalizer() { + C.TFE_DeleteContext(c.c) +} + +// ListDevices returns the list of devices associated with a Context. +func (c *Context) ListDevices() ([]Device, error) { + status := newStatus() + devicesList := C.TFE_ContextListDevices(c.c, status.c) + if err := status.Err(); err != nil { + return nil, fmt.Errorf("SessionListDevices() failed: %v", err) + } + defer C.TF_DeleteDeviceList(devicesList) + return deviceSliceFromDeviceList(devicesList) +} diff --git a/third_party/go-tensorflow/tensorflow/go/context_test.go b/third_party/go-tensorflow/tensorflow/go/context_test.go new file mode 100644 index 0000000..ce4005d --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/context_test.go @@ -0,0 +1,57 @@ +/* +Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package tensorflow + +import ( + "fmt" + "testing" +) + +func TestContextConfigSetAsync(t *testing.T) { + tests := []bool{false, true} + for _, test := range tests { + t.Run(fmt.Sprint(test), func(t *testing.T) { + opt := &ContextOptions{Async: test} + if _, err := NewContext(opt); err != nil { + t.Fatal(err) + } + }) + } +} + +func TestContextConfigListDevices(t *testing.T) { + c, err := NewContext(nil) + if err != nil { + t.Fatal(err) + } + devs, err := c.ListDevices() + if err != nil { + t.Fatal(err) + } + if len(devs) < 1 { + t.Fatalf("No devices found using ListDevices()") + } + foundCPUDevice := false + for _, d := range devs { + if d.Type == "CPU" { + foundCPUDevice = true + } + } + if !foundCPUDevice { + t.Error("Failed to find CPU device using ListDevices()") + } +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/framework/allocation_description_go_proto/allocation_description.pb.go b/third_party/go-tensorflow/tensorflow/go/core/framework/allocation_description_go_proto/allocation_description.pb.go new file mode 100644 index 0000000..2cadcf8 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/framework/allocation_description_go_proto/allocation_description.pb.go @@ -0,0 +1,175 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/allocation_description.proto + +package allocation_description_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type AllocationDescription struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Total number of bytes requested + RequestedBytes int64 `protobuf:"varint,1,opt,name=requested_bytes,json=requestedBytes,proto3" json:"requested_bytes,omitempty"` + // Total number of bytes allocated if known + AllocatedBytes int64 `protobuf:"varint,2,opt,name=allocated_bytes,json=allocatedBytes,proto3" json:"allocated_bytes,omitempty"` + // Name of the allocator used + AllocatorName string `protobuf:"bytes,3,opt,name=allocator_name,json=allocatorName,proto3" json:"allocator_name,omitempty"` + // Identifier of the allocated buffer if known + AllocationId int64 `protobuf:"varint,4,opt,name=allocation_id,json=allocationId,proto3" json:"allocation_id,omitempty"` + // Set if this tensor only has one remaining reference + HasSingleReference bool `protobuf:"varint,5,opt,name=has_single_reference,json=hasSingleReference,proto3" json:"has_single_reference,omitempty"` + // Address of the allocation. + Ptr uint64 `protobuf:"varint,6,opt,name=ptr,proto3" json:"ptr,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AllocationDescription) Reset() { + *x = AllocationDescription{} + mi := &file_tensorflow_core_framework_allocation_description_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AllocationDescription) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AllocationDescription) ProtoMessage() {} + +func (x *AllocationDescription) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_allocation_description_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AllocationDescription.ProtoReflect.Descriptor instead. +func (*AllocationDescription) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_allocation_description_proto_rawDescGZIP(), []int{0} +} + +func (x *AllocationDescription) GetRequestedBytes() int64 { + if x != nil { + return x.RequestedBytes + } + return 0 +} + +func (x *AllocationDescription) GetAllocatedBytes() int64 { + if x != nil { + return x.AllocatedBytes + } + return 0 +} + +func (x *AllocationDescription) GetAllocatorName() string { + if x != nil { + return x.AllocatorName + } + return "" +} + +func (x *AllocationDescription) GetAllocationId() int64 { + if x != nil { + return x.AllocationId + } + return 0 +} + +func (x *AllocationDescription) GetHasSingleReference() bool { + if x != nil { + return x.HasSingleReference + } + return false +} + +func (x *AllocationDescription) GetPtr() uint64 { + if x != nil { + return x.Ptr + } + return 0 +} + +var File_tensorflow_core_framework_allocation_description_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_allocation_description_proto_rawDesc = "" + + "\n" + + "6tensorflow/core/framework/allocation_description.proto\x12\n" + + "tensorflow\"\xf9\x01\n" + + "\x15AllocationDescription\x12'\n" + + "\x0frequested_bytes\x18\x01 \x01(\x03R\x0erequestedBytes\x12'\n" + + "\x0fallocated_bytes\x18\x02 \x01(\x03R\x0eallocatedBytes\x12%\n" + + "\x0eallocator_name\x18\x03 \x01(\tR\rallocatorName\x12#\n" + + "\rallocation_id\x18\x04 \x01(\x03R\fallocationId\x120\n" + + "\x14has_single_reference\x18\x05 \x01(\bR\x12hasSingleReference\x12\x10\n" + + "\x03ptr\x18\x06 \x01(\x04R\x03ptrB\x9b\x01\n" + + "\x18org.tensorflow.frameworkB\x1bAllocationDescriptionProtosP\x01Z]github.com/tensorflow/tensorflow/tensorflow/go/core/framework/allocation_description_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_allocation_description_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_allocation_description_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_allocation_description_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_allocation_description_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_allocation_description_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_allocation_description_proto_rawDesc), len(file_tensorflow_core_framework_allocation_description_proto_rawDesc))) + }) + return file_tensorflow_core_framework_allocation_description_proto_rawDescData +} + +var file_tensorflow_core_framework_allocation_description_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_tensorflow_core_framework_allocation_description_proto_goTypes = []any{ + (*AllocationDescription)(nil), // 0: tensorflow.AllocationDescription +} +var file_tensorflow_core_framework_allocation_description_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_allocation_description_proto_init() } +func file_tensorflow_core_framework_allocation_description_proto_init() { + if File_tensorflow_core_framework_allocation_description_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_allocation_description_proto_rawDesc), len(file_tensorflow_core_framework_allocation_description_proto_rawDesc)), + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_allocation_description_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_allocation_description_proto_depIdxs, + MessageInfos: file_tensorflow_core_framework_allocation_description_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_allocation_description_proto = out.File + file_tensorflow_core_framework_allocation_description_proto_goTypes = nil + file_tensorflow_core_framework_allocation_description_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/framework/api_def_go_proto/api_def.pb.go b/third_party/go-tensorflow/tensorflow/go/core/framework/api_def_go_proto/api_def.pb.go new file mode 100644 index 0000000..f6a05b9 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/framework/api_def_go_proto/api_def.pb.go @@ -0,0 +1,630 @@ +// Defines the text format for including per-op API definition and +// overrides for client language op code generators. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/api_def.proto + +package api_def_go_proto + +import ( + attr_value_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/attr_value_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type ApiDef_Visibility int32 + +const ( + // Normally this is "VISIBLE" unless you are inheriting a + // different value from another ApiDef. + ApiDef_DEFAULT_VISIBILITY ApiDef_Visibility = 0 + // Publicly visible in the API. + ApiDef_VISIBLE ApiDef_Visibility = 1 + // Do not include this op in the generated API. If visibility is + // set to 'SKIP', other fields are ignored for this op. + ApiDef_SKIP ApiDef_Visibility = 2 + // Hide this op by putting it into an internal namespace (or whatever + // is appropriate in the target language). + ApiDef_HIDDEN ApiDef_Visibility = 3 +) + +// Enum value maps for ApiDef_Visibility. +var ( + ApiDef_Visibility_name = map[int32]string{ + 0: "DEFAULT_VISIBILITY", + 1: "VISIBLE", + 2: "SKIP", + 3: "HIDDEN", + } + ApiDef_Visibility_value = map[string]int32{ + "DEFAULT_VISIBILITY": 0, + "VISIBLE": 1, + "SKIP": 2, + "HIDDEN": 3, + } +) + +func (x ApiDef_Visibility) Enum() *ApiDef_Visibility { + p := new(ApiDef_Visibility) + *p = x + return p +} + +func (x ApiDef_Visibility) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ApiDef_Visibility) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_framework_api_def_proto_enumTypes[0].Descriptor() +} + +func (ApiDef_Visibility) Type() protoreflect.EnumType { + return &file_tensorflow_core_framework_api_def_proto_enumTypes[0] +} + +func (x ApiDef_Visibility) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ApiDef_Visibility.Descriptor instead. +func (ApiDef_Visibility) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_framework_api_def_proto_rawDescGZIP(), []int{0, 0} +} + +// Used to specify and override the default API & behavior in the +// generated code for client languages, from what you would get from +// the OpDef alone. There will be a set of ApiDefs that are common +// to all client languages, and another set per client language. +// The per-client-language ApiDefs will inherit values from the +// 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 +// graphs. Overrides go in an "api_def.pbtxt" file with a text-format +// ApiDefs message. +// +// WARNING: Be *very* careful changing the API for any existing op -- +// you can change the semantics of existing code. These changes may +// need to wait until a major release of TensorFlow to avoid breaking +// our compatibility promises. +type ApiDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Name of the op (in the OpDef) to specify the API for. + GraphOpName string `protobuf:"bytes,1,opt,name=graph_op_name,json=graphOpName,proto3" json:"graph_op_name,omitempty"` + // If this op is deprecated, set deprecation message to the message + // that should be logged when this op is used. + // The message should indicate alternative op to use, if any. + DeprecationMessage string `protobuf:"bytes,12,opt,name=deprecation_message,json=deprecationMessage,proto3" json:"deprecation_message,omitempty"` + // Major version when the op will be deleted. For e.g. set this + // value to 2 if op API should be removed in TensorFlow 2.0 and + // deprecated in versions before that. + DeprecationVersion int32 `protobuf:"varint,13,opt,name=deprecation_version,json=deprecationVersion,proto3" json:"deprecation_version,omitempty"` + Visibility ApiDef_Visibility `protobuf:"varint,2,opt,name=visibility,proto3,enum=tensorflow.ApiDef_Visibility" json:"visibility,omitempty"` + Endpoint []*ApiDef_Endpoint `protobuf:"bytes,3,rep,name=endpoint,proto3" json:"endpoint,omitempty"` + InArg []*ApiDef_Arg `protobuf:"bytes,4,rep,name=in_arg,json=inArg,proto3" json:"in_arg,omitempty"` + OutArg []*ApiDef_Arg `protobuf:"bytes,5,rep,name=out_arg,json=outArg,proto3" json:"out_arg,omitempty"` + // List of original in_arg names to specify new argument order. + // Length of arg_order should be either empty to keep current order + // or match size of in_arg. + ArgOrder []string `protobuf:"bytes,11,rep,name=arg_order,json=argOrder,proto3" json:"arg_order,omitempty"` + Attr []*ApiDef_Attr `protobuf:"bytes,6,rep,name=attr,proto3" json:"attr,omitempty"` + // One-line human-readable description of what the Op does. + Summary string `protobuf:"bytes,7,opt,name=summary,proto3" json:"summary,omitempty"` + // Additional, longer human-readable description of what the Op does. + Description string `protobuf:"bytes,8,opt,name=description,proto3" json:"description,omitempty"` + // Modify an existing/inherited description by adding text to the beginning + // or end. + DescriptionPrefix string `protobuf:"bytes,9,opt,name=description_prefix,json=descriptionPrefix,proto3" json:"description_prefix,omitempty"` + DescriptionSuffix string `protobuf:"bytes,10,opt,name=description_suffix,json=descriptionSuffix,proto3" json:"description_suffix,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ApiDef) Reset() { + *x = ApiDef{} + mi := &file_tensorflow_core_framework_api_def_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ApiDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ApiDef) ProtoMessage() {} + +func (x *ApiDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_api_def_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ApiDef.ProtoReflect.Descriptor instead. +func (*ApiDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_api_def_proto_rawDescGZIP(), []int{0} +} + +func (x *ApiDef) GetGraphOpName() string { + if x != nil { + return x.GraphOpName + } + return "" +} + +func (x *ApiDef) GetDeprecationMessage() string { + if x != nil { + return x.DeprecationMessage + } + return "" +} + +func (x *ApiDef) GetDeprecationVersion() int32 { + if x != nil { + return x.DeprecationVersion + } + return 0 +} + +func (x *ApiDef) GetVisibility() ApiDef_Visibility { + if x != nil { + return x.Visibility + } + return ApiDef_DEFAULT_VISIBILITY +} + +func (x *ApiDef) GetEndpoint() []*ApiDef_Endpoint { + if x != nil { + return x.Endpoint + } + return nil +} + +func (x *ApiDef) GetInArg() []*ApiDef_Arg { + if x != nil { + return x.InArg + } + return nil +} + +func (x *ApiDef) GetOutArg() []*ApiDef_Arg { + if x != nil { + return x.OutArg + } + return nil +} + +func (x *ApiDef) GetArgOrder() []string { + if x != nil { + return x.ArgOrder + } + return nil +} + +func (x *ApiDef) GetAttr() []*ApiDef_Attr { + if x != nil { + return x.Attr + } + return nil +} + +func (x *ApiDef) GetSummary() string { + if x != nil { + return x.Summary + } + return "" +} + +func (x *ApiDef) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *ApiDef) GetDescriptionPrefix() string { + if x != nil { + return x.DescriptionPrefix + } + return "" +} + +func (x *ApiDef) GetDescriptionSuffix() string { + if x != nil { + return x.DescriptionSuffix + } + return "" +} + +type ApiDefs struct { + state protoimpl.MessageState `protogen:"open.v1"` + Op []*ApiDef `protobuf:"bytes,1,rep,name=op,proto3" json:"op,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ApiDefs) Reset() { + *x = ApiDefs{} + mi := &file_tensorflow_core_framework_api_def_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ApiDefs) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ApiDefs) ProtoMessage() {} + +func (x *ApiDefs) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_api_def_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ApiDefs.ProtoReflect.Descriptor instead. +func (*ApiDefs) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_api_def_proto_rawDescGZIP(), []int{1} +} + +func (x *ApiDefs) GetOp() []*ApiDef { + if x != nil { + return x.Op + } + return nil +} + +// If you specify any endpoint, this will replace all of the +// inherited endpoints. The first endpoint should be the +// "canonical" endpoint, and should not be deprecated (unless all +// endpoints are deprecated). +type ApiDef_Endpoint struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Name should be either like "CamelCaseName" or + // "Package.CamelCaseName". Client-language-specific ApiDefs may + // use a snake_case convention instead of CamelCase. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Set if this endpoint is deprecated. If set to true, a message suggesting + // to use a non-deprecated endpoint instead will be printed. If all + // endpoints are deprecated, set deprecation_message in ApiDef instead. + Deprecated bool `protobuf:"varint,3,opt,name=deprecated,proto3" json:"deprecated,omitempty"` + // Major version when an endpoint will be deleted. For e.g. set this + // value to 2 if endpoint should be removed in TensorFlow 2.0 and + // deprecated in versions before that. + DeprecationVersion int32 `protobuf:"varint,4,opt,name=deprecation_version,json=deprecationVersion,proto3" json:"deprecation_version,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ApiDef_Endpoint) Reset() { + *x = ApiDef_Endpoint{} + mi := &file_tensorflow_core_framework_api_def_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ApiDef_Endpoint) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ApiDef_Endpoint) ProtoMessage() {} + +func (x *ApiDef_Endpoint) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_api_def_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ApiDef_Endpoint.ProtoReflect.Descriptor instead. +func (*ApiDef_Endpoint) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_api_def_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *ApiDef_Endpoint) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ApiDef_Endpoint) GetDeprecated() bool { + if x != nil { + return x.Deprecated + } + return false +} + +func (x *ApiDef_Endpoint) GetDeprecationVersion() int32 { + if x != nil { + return x.DeprecationVersion + } + return 0 +} + +type ApiDef_Arg struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Change the name used to access this arg in the API from what + // is used in the GraphDef. Note that these names in `backticks` + // will also be replaced in the summary & description fields. + RenameTo string `protobuf:"bytes,2,opt,name=rename_to,json=renameTo,proto3" json:"rename_to,omitempty"` + // Note: this will replace any inherited arg doc. There is no + // current way of modifying arg descriptions (other than replacing + // them entirely) as can be done with op descriptions. + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ApiDef_Arg) Reset() { + *x = ApiDef_Arg{} + mi := &file_tensorflow_core_framework_api_def_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ApiDef_Arg) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ApiDef_Arg) ProtoMessage() {} + +func (x *ApiDef_Arg) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_api_def_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ApiDef_Arg.ProtoReflect.Descriptor instead. +func (*ApiDef_Arg) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_api_def_proto_rawDescGZIP(), []int{0, 1} +} + +func (x *ApiDef_Arg) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ApiDef_Arg) GetRenameTo() string { + if x != nil { + return x.RenameTo + } + return "" +} + +func (x *ApiDef_Arg) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +// Description of the graph-construction-time configuration of this +// Op. That is to say, this describes the attr fields that will +// be specified in the NodeDef. +type ApiDef_Attr struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Change the name used to access this attr in the API from what + // is used in the GraphDef. Note that these names in `backticks` + // will also be replaced in the summary & description fields. + RenameTo string `protobuf:"bytes,2,opt,name=rename_to,json=renameTo,proto3" json:"rename_to,omitempty"` + // Specify a new default value to use for this attr. This default + // will be used when creating new graphs, as opposed to the + // default in the OpDef, which will be used when interpreting old + // GraphDefs. + DefaultValue *attr_value_go_proto.AttrValue `protobuf:"bytes,3,opt,name=default_value,json=defaultValue,proto3" json:"default_value,omitempty"` + // Note: this will replace any inherited attr doc, there is no current + // way of modifying attr descriptions as can be done with op descriptions. + Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ApiDef_Attr) Reset() { + *x = ApiDef_Attr{} + mi := &file_tensorflow_core_framework_api_def_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ApiDef_Attr) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ApiDef_Attr) ProtoMessage() {} + +func (x *ApiDef_Attr) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_api_def_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ApiDef_Attr.ProtoReflect.Descriptor instead. +func (*ApiDef_Attr) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_api_def_proto_rawDescGZIP(), []int{0, 2} +} + +func (x *ApiDef_Attr) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ApiDef_Attr) GetRenameTo() string { + if x != nil { + return x.RenameTo + } + return "" +} + +func (x *ApiDef_Attr) GetDefaultValue() *attr_value_go_proto.AttrValue { + if x != nil { + return x.DefaultValue + } + return nil +} + +func (x *ApiDef_Attr) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +var File_tensorflow_core_framework_api_def_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_api_def_proto_rawDesc = "" + + "\n" + + "'tensorflow/core/framework/api_def.proto\x12\n" + + "tensorflow\x1a*tensorflow/core/framework/attr_value.proto\"\xf6\a\n" + + "\x06ApiDef\x12\"\n" + + "\rgraph_op_name\x18\x01 \x01(\tR\vgraphOpName\x12/\n" + + "\x13deprecation_message\x18\f \x01(\tR\x12deprecationMessage\x12/\n" + + "\x13deprecation_version\x18\r \x01(\x05R\x12deprecationVersion\x12=\n" + + "\n" + + "visibility\x18\x02 \x01(\x0e2\x1d.tensorflow.ApiDef.VisibilityR\n" + + "visibility\x127\n" + + "\bendpoint\x18\x03 \x03(\v2\x1b.tensorflow.ApiDef.EndpointR\bendpoint\x12-\n" + + "\x06in_arg\x18\x04 \x03(\v2\x16.tensorflow.ApiDef.ArgR\x05inArg\x12/\n" + + "\aout_arg\x18\x05 \x03(\v2\x16.tensorflow.ApiDef.ArgR\x06outArg\x12\x1b\n" + + "\targ_order\x18\v \x03(\tR\bargOrder\x12+\n" + + "\x04attr\x18\x06 \x03(\v2\x17.tensorflow.ApiDef.AttrR\x04attr\x12\x18\n" + + "\asummary\x18\a \x01(\tR\asummary\x12 \n" + + "\vdescription\x18\b \x01(\tR\vdescription\x12-\n" + + "\x12description_prefix\x18\t \x01(\tR\x11descriptionPrefix\x12-\n" + + "\x12description_suffix\x18\n" + + " \x01(\tR\x11descriptionSuffix\x1ao\n" + + "\bEndpoint\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x1e\n" + + "\n" + + "deprecated\x18\x03 \x01(\bR\n" + + "deprecated\x12/\n" + + "\x13deprecation_version\x18\x04 \x01(\x05R\x12deprecationVersion\x1aX\n" + + "\x03Arg\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x1b\n" + + "\trename_to\x18\x02 \x01(\tR\brenameTo\x12 \n" + + "\vdescription\x18\x03 \x01(\tR\vdescription\x1a\x95\x01\n" + + "\x04Attr\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x1b\n" + + "\trename_to\x18\x02 \x01(\tR\brenameTo\x12:\n" + + "\rdefault_value\x18\x03 \x01(\v2\x15.tensorflow.AttrValueR\fdefaultValue\x12 \n" + + "\vdescription\x18\x04 \x01(\tR\vdescription\"G\n" + + "\n" + + "Visibility\x12\x16\n" + + "\x12DEFAULT_VISIBILITY\x10\x00\x12\v\n" + + "\aVISIBLE\x10\x01\x12\b\n" + + "\x04SKIP\x10\x02\x12\n" + + "\n" + + "\x06HIDDEN\x10\x03\"-\n" + + "\aApiDefs\x12\"\n" + + "\x02op\x18\x01 \x03(\v2\x12.tensorflow.ApiDefR\x02opB}\n" + + "\x18org.tensorflow.frameworkB\fApiDefProtosP\x01ZNgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/api_def_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_api_def_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_api_def_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_api_def_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_api_def_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_api_def_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_api_def_proto_rawDesc), len(file_tensorflow_core_framework_api_def_proto_rawDesc))) + }) + return file_tensorflow_core_framework_api_def_proto_rawDescData +} + +var file_tensorflow_core_framework_api_def_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_tensorflow_core_framework_api_def_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_tensorflow_core_framework_api_def_proto_goTypes = []any{ + (ApiDef_Visibility)(0), // 0: tensorflow.ApiDef.Visibility + (*ApiDef)(nil), // 1: tensorflow.ApiDef + (*ApiDefs)(nil), // 2: tensorflow.ApiDefs + (*ApiDef_Endpoint)(nil), // 3: tensorflow.ApiDef.Endpoint + (*ApiDef_Arg)(nil), // 4: tensorflow.ApiDef.Arg + (*ApiDef_Attr)(nil), // 5: tensorflow.ApiDef.Attr + (*attr_value_go_proto.AttrValue)(nil), // 6: tensorflow.AttrValue +} +var file_tensorflow_core_framework_api_def_proto_depIdxs = []int32{ + 0, // 0: tensorflow.ApiDef.visibility:type_name -> tensorflow.ApiDef.Visibility + 3, // 1: tensorflow.ApiDef.endpoint:type_name -> tensorflow.ApiDef.Endpoint + 4, // 2: tensorflow.ApiDef.in_arg:type_name -> tensorflow.ApiDef.Arg + 4, // 3: tensorflow.ApiDef.out_arg:type_name -> tensorflow.ApiDef.Arg + 5, // 4: tensorflow.ApiDef.attr:type_name -> tensorflow.ApiDef.Attr + 1, // 5: tensorflow.ApiDefs.op:type_name -> tensorflow.ApiDef + 6, // 6: tensorflow.ApiDef.Attr.default_value:type_name -> tensorflow.AttrValue + 7, // [7:7] is the sub-list for method output_type + 7, // [7:7] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_api_def_proto_init() } +func file_tensorflow_core_framework_api_def_proto_init() { + if File_tensorflow_core_framework_api_def_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_api_def_proto_rawDesc), len(file_tensorflow_core_framework_api_def_proto_rawDesc)), + NumEnums: 1, + NumMessages: 5, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_api_def_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_api_def_proto_depIdxs, + EnumInfos: file_tensorflow_core_framework_api_def_proto_enumTypes, + MessageInfos: file_tensorflow_core_framework_api_def_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_api_def_proto = out.File + file_tensorflow_core_framework_api_def_proto_goTypes = nil + file_tensorflow_core_framework_api_def_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/framework/attr_value_go_proto/attr_value.pb.go b/third_party/go-tensorflow/tensorflow/go/core/framework/attr_value_go_proto/attr_value.pb.go new file mode 100644 index 0000000..6aab6e3 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/framework/attr_value_go_proto/attr_value.pb.go @@ -0,0 +1,517 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/attr_value.proto + +package attr_value_go_proto + +import ( + tensor_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_go_proto" + tensor_shape_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_shape_go_proto" + types_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/types_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Protocol buffer representing the value for an attr used to configure an Op. +// Comment indicates the corresponding attr type. Only the field matching the +// attr type may be filled. +type AttrValue struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Value: + // + // *AttrValue_S + // *AttrValue_I + // *AttrValue_F + // *AttrValue_B + // *AttrValue_Type + // *AttrValue_Shape + // *AttrValue_Tensor + // *AttrValue_List + // *AttrValue_Func + // *AttrValue_Placeholder + Value isAttrValue_Value `protobuf_oneof:"value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AttrValue) Reset() { + *x = AttrValue{} + mi := &file_tensorflow_core_framework_attr_value_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AttrValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AttrValue) ProtoMessage() {} + +func (x *AttrValue) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_attr_value_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AttrValue.ProtoReflect.Descriptor instead. +func (*AttrValue) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_attr_value_proto_rawDescGZIP(), []int{0} +} + +func (x *AttrValue) GetValue() isAttrValue_Value { + if x != nil { + return x.Value + } + return nil +} + +func (x *AttrValue) GetS() []byte { + if x != nil { + if x, ok := x.Value.(*AttrValue_S); ok { + return x.S + } + } + return nil +} + +func (x *AttrValue) GetI() int64 { + if x != nil { + if x, ok := x.Value.(*AttrValue_I); ok { + return x.I + } + } + return 0 +} + +func (x *AttrValue) GetF() float32 { + if x != nil { + if x, ok := x.Value.(*AttrValue_F); ok { + return x.F + } + } + return 0 +} + +func (x *AttrValue) GetB() bool { + if x != nil { + if x, ok := x.Value.(*AttrValue_B); ok { + return x.B + } + } + return false +} + +func (x *AttrValue) GetType() types_go_proto.DataType { + if x != nil { + if x, ok := x.Value.(*AttrValue_Type); ok { + return x.Type + } + } + return types_go_proto.DataType(0) +} + +func (x *AttrValue) GetShape() *tensor_shape_go_proto.TensorShapeProto { + if x != nil { + if x, ok := x.Value.(*AttrValue_Shape); ok { + return x.Shape + } + } + return nil +} + +func (x *AttrValue) GetTensor() *tensor_go_proto.TensorProto { + if x != nil { + if x, ok := x.Value.(*AttrValue_Tensor); ok { + return x.Tensor + } + } + return nil +} + +func (x *AttrValue) GetList() *AttrValue_ListValue { + if x != nil { + if x, ok := x.Value.(*AttrValue_List); ok { + return x.List + } + } + return nil +} + +func (x *AttrValue) GetFunc() *NameAttrList { + if x != nil { + if x, ok := x.Value.(*AttrValue_Func); ok { + return x.Func + } + } + return nil +} + +func (x *AttrValue) GetPlaceholder() string { + if x != nil { + if x, ok := x.Value.(*AttrValue_Placeholder); ok { + return x.Placeholder + } + } + return "" +} + +type isAttrValue_Value interface { + isAttrValue_Value() +} + +type AttrValue_S struct { + S []byte `protobuf:"bytes,2,opt,name=s,proto3,oneof"` // "string" +} + +type AttrValue_I struct { + I int64 `protobuf:"varint,3,opt,name=i,proto3,oneof"` // "int" +} + +type AttrValue_F struct { + F float32 `protobuf:"fixed32,4,opt,name=f,proto3,oneof"` // "float" +} + +type AttrValue_B struct { + B bool `protobuf:"varint,5,opt,name=b,proto3,oneof"` // "bool" +} + +type AttrValue_Type struct { + Type types_go_proto.DataType `protobuf:"varint,6,opt,name=type,proto3,enum=tensorflow.DataType,oneof"` // "type" +} + +type AttrValue_Shape struct { + Shape *tensor_shape_go_proto.TensorShapeProto `protobuf:"bytes,7,opt,name=shape,proto3,oneof"` // "shape" +} + +type AttrValue_Tensor struct { + Tensor *tensor_go_proto.TensorProto `protobuf:"bytes,8,opt,name=tensor,proto3,oneof"` // "tensor" +} + +type AttrValue_List struct { + List *AttrValue_ListValue `protobuf:"bytes,1,opt,name=list,proto3,oneof"` // any "list(...)" +} + +type AttrValue_Func struct { + // "func" represents a function. func.name is a function's name or + // a primitive op's name. func.attr.first is the name of an attr + // defined for that function. func.attr.second is the value for + // that attr in the instantiation. + Func *NameAttrList `protobuf:"bytes,10,opt,name=func,proto3,oneof"` +} + +type AttrValue_Placeholder struct { + // This is a placeholder only used in nodes defined inside a + // function. It indicates the attr value will be supplied when + // the function is instantiated. For example, let us suppose a + // node "N" in function "FN". "N" has an attr "A" with value + // placeholder = "foo". When FN is instantiated with attr "foo" + // set to "bar", the instantiated node N's attr A will have been + // given the value "bar". + Placeholder string `protobuf:"bytes,9,opt,name=placeholder,proto3,oneof"` +} + +func (*AttrValue_S) isAttrValue_Value() {} + +func (*AttrValue_I) isAttrValue_Value() {} + +func (*AttrValue_F) isAttrValue_Value() {} + +func (*AttrValue_B) isAttrValue_Value() {} + +func (*AttrValue_Type) isAttrValue_Value() {} + +func (*AttrValue_Shape) isAttrValue_Value() {} + +func (*AttrValue_Tensor) isAttrValue_Value() {} + +func (*AttrValue_List) isAttrValue_Value() {} + +func (*AttrValue_Func) isAttrValue_Value() {} + +func (*AttrValue_Placeholder) isAttrValue_Value() {} + +// A list of attr names and their values. The whole list is attached +// with a string name. E.g., MatMul[T=float]. +type NameAttrList struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Attr map[string]*AttrValue `protobuf:"bytes,2,rep,name=attr,proto3" json:"attr,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NameAttrList) Reset() { + *x = NameAttrList{} + mi := &file_tensorflow_core_framework_attr_value_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NameAttrList) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NameAttrList) ProtoMessage() {} + +func (x *NameAttrList) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_attr_value_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NameAttrList.ProtoReflect.Descriptor instead. +func (*NameAttrList) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_attr_value_proto_rawDescGZIP(), []int{1} +} + +func (x *NameAttrList) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *NameAttrList) GetAttr() map[string]*AttrValue { + if x != nil { + return x.Attr + } + return nil +} + +// LINT.IfChange +type AttrValue_ListValue struct { + state protoimpl.MessageState `protogen:"open.v1"` + S [][]byte `protobuf:"bytes,2,rep,name=s,proto3" json:"s,omitempty"` // "list(string)" + I []int64 `protobuf:"varint,3,rep,packed,name=i,proto3" json:"i,omitempty"` // "list(int)" + F []float32 `protobuf:"fixed32,4,rep,packed,name=f,proto3" json:"f,omitempty"` // "list(float)" + B []bool `protobuf:"varint,5,rep,packed,name=b,proto3" json:"b,omitempty"` // "list(bool)" + Type []types_go_proto.DataType `protobuf:"varint,6,rep,packed,name=type,proto3,enum=tensorflow.DataType" json:"type,omitempty"` // "list(type)" + Shape []*tensor_shape_go_proto.TensorShapeProto `protobuf:"bytes,7,rep,name=shape,proto3" json:"shape,omitempty"` // "list(shape)" + Tensor []*tensor_go_proto.TensorProto `protobuf:"bytes,8,rep,name=tensor,proto3" json:"tensor,omitempty"` // "list(tensor)" + Func []*NameAttrList `protobuf:"bytes,9,rep,name=func,proto3" json:"func,omitempty"` // "list(attr)" + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AttrValue_ListValue) Reset() { + *x = AttrValue_ListValue{} + mi := &file_tensorflow_core_framework_attr_value_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AttrValue_ListValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AttrValue_ListValue) ProtoMessage() {} + +func (x *AttrValue_ListValue) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_attr_value_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AttrValue_ListValue.ProtoReflect.Descriptor instead. +func (*AttrValue_ListValue) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_attr_value_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *AttrValue_ListValue) GetS() [][]byte { + if x != nil { + return x.S + } + return nil +} + +func (x *AttrValue_ListValue) GetI() []int64 { + if x != nil { + return x.I + } + return nil +} + +func (x *AttrValue_ListValue) GetF() []float32 { + if x != nil { + return x.F + } + return nil +} + +func (x *AttrValue_ListValue) GetB() []bool { + if x != nil { + return x.B + } + return nil +} + +func (x *AttrValue_ListValue) GetType() []types_go_proto.DataType { + if x != nil { + return x.Type + } + return nil +} + +func (x *AttrValue_ListValue) GetShape() []*tensor_shape_go_proto.TensorShapeProto { + if x != nil { + return x.Shape + } + return nil +} + +func (x *AttrValue_ListValue) GetTensor() []*tensor_go_proto.TensorProto { + if x != nil { + return x.Tensor + } + return nil +} + +func (x *AttrValue_ListValue) GetFunc() []*NameAttrList { + if x != nil { + return x.Func + } + return nil +} + +var File_tensorflow_core_framework_attr_value_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_attr_value_proto_rawDesc = "" + + "\n" + + "*tensorflow/core/framework/attr_value.proto\x12\n" + + "tensorflow\x1a&tensorflow/core/framework/tensor.proto\x1a,tensorflow/core/framework/tensor_shape.proto\x1a%tensorflow/core/framework/types.proto\"\x87\x05\n" + + "\tAttrValue\x12\x0e\n" + + "\x01s\x18\x02 \x01(\fH\x00R\x01s\x12\x0e\n" + + "\x01i\x18\x03 \x01(\x03H\x00R\x01i\x12\x0e\n" + + "\x01f\x18\x04 \x01(\x02H\x00R\x01f\x12\x0e\n" + + "\x01b\x18\x05 \x01(\bH\x00R\x01b\x12*\n" + + "\x04type\x18\x06 \x01(\x0e2\x14.tensorflow.DataTypeH\x00R\x04type\x124\n" + + "\x05shape\x18\a \x01(\v2\x1c.tensorflow.TensorShapeProtoH\x00R\x05shape\x121\n" + + "\x06tensor\x18\b \x01(\v2\x17.tensorflow.TensorProtoH\x00R\x06tensor\x125\n" + + "\x04list\x18\x01 \x01(\v2\x1f.tensorflow.AttrValue.ListValueH\x00R\x04list\x12.\n" + + "\x04func\x18\n" + + " \x01(\v2\x18.tensorflow.NameAttrListH\x00R\x04func\x12\"\n" + + "\vplaceholder\x18\t \x01(\tH\x00R\vplaceholder\x1a\x90\x02\n" + + "\tListValue\x12\f\n" + + "\x01s\x18\x02 \x03(\fR\x01s\x12\x10\n" + + "\x01i\x18\x03 \x03(\x03B\x02\x10\x01R\x01i\x12\x10\n" + + "\x01f\x18\x04 \x03(\x02B\x02\x10\x01R\x01f\x12\x10\n" + + "\x01b\x18\x05 \x03(\bB\x02\x10\x01R\x01b\x12,\n" + + "\x04type\x18\x06 \x03(\x0e2\x14.tensorflow.DataTypeB\x02\x10\x01R\x04type\x122\n" + + "\x05shape\x18\a \x03(\v2\x1c.tensorflow.TensorShapeProtoR\x05shape\x12/\n" + + "\x06tensor\x18\b \x03(\v2\x17.tensorflow.TensorProtoR\x06tensor\x12,\n" + + "\x04func\x18\t \x03(\v2\x18.tensorflow.NameAttrListR\x04funcB\a\n" + + "\x05value\"\xaa\x01\n" + + "\fNameAttrList\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x126\n" + + "\x04attr\x18\x02 \x03(\v2\".tensorflow.NameAttrList.AttrEntryR\x04attr\x1aN\n" + + "\tAttrEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12+\n" + + "\x05value\x18\x02 \x01(\v2\x15.tensorflow.AttrValueR\x05value:\x028\x01B\x83\x01\n" + + "\x18org.tensorflow.frameworkB\x0fAttrValueProtosP\x01ZQgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/attr_value_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_attr_value_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_attr_value_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_attr_value_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_attr_value_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_attr_value_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_attr_value_proto_rawDesc), len(file_tensorflow_core_framework_attr_value_proto_rawDesc))) + }) + return file_tensorflow_core_framework_attr_value_proto_rawDescData +} + +var file_tensorflow_core_framework_attr_value_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_tensorflow_core_framework_attr_value_proto_goTypes = []any{ + (*AttrValue)(nil), // 0: tensorflow.AttrValue + (*NameAttrList)(nil), // 1: tensorflow.NameAttrList + (*AttrValue_ListValue)(nil), // 2: tensorflow.AttrValue.ListValue + nil, // 3: tensorflow.NameAttrList.AttrEntry + (types_go_proto.DataType)(0), // 4: tensorflow.DataType + (*tensor_shape_go_proto.TensorShapeProto)(nil), // 5: tensorflow.TensorShapeProto + (*tensor_go_proto.TensorProto)(nil), // 6: tensorflow.TensorProto +} +var file_tensorflow_core_framework_attr_value_proto_depIdxs = []int32{ + 4, // 0: tensorflow.AttrValue.type:type_name -> tensorflow.DataType + 5, // 1: tensorflow.AttrValue.shape:type_name -> tensorflow.TensorShapeProto + 6, // 2: tensorflow.AttrValue.tensor:type_name -> tensorflow.TensorProto + 2, // 3: tensorflow.AttrValue.list:type_name -> tensorflow.AttrValue.ListValue + 1, // 4: tensorflow.AttrValue.func:type_name -> tensorflow.NameAttrList + 3, // 5: tensorflow.NameAttrList.attr:type_name -> tensorflow.NameAttrList.AttrEntry + 4, // 6: tensorflow.AttrValue.ListValue.type:type_name -> tensorflow.DataType + 5, // 7: tensorflow.AttrValue.ListValue.shape:type_name -> tensorflow.TensorShapeProto + 6, // 8: tensorflow.AttrValue.ListValue.tensor:type_name -> tensorflow.TensorProto + 1, // 9: tensorflow.AttrValue.ListValue.func:type_name -> tensorflow.NameAttrList + 0, // 10: tensorflow.NameAttrList.AttrEntry.value:type_name -> tensorflow.AttrValue + 11, // [11:11] is the sub-list for method output_type + 11, // [11:11] is the sub-list for method input_type + 11, // [11:11] is the sub-list for extension type_name + 11, // [11:11] is the sub-list for extension extendee + 0, // [0:11] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_attr_value_proto_init() } +func file_tensorflow_core_framework_attr_value_proto_init() { + if File_tensorflow_core_framework_attr_value_proto != nil { + return + } + file_tensorflow_core_framework_attr_value_proto_msgTypes[0].OneofWrappers = []any{ + (*AttrValue_S)(nil), + (*AttrValue_I)(nil), + (*AttrValue_F)(nil), + (*AttrValue_B)(nil), + (*AttrValue_Type)(nil), + (*AttrValue_Shape)(nil), + (*AttrValue_Tensor)(nil), + (*AttrValue_List)(nil), + (*AttrValue_Func)(nil), + (*AttrValue_Placeholder)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_attr_value_proto_rawDesc), len(file_tensorflow_core_framework_attr_value_proto_rawDesc)), + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_attr_value_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_attr_value_proto_depIdxs, + MessageInfos: file_tensorflow_core_framework_attr_value_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_attr_value_proto = out.File + file_tensorflow_core_framework_attr_value_proto_goTypes = nil + file_tensorflow_core_framework_attr_value_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/framework/cost_graph_go_proto/cost_graph.pb.go b/third_party/go-tensorflow/tensorflow/go/core/framework/cost_graph_go_proto/cost_graph.pb.go new file mode 100644 index 0000000..6c633a7 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/framework/cost_graph_go_proto/cost_graph.pb.go @@ -0,0 +1,549 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/cost_graph.proto + +package cost_graph_go_proto + +import ( + tensor_shape_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_shape_go_proto" + types_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/types_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type CostGraphDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + Node []*CostGraphDef_Node `protobuf:"bytes,1,rep,name=node,proto3" json:"node,omitempty"` + Cost []*CostGraphDef_AggregatedCost `protobuf:"bytes,2,rep,name=cost,proto3" json:"cost,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CostGraphDef) Reset() { + *x = CostGraphDef{} + mi := &file_tensorflow_core_framework_cost_graph_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CostGraphDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CostGraphDef) ProtoMessage() {} + +func (x *CostGraphDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_cost_graph_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CostGraphDef.ProtoReflect.Descriptor instead. +func (*CostGraphDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_cost_graph_proto_rawDescGZIP(), []int{0} +} + +func (x *CostGraphDef) GetNode() []*CostGraphDef_Node { + if x != nil { + return x.Node + } + return nil +} + +func (x *CostGraphDef) GetCost() []*CostGraphDef_AggregatedCost { + if x != nil { + return x.Cost + } + return nil +} + +type CostGraphDef_Node struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The name of the node. Names are globally unique. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // The device of the node. Can be empty if the node is mapped to the + // default partition or partitioning hasn't been run yet. + Device string `protobuf:"bytes,2,opt,name=device,proto3" json:"device,omitempty"` + // The id of the node. Node ids are only unique inside a partition. + Id int32 `protobuf:"varint,3,opt,name=id,proto3" json:"id,omitempty"` + InputInfo []*CostGraphDef_Node_InputInfo `protobuf:"bytes,4,rep,name=input_info,json=inputInfo,proto3" json:"input_info,omitempty"` + OutputInfo []*CostGraphDef_Node_OutputInfo `protobuf:"bytes,5,rep,name=output_info,json=outputInfo,proto3" json:"output_info,omitempty"` + // Temporary memory used by this node. + TemporaryMemorySize int64 `protobuf:"varint,6,opt,name=temporary_memory_size,json=temporaryMemorySize,proto3" json:"temporary_memory_size,omitempty"` + // Persistent memory used by this node. + PersistentMemorySize int64 `protobuf:"varint,12,opt,name=persistent_memory_size,json=persistentMemorySize,proto3" json:"persistent_memory_size,omitempty"` + // Deprecated: Marked as deprecated in tensorflow/core/framework/cost_graph.proto. + HostTempMemorySize int64 `protobuf:"varint,10,opt,name=host_temp_memory_size,json=hostTempMemorySize,proto3" json:"host_temp_memory_size,omitempty"` + // Deprecated: Marked as deprecated in tensorflow/core/framework/cost_graph.proto. + DeviceTempMemorySize int64 `protobuf:"varint,11,opt,name=device_temp_memory_size,json=deviceTempMemorySize,proto3" json:"device_temp_memory_size,omitempty"` + // Deprecated: Marked as deprecated in tensorflow/core/framework/cost_graph.proto. + DevicePersistentMemorySize int64 `protobuf:"varint,16,opt,name=device_persistent_memory_size,json=devicePersistentMemorySize,proto3" json:"device_persistent_memory_size,omitempty"` + // Estimate of the computational cost of this node, in microseconds. + ComputeCost int64 `protobuf:"varint,9,opt,name=compute_cost,json=computeCost,proto3" json:"compute_cost,omitempty"` + // Analytical estimate of the computational cost of this node, in + // microseconds. + ComputeTime int64 `protobuf:"varint,14,opt,name=compute_time,json=computeTime,proto3" json:"compute_time,omitempty"` + // Analytical estimate of the memory access cost of this node, in + // microseconds. + MemoryTime int64 `protobuf:"varint,15,opt,name=memory_time,json=memoryTime,proto3" json:"memory_time,omitempty"` + // If true, the output is permanent: it can't be discarded, because this + // node is part of the "final output". Nodes may depend on final nodes. + IsFinal bool `protobuf:"varint,7,opt,name=is_final,json=isFinal,proto3" json:"is_final,omitempty"` + // Ids of the control inputs for this node. + ControlInput []int32 `protobuf:"varint,8,rep,packed,name=control_input,json=controlInput,proto3" json:"control_input,omitempty"` + // Are the costs inaccurate? + Inaccurate bool `protobuf:"varint,17,opt,name=inaccurate,proto3" json:"inaccurate,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CostGraphDef_Node) Reset() { + *x = CostGraphDef_Node{} + mi := &file_tensorflow_core_framework_cost_graph_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CostGraphDef_Node) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CostGraphDef_Node) ProtoMessage() {} + +func (x *CostGraphDef_Node) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_cost_graph_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CostGraphDef_Node.ProtoReflect.Descriptor instead. +func (*CostGraphDef_Node) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_cost_graph_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *CostGraphDef_Node) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CostGraphDef_Node) GetDevice() string { + if x != nil { + return x.Device + } + return "" +} + +func (x *CostGraphDef_Node) GetId() int32 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *CostGraphDef_Node) GetInputInfo() []*CostGraphDef_Node_InputInfo { + if x != nil { + return x.InputInfo + } + return nil +} + +func (x *CostGraphDef_Node) GetOutputInfo() []*CostGraphDef_Node_OutputInfo { + if x != nil { + return x.OutputInfo + } + return nil +} + +func (x *CostGraphDef_Node) GetTemporaryMemorySize() int64 { + if x != nil { + return x.TemporaryMemorySize + } + return 0 +} + +func (x *CostGraphDef_Node) GetPersistentMemorySize() int64 { + if x != nil { + return x.PersistentMemorySize + } + return 0 +} + +// Deprecated: Marked as deprecated in tensorflow/core/framework/cost_graph.proto. +func (x *CostGraphDef_Node) GetHostTempMemorySize() int64 { + if x != nil { + return x.HostTempMemorySize + } + return 0 +} + +// Deprecated: Marked as deprecated in tensorflow/core/framework/cost_graph.proto. +func (x *CostGraphDef_Node) GetDeviceTempMemorySize() int64 { + if x != nil { + return x.DeviceTempMemorySize + } + return 0 +} + +// Deprecated: Marked as deprecated in tensorflow/core/framework/cost_graph.proto. +func (x *CostGraphDef_Node) GetDevicePersistentMemorySize() int64 { + if x != nil { + return x.DevicePersistentMemorySize + } + return 0 +} + +func (x *CostGraphDef_Node) GetComputeCost() int64 { + if x != nil { + return x.ComputeCost + } + return 0 +} + +func (x *CostGraphDef_Node) GetComputeTime() int64 { + if x != nil { + return x.ComputeTime + } + return 0 +} + +func (x *CostGraphDef_Node) GetMemoryTime() int64 { + if x != nil { + return x.MemoryTime + } + return 0 +} + +func (x *CostGraphDef_Node) GetIsFinal() bool { + if x != nil { + return x.IsFinal + } + return false +} + +func (x *CostGraphDef_Node) GetControlInput() []int32 { + if x != nil { + return x.ControlInput + } + return nil +} + +func (x *CostGraphDef_Node) GetInaccurate() bool { + if x != nil { + return x.Inaccurate + } + return false +} + +// Total cost of this graph, typically used for balancing decisions. +type CostGraphDef_AggregatedCost struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Aggregated cost value. + Cost float32 `protobuf:"fixed32,1,opt,name=cost,proto3" json:"cost,omitempty"` + // Aggregated cost dimension (e.g. 'memory', 'compute', 'network'). + Dimension string `protobuf:"bytes,2,opt,name=dimension,proto3" json:"dimension,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CostGraphDef_AggregatedCost) Reset() { + *x = CostGraphDef_AggregatedCost{} + mi := &file_tensorflow_core_framework_cost_graph_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CostGraphDef_AggregatedCost) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CostGraphDef_AggregatedCost) ProtoMessage() {} + +func (x *CostGraphDef_AggregatedCost) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_cost_graph_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CostGraphDef_AggregatedCost.ProtoReflect.Descriptor instead. +func (*CostGraphDef_AggregatedCost) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_cost_graph_proto_rawDescGZIP(), []int{0, 1} +} + +func (x *CostGraphDef_AggregatedCost) GetCost() float32 { + if x != nil { + return x.Cost + } + return 0 +} + +func (x *CostGraphDef_AggregatedCost) GetDimension() string { + if x != nil { + return x.Dimension + } + return "" +} + +// 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. +type CostGraphDef_Node_InputInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + PrecedingNode int32 `protobuf:"varint,1,opt,name=preceding_node,json=precedingNode,proto3" json:"preceding_node,omitempty"` + PrecedingPort int32 `protobuf:"varint,2,opt,name=preceding_port,json=precedingPort,proto3" json:"preceding_port,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CostGraphDef_Node_InputInfo) Reset() { + *x = CostGraphDef_Node_InputInfo{} + mi := &file_tensorflow_core_framework_cost_graph_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CostGraphDef_Node_InputInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CostGraphDef_Node_InputInfo) ProtoMessage() {} + +func (x *CostGraphDef_Node_InputInfo) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_cost_graph_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CostGraphDef_Node_InputInfo.ProtoReflect.Descriptor instead. +func (*CostGraphDef_Node_InputInfo) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_cost_graph_proto_rawDescGZIP(), []int{0, 0, 0} +} + +func (x *CostGraphDef_Node_InputInfo) GetPrecedingNode() int32 { + if x != nil { + return x.PrecedingNode + } + return 0 +} + +func (x *CostGraphDef_Node_InputInfo) GetPrecedingPort() int32 { + if x != nil { + return x.PrecedingPort + } + return 0 +} + +// Outputs of this node. +type CostGraphDef_Node_OutputInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + Size int64 `protobuf:"varint,1,opt,name=size,proto3" json:"size,omitempty"` + // If >= 0, the output is an alias of an input. Note that an alias input + // may itself be an alias. The algorithm will therefore need to follow + // those pointers. + AliasInputPort int64 `protobuf:"varint,2,opt,name=alias_input_port,json=aliasInputPort,proto3" json:"alias_input_port,omitempty"` + Shape *tensor_shape_go_proto.TensorShapeProto `protobuf:"bytes,3,opt,name=shape,proto3" json:"shape,omitempty"` + Dtype types_go_proto.DataType `protobuf:"varint,4,opt,name=dtype,proto3,enum=tensorflow.DataType" json:"dtype,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CostGraphDef_Node_OutputInfo) Reset() { + *x = CostGraphDef_Node_OutputInfo{} + mi := &file_tensorflow_core_framework_cost_graph_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CostGraphDef_Node_OutputInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CostGraphDef_Node_OutputInfo) ProtoMessage() {} + +func (x *CostGraphDef_Node_OutputInfo) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_cost_graph_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CostGraphDef_Node_OutputInfo.ProtoReflect.Descriptor instead. +func (*CostGraphDef_Node_OutputInfo) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_cost_graph_proto_rawDescGZIP(), []int{0, 0, 1} +} + +func (x *CostGraphDef_Node_OutputInfo) GetSize() int64 { + if x != nil { + return x.Size + } + return 0 +} + +func (x *CostGraphDef_Node_OutputInfo) GetAliasInputPort() int64 { + if x != nil { + return x.AliasInputPort + } + return 0 +} + +func (x *CostGraphDef_Node_OutputInfo) GetShape() *tensor_shape_go_proto.TensorShapeProto { + if x != nil { + return x.Shape + } + return nil +} + +func (x *CostGraphDef_Node_OutputInfo) GetDtype() types_go_proto.DataType { + if x != nil { + return x.Dtype + } + return types_go_proto.DataType(0) +} + +var File_tensorflow_core_framework_cost_graph_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_cost_graph_proto_rawDesc = "" + + "\n" + + "*tensorflow/core/framework/cost_graph.proto\x12\n" + + "tensorflow\x1a,tensorflow/core/framework/tensor_shape.proto\x1a%tensorflow/core/framework/types.proto\"\x8c\t\n" + + "\fCostGraphDef\x121\n" + + "\x04node\x18\x01 \x03(\v2\x1d.tensorflow.CostGraphDef.NodeR\x04node\x12;\n" + + "\x04cost\x18\x02 \x03(\v2'.tensorflow.CostGraphDef.AggregatedCostR\x04cost\x1a\xc7\a\n" + + "\x04Node\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x16\n" + + "\x06device\x18\x02 \x01(\tR\x06device\x12\x0e\n" + + "\x02id\x18\x03 \x01(\x05R\x02id\x12F\n" + + "\n" + + "input_info\x18\x04 \x03(\v2'.tensorflow.CostGraphDef.Node.InputInfoR\tinputInfo\x12I\n" + + "\voutput_info\x18\x05 \x03(\v2(.tensorflow.CostGraphDef.Node.OutputInfoR\n" + + "outputInfo\x122\n" + + "\x15temporary_memory_size\x18\x06 \x01(\x03R\x13temporaryMemorySize\x124\n" + + "\x16persistent_memory_size\x18\f \x01(\x03R\x14persistentMemorySize\x125\n" + + "\x15host_temp_memory_size\x18\n" + + " \x01(\x03B\x02\x18\x01R\x12hostTempMemorySize\x129\n" + + "\x17device_temp_memory_size\x18\v \x01(\x03B\x02\x18\x01R\x14deviceTempMemorySize\x12E\n" + + "\x1ddevice_persistent_memory_size\x18\x10 \x01(\x03B\x02\x18\x01R\x1adevicePersistentMemorySize\x12!\n" + + "\fcompute_cost\x18\t \x01(\x03R\vcomputeCost\x12!\n" + + "\fcompute_time\x18\x0e \x01(\x03R\vcomputeTime\x12\x1f\n" + + "\vmemory_time\x18\x0f \x01(\x03R\n" + + "memoryTime\x12\x19\n" + + "\bis_final\x18\a \x01(\bR\aisFinal\x12#\n" + + "\rcontrol_input\x18\b \x03(\x05R\fcontrolInput\x12\x1e\n" + + "\n" + + "inaccurate\x18\x11 \x01(\bR\n" + + "inaccurate\x1aY\n" + + "\tInputInfo\x12%\n" + + "\x0epreceding_node\x18\x01 \x01(\x05R\rprecedingNode\x12%\n" + + "\x0epreceding_port\x18\x02 \x01(\x05R\rprecedingPort\x1a\xaa\x01\n" + + "\n" + + "OutputInfo\x12\x12\n" + + "\x04size\x18\x01 \x01(\x03R\x04size\x12(\n" + + "\x10alias_input_port\x18\x02 \x01(\x03R\x0ealiasInputPort\x122\n" + + "\x05shape\x18\x03 \x01(\v2\x1c.tensorflow.TensorShapeProtoR\x05shape\x12*\n" + + "\x05dtype\x18\x04 \x01(\x0e2\x14.tensorflow.DataTypeR\x05dtype\x1aB\n" + + "\x0eAggregatedCost\x12\x12\n" + + "\x04cost\x18\x01 \x01(\x02R\x04cost\x12\x1c\n" + + "\tdimension\x18\x02 \x01(\tR\tdimensionB\x83\x01\n" + + "\x18org.tensorflow.frameworkB\x0fCostGraphProtosP\x01ZQgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/cost_graph_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_cost_graph_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_cost_graph_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_cost_graph_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_cost_graph_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_cost_graph_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_cost_graph_proto_rawDesc), len(file_tensorflow_core_framework_cost_graph_proto_rawDesc))) + }) + return file_tensorflow_core_framework_cost_graph_proto_rawDescData +} + +var file_tensorflow_core_framework_cost_graph_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_tensorflow_core_framework_cost_graph_proto_goTypes = []any{ + (*CostGraphDef)(nil), // 0: tensorflow.CostGraphDef + (*CostGraphDef_Node)(nil), // 1: tensorflow.CostGraphDef.Node + (*CostGraphDef_AggregatedCost)(nil), // 2: tensorflow.CostGraphDef.AggregatedCost + (*CostGraphDef_Node_InputInfo)(nil), // 3: tensorflow.CostGraphDef.Node.InputInfo + (*CostGraphDef_Node_OutputInfo)(nil), // 4: tensorflow.CostGraphDef.Node.OutputInfo + (*tensor_shape_go_proto.TensorShapeProto)(nil), // 5: tensorflow.TensorShapeProto + (types_go_proto.DataType)(0), // 6: tensorflow.DataType +} +var file_tensorflow_core_framework_cost_graph_proto_depIdxs = []int32{ + 1, // 0: tensorflow.CostGraphDef.node:type_name -> tensorflow.CostGraphDef.Node + 2, // 1: tensorflow.CostGraphDef.cost:type_name -> tensorflow.CostGraphDef.AggregatedCost + 3, // 2: tensorflow.CostGraphDef.Node.input_info:type_name -> tensorflow.CostGraphDef.Node.InputInfo + 4, // 3: tensorflow.CostGraphDef.Node.output_info:type_name -> tensorflow.CostGraphDef.Node.OutputInfo + 5, // 4: tensorflow.CostGraphDef.Node.OutputInfo.shape:type_name -> tensorflow.TensorShapeProto + 6, // 5: tensorflow.CostGraphDef.Node.OutputInfo.dtype:type_name -> tensorflow.DataType + 6, // [6:6] is the sub-list for method output_type + 6, // [6:6] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_cost_graph_proto_init() } +func file_tensorflow_core_framework_cost_graph_proto_init() { + if File_tensorflow_core_framework_cost_graph_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_cost_graph_proto_rawDesc), len(file_tensorflow_core_framework_cost_graph_proto_rawDesc)), + NumEnums: 0, + NumMessages: 5, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_cost_graph_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_cost_graph_proto_depIdxs, + MessageInfos: file_tensorflow_core_framework_cost_graph_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_cost_graph_proto = out.File + file_tensorflow_core_framework_cost_graph_proto_goTypes = nil + file_tensorflow_core_framework_cost_graph_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/framework/device_attributes_go_proto/device_attributes.pb.go b/third_party/go-tensorflow/tensorflow/go/core/framework/device_attributes_go_proto/device_attributes.pb.go new file mode 100644 index 0000000..6af80d8 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/framework/device_attributes_go_proto/device_attributes.pb.go @@ -0,0 +1,363 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/device_attributes.proto + +package device_attributes_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type InterconnectLink struct { + state protoimpl.MessageState `protogen:"open.v1"` + DeviceId int32 `protobuf:"varint,1,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"` + Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` + Strength int32 `protobuf:"varint,3,opt,name=strength,proto3" json:"strength,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *InterconnectLink) Reset() { + *x = InterconnectLink{} + mi := &file_tensorflow_core_framework_device_attributes_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *InterconnectLink) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InterconnectLink) ProtoMessage() {} + +func (x *InterconnectLink) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_device_attributes_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InterconnectLink.ProtoReflect.Descriptor instead. +func (*InterconnectLink) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_device_attributes_proto_rawDescGZIP(), []int{0} +} + +func (x *InterconnectLink) GetDeviceId() int32 { + if x != nil { + return x.DeviceId + } + return 0 +} + +func (x *InterconnectLink) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *InterconnectLink) GetStrength() int32 { + if x != nil { + return x.Strength + } + return 0 +} + +type LocalLinks struct { + state protoimpl.MessageState `protogen:"open.v1"` + Link []*InterconnectLink `protobuf:"bytes,1,rep,name=link,proto3" json:"link,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LocalLinks) Reset() { + *x = LocalLinks{} + mi := &file_tensorflow_core_framework_device_attributes_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LocalLinks) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LocalLinks) ProtoMessage() {} + +func (x *LocalLinks) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_device_attributes_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LocalLinks.ProtoReflect.Descriptor instead. +func (*LocalLinks) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_device_attributes_proto_rawDescGZIP(), []int{1} +} + +func (x *LocalLinks) GetLink() []*InterconnectLink { + if x != nil { + return x.Link + } + return nil +} + +type DeviceLocality struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Optional bus locality of device. Default value of 0 means + // no specific locality. Specific localities are indexed from 1. + BusId int32 `protobuf:"varint,1,opt,name=bus_id,json=busId,proto3" json:"bus_id,omitempty"` + // Optional NUMA locality of device. + NumaNode int32 `protobuf:"varint,2,opt,name=numa_node,json=numaNode,proto3" json:"numa_node,omitempty"` + // Optional local interconnect links to other devices. + Links *LocalLinks `protobuf:"bytes,3,opt,name=links,proto3" json:"links,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeviceLocality) Reset() { + *x = DeviceLocality{} + mi := &file_tensorflow_core_framework_device_attributes_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeviceLocality) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeviceLocality) ProtoMessage() {} + +func (x *DeviceLocality) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_device_attributes_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeviceLocality.ProtoReflect.Descriptor instead. +func (*DeviceLocality) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_device_attributes_proto_rawDescGZIP(), []int{2} +} + +func (x *DeviceLocality) GetBusId() int32 { + if x != nil { + return x.BusId + } + return 0 +} + +func (x *DeviceLocality) GetNumaNode() int32 { + if x != nil { + return x.NumaNode + } + return 0 +} + +func (x *DeviceLocality) GetLinks() *LocalLinks { + if x != nil { + return x.Links + } + return nil +} + +type DeviceAttributes struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Fully specified name of the device within a cluster. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // String representation of device_type. + DeviceType string `protobuf:"bytes,2,opt,name=device_type,json=deviceType,proto3" json:"device_type,omitempty"` + // Memory capacity of device in bytes. + MemoryLimit int64 `protobuf:"varint,4,opt,name=memory_limit,json=memoryLimit,proto3" json:"memory_limit,omitempty"` + // Platform-specific data about device that may be useful + // for supporting efficient data transfers. + Locality *DeviceLocality `protobuf:"bytes,5,opt,name=locality,proto3" json:"locality,omitempty"` + // A device is assigned a global unique number each time it is + // initialized. "incarnation" should never be 0. + Incarnation uint64 `protobuf:"fixed64,6,opt,name=incarnation,proto3" json:"incarnation,omitempty"` + // String representation of the physical device that this device maps to. + PhysicalDeviceDesc string `protobuf:"bytes,7,opt,name=physical_device_desc,json=physicalDeviceDesc,proto3" json:"physical_device_desc,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeviceAttributes) Reset() { + *x = DeviceAttributes{} + mi := &file_tensorflow_core_framework_device_attributes_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeviceAttributes) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeviceAttributes) ProtoMessage() {} + +func (x *DeviceAttributes) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_device_attributes_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeviceAttributes.ProtoReflect.Descriptor instead. +func (*DeviceAttributes) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_device_attributes_proto_rawDescGZIP(), []int{3} +} + +func (x *DeviceAttributes) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *DeviceAttributes) GetDeviceType() string { + if x != nil { + return x.DeviceType + } + return "" +} + +func (x *DeviceAttributes) GetMemoryLimit() int64 { + if x != nil { + return x.MemoryLimit + } + return 0 +} + +func (x *DeviceAttributes) GetLocality() *DeviceLocality { + if x != nil { + return x.Locality + } + return nil +} + +func (x *DeviceAttributes) GetIncarnation() uint64 { + if x != nil { + return x.Incarnation + } + return 0 +} + +func (x *DeviceAttributes) GetPhysicalDeviceDesc() string { + if x != nil { + return x.PhysicalDeviceDesc + } + return "" +} + +var File_tensorflow_core_framework_device_attributes_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_device_attributes_proto_rawDesc = "" + + "\n" + + "1tensorflow/core/framework/device_attributes.proto\x12\n" + + "tensorflow\"_\n" + + "\x10InterconnectLink\x12\x1b\n" + + "\tdevice_id\x18\x01 \x01(\x05R\bdeviceId\x12\x12\n" + + "\x04type\x18\x02 \x01(\tR\x04type\x12\x1a\n" + + "\bstrength\x18\x03 \x01(\x05R\bstrength\">\n" + + "\n" + + "LocalLinks\x120\n" + + "\x04link\x18\x01 \x03(\v2\x1c.tensorflow.InterconnectLinkR\x04link\"r\n" + + "\x0eDeviceLocality\x12\x15\n" + + "\x06bus_id\x18\x01 \x01(\x05R\x05busId\x12\x1b\n" + + "\tnuma_node\x18\x02 \x01(\x05R\bnumaNode\x12,\n" + + "\x05links\x18\x03 \x01(\v2\x16.tensorflow.LocalLinksR\x05links\"\xf6\x01\n" + + "\x10DeviceAttributes\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x1f\n" + + "\vdevice_type\x18\x02 \x01(\tR\n" + + "deviceType\x12!\n" + + "\fmemory_limit\x18\x04 \x01(\x03R\vmemoryLimit\x126\n" + + "\blocality\x18\x05 \x01(\v2\x1a.tensorflow.DeviceLocalityR\blocality\x12 \n" + + "\vincarnation\x18\x06 \x01(\x06R\vincarnation\x120\n" + + "\x14physical_device_desc\x18\a \x01(\tR\x12physicalDeviceDescB\x91\x01\n" + + "\x18org.tensorflow.frameworkB\x16DeviceAttributesProtosP\x01ZXgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/device_attributes_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_device_attributes_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_device_attributes_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_device_attributes_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_device_attributes_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_device_attributes_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_device_attributes_proto_rawDesc), len(file_tensorflow_core_framework_device_attributes_proto_rawDesc))) + }) + return file_tensorflow_core_framework_device_attributes_proto_rawDescData +} + +var file_tensorflow_core_framework_device_attributes_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_tensorflow_core_framework_device_attributes_proto_goTypes = []any{ + (*InterconnectLink)(nil), // 0: tensorflow.InterconnectLink + (*LocalLinks)(nil), // 1: tensorflow.LocalLinks + (*DeviceLocality)(nil), // 2: tensorflow.DeviceLocality + (*DeviceAttributes)(nil), // 3: tensorflow.DeviceAttributes +} +var file_tensorflow_core_framework_device_attributes_proto_depIdxs = []int32{ + 0, // 0: tensorflow.LocalLinks.link:type_name -> tensorflow.InterconnectLink + 1, // 1: tensorflow.DeviceLocality.links:type_name -> tensorflow.LocalLinks + 2, // 2: tensorflow.DeviceAttributes.locality:type_name -> tensorflow.DeviceLocality + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_device_attributes_proto_init() } +func file_tensorflow_core_framework_device_attributes_proto_init() { + if File_tensorflow_core_framework_device_attributes_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_device_attributes_proto_rawDesc), len(file_tensorflow_core_framework_device_attributes_proto_rawDesc)), + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_device_attributes_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_device_attributes_proto_depIdxs, + MessageInfos: file_tensorflow_core_framework_device_attributes_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_device_attributes_proto = out.File + file_tensorflow_core_framework_device_attributes_proto_goTypes = nil + file_tensorflow_core_framework_device_attributes_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/framework/function_go_proto/function.pb.go b/third_party/go-tensorflow/tensorflow/go/core/framework/function_go_proto/function.pb.go new file mode 100644 index 0000000..84cc8ce --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/framework/function_go_proto/function.pb.go @@ -0,0 +1,431 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/function.proto + +package function_go_proto + +import ( + attr_value_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/attr_value_go_proto" + node_def_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/node_def_go_proto" + op_def_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/op_def_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// A library is a set of named functions. +type FunctionDefLibrary struct { + state protoimpl.MessageState `protogen:"open.v1"` + Function []*FunctionDef `protobuf:"bytes,1,rep,name=function,proto3" json:"function,omitempty"` + Gradient []*GradientDef `protobuf:"bytes,2,rep,name=gradient,proto3" json:"gradient,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *FunctionDefLibrary) Reset() { + *x = FunctionDefLibrary{} + mi := &file_tensorflow_core_framework_function_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *FunctionDefLibrary) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FunctionDefLibrary) ProtoMessage() {} + +func (x *FunctionDefLibrary) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_function_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FunctionDefLibrary.ProtoReflect.Descriptor instead. +func (*FunctionDefLibrary) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_function_proto_rawDescGZIP(), []int{0} +} + +func (x *FunctionDefLibrary) GetFunction() []*FunctionDef { + if x != nil { + return x.Function + } + return nil +} + +func (x *FunctionDefLibrary) GetGradient() []*GradientDef { + if x != nil { + return x.Gradient + } + return nil +} + +// A function can be instantiated when the runtime can bind every attr +// with a value. When a GraphDef has a call to a function, it must +// have binding for every attr defined in the signature. +// +// TODO(zhifengc): +// - device spec, etc. +type FunctionDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The definition of the function's name, arguments, return values, + // attrs etc. + Signature *op_def_go_proto.OpDef `protobuf:"bytes,1,opt,name=signature,proto3" json:"signature,omitempty"` + // Attributes specific to this function definition. + Attr map[string]*attr_value_go_proto.AttrValue `protobuf:"bytes,5,rep,name=attr,proto3" json:"attr,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + ArgAttr map[uint32]*FunctionDef_ArgAttrs `protobuf:"bytes,7,rep,name=arg_attr,json=argAttr,proto3" json:"arg_attr,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // Unique IDs for each resource argument, used to track aliasing resources. If + // Argument A and Argument B alias each other, then + // resource_arg_unique_ids[A.index] == resource_arg_unique_ids[B.index]. + // + // If this field is empty, none of the arguments could alias; otherwise, every + // resource argument should have an entry in this field. + // + // When instantiated, the unique IDs will be attached to the _Arg nodes' + // "_resource_arg_unique_id" attribute. + ResourceArgUniqueId map[uint32]uint32 `protobuf:"bytes,8,rep,name=resource_arg_unique_id,json=resourceArgUniqueId,proto3" json:"resource_arg_unique_id,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"` + // By convention, "op" in node_def is resolved by consulting with a + // user-defined library first. If not resolved, "func" is assumed to + // be a builtin op. + NodeDef []*node_def_go_proto.NodeDef `protobuf:"bytes,3,rep,name=node_def,json=nodeDef,proto3" json:"node_def,omitempty"` + // A mapping from the output arg names from `signature` to the + // outputs from `node_def` that should be returned by the function. + Ret map[string]string `protobuf:"bytes,4,rep,name=ret,proto3" json:"ret,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // A mapping from control output names from `signature` to node names in + // `node_def` which should be control outputs of this function. + ControlRet map[string]string `protobuf:"bytes,6,rep,name=control_ret,json=controlRet,proto3" json:"control_ret,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *FunctionDef) Reset() { + *x = FunctionDef{} + mi := &file_tensorflow_core_framework_function_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *FunctionDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FunctionDef) ProtoMessage() {} + +func (x *FunctionDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_function_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FunctionDef.ProtoReflect.Descriptor instead. +func (*FunctionDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_function_proto_rawDescGZIP(), []int{1} +} + +func (x *FunctionDef) GetSignature() *op_def_go_proto.OpDef { + if x != nil { + return x.Signature + } + return nil +} + +func (x *FunctionDef) GetAttr() map[string]*attr_value_go_proto.AttrValue { + if x != nil { + return x.Attr + } + return nil +} + +func (x *FunctionDef) GetArgAttr() map[uint32]*FunctionDef_ArgAttrs { + if x != nil { + return x.ArgAttr + } + return nil +} + +func (x *FunctionDef) GetResourceArgUniqueId() map[uint32]uint32 { + if x != nil { + return x.ResourceArgUniqueId + } + return nil +} + +func (x *FunctionDef) GetNodeDef() []*node_def_go_proto.NodeDef { + if x != nil { + return x.NodeDef + } + return nil +} + +func (x *FunctionDef) GetRet() map[string]string { + if x != nil { + return x.Ret + } + return nil +} + +func (x *FunctionDef) GetControlRet() map[string]string { + if x != nil { + return x.ControlRet + } + return nil +} + +// GradientDef defines the gradient function of a function defined in +// a function library. +// +// A gradient function g (specified by gradient_func) for a function f +// (specified by function_name) must follow the following: +// +// The function 'f' must be a numerical function which takes N inputs +// and produces M outputs. Its gradient function 'g', which is a +// function taking N + M inputs and produces N outputs. +// +// I.e. if we have +// +// (y1, y2, ..., y_M) = f(x1, x2, ..., x_N), +// +// then, g is +// +// (dL/dx1, dL/dx2, ..., dL/dx_N) = g(x1, x2, ..., x_N, +// dL/dy1, dL/dy2, ..., dL/dy_M), +// +// where L is a scalar-value function of (x1, x2, ..., xN) (e.g., the +// loss function). dL/dx_i is the partial derivative of L with respect +// to x_i. +type GradientDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + FunctionName string `protobuf:"bytes,1,opt,name=function_name,json=functionName,proto3" json:"function_name,omitempty"` // The function name. + GradientFunc string `protobuf:"bytes,2,opt,name=gradient_func,json=gradientFunc,proto3" json:"gradient_func,omitempty"` // The gradient function's name. + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GradientDef) Reset() { + *x = GradientDef{} + mi := &file_tensorflow_core_framework_function_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GradientDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GradientDef) ProtoMessage() {} + +func (x *GradientDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_function_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GradientDef.ProtoReflect.Descriptor instead. +func (*GradientDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_function_proto_rawDescGZIP(), []int{2} +} + +func (x *GradientDef) GetFunctionName() string { + if x != nil { + return x.FunctionName + } + return "" +} + +func (x *GradientDef) GetGradientFunc() string { + if x != nil { + return x.GradientFunc + } + return "" +} + +// Attributes for function arguments. These attributes are the same set of +// valid attributes as to _Arg nodes. +type FunctionDef_ArgAttrs struct { + state protoimpl.MessageState `protogen:"open.v1"` + Attr map[string]*attr_value_go_proto.AttrValue `protobuf:"bytes,1,rep,name=attr,proto3" json:"attr,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *FunctionDef_ArgAttrs) Reset() { + *x = FunctionDef_ArgAttrs{} + mi := &file_tensorflow_core_framework_function_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *FunctionDef_ArgAttrs) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FunctionDef_ArgAttrs) ProtoMessage() {} + +func (x *FunctionDef_ArgAttrs) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_function_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FunctionDef_ArgAttrs.ProtoReflect.Descriptor instead. +func (*FunctionDef_ArgAttrs) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_function_proto_rawDescGZIP(), []int{1, 1} +} + +func (x *FunctionDef_ArgAttrs) GetAttr() map[string]*attr_value_go_proto.AttrValue { + if x != nil { + return x.Attr + } + return nil +} + +var File_tensorflow_core_framework_function_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_function_proto_rawDesc = "" + + "\n" + + "(tensorflow/core/framework/function.proto\x12\n" + + "tensorflow\x1a*tensorflow/core/framework/attr_value.proto\x1a(tensorflow/core/framework/node_def.proto\x1a&tensorflow/core/framework/op_def.proto\"~\n" + + "\x12FunctionDefLibrary\x123\n" + + "\bfunction\x18\x01 \x03(\v2\x17.tensorflow.FunctionDefR\bfunction\x123\n" + + "\bgradient\x18\x02 \x03(\v2\x17.tensorflow.GradientDefR\bgradient\"\xdb\a\n" + + "\vFunctionDef\x12/\n" + + "\tsignature\x18\x01 \x01(\v2\x11.tensorflow.OpDefR\tsignature\x125\n" + + "\x04attr\x18\x05 \x03(\v2!.tensorflow.FunctionDef.AttrEntryR\x04attr\x12?\n" + + "\barg_attr\x18\a \x03(\v2$.tensorflow.FunctionDef.ArgAttrEntryR\aargAttr\x12e\n" + + "\x16resource_arg_unique_id\x18\b \x03(\v20.tensorflow.FunctionDef.ResourceArgUniqueIdEntryR\x13resourceArgUniqueId\x12.\n" + + "\bnode_def\x18\x03 \x03(\v2\x13.tensorflow.NodeDefR\anodeDef\x122\n" + + "\x03ret\x18\x04 \x03(\v2 .tensorflow.FunctionDef.RetEntryR\x03ret\x12H\n" + + "\vcontrol_ret\x18\x06 \x03(\v2'.tensorflow.FunctionDef.ControlRetEntryR\n" + + "controlRet\x1aN\n" + + "\tAttrEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12+\n" + + "\x05value\x18\x02 \x01(\v2\x15.tensorflow.AttrValueR\x05value:\x028\x01\x1a\x9a\x01\n" + + "\bArgAttrs\x12>\n" + + "\x04attr\x18\x01 \x03(\v2*.tensorflow.FunctionDef.ArgAttrs.AttrEntryR\x04attr\x1aN\n" + + "\tAttrEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12+\n" + + "\x05value\x18\x02 \x01(\v2\x15.tensorflow.AttrValueR\x05value:\x028\x01\x1a\\\n" + + "\fArgAttrEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\rR\x03key\x126\n" + + "\x05value\x18\x02 \x01(\v2 .tensorflow.FunctionDef.ArgAttrsR\x05value:\x028\x01\x1aF\n" + + "\x18ResourceArgUniqueIdEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\rR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\rR\x05value:\x028\x01\x1a6\n" + + "\bRetEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\x1a=\n" + + "\x0fControlRetEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01J\x04\b\x02\x10\x03\"W\n" + + "\vGradientDef\x12#\n" + + "\rfunction_name\x18\x01 \x01(\tR\ffunctionName\x12#\n" + + "\rgradient_func\x18\x02 \x01(\tR\fgradientFuncB\x80\x01\n" + + "\x18org.tensorflow.frameworkB\x0eFunctionProtosP\x01ZOgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/function_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_function_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_function_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_function_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_function_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_function_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_function_proto_rawDesc), len(file_tensorflow_core_framework_function_proto_rawDesc))) + }) + return file_tensorflow_core_framework_function_proto_rawDescData +} + +var file_tensorflow_core_framework_function_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_tensorflow_core_framework_function_proto_goTypes = []any{ + (*FunctionDefLibrary)(nil), // 0: tensorflow.FunctionDefLibrary + (*FunctionDef)(nil), // 1: tensorflow.FunctionDef + (*GradientDef)(nil), // 2: tensorflow.GradientDef + nil, // 3: tensorflow.FunctionDef.AttrEntry + (*FunctionDef_ArgAttrs)(nil), // 4: tensorflow.FunctionDef.ArgAttrs + nil, // 5: tensorflow.FunctionDef.ArgAttrEntry + nil, // 6: tensorflow.FunctionDef.ResourceArgUniqueIdEntry + nil, // 7: tensorflow.FunctionDef.RetEntry + nil, // 8: tensorflow.FunctionDef.ControlRetEntry + nil, // 9: tensorflow.FunctionDef.ArgAttrs.AttrEntry + (*op_def_go_proto.OpDef)(nil), // 10: tensorflow.OpDef + (*node_def_go_proto.NodeDef)(nil), // 11: tensorflow.NodeDef + (*attr_value_go_proto.AttrValue)(nil), // 12: tensorflow.AttrValue +} +var file_tensorflow_core_framework_function_proto_depIdxs = []int32{ + 1, // 0: tensorflow.FunctionDefLibrary.function:type_name -> tensorflow.FunctionDef + 2, // 1: tensorflow.FunctionDefLibrary.gradient:type_name -> tensorflow.GradientDef + 10, // 2: tensorflow.FunctionDef.signature:type_name -> tensorflow.OpDef + 3, // 3: tensorflow.FunctionDef.attr:type_name -> tensorflow.FunctionDef.AttrEntry + 5, // 4: tensorflow.FunctionDef.arg_attr:type_name -> tensorflow.FunctionDef.ArgAttrEntry + 6, // 5: tensorflow.FunctionDef.resource_arg_unique_id:type_name -> tensorflow.FunctionDef.ResourceArgUniqueIdEntry + 11, // 6: tensorflow.FunctionDef.node_def:type_name -> tensorflow.NodeDef + 7, // 7: tensorflow.FunctionDef.ret:type_name -> tensorflow.FunctionDef.RetEntry + 8, // 8: tensorflow.FunctionDef.control_ret:type_name -> tensorflow.FunctionDef.ControlRetEntry + 12, // 9: tensorflow.FunctionDef.AttrEntry.value:type_name -> tensorflow.AttrValue + 9, // 10: tensorflow.FunctionDef.ArgAttrs.attr:type_name -> tensorflow.FunctionDef.ArgAttrs.AttrEntry + 4, // 11: tensorflow.FunctionDef.ArgAttrEntry.value:type_name -> tensorflow.FunctionDef.ArgAttrs + 12, // 12: tensorflow.FunctionDef.ArgAttrs.AttrEntry.value:type_name -> tensorflow.AttrValue + 13, // [13:13] is the sub-list for method output_type + 13, // [13:13] is the sub-list for method input_type + 13, // [13:13] is the sub-list for extension type_name + 13, // [13:13] is the sub-list for extension extendee + 0, // [0:13] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_function_proto_init() } +func file_tensorflow_core_framework_function_proto_init() { + if File_tensorflow_core_framework_function_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_function_proto_rawDesc), len(file_tensorflow_core_framework_function_proto_rawDesc)), + NumEnums: 0, + NumMessages: 10, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_function_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_function_proto_depIdxs, + MessageInfos: file_tensorflow_core_framework_function_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_function_proto = out.File + file_tensorflow_core_framework_function_proto_goTypes = nil + file_tensorflow_core_framework_function_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/framework/graph_go_proto/graph.pb.go b/third_party/go-tensorflow/tensorflow/go/core/framework/graph_go_proto/graph.pb.go new file mode 100644 index 0000000..25f9aff --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/framework/graph_go_proto/graph.pb.go @@ -0,0 +1,197 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/graph.proto + +package graph_go_proto + +import ( + function_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/function_go_proto" + node_def_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/node_def_go_proto" + versions_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/versions_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Represents the graph of operations +type GraphDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + Node []*node_def_go_proto.NodeDef `protobuf:"bytes,1,rep,name=node,proto3" json:"node,omitempty"` + // Compatibility versions of the graph. See core/public/version.h for version + // history. The GraphDef version is distinct from the TensorFlow version, and + // each release of TensorFlow will support a range of GraphDef versions. + Versions *versions_go_proto.VersionDef `protobuf:"bytes,4,opt,name=versions,proto3" json:"versions,omitempty"` + // Deprecated single version field; use versions above instead. Since all + // GraphDef changes before "versions" was introduced were forward + // compatible, this field is entirely ignored. + // + // Deprecated: Marked as deprecated in tensorflow/core/framework/graph.proto. + Version int32 `protobuf:"varint,3,opt,name=version,proto3" json:"version,omitempty"` + // EXPERIMENTAL. DO NOT USE OR DEPEND ON THIS YET. + // + // "library" provides user-defined functions. + // + // Naming: + // - library.function.name are in a flat namespace. + // NOTE: We may need to change it to be hierarchical to support + // different orgs. E.g., + // { "/google/nn", { ... }}, + // { "/google/vision", { ... }} + // { "/org_foo/module_bar", { ... }} + // map named_lib; + // - If node[i].op is the name of one function in "library", + // node[i] is deemed as a function call. Otherwise, node[i].op + // must be a primitive operation supported by the runtime. + // + // Function call semantics: + // + // - The callee may start execution as soon as some of its inputs + // are ready. The caller may want to use Tuple() mechanism to + // ensure all inputs are ready in the same time. + // + // - The consumer of return values may start executing as soon as + // the return values the consumer depends on are ready. The + // consumer may want to use Tuple() mechanism to ensure the + // consumer does not start until all return values of the callee + // function are ready. + Library *function_go_proto.FunctionDefLibrary `protobuf:"bytes,2,opt,name=library,proto3" json:"library,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GraphDef) Reset() { + *x = GraphDef{} + mi := &file_tensorflow_core_framework_graph_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GraphDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GraphDef) ProtoMessage() {} + +func (x *GraphDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_graph_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GraphDef.ProtoReflect.Descriptor instead. +func (*GraphDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_graph_proto_rawDescGZIP(), []int{0} +} + +func (x *GraphDef) GetNode() []*node_def_go_proto.NodeDef { + if x != nil { + return x.Node + } + return nil +} + +func (x *GraphDef) GetVersions() *versions_go_proto.VersionDef { + if x != nil { + return x.Versions + } + return nil +} + +// Deprecated: Marked as deprecated in tensorflow/core/framework/graph.proto. +func (x *GraphDef) GetVersion() int32 { + if x != nil { + return x.Version + } + return 0 +} + +func (x *GraphDef) GetLibrary() *function_go_proto.FunctionDefLibrary { + if x != nil { + return x.Library + } + return nil +} + +var File_tensorflow_core_framework_graph_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_graph_proto_rawDesc = "" + + "\n" + + "%tensorflow/core/framework/graph.proto\x12\n" + + "tensorflow\x1a(tensorflow/core/framework/function.proto\x1a(tensorflow/core/framework/node_def.proto\x1a(tensorflow/core/framework/versions.proto\"\xbf\x01\n" + + "\bGraphDef\x12'\n" + + "\x04node\x18\x01 \x03(\v2\x13.tensorflow.NodeDefR\x04node\x122\n" + + "\bversions\x18\x04 \x01(\v2\x16.tensorflow.VersionDefR\bversions\x12\x1c\n" + + "\aversion\x18\x03 \x01(\x05B\x02\x18\x01R\aversion\x128\n" + + "\alibrary\x18\x02 \x01(\v2\x1e.tensorflow.FunctionDefLibraryR\alibraryBz\n" + + "\x18org.tensorflow.frameworkB\vGraphProtosP\x01ZLgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/graph_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_graph_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_graph_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_graph_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_graph_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_graph_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_graph_proto_rawDesc), len(file_tensorflow_core_framework_graph_proto_rawDesc))) + }) + return file_tensorflow_core_framework_graph_proto_rawDescData +} + +var file_tensorflow_core_framework_graph_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_tensorflow_core_framework_graph_proto_goTypes = []any{ + (*GraphDef)(nil), // 0: tensorflow.GraphDef + (*node_def_go_proto.NodeDef)(nil), // 1: tensorflow.NodeDef + (*versions_go_proto.VersionDef)(nil), // 2: tensorflow.VersionDef + (*function_go_proto.FunctionDefLibrary)(nil), // 3: tensorflow.FunctionDefLibrary +} +var file_tensorflow_core_framework_graph_proto_depIdxs = []int32{ + 1, // 0: tensorflow.GraphDef.node:type_name -> tensorflow.NodeDef + 2, // 1: tensorflow.GraphDef.versions:type_name -> tensorflow.VersionDef + 3, // 2: tensorflow.GraphDef.library:type_name -> tensorflow.FunctionDefLibrary + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_graph_proto_init() } +func file_tensorflow_core_framework_graph_proto_init() { + if File_tensorflow_core_framework_graph_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_graph_proto_rawDesc), len(file_tensorflow_core_framework_graph_proto_rawDesc)), + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_graph_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_graph_proto_depIdxs, + MessageInfos: file_tensorflow_core_framework_graph_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_graph_proto = out.File + file_tensorflow_core_framework_graph_proto_goTypes = nil + file_tensorflow_core_framework_graph_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/framework/graph_transfer_info_go_proto/graph_transfer_info.pb.go b/third_party/go-tensorflow/tensorflow/go/core/framework/graph_transfer_info_go_proto/graph_transfer_info.pb.go new file mode 100644 index 0000000..524dace --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/framework/graph_transfer_info_go_proto/graph_transfer_info.pb.go @@ -0,0 +1,734 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/graph_transfer_info.proto + +package graph_transfer_info_go_proto + +import ( + types_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/types_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type GraphTransferInfo_Destination int32 + +const ( + GraphTransferInfo_NOP GraphTransferInfo_Destination = 0 + GraphTransferInfo_HEXAGON GraphTransferInfo_Destination = 1 +) + +// Enum value maps for GraphTransferInfo_Destination. +var ( + GraphTransferInfo_Destination_name = map[int32]string{ + 0: "NOP", + 1: "HEXAGON", + } + GraphTransferInfo_Destination_value = map[string]int32{ + "NOP": 0, + "HEXAGON": 1, + } +) + +func (x GraphTransferInfo_Destination) Enum() *GraphTransferInfo_Destination { + p := new(GraphTransferInfo_Destination) + *p = x + return p +} + +func (x GraphTransferInfo_Destination) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (GraphTransferInfo_Destination) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_framework_graph_transfer_info_proto_enumTypes[0].Descriptor() +} + +func (GraphTransferInfo_Destination) Type() protoreflect.EnumType { + return &file_tensorflow_core_framework_graph_transfer_info_proto_enumTypes[0] +} + +func (x GraphTransferInfo_Destination) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use GraphTransferInfo_Destination.Descriptor instead. +func (GraphTransferInfo_Destination) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_framework_graph_transfer_info_proto_rawDescGZIP(), []int{7, 0} +} + +type GraphTransferNodeInput struct { + state protoimpl.MessageState `protogen:"open.v1"` + NodeId int32 `protobuf:"varint,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` + OutputPort int32 `protobuf:"varint,2,opt,name=output_port,json=outputPort,proto3" json:"output_port,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GraphTransferNodeInput) Reset() { + *x = GraphTransferNodeInput{} + mi := &file_tensorflow_core_framework_graph_transfer_info_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GraphTransferNodeInput) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GraphTransferNodeInput) ProtoMessage() {} + +func (x *GraphTransferNodeInput) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_graph_transfer_info_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GraphTransferNodeInput.ProtoReflect.Descriptor instead. +func (*GraphTransferNodeInput) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_graph_transfer_info_proto_rawDescGZIP(), []int{0} +} + +func (x *GraphTransferNodeInput) GetNodeId() int32 { + if x != nil { + return x.NodeId + } + return 0 +} + +func (x *GraphTransferNodeInput) GetOutputPort() int32 { + if x != nil { + return x.OutputPort + } + return 0 +} + +type GraphTransferNodeInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + NodeId int32 `protobuf:"varint,2,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` + TypeName string `protobuf:"bytes,3,opt,name=type_name,json=typeName,proto3" json:"type_name,omitempty"` + SocOpId int32 `protobuf:"varint,4,opt,name=soc_op_id,json=socOpId,proto3" json:"soc_op_id,omitempty"` + PaddingId int32 `protobuf:"varint,5,opt,name=padding_id,json=paddingId,proto3" json:"padding_id,omitempty"` + InputCount int32 `protobuf:"varint,6,opt,name=input_count,json=inputCount,proto3" json:"input_count,omitempty"` + OutputCount int32 `protobuf:"varint,7,opt,name=output_count,json=outputCount,proto3" json:"output_count,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GraphTransferNodeInfo) Reset() { + *x = GraphTransferNodeInfo{} + mi := &file_tensorflow_core_framework_graph_transfer_info_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GraphTransferNodeInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GraphTransferNodeInfo) ProtoMessage() {} + +func (x *GraphTransferNodeInfo) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_graph_transfer_info_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GraphTransferNodeInfo.ProtoReflect.Descriptor instead. +func (*GraphTransferNodeInfo) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_graph_transfer_info_proto_rawDescGZIP(), []int{1} +} + +func (x *GraphTransferNodeInfo) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *GraphTransferNodeInfo) GetNodeId() int32 { + if x != nil { + return x.NodeId + } + return 0 +} + +func (x *GraphTransferNodeInfo) GetTypeName() string { + if x != nil { + return x.TypeName + } + return "" +} + +func (x *GraphTransferNodeInfo) GetSocOpId() int32 { + if x != nil { + return x.SocOpId + } + return 0 +} + +func (x *GraphTransferNodeInfo) GetPaddingId() int32 { + if x != nil { + return x.PaddingId + } + return 0 +} + +func (x *GraphTransferNodeInfo) GetInputCount() int32 { + if x != nil { + return x.InputCount + } + return 0 +} + +func (x *GraphTransferNodeInfo) GetOutputCount() int32 { + if x != nil { + return x.OutputCount + } + return 0 +} + +type GraphTransferConstNodeInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + NodeId int32 `protobuf:"varint,2,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` + Shape []int64 `protobuf:"varint,3,rep,packed,name=shape,proto3" json:"shape,omitempty"` + Data []byte `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` + Dtype types_go_proto.DataType `protobuf:"varint,5,opt,name=dtype,proto3,enum=tensorflow.DataType" json:"dtype,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GraphTransferConstNodeInfo) Reset() { + *x = GraphTransferConstNodeInfo{} + mi := &file_tensorflow_core_framework_graph_transfer_info_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GraphTransferConstNodeInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GraphTransferConstNodeInfo) ProtoMessage() {} + +func (x *GraphTransferConstNodeInfo) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_graph_transfer_info_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GraphTransferConstNodeInfo.ProtoReflect.Descriptor instead. +func (*GraphTransferConstNodeInfo) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_graph_transfer_info_proto_rawDescGZIP(), []int{2} +} + +func (x *GraphTransferConstNodeInfo) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *GraphTransferConstNodeInfo) GetNodeId() int32 { + if x != nil { + return x.NodeId + } + return 0 +} + +func (x *GraphTransferConstNodeInfo) GetShape() []int64 { + if x != nil { + return x.Shape + } + return nil +} + +func (x *GraphTransferConstNodeInfo) GetData() []byte { + if x != nil { + return x.Data + } + return nil +} + +func (x *GraphTransferConstNodeInfo) GetDtype() types_go_proto.DataType { + if x != nil { + return x.Dtype + } + return types_go_proto.DataType(0) +} + +type GraphTransferNodeInputInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + NodeId int32 `protobuf:"varint,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` + NodeInput []*GraphTransferNodeInput `protobuf:"bytes,2,rep,name=node_input,json=nodeInput,proto3" json:"node_input,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GraphTransferNodeInputInfo) Reset() { + *x = GraphTransferNodeInputInfo{} + mi := &file_tensorflow_core_framework_graph_transfer_info_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GraphTransferNodeInputInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GraphTransferNodeInputInfo) ProtoMessage() {} + +func (x *GraphTransferNodeInputInfo) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_graph_transfer_info_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GraphTransferNodeInputInfo.ProtoReflect.Descriptor instead. +func (*GraphTransferNodeInputInfo) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_graph_transfer_info_proto_rawDescGZIP(), []int{3} +} + +func (x *GraphTransferNodeInputInfo) GetNodeId() int32 { + if x != nil { + return x.NodeId + } + return 0 +} + +func (x *GraphTransferNodeInputInfo) GetNodeInput() []*GraphTransferNodeInput { + if x != nil { + return x.NodeInput + } + return nil +} + +type GraphTransferNodeOutputInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + NodeId int32 `protobuf:"varint,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` + MaxByteSize []int32 `protobuf:"varint,2,rep,packed,name=max_byte_size,json=maxByteSize,proto3" json:"max_byte_size,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GraphTransferNodeOutputInfo) Reset() { + *x = GraphTransferNodeOutputInfo{} + mi := &file_tensorflow_core_framework_graph_transfer_info_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GraphTransferNodeOutputInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GraphTransferNodeOutputInfo) ProtoMessage() {} + +func (x *GraphTransferNodeOutputInfo) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_graph_transfer_info_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GraphTransferNodeOutputInfo.ProtoReflect.Descriptor instead. +func (*GraphTransferNodeOutputInfo) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_graph_transfer_info_proto_rawDescGZIP(), []int{4} +} + +func (x *GraphTransferNodeOutputInfo) GetNodeId() int32 { + if x != nil { + return x.NodeId + } + return 0 +} + +func (x *GraphTransferNodeOutputInfo) GetMaxByteSize() []int32 { + if x != nil { + return x.MaxByteSize + } + return nil +} + +type GraphTransferGraphInputNodeInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Shape []int64 `protobuf:"varint,2,rep,packed,name=shape,proto3" json:"shape,omitempty"` + Dtype types_go_proto.DataType `protobuf:"varint,3,opt,name=dtype,proto3,enum=tensorflow.DataType" json:"dtype,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GraphTransferGraphInputNodeInfo) Reset() { + *x = GraphTransferGraphInputNodeInfo{} + mi := &file_tensorflow_core_framework_graph_transfer_info_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GraphTransferGraphInputNodeInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GraphTransferGraphInputNodeInfo) ProtoMessage() {} + +func (x *GraphTransferGraphInputNodeInfo) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_graph_transfer_info_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GraphTransferGraphInputNodeInfo.ProtoReflect.Descriptor instead. +func (*GraphTransferGraphInputNodeInfo) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_graph_transfer_info_proto_rawDescGZIP(), []int{5} +} + +func (x *GraphTransferGraphInputNodeInfo) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *GraphTransferGraphInputNodeInfo) GetShape() []int64 { + if x != nil { + return x.Shape + } + return nil +} + +func (x *GraphTransferGraphInputNodeInfo) GetDtype() types_go_proto.DataType { + if x != nil { + return x.Dtype + } + return types_go_proto.DataType(0) +} + +type GraphTransferGraphOutputNodeInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Shape []int64 `protobuf:"varint,2,rep,packed,name=shape,proto3" json:"shape,omitempty"` + Dtype types_go_proto.DataType `protobuf:"varint,3,opt,name=dtype,proto3,enum=tensorflow.DataType" json:"dtype,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GraphTransferGraphOutputNodeInfo) Reset() { + *x = GraphTransferGraphOutputNodeInfo{} + mi := &file_tensorflow_core_framework_graph_transfer_info_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GraphTransferGraphOutputNodeInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GraphTransferGraphOutputNodeInfo) ProtoMessage() {} + +func (x *GraphTransferGraphOutputNodeInfo) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_graph_transfer_info_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GraphTransferGraphOutputNodeInfo.ProtoReflect.Descriptor instead. +func (*GraphTransferGraphOutputNodeInfo) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_graph_transfer_info_proto_rawDescGZIP(), []int{6} +} + +func (x *GraphTransferGraphOutputNodeInfo) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *GraphTransferGraphOutputNodeInfo) GetShape() []int64 { + if x != nil { + return x.Shape + } + return nil +} + +func (x *GraphTransferGraphOutputNodeInfo) GetDtype() types_go_proto.DataType { + if x != nil { + return x.Dtype + } + return types_go_proto.DataType(0) +} + +// Protocol buffer representing a handle to a tensorflow resource. Handles are +// not valid across executions, but can be serialized back and forth from within +// a single run. +type GraphTransferInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + NodeInfo []*GraphTransferNodeInfo `protobuf:"bytes,1,rep,name=node_info,json=nodeInfo,proto3" json:"node_info,omitempty"` + ConstNodeInfo []*GraphTransferConstNodeInfo `protobuf:"bytes,2,rep,name=const_node_info,json=constNodeInfo,proto3" json:"const_node_info,omitempty"` + NodeInputInfo []*GraphTransferNodeInputInfo `protobuf:"bytes,3,rep,name=node_input_info,json=nodeInputInfo,proto3" json:"node_input_info,omitempty"` + NodeOutputInfo []*GraphTransferNodeOutputInfo `protobuf:"bytes,4,rep,name=node_output_info,json=nodeOutputInfo,proto3" json:"node_output_info,omitempty"` + // Input Node parameters of transferred graph + GraphInputNodeInfo []*GraphTransferGraphInputNodeInfo `protobuf:"bytes,5,rep,name=graph_input_node_info,json=graphInputNodeInfo,proto3" json:"graph_input_node_info,omitempty"` + GraphOutputNodeInfo []*GraphTransferGraphOutputNodeInfo `protobuf:"bytes,6,rep,name=graph_output_node_info,json=graphOutputNodeInfo,proto3" json:"graph_output_node_info,omitempty"` + // Destination of graph transfer + Destination GraphTransferInfo_Destination `protobuf:"varint,7,opt,name=destination,proto3,enum=tensorflow.GraphTransferInfo_Destination" json:"destination,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GraphTransferInfo) Reset() { + *x = GraphTransferInfo{} + mi := &file_tensorflow_core_framework_graph_transfer_info_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GraphTransferInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GraphTransferInfo) ProtoMessage() {} + +func (x *GraphTransferInfo) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_graph_transfer_info_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GraphTransferInfo.ProtoReflect.Descriptor instead. +func (*GraphTransferInfo) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_graph_transfer_info_proto_rawDescGZIP(), []int{7} +} + +func (x *GraphTransferInfo) GetNodeInfo() []*GraphTransferNodeInfo { + if x != nil { + return x.NodeInfo + } + return nil +} + +func (x *GraphTransferInfo) GetConstNodeInfo() []*GraphTransferConstNodeInfo { + if x != nil { + return x.ConstNodeInfo + } + return nil +} + +func (x *GraphTransferInfo) GetNodeInputInfo() []*GraphTransferNodeInputInfo { + if x != nil { + return x.NodeInputInfo + } + return nil +} + +func (x *GraphTransferInfo) GetNodeOutputInfo() []*GraphTransferNodeOutputInfo { + if x != nil { + return x.NodeOutputInfo + } + return nil +} + +func (x *GraphTransferInfo) GetGraphInputNodeInfo() []*GraphTransferGraphInputNodeInfo { + if x != nil { + return x.GraphInputNodeInfo + } + return nil +} + +func (x *GraphTransferInfo) GetGraphOutputNodeInfo() []*GraphTransferGraphOutputNodeInfo { + if x != nil { + return x.GraphOutputNodeInfo + } + return nil +} + +func (x *GraphTransferInfo) GetDestination() GraphTransferInfo_Destination { + if x != nil { + return x.Destination + } + return GraphTransferInfo_NOP +} + +var File_tensorflow_core_framework_graph_transfer_info_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_graph_transfer_info_proto_rawDesc = "" + + "\n" + + "3tensorflow/core/framework/graph_transfer_info.proto\x12\n" + + "tensorflow\x1a%tensorflow/core/framework/types.proto\"R\n" + + "\x16GraphTransferNodeInput\x12\x17\n" + + "\anode_id\x18\x01 \x01(\x05R\x06nodeId\x12\x1f\n" + + "\voutput_port\x18\x02 \x01(\x05R\n" + + "outputPort\"\xe0\x01\n" + + "\x15GraphTransferNodeInfo\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x17\n" + + "\anode_id\x18\x02 \x01(\x05R\x06nodeId\x12\x1b\n" + + "\ttype_name\x18\x03 \x01(\tR\btypeName\x12\x1a\n" + + "\tsoc_op_id\x18\x04 \x01(\x05R\asocOpId\x12\x1d\n" + + "\n" + + "padding_id\x18\x05 \x01(\x05R\tpaddingId\x12\x1f\n" + + "\vinput_count\x18\x06 \x01(\x05R\n" + + "inputCount\x12!\n" + + "\foutput_count\x18\a \x01(\x05R\voutputCount\"\x9f\x01\n" + + "\x1aGraphTransferConstNodeInfo\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x17\n" + + "\anode_id\x18\x02 \x01(\x05R\x06nodeId\x12\x14\n" + + "\x05shape\x18\x03 \x03(\x03R\x05shape\x12\x12\n" + + "\x04data\x18\x04 \x01(\fR\x04data\x12*\n" + + "\x05dtype\x18\x05 \x01(\x0e2\x14.tensorflow.DataTypeR\x05dtype\"x\n" + + "\x1aGraphTransferNodeInputInfo\x12\x17\n" + + "\anode_id\x18\x01 \x01(\x05R\x06nodeId\x12A\n" + + "\n" + + "node_input\x18\x02 \x03(\v2\".tensorflow.GraphTransferNodeInputR\tnodeInput\"Z\n" + + "\x1bGraphTransferNodeOutputInfo\x12\x17\n" + + "\anode_id\x18\x01 \x01(\x05R\x06nodeId\x12\"\n" + + "\rmax_byte_size\x18\x02 \x03(\x05R\vmaxByteSize\"w\n" + + "\x1fGraphTransferGraphInputNodeInfo\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x14\n" + + "\x05shape\x18\x02 \x03(\x03R\x05shape\x12*\n" + + "\x05dtype\x18\x03 \x01(\x0e2\x14.tensorflow.DataTypeR\x05dtype\"x\n" + + " GraphTransferGraphOutputNodeInfo\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x14\n" + + "\x05shape\x18\x02 \x03(\x03R\x05shape\x12*\n" + + "\x05dtype\x18\x03 \x01(\x0e2\x14.tensorflow.DataTypeR\x05dtype\"\xfb\x04\n" + + "\x11GraphTransferInfo\x12>\n" + + "\tnode_info\x18\x01 \x03(\v2!.tensorflow.GraphTransferNodeInfoR\bnodeInfo\x12N\n" + + "\x0fconst_node_info\x18\x02 \x03(\v2&.tensorflow.GraphTransferConstNodeInfoR\rconstNodeInfo\x12N\n" + + "\x0fnode_input_info\x18\x03 \x03(\v2&.tensorflow.GraphTransferNodeInputInfoR\rnodeInputInfo\x12Q\n" + + "\x10node_output_info\x18\x04 \x03(\v2'.tensorflow.GraphTransferNodeOutputInfoR\x0enodeOutputInfo\x12^\n" + + "\x15graph_input_node_info\x18\x05 \x03(\v2+.tensorflow.GraphTransferGraphInputNodeInfoR\x12graphInputNodeInfo\x12a\n" + + "\x16graph_output_node_info\x18\x06 \x03(\v2,.tensorflow.GraphTransferGraphOutputNodeInfoR\x13graphOutputNodeInfo\x12K\n" + + "\vdestination\x18\a \x01(\x0e2).tensorflow.GraphTransferInfo.DestinationR\vdestination\"#\n" + + "\vDestination\x12\a\n" + + "\x03NOP\x10\x00\x12\v\n" + + "\aHEXAGON\x10\x01B\x93\x01\n" + + "\x18org.tensorflow.frameworkB\x16GraphTransferInfoProtoP\x01ZZgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/graph_transfer_info_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_graph_transfer_info_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_graph_transfer_info_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_graph_transfer_info_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_graph_transfer_info_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_graph_transfer_info_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_graph_transfer_info_proto_rawDesc), len(file_tensorflow_core_framework_graph_transfer_info_proto_rawDesc))) + }) + return file_tensorflow_core_framework_graph_transfer_info_proto_rawDescData +} + +var file_tensorflow_core_framework_graph_transfer_info_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_tensorflow_core_framework_graph_transfer_info_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_tensorflow_core_framework_graph_transfer_info_proto_goTypes = []any{ + (GraphTransferInfo_Destination)(0), // 0: tensorflow.GraphTransferInfo.Destination + (*GraphTransferNodeInput)(nil), // 1: tensorflow.GraphTransferNodeInput + (*GraphTransferNodeInfo)(nil), // 2: tensorflow.GraphTransferNodeInfo + (*GraphTransferConstNodeInfo)(nil), // 3: tensorflow.GraphTransferConstNodeInfo + (*GraphTransferNodeInputInfo)(nil), // 4: tensorflow.GraphTransferNodeInputInfo + (*GraphTransferNodeOutputInfo)(nil), // 5: tensorflow.GraphTransferNodeOutputInfo + (*GraphTransferGraphInputNodeInfo)(nil), // 6: tensorflow.GraphTransferGraphInputNodeInfo + (*GraphTransferGraphOutputNodeInfo)(nil), // 7: tensorflow.GraphTransferGraphOutputNodeInfo + (*GraphTransferInfo)(nil), // 8: tensorflow.GraphTransferInfo + (types_go_proto.DataType)(0), // 9: tensorflow.DataType +} +var file_tensorflow_core_framework_graph_transfer_info_proto_depIdxs = []int32{ + 9, // 0: tensorflow.GraphTransferConstNodeInfo.dtype:type_name -> tensorflow.DataType + 1, // 1: tensorflow.GraphTransferNodeInputInfo.node_input:type_name -> tensorflow.GraphTransferNodeInput + 9, // 2: tensorflow.GraphTransferGraphInputNodeInfo.dtype:type_name -> tensorflow.DataType + 9, // 3: tensorflow.GraphTransferGraphOutputNodeInfo.dtype:type_name -> tensorflow.DataType + 2, // 4: tensorflow.GraphTransferInfo.node_info:type_name -> tensorflow.GraphTransferNodeInfo + 3, // 5: tensorflow.GraphTransferInfo.const_node_info:type_name -> tensorflow.GraphTransferConstNodeInfo + 4, // 6: tensorflow.GraphTransferInfo.node_input_info:type_name -> tensorflow.GraphTransferNodeInputInfo + 5, // 7: tensorflow.GraphTransferInfo.node_output_info:type_name -> tensorflow.GraphTransferNodeOutputInfo + 6, // 8: tensorflow.GraphTransferInfo.graph_input_node_info:type_name -> tensorflow.GraphTransferGraphInputNodeInfo + 7, // 9: tensorflow.GraphTransferInfo.graph_output_node_info:type_name -> tensorflow.GraphTransferGraphOutputNodeInfo + 0, // 10: tensorflow.GraphTransferInfo.destination:type_name -> tensorflow.GraphTransferInfo.Destination + 11, // [11:11] is the sub-list for method output_type + 11, // [11:11] is the sub-list for method input_type + 11, // [11:11] is the sub-list for extension type_name + 11, // [11:11] is the sub-list for extension extendee + 0, // [0:11] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_graph_transfer_info_proto_init() } +func file_tensorflow_core_framework_graph_transfer_info_proto_init() { + if File_tensorflow_core_framework_graph_transfer_info_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_graph_transfer_info_proto_rawDesc), len(file_tensorflow_core_framework_graph_transfer_info_proto_rawDesc)), + NumEnums: 1, + NumMessages: 8, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_graph_transfer_info_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_graph_transfer_info_proto_depIdxs, + EnumInfos: file_tensorflow_core_framework_graph_transfer_info_proto_enumTypes, + MessageInfos: file_tensorflow_core_framework_graph_transfer_info_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_graph_transfer_info_proto = out.File + file_tensorflow_core_framework_graph_transfer_info_proto_goTypes = nil + file_tensorflow_core_framework_graph_transfer_info_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/framework/kernel_def_go_proto/kernel_def.pb.go b/third_party/go-tensorflow/tensorflow/go/core/framework/kernel_def_go_proto/kernel_def.pb.go new file mode 100644 index 0000000..83811b5 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/framework/kernel_def_go_proto/kernel_def.pb.go @@ -0,0 +1,295 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/kernel_def.proto + +package kernel_def_go_proto + +import ( + attr_value_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/attr_value_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type KernelDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Must match the name of an Op. + Op string `protobuf:"bytes,1,opt,name=op,proto3" json:"op,omitempty"` + // Type of device this kernel runs on. + DeviceType string `protobuf:"bytes,2,opt,name=device_type,json=deviceType,proto3" json:"device_type,omitempty"` + Constraint []*KernelDef_AttrConstraint `protobuf:"bytes,3,rep,name=constraint,proto3" json:"constraint,omitempty"` + // Names of the Op's input_/output_args that reside in host memory + // instead of device memory. + HostMemoryArg []string `protobuf:"bytes,4,rep,name=host_memory_arg,json=hostMemoryArg,proto3" json:"host_memory_arg,omitempty"` + // This allows experimental kernels to be registered for an op that + // won't be used unless the user specifies a "_kernel" attr with + // value matching this. + Label string `protobuf:"bytes,5,opt,name=label,proto3" json:"label,omitempty"` + // Prioritization of kernel amongst different devices. By default we assume + // priority is 0. The higher the priority the better. By default (i.e. if + // this is not set), we prefer GPU kernels over CPU. + Priority int32 `protobuf:"varint,6,opt,name=priority,proto3" json:"priority,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KernelDef) Reset() { + *x = KernelDef{} + mi := &file_tensorflow_core_framework_kernel_def_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KernelDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KernelDef) ProtoMessage() {} + +func (x *KernelDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_kernel_def_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KernelDef.ProtoReflect.Descriptor instead. +func (*KernelDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_kernel_def_proto_rawDescGZIP(), []int{0} +} + +func (x *KernelDef) GetOp() string { + if x != nil { + return x.Op + } + return "" +} + +func (x *KernelDef) GetDeviceType() string { + if x != nil { + return x.DeviceType + } + return "" +} + +func (x *KernelDef) GetConstraint() []*KernelDef_AttrConstraint { + if x != nil { + return x.Constraint + } + return nil +} + +func (x *KernelDef) GetHostMemoryArg() []string { + if x != nil { + return x.HostMemoryArg + } + return nil +} + +func (x *KernelDef) GetLabel() string { + if x != nil { + return x.Label + } + return "" +} + +func (x *KernelDef) GetPriority() int32 { + if x != nil { + return x.Priority + } + return 0 +} + +// A collection of KernelDefs +type KernelList struct { + state protoimpl.MessageState `protogen:"open.v1"` + Kernel []*KernelDef `protobuf:"bytes,1,rep,name=kernel,proto3" json:"kernel,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KernelList) Reset() { + *x = KernelList{} + mi := &file_tensorflow_core_framework_kernel_def_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KernelList) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KernelList) ProtoMessage() {} + +func (x *KernelList) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_kernel_def_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KernelList.ProtoReflect.Descriptor instead. +func (*KernelList) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_kernel_def_proto_rawDescGZIP(), []int{1} +} + +func (x *KernelList) GetKernel() []*KernelDef { + if x != nil { + return x.Kernel + } + return nil +} + +type KernelDef_AttrConstraint struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Name of an attr from the Op. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // A list of values that this kernel supports for this attr. + // Like OpDef.AttrDef.allowed_values, except for kernels instead of Ops. + AllowedValues *attr_value_go_proto.AttrValue `protobuf:"bytes,2,opt,name=allowed_values,json=allowedValues,proto3" json:"allowed_values,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KernelDef_AttrConstraint) Reset() { + *x = KernelDef_AttrConstraint{} + mi := &file_tensorflow_core_framework_kernel_def_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KernelDef_AttrConstraint) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KernelDef_AttrConstraint) ProtoMessage() {} + +func (x *KernelDef_AttrConstraint) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_kernel_def_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KernelDef_AttrConstraint.ProtoReflect.Descriptor instead. +func (*KernelDef_AttrConstraint) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_kernel_def_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *KernelDef_AttrConstraint) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *KernelDef_AttrConstraint) GetAllowedValues() *attr_value_go_proto.AttrValue { + if x != nil { + return x.AllowedValues + } + return nil +} + +var File_tensorflow_core_framework_kernel_def_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_kernel_def_proto_rawDesc = "" + + "\n" + + "*tensorflow/core/framework/kernel_def.proto\x12\n" + + "tensorflow\x1a*tensorflow/core/framework/attr_value.proto\"\xc0\x02\n" + + "\tKernelDef\x12\x0e\n" + + "\x02op\x18\x01 \x01(\tR\x02op\x12\x1f\n" + + "\vdevice_type\x18\x02 \x01(\tR\n" + + "deviceType\x12D\n" + + "\n" + + "constraint\x18\x03 \x03(\v2$.tensorflow.KernelDef.AttrConstraintR\n" + + "constraint\x12&\n" + + "\x0fhost_memory_arg\x18\x04 \x03(\tR\rhostMemoryArg\x12\x14\n" + + "\x05label\x18\x05 \x01(\tR\x05label\x12\x1a\n" + + "\bpriority\x18\x06 \x01(\x05R\bpriority\x1ab\n" + + "\x0eAttrConstraint\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12<\n" + + "\x0eallowed_values\x18\x02 \x01(\v2\x15.tensorflow.AttrValueR\rallowedValues\";\n" + + "\n" + + "KernelList\x12-\n" + + "\x06kernel\x18\x01 \x03(\v2\x15.tensorflow.KernelDefR\x06kernelB\x83\x01\n" + + "\x18org.tensorflow.frameworkB\x0fKernelDefProtosP\x01ZQgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/kernel_def_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_kernel_def_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_kernel_def_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_kernel_def_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_kernel_def_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_kernel_def_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_kernel_def_proto_rawDesc), len(file_tensorflow_core_framework_kernel_def_proto_rawDesc))) + }) + return file_tensorflow_core_framework_kernel_def_proto_rawDescData +} + +var file_tensorflow_core_framework_kernel_def_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_tensorflow_core_framework_kernel_def_proto_goTypes = []any{ + (*KernelDef)(nil), // 0: tensorflow.KernelDef + (*KernelList)(nil), // 1: tensorflow.KernelList + (*KernelDef_AttrConstraint)(nil), // 2: tensorflow.KernelDef.AttrConstraint + (*attr_value_go_proto.AttrValue)(nil), // 3: tensorflow.AttrValue +} +var file_tensorflow_core_framework_kernel_def_proto_depIdxs = []int32{ + 2, // 0: tensorflow.KernelDef.constraint:type_name -> tensorflow.KernelDef.AttrConstraint + 0, // 1: tensorflow.KernelList.kernel:type_name -> tensorflow.KernelDef + 3, // 2: tensorflow.KernelDef.AttrConstraint.allowed_values:type_name -> tensorflow.AttrValue + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_kernel_def_proto_init() } +func file_tensorflow_core_framework_kernel_def_proto_init() { + if File_tensorflow_core_framework_kernel_def_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_kernel_def_proto_rawDesc), len(file_tensorflow_core_framework_kernel_def_proto_rawDesc)), + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_kernel_def_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_kernel_def_proto_depIdxs, + MessageInfos: file_tensorflow_core_framework_kernel_def_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_kernel_def_proto = out.File + file_tensorflow_core_framework_kernel_def_proto_goTypes = nil + file_tensorflow_core_framework_kernel_def_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/framework/log_memory_go_proto/log_memory.pb.go b/third_party/go-tensorflow/tensorflow/go/core/framework/log_memory_go_proto/log_memory.pb.go new file mode 100644 index 0000000..68edb11 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/framework/log_memory_go_proto/log_memory.pb.go @@ -0,0 +1,537 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/log_memory.proto + +package log_memory_go_proto + +import ( + tensor_description_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_description_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type MemoryLogStep struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Process-unique step id. + StepId int64 `protobuf:"varint,1,opt,name=step_id,json=stepId,proto3" json:"step_id,omitempty"` + // Handle describing the feeds and fetches of the step. + Handle string `protobuf:"bytes,2,opt,name=handle,proto3" json:"handle,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MemoryLogStep) Reset() { + *x = MemoryLogStep{} + mi := &file_tensorflow_core_framework_log_memory_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MemoryLogStep) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MemoryLogStep) ProtoMessage() {} + +func (x *MemoryLogStep) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_log_memory_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MemoryLogStep.ProtoReflect.Descriptor instead. +func (*MemoryLogStep) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_log_memory_proto_rawDescGZIP(), []int{0} +} + +func (x *MemoryLogStep) GetStepId() int64 { + if x != nil { + return x.StepId + } + return 0 +} + +func (x *MemoryLogStep) GetHandle() string { + if x != nil { + return x.Handle + } + return "" +} + +type MemoryLogTensorAllocation struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Process-unique step id. + StepId int64 `protobuf:"varint,1,opt,name=step_id,json=stepId,proto3" json:"step_id,omitempty"` + // Name of the kernel making the allocation as set in GraphDef, + // e.g., "affine2/weights/Assign". + KernelName string `protobuf:"bytes,2,opt,name=kernel_name,json=kernelName,proto3" json:"kernel_name,omitempty"` + // Allocated tensor details. + Tensor *tensor_description_go_proto.TensorDescription `protobuf:"bytes,3,opt,name=tensor,proto3" json:"tensor,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MemoryLogTensorAllocation) Reset() { + *x = MemoryLogTensorAllocation{} + mi := &file_tensorflow_core_framework_log_memory_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MemoryLogTensorAllocation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MemoryLogTensorAllocation) ProtoMessage() {} + +func (x *MemoryLogTensorAllocation) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_log_memory_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MemoryLogTensorAllocation.ProtoReflect.Descriptor instead. +func (*MemoryLogTensorAllocation) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_log_memory_proto_rawDescGZIP(), []int{1} +} + +func (x *MemoryLogTensorAllocation) GetStepId() int64 { + if x != nil { + return x.StepId + } + return 0 +} + +func (x *MemoryLogTensorAllocation) GetKernelName() string { + if x != nil { + return x.KernelName + } + return "" +} + +func (x *MemoryLogTensorAllocation) GetTensor() *tensor_description_go_proto.TensorDescription { + if x != nil { + return x.Tensor + } + return nil +} + +type MemoryLogTensorDeallocation struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Id of the tensor buffer being deallocated, used to match to a + // corresponding allocation. + AllocationId int64 `protobuf:"varint,1,opt,name=allocation_id,json=allocationId,proto3" json:"allocation_id,omitempty"` + // Name of the allocator used. + AllocatorName string `protobuf:"bytes,2,opt,name=allocator_name,json=allocatorName,proto3" json:"allocator_name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MemoryLogTensorDeallocation) Reset() { + *x = MemoryLogTensorDeallocation{} + mi := &file_tensorflow_core_framework_log_memory_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MemoryLogTensorDeallocation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MemoryLogTensorDeallocation) ProtoMessage() {} + +func (x *MemoryLogTensorDeallocation) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_log_memory_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MemoryLogTensorDeallocation.ProtoReflect.Descriptor instead. +func (*MemoryLogTensorDeallocation) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_log_memory_proto_rawDescGZIP(), []int{2} +} + +func (x *MemoryLogTensorDeallocation) GetAllocationId() int64 { + if x != nil { + return x.AllocationId + } + return 0 +} + +func (x *MemoryLogTensorDeallocation) GetAllocatorName() string { + if x != nil { + return x.AllocatorName + } + return "" +} + +type MemoryLogTensorOutput struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Process-unique step id. + StepId int64 `protobuf:"varint,1,opt,name=step_id,json=stepId,proto3" json:"step_id,omitempty"` + // Name of the kernel producing an output as set in GraphDef, e.g., + // "affine2/weights/Assign". + KernelName string `protobuf:"bytes,2,opt,name=kernel_name,json=kernelName,proto3" json:"kernel_name,omitempty"` + // Index of the output being set. + Index int32 `protobuf:"varint,3,opt,name=index,proto3" json:"index,omitempty"` + // Output tensor details. + Tensor *tensor_description_go_proto.TensorDescription `protobuf:"bytes,4,opt,name=tensor,proto3" json:"tensor,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MemoryLogTensorOutput) Reset() { + *x = MemoryLogTensorOutput{} + mi := &file_tensorflow_core_framework_log_memory_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MemoryLogTensorOutput) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MemoryLogTensorOutput) ProtoMessage() {} + +func (x *MemoryLogTensorOutput) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_log_memory_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MemoryLogTensorOutput.ProtoReflect.Descriptor instead. +func (*MemoryLogTensorOutput) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_log_memory_proto_rawDescGZIP(), []int{3} +} + +func (x *MemoryLogTensorOutput) GetStepId() int64 { + if x != nil { + return x.StepId + } + return 0 +} + +func (x *MemoryLogTensorOutput) GetKernelName() string { + if x != nil { + return x.KernelName + } + return "" +} + +func (x *MemoryLogTensorOutput) GetIndex() int32 { + if x != nil { + return x.Index + } + return 0 +} + +func (x *MemoryLogTensorOutput) GetTensor() *tensor_description_go_proto.TensorDescription { + if x != nil { + return x.Tensor + } + return nil +} + +type MemoryLogRawAllocation struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Process-unique step id. + StepId int64 `protobuf:"varint,1,opt,name=step_id,json=stepId,proto3" json:"step_id,omitempty"` + // Name of the operation making the allocation. + Operation string `protobuf:"bytes,2,opt,name=operation,proto3" json:"operation,omitempty"` + // Number of bytes in the allocation. + NumBytes int64 `protobuf:"varint,3,opt,name=num_bytes,json=numBytes,proto3" json:"num_bytes,omitempty"` + // Address of the allocation. + Ptr uint64 `protobuf:"varint,4,opt,name=ptr,proto3" json:"ptr,omitempty"` + // Id of the tensor buffer being allocated, used to match to a + // corresponding deallocation. + AllocationId int64 `protobuf:"varint,5,opt,name=allocation_id,json=allocationId,proto3" json:"allocation_id,omitempty"` + // Name of the allocator used. + AllocatorName string `protobuf:"bytes,6,opt,name=allocator_name,json=allocatorName,proto3" json:"allocator_name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MemoryLogRawAllocation) Reset() { + *x = MemoryLogRawAllocation{} + mi := &file_tensorflow_core_framework_log_memory_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MemoryLogRawAllocation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MemoryLogRawAllocation) ProtoMessage() {} + +func (x *MemoryLogRawAllocation) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_log_memory_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MemoryLogRawAllocation.ProtoReflect.Descriptor instead. +func (*MemoryLogRawAllocation) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_log_memory_proto_rawDescGZIP(), []int{4} +} + +func (x *MemoryLogRawAllocation) GetStepId() int64 { + if x != nil { + return x.StepId + } + return 0 +} + +func (x *MemoryLogRawAllocation) GetOperation() string { + if x != nil { + return x.Operation + } + return "" +} + +func (x *MemoryLogRawAllocation) GetNumBytes() int64 { + if x != nil { + return x.NumBytes + } + return 0 +} + +func (x *MemoryLogRawAllocation) GetPtr() uint64 { + if x != nil { + return x.Ptr + } + return 0 +} + +func (x *MemoryLogRawAllocation) GetAllocationId() int64 { + if x != nil { + return x.AllocationId + } + return 0 +} + +func (x *MemoryLogRawAllocation) GetAllocatorName() string { + if x != nil { + return x.AllocatorName + } + return "" +} + +type MemoryLogRawDeallocation struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Process-unique step id. + StepId int64 `protobuf:"varint,1,opt,name=step_id,json=stepId,proto3" json:"step_id,omitempty"` + // Name of the operation making the deallocation. + Operation string `protobuf:"bytes,2,opt,name=operation,proto3" json:"operation,omitempty"` + // Id of the tensor buffer being deallocated, used to match to a + // corresponding allocation. + AllocationId int64 `protobuf:"varint,3,opt,name=allocation_id,json=allocationId,proto3" json:"allocation_id,omitempty"` + // Name of the allocator used. + AllocatorName string `protobuf:"bytes,4,opt,name=allocator_name,json=allocatorName,proto3" json:"allocator_name,omitempty"` + // True if the deallocation is queued and will be performed later, + // e.g. for GPU lazy freeing of buffers. + Deferred bool `protobuf:"varint,5,opt,name=deferred,proto3" json:"deferred,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MemoryLogRawDeallocation) Reset() { + *x = MemoryLogRawDeallocation{} + mi := &file_tensorflow_core_framework_log_memory_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MemoryLogRawDeallocation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MemoryLogRawDeallocation) ProtoMessage() {} + +func (x *MemoryLogRawDeallocation) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_log_memory_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MemoryLogRawDeallocation.ProtoReflect.Descriptor instead. +func (*MemoryLogRawDeallocation) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_log_memory_proto_rawDescGZIP(), []int{5} +} + +func (x *MemoryLogRawDeallocation) GetStepId() int64 { + if x != nil { + return x.StepId + } + return 0 +} + +func (x *MemoryLogRawDeallocation) GetOperation() string { + if x != nil { + return x.Operation + } + return "" +} + +func (x *MemoryLogRawDeallocation) GetAllocationId() int64 { + if x != nil { + return x.AllocationId + } + return 0 +} + +func (x *MemoryLogRawDeallocation) GetAllocatorName() string { + if x != nil { + return x.AllocatorName + } + return "" +} + +func (x *MemoryLogRawDeallocation) GetDeferred() bool { + if x != nil { + return x.Deferred + } + return false +} + +var File_tensorflow_core_framework_log_memory_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_log_memory_proto_rawDesc = "" + + "\n" + + "*tensorflow/core/framework/log_memory.proto\x12\n" + + "tensorflow\x1a2tensorflow/core/framework/tensor_description.proto\"@\n" + + "\rMemoryLogStep\x12\x17\n" + + "\astep_id\x18\x01 \x01(\x03R\x06stepId\x12\x16\n" + + "\x06handle\x18\x02 \x01(\tR\x06handle\"\x8c\x01\n" + + "\x19MemoryLogTensorAllocation\x12\x17\n" + + "\astep_id\x18\x01 \x01(\x03R\x06stepId\x12\x1f\n" + + "\vkernel_name\x18\x02 \x01(\tR\n" + + "kernelName\x125\n" + + "\x06tensor\x18\x03 \x01(\v2\x1d.tensorflow.TensorDescriptionR\x06tensor\"i\n" + + "\x1bMemoryLogTensorDeallocation\x12#\n" + + "\rallocation_id\x18\x01 \x01(\x03R\fallocationId\x12%\n" + + "\x0eallocator_name\x18\x02 \x01(\tR\rallocatorName\"\x9e\x01\n" + + "\x15MemoryLogTensorOutput\x12\x17\n" + + "\astep_id\x18\x01 \x01(\x03R\x06stepId\x12\x1f\n" + + "\vkernel_name\x18\x02 \x01(\tR\n" + + "kernelName\x12\x14\n" + + "\x05index\x18\x03 \x01(\x05R\x05index\x125\n" + + "\x06tensor\x18\x04 \x01(\v2\x1d.tensorflow.TensorDescriptionR\x06tensor\"\xca\x01\n" + + "\x16MemoryLogRawAllocation\x12\x17\n" + + "\astep_id\x18\x01 \x01(\x03R\x06stepId\x12\x1c\n" + + "\toperation\x18\x02 \x01(\tR\toperation\x12\x1b\n" + + "\tnum_bytes\x18\x03 \x01(\x03R\bnumBytes\x12\x10\n" + + "\x03ptr\x18\x04 \x01(\x04R\x03ptr\x12#\n" + + "\rallocation_id\x18\x05 \x01(\x03R\fallocationId\x12%\n" + + "\x0eallocator_name\x18\x06 \x01(\tR\rallocatorName\"\xb9\x01\n" + + "\x18MemoryLogRawDeallocation\x12\x17\n" + + "\astep_id\x18\x01 \x01(\x03R\x06stepId\x12\x1c\n" + + "\toperation\x18\x02 \x01(\tR\toperation\x12#\n" + + "\rallocation_id\x18\x03 \x01(\x03R\fallocationId\x12%\n" + + "\x0eallocator_name\x18\x04 \x01(\tR\rallocatorName\x12\x1a\n" + + "\bdeferred\x18\x05 \x01(\bR\bdeferredB\x83\x01\n" + + "\x18org.tensorflow.frameworkB\x0fLogMemoryProtosP\x01ZQgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/log_memory_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_log_memory_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_log_memory_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_log_memory_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_log_memory_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_log_memory_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_log_memory_proto_rawDesc), len(file_tensorflow_core_framework_log_memory_proto_rawDesc))) + }) + return file_tensorflow_core_framework_log_memory_proto_rawDescData +} + +var file_tensorflow_core_framework_log_memory_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_tensorflow_core_framework_log_memory_proto_goTypes = []any{ + (*MemoryLogStep)(nil), // 0: tensorflow.MemoryLogStep + (*MemoryLogTensorAllocation)(nil), // 1: tensorflow.MemoryLogTensorAllocation + (*MemoryLogTensorDeallocation)(nil), // 2: tensorflow.MemoryLogTensorDeallocation + (*MemoryLogTensorOutput)(nil), // 3: tensorflow.MemoryLogTensorOutput + (*MemoryLogRawAllocation)(nil), // 4: tensorflow.MemoryLogRawAllocation + (*MemoryLogRawDeallocation)(nil), // 5: tensorflow.MemoryLogRawDeallocation + (*tensor_description_go_proto.TensorDescription)(nil), // 6: tensorflow.TensorDescription +} +var file_tensorflow_core_framework_log_memory_proto_depIdxs = []int32{ + 6, // 0: tensorflow.MemoryLogTensorAllocation.tensor:type_name -> tensorflow.TensorDescription + 6, // 1: tensorflow.MemoryLogTensorOutput.tensor:type_name -> tensorflow.TensorDescription + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_log_memory_proto_init() } +func file_tensorflow_core_framework_log_memory_proto_init() { + if File_tensorflow_core_framework_log_memory_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_log_memory_proto_rawDesc), len(file_tensorflow_core_framework_log_memory_proto_rawDesc)), + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_log_memory_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_log_memory_proto_depIdxs, + MessageInfos: file_tensorflow_core_framework_log_memory_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_log_memory_proto = out.File + file_tensorflow_core_framework_log_memory_proto_goTypes = nil + file_tensorflow_core_framework_log_memory_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/framework/node_def_go_proto/node_def.pb.go b/third_party/go-tensorflow/tensorflow/go/core/framework/node_def_go_proto/node_def.pb.go new file mode 100644 index 0000000..8e998a7 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/framework/node_def_go_proto/node_def.pb.go @@ -0,0 +1,292 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/node_def.proto + +package node_def_go_proto + +import ( + attr_value_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/attr_value_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type NodeDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The name given to this operator. Used for naming inputs, + // logging, visualization, etc. Unique within a single GraphDef. + // Must match the regexp "[A-Za-z0-9.][A-Za-z0-9_>./]*". + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // The operation name. There may be custom parameters in attrs. + // Op names starting with an underscore are reserved for internal use. + Op string `protobuf:"bytes,2,opt,name=op,proto3" json:"op,omitempty"` + // Each input is "node:src_output" with "node" being a string name and + // "src_output" indicating which output tensor to use from "node". If + // "src_output" is 0 the ":0" suffix can be omitted. Regular inputs + // may optionally be followed by control inputs that have the format + // "^node". + Input []string `protobuf:"bytes,3,rep,name=input,proto3" json:"input,omitempty"` + // A (possibly partial) specification for the device on which this + // node should be placed. + // The expected syntax for this string is as follows: + // + // DEVICE_SPEC ::= PARTIAL_SPEC + // + // PARTIAL_SPEC ::= ("/" CONSTRAINT) * + // CONSTRAINT ::= ("job:" JOB_NAME) + // + // | ("replica:" [1-9][0-9]*) + // | ("task:" [1-9][0-9]*) + // | ("device:" [A-Za-z]* ":" ([1-9][0-9]* | "*") ) + // + // Valid values for this string include: + // * "/job:worker/replica:0/task:1/device:GPU:3" (full specification) + // * "/job:worker/device:GPU:3" (partial specification) + // * "" (no specification) + // + // If the constraints do not resolve to a single device (or if this + // field is empty or not present), the runtime will attempt to + // choose a device automatically. + Device string `protobuf:"bytes,4,opt,name=device,proto3" json:"device,omitempty"` + // Operation-specific graph-construction-time configuration. + // Note that this should include all attrs defined in the + // corresponding OpDef, including those with a value matching + // the default -- this allows the default to change and makes + // NodeDefs easier to interpret on their own. However, if + // an attr with a default is not specified in this list, the + // default will be used. + // The "names" (keys) must match the regexp "[a-z][a-z0-9_]+" (and + // one of the names from the corresponding OpDef's attr field). + // The values must have a type matching the corresponding OpDef + // attr's type field. + // TODO(josh11b): Add some examples here showing best practices. + Attr map[string]*attr_value_go_proto.AttrValue `protobuf:"bytes,5,rep,name=attr,proto3" json:"attr,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // This stores debug information associated with the node. + ExperimentalDebugInfo *NodeDef_ExperimentalDebugInfo `protobuf:"bytes,6,opt,name=experimental_debug_info,json=experimentalDebugInfo,proto3" json:"experimental_debug_info,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NodeDef) Reset() { + *x = NodeDef{} + mi := &file_tensorflow_core_framework_node_def_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NodeDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NodeDef) ProtoMessage() {} + +func (x *NodeDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_node_def_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NodeDef.ProtoReflect.Descriptor instead. +func (*NodeDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_node_def_proto_rawDescGZIP(), []int{0} +} + +func (x *NodeDef) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *NodeDef) GetOp() string { + if x != nil { + return x.Op + } + return "" +} + +func (x *NodeDef) GetInput() []string { + if x != nil { + return x.Input + } + return nil +} + +func (x *NodeDef) GetDevice() string { + if x != nil { + return x.Device + } + return "" +} + +func (x *NodeDef) GetAttr() map[string]*attr_value_go_proto.AttrValue { + if x != nil { + return x.Attr + } + return nil +} + +func (x *NodeDef) GetExperimentalDebugInfo() *NodeDef_ExperimentalDebugInfo { + if x != nil { + return x.ExperimentalDebugInfo + } + return nil +} + +type NodeDef_ExperimentalDebugInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Opaque string inserted into error messages created by the runtime. + // + // This is intended to store the list of names of the nodes from the + // original graph that this node was derived. For example if this node, say + // C, was result of a fusion of 2 nodes A and B, then 'original_node' would + // be {A, B}. This information can be used to map errors originating at the + // current node to some top level source code. + OriginalNodeNames []string `protobuf:"bytes,1,rep,name=original_node_names,json=originalNodeNames,proto3" json:"original_node_names,omitempty"` + // This is intended to store the list of names of the functions from the + // original graph that this node was derived. For example if this node, say + // C, was result of a fusion of node A in function FA and node B in function + // FB, then `original_funcs` would be {FA, FB}. If the node is in the top + // level graph, the `original_func` is empty. This information, with the + // `original_node_names` can be used to map errors originating at the + // current ndoe to some top level source code. + OriginalFuncNames []string `protobuf:"bytes,2,rep,name=original_func_names,json=originalFuncNames,proto3" json:"original_func_names,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NodeDef_ExperimentalDebugInfo) Reset() { + *x = NodeDef_ExperimentalDebugInfo{} + mi := &file_tensorflow_core_framework_node_def_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NodeDef_ExperimentalDebugInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NodeDef_ExperimentalDebugInfo) ProtoMessage() {} + +func (x *NodeDef_ExperimentalDebugInfo) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_node_def_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NodeDef_ExperimentalDebugInfo.ProtoReflect.Descriptor instead. +func (*NodeDef_ExperimentalDebugInfo) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_node_def_proto_rawDescGZIP(), []int{0, 1} +} + +func (x *NodeDef_ExperimentalDebugInfo) GetOriginalNodeNames() []string { + if x != nil { + return x.OriginalNodeNames + } + return nil +} + +func (x *NodeDef_ExperimentalDebugInfo) GetOriginalFuncNames() []string { + if x != nil { + return x.OriginalFuncNames + } + return nil +} + +var File_tensorflow_core_framework_node_def_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_node_def_proto_rawDesc = "" + + "\n" + + "(tensorflow/core/framework/node_def.proto\x12\n" + + "tensorflow\x1a*tensorflow/core/framework/attr_value.proto\"\xba\x03\n" + + "\aNodeDef\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x0e\n" + + "\x02op\x18\x02 \x01(\tR\x02op\x12\x14\n" + + "\x05input\x18\x03 \x03(\tR\x05input\x12\x16\n" + + "\x06device\x18\x04 \x01(\tR\x06device\x121\n" + + "\x04attr\x18\x05 \x03(\v2\x1d.tensorflow.NodeDef.AttrEntryR\x04attr\x12a\n" + + "\x17experimental_debug_info\x18\x06 \x01(\v2).tensorflow.NodeDef.ExperimentalDebugInfoR\x15experimentalDebugInfo\x1aN\n" + + "\tAttrEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12+\n" + + "\x05value\x18\x02 \x01(\v2\x15.tensorflow.AttrValueR\x05value:\x028\x01\x1aw\n" + + "\x15ExperimentalDebugInfo\x12.\n" + + "\x13original_node_names\x18\x01 \x03(\tR\x11originalNodeNames\x12.\n" + + "\x13original_func_names\x18\x02 \x03(\tR\x11originalFuncNamesB{\n" + + "\x18org.tensorflow.frameworkB\tNodeProtoP\x01ZOgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/node_def_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_node_def_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_node_def_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_node_def_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_node_def_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_node_def_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_node_def_proto_rawDesc), len(file_tensorflow_core_framework_node_def_proto_rawDesc))) + }) + return file_tensorflow_core_framework_node_def_proto_rawDescData +} + +var file_tensorflow_core_framework_node_def_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_tensorflow_core_framework_node_def_proto_goTypes = []any{ + (*NodeDef)(nil), // 0: tensorflow.NodeDef + nil, // 1: tensorflow.NodeDef.AttrEntry + (*NodeDef_ExperimentalDebugInfo)(nil), // 2: tensorflow.NodeDef.ExperimentalDebugInfo + (*attr_value_go_proto.AttrValue)(nil), // 3: tensorflow.AttrValue +} +var file_tensorflow_core_framework_node_def_proto_depIdxs = []int32{ + 1, // 0: tensorflow.NodeDef.attr:type_name -> tensorflow.NodeDef.AttrEntry + 2, // 1: tensorflow.NodeDef.experimental_debug_info:type_name -> tensorflow.NodeDef.ExperimentalDebugInfo + 3, // 2: tensorflow.NodeDef.AttrEntry.value:type_name -> tensorflow.AttrValue + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_node_def_proto_init() } +func file_tensorflow_core_framework_node_def_proto_init() { + if File_tensorflow_core_framework_node_def_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_node_def_proto_rawDesc), len(file_tensorflow_core_framework_node_def_proto_rawDesc)), + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_node_def_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_node_def_proto_depIdxs, + MessageInfos: file_tensorflow_core_framework_node_def_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_node_def_proto = out.File + file_tensorflow_core_framework_node_def_proto_goTypes = nil + file_tensorflow_core_framework_node_def_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/framework/op_def_go_proto/op_def.pb.go b/third_party/go-tensorflow/tensorflow/go/core/framework/op_def_go_proto/op_def.pb.go new file mode 100644 index 0000000..a9451ae --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/framework/op_def_go_proto/op_def.pb.go @@ -0,0 +1,623 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/op_def.proto + +package op_def_go_proto + +import ( + attr_value_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/attr_value_go_proto" + types_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/types_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Defines an operation. A NodeDef in a GraphDef specifies an Op by +// using the "op" field which should match the name of a OpDef. +// LINT.IfChange +type OpDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Op names starting with an underscore are reserved for internal use. + // Names should be CamelCase and match the regexp "[A-Z][a-zA-Z0-9>_]*". + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Description of the input(s). + InputArg []*OpDef_ArgDef `protobuf:"bytes,2,rep,name=input_arg,json=inputArg,proto3" json:"input_arg,omitempty"` + // Description of the output(s). + OutputArg []*OpDef_ArgDef `protobuf:"bytes,3,rep,name=output_arg,json=outputArg,proto3" json:"output_arg,omitempty"` + // Named control outputs for this operation. Useful only for composite + // operations (i.e. functions) which want to name different control outputs. + ControlOutput []string `protobuf:"bytes,20,rep,name=control_output,json=controlOutput,proto3" json:"control_output,omitempty"` + Attr []*OpDef_AttrDef `protobuf:"bytes,4,rep,name=attr,proto3" json:"attr,omitempty"` + // Optional deprecation based on GraphDef versions. + Deprecation *OpDeprecation `protobuf:"bytes,8,opt,name=deprecation,proto3" json:"deprecation,omitempty"` + // One-line human-readable description of what the Op does. + Summary string `protobuf:"bytes,5,opt,name=summary,proto3" json:"summary,omitempty"` + // Additional, longer human-readable description of what the Op does. + Description string `protobuf:"bytes,6,opt,name=description,proto3" json:"description,omitempty"` + // True if the operation is commutative ("op(a,b) == op(b,a)" for all inputs) + IsCommutative bool `protobuf:"varint,18,opt,name=is_commutative,json=isCommutative,proto3" json:"is_commutative,omitempty"` + // If is_aggregate is true, then this operation accepts N >= 2 + // inputs and produces 1 output all of the same type. Should be + // associative and commutative, and produce output with the same + // shape as the input. The optimizer may replace an aggregate op + // taking input from multiple devices with a tree of aggregate ops + // that aggregate locally within each device (and possibly within + // groups of nearby devices) before communicating. + // TODO(josh11b): Implement that optimization. + IsAggregate bool `protobuf:"varint,16,opt,name=is_aggregate,json=isAggregate,proto3" json:"is_aggregate,omitempty"` // for things like add + // Ops are marked as stateful if their behavior depends on some state beyond + // their input tensors (e.g. variable reading op) or if they have + // a side-effect (e.g. printing or asserting ops). Equivalently, stateless ops + // must always produce the same output for the same input and have + // no side-effects. + // + // By default Ops may be moved between devices. Stateful ops should + // either not be moved, or should only be moved if that state can also + // be moved (e.g. via some sort of save / restore). + // Stateful ops are guaranteed to never be optimized away by Common + // Subexpression Elimination (CSE). + IsStateful bool `protobuf:"varint,17,opt,name=is_stateful,json=isStateful,proto3" json:"is_stateful,omitempty"` // for things like variables, queue + // By default, all inputs to an Op must be initialized Tensors. Ops + // that may initialize tensors for the first time should set this + // field to true, to allow the Op to take an uninitialized Tensor as + // input. + AllowsUninitializedInput bool `protobuf:"varint,19,opt,name=allows_uninitialized_input,json=allowsUninitializedInput,proto3" json:"allows_uninitialized_input,omitempty"` // for Assign, etc. + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *OpDef) Reset() { + *x = OpDef{} + mi := &file_tensorflow_core_framework_op_def_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *OpDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OpDef) ProtoMessage() {} + +func (x *OpDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_op_def_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OpDef.ProtoReflect.Descriptor instead. +func (*OpDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_op_def_proto_rawDescGZIP(), []int{0} +} + +func (x *OpDef) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *OpDef) GetInputArg() []*OpDef_ArgDef { + if x != nil { + return x.InputArg + } + return nil +} + +func (x *OpDef) GetOutputArg() []*OpDef_ArgDef { + if x != nil { + return x.OutputArg + } + return nil +} + +func (x *OpDef) GetControlOutput() []string { + if x != nil { + return x.ControlOutput + } + return nil +} + +func (x *OpDef) GetAttr() []*OpDef_AttrDef { + if x != nil { + return x.Attr + } + return nil +} + +func (x *OpDef) GetDeprecation() *OpDeprecation { + if x != nil { + return x.Deprecation + } + return nil +} + +func (x *OpDef) GetSummary() string { + if x != nil { + return x.Summary + } + return "" +} + +func (x *OpDef) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *OpDef) GetIsCommutative() bool { + if x != nil { + return x.IsCommutative + } + return false +} + +func (x *OpDef) GetIsAggregate() bool { + if x != nil { + return x.IsAggregate + } + return false +} + +func (x *OpDef) GetIsStateful() bool { + if x != nil { + return x.IsStateful + } + return false +} + +func (x *OpDef) GetAllowsUninitializedInput() bool { + if x != nil { + return x.AllowsUninitializedInput + } + return false +} + +// Information about version-dependent deprecation of an op +type OpDeprecation struct { + state protoimpl.MessageState `protogen:"open.v1"` + // First GraphDef version at which the op is disallowed. + Version int32 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"` + // Explanation of why it was deprecated and what to use instead. + Explanation string `protobuf:"bytes,2,opt,name=explanation,proto3" json:"explanation,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *OpDeprecation) Reset() { + *x = OpDeprecation{} + mi := &file_tensorflow_core_framework_op_def_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *OpDeprecation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OpDeprecation) ProtoMessage() {} + +func (x *OpDeprecation) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_op_def_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OpDeprecation.ProtoReflect.Descriptor instead. +func (*OpDeprecation) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_op_def_proto_rawDescGZIP(), []int{1} +} + +func (x *OpDeprecation) GetVersion() int32 { + if x != nil { + return x.Version + } + return 0 +} + +func (x *OpDeprecation) GetExplanation() string { + if x != nil { + return x.Explanation + } + return "" +} + +// A collection of OpDefs +type OpList struct { + state protoimpl.MessageState `protogen:"open.v1"` + Op []*OpDef `protobuf:"bytes,1,rep,name=op,proto3" json:"op,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *OpList) Reset() { + *x = OpList{} + mi := &file_tensorflow_core_framework_op_def_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *OpList) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OpList) ProtoMessage() {} + +func (x *OpList) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_op_def_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OpList.ProtoReflect.Descriptor instead. +func (*OpList) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_op_def_proto_rawDescGZIP(), []int{2} +} + +func (x *OpList) GetOp() []*OpDef { + if x != nil { + return x.Op + } + return nil +} + +// For describing inputs and outputs. +type OpDef_ArgDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Name for the input/output. Should match the regexp "[a-z][a-z0-9_]*". + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Human readable description. + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + // Describes the type of one or more tensors that are accepted/produced + // by this input/output arg. The only legal combinations are: + // - For a single tensor: either the "type" field is set or the + // "type_attr" field is set to the name of an attr with type "type". + // - For a sequence of tensors with the same type: the "number_attr" + // field will be set to the name of an attr with type "int", and + // either the "type" or "type_attr" field will be set as for + // single tensors. + // - For a sequence of tensors, the "type_list_attr" field will be set + // to the name of an attr with type "list(type)". + Type types_go_proto.DataType `protobuf:"varint,3,opt,name=type,proto3,enum=tensorflow.DataType" json:"type,omitempty"` + TypeAttr string `protobuf:"bytes,4,opt,name=type_attr,json=typeAttr,proto3" json:"type_attr,omitempty"` // if specified, attr must have type "type" + NumberAttr string `protobuf:"bytes,5,opt,name=number_attr,json=numberAttr,proto3" json:"number_attr,omitempty"` // if specified, attr must have type "int" + // If specified, attr must have type "list(type)", and none of + // type, type_attr, and number_attr may be specified. + TypeListAttr string `protobuf:"bytes,6,opt,name=type_list_attr,json=typeListAttr,proto3" json:"type_list_attr,omitempty"` + // For inputs: if true, the inputs are required to be refs. + // + // By default, inputs can be either refs or non-refs. + // + // For outputs: if true, outputs are refs, otherwise they are not. + IsRef bool `protobuf:"varint,16,opt,name=is_ref,json=isRef,proto3" json:"is_ref,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *OpDef_ArgDef) Reset() { + *x = OpDef_ArgDef{} + mi := &file_tensorflow_core_framework_op_def_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *OpDef_ArgDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OpDef_ArgDef) ProtoMessage() {} + +func (x *OpDef_ArgDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_op_def_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OpDef_ArgDef.ProtoReflect.Descriptor instead. +func (*OpDef_ArgDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_op_def_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *OpDef_ArgDef) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *OpDef_ArgDef) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *OpDef_ArgDef) GetType() types_go_proto.DataType { + if x != nil { + return x.Type + } + return types_go_proto.DataType(0) +} + +func (x *OpDef_ArgDef) GetTypeAttr() string { + if x != nil { + return x.TypeAttr + } + return "" +} + +func (x *OpDef_ArgDef) GetNumberAttr() string { + if x != nil { + return x.NumberAttr + } + return "" +} + +func (x *OpDef_ArgDef) GetTypeListAttr() string { + if x != nil { + return x.TypeListAttr + } + return "" +} + +func (x *OpDef_ArgDef) GetIsRef() bool { + if x != nil { + return x.IsRef + } + return false +} + +// Description of the graph-construction-time configuration of this +// Op. That is to say, this describes the attr fields that will +// be specified in the NodeDef. +type OpDef_AttrDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // A descriptive name for the argument. May be used, e.g. by the + // Python client, as a keyword argument name, and so should match + // the regexp "[a-z][a-z0-9_]+". + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // One of the type names from attr_value.proto ("string", "list(string)", + // "int", etc.). + Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` + // A reasonable default for this attribute if the user does not supply + // a value. If not specified, the user must supply a value. + DefaultValue *attr_value_go_proto.AttrValue `protobuf:"bytes,3,opt,name=default_value,json=defaultValue,proto3" json:"default_value,omitempty"` + // Human-readable description. + Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` + // For type == "int", this is a minimum value. For "list(___)" + // types, this is the minimum length. + HasMinimum bool `protobuf:"varint,5,opt,name=has_minimum,json=hasMinimum,proto3" json:"has_minimum,omitempty"` + Minimum int64 `protobuf:"varint,6,opt,name=minimum,proto3" json:"minimum,omitempty"` + // The set of allowed values. Has type that is the "list" version + // of the "type" field above (uses the "list" field of AttrValue). + // If type == "type" or "list(type)" above, then the "type" field + // of "allowed_values.list" has the set of allowed DataTypes. + // If type == "string" or "list(string)", then the "s" field of + // "allowed_values.list" has the set of allowed strings. + AllowedValues *attr_value_go_proto.AttrValue `protobuf:"bytes,7,opt,name=allowed_values,json=allowedValues,proto3" json:"allowed_values,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *OpDef_AttrDef) Reset() { + *x = OpDef_AttrDef{} + mi := &file_tensorflow_core_framework_op_def_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *OpDef_AttrDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OpDef_AttrDef) ProtoMessage() {} + +func (x *OpDef_AttrDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_op_def_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OpDef_AttrDef.ProtoReflect.Descriptor instead. +func (*OpDef_AttrDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_op_def_proto_rawDescGZIP(), []int{0, 1} +} + +func (x *OpDef_AttrDef) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *OpDef_AttrDef) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *OpDef_AttrDef) GetDefaultValue() *attr_value_go_proto.AttrValue { + if x != nil { + return x.DefaultValue + } + return nil +} + +func (x *OpDef_AttrDef) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *OpDef_AttrDef) GetHasMinimum() bool { + if x != nil { + return x.HasMinimum + } + return false +} + +func (x *OpDef_AttrDef) GetMinimum() int64 { + if x != nil { + return x.Minimum + } + return 0 +} + +func (x *OpDef_AttrDef) GetAllowedValues() *attr_value_go_proto.AttrValue { + if x != nil { + return x.AllowedValues + } + return nil +} + +var File_tensorflow_core_framework_op_def_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_op_def_proto_rawDesc = "" + + "\n" + + "&tensorflow/core/framework/op_def.proto\x12\n" + + "tensorflow\x1a*tensorflow/core/framework/attr_value.proto\x1a%tensorflow/core/framework/types.proto\"\xf4\a\n" + + "\x05OpDef\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x125\n" + + "\tinput_arg\x18\x02 \x03(\v2\x18.tensorflow.OpDef.ArgDefR\binputArg\x127\n" + + "\n" + + "output_arg\x18\x03 \x03(\v2\x18.tensorflow.OpDef.ArgDefR\toutputArg\x12%\n" + + "\x0econtrol_output\x18\x14 \x03(\tR\rcontrolOutput\x12-\n" + + "\x04attr\x18\x04 \x03(\v2\x19.tensorflow.OpDef.AttrDefR\x04attr\x12;\n" + + "\vdeprecation\x18\b \x01(\v2\x19.tensorflow.OpDeprecationR\vdeprecation\x12\x18\n" + + "\asummary\x18\x05 \x01(\tR\asummary\x12 \n" + + "\vdescription\x18\x06 \x01(\tR\vdescription\x12%\n" + + "\x0eis_commutative\x18\x12 \x01(\bR\risCommutative\x12!\n" + + "\fis_aggregate\x18\x10 \x01(\bR\visAggregate\x12\x1f\n" + + "\vis_stateful\x18\x11 \x01(\bR\n" + + "isStateful\x12<\n" + + "\x1aallows_uninitialized_input\x18\x13 \x01(\bR\x18allowsUninitializedInput\x1a\xe3\x01\n" + + "\x06ArgDef\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12 \n" + + "\vdescription\x18\x02 \x01(\tR\vdescription\x12(\n" + + "\x04type\x18\x03 \x01(\x0e2\x14.tensorflow.DataTypeR\x04type\x12\x1b\n" + + "\ttype_attr\x18\x04 \x01(\tR\btypeAttr\x12\x1f\n" + + "\vnumber_attr\x18\x05 \x01(\tR\n" + + "numberAttr\x12$\n" + + "\x0etype_list_attr\x18\x06 \x01(\tR\ftypeListAttr\x12\x15\n" + + "\x06is_ref\x18\x10 \x01(\bR\x05isRef\x1a\x88\x02\n" + + "\aAttrDef\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x12\n" + + "\x04type\x18\x02 \x01(\tR\x04type\x12:\n" + + "\rdefault_value\x18\x03 \x01(\v2\x15.tensorflow.AttrValueR\fdefaultValue\x12 \n" + + "\vdescription\x18\x04 \x01(\tR\vdescription\x12\x1f\n" + + "\vhas_minimum\x18\x05 \x01(\bR\n" + + "hasMinimum\x12\x18\n" + + "\aminimum\x18\x06 \x01(\x03R\aminimum\x12<\n" + + "\x0eallowed_values\x18\a \x01(\v2\x15.tensorflow.AttrValueR\rallowedValues\"K\n" + + "\rOpDeprecation\x12\x18\n" + + "\aversion\x18\x01 \x01(\x05R\aversion\x12 \n" + + "\vexplanation\x18\x02 \x01(\tR\vexplanation\"+\n" + + "\x06OpList\x12!\n" + + "\x02op\x18\x01 \x03(\v2\x11.tensorflow.OpDefR\x02opB{\n" + + "\x18org.tensorflow.frameworkB\vOpDefProtosP\x01ZMgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/op_def_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_op_def_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_op_def_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_op_def_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_op_def_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_op_def_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_op_def_proto_rawDesc), len(file_tensorflow_core_framework_op_def_proto_rawDesc))) + }) + return file_tensorflow_core_framework_op_def_proto_rawDescData +} + +var file_tensorflow_core_framework_op_def_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_tensorflow_core_framework_op_def_proto_goTypes = []any{ + (*OpDef)(nil), // 0: tensorflow.OpDef + (*OpDeprecation)(nil), // 1: tensorflow.OpDeprecation + (*OpList)(nil), // 2: tensorflow.OpList + (*OpDef_ArgDef)(nil), // 3: tensorflow.OpDef.ArgDef + (*OpDef_AttrDef)(nil), // 4: tensorflow.OpDef.AttrDef + (types_go_proto.DataType)(0), // 5: tensorflow.DataType + (*attr_value_go_proto.AttrValue)(nil), // 6: tensorflow.AttrValue +} +var file_tensorflow_core_framework_op_def_proto_depIdxs = []int32{ + 3, // 0: tensorflow.OpDef.input_arg:type_name -> tensorflow.OpDef.ArgDef + 3, // 1: tensorflow.OpDef.output_arg:type_name -> tensorflow.OpDef.ArgDef + 4, // 2: tensorflow.OpDef.attr:type_name -> tensorflow.OpDef.AttrDef + 1, // 3: tensorflow.OpDef.deprecation:type_name -> tensorflow.OpDeprecation + 0, // 4: tensorflow.OpList.op:type_name -> tensorflow.OpDef + 5, // 5: tensorflow.OpDef.ArgDef.type:type_name -> tensorflow.DataType + 6, // 6: tensorflow.OpDef.AttrDef.default_value:type_name -> tensorflow.AttrValue + 6, // 7: tensorflow.OpDef.AttrDef.allowed_values:type_name -> tensorflow.AttrValue + 8, // [8:8] is the sub-list for method output_type + 8, // [8:8] is the sub-list for method input_type + 8, // [8:8] is the sub-list for extension type_name + 8, // [8:8] is the sub-list for extension extendee + 0, // [0:8] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_op_def_proto_init() } +func file_tensorflow_core_framework_op_def_proto_init() { + if File_tensorflow_core_framework_op_def_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_op_def_proto_rawDesc), len(file_tensorflow_core_framework_op_def_proto_rawDesc)), + NumEnums: 0, + NumMessages: 5, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_op_def_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_op_def_proto_depIdxs, + MessageInfos: file_tensorflow_core_framework_op_def_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_op_def_proto = out.File + file_tensorflow_core_framework_op_def_proto_goTypes = nil + file_tensorflow_core_framework_op_def_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/framework/reader_base_go_proto/reader_base.pb.go b/third_party/go-tensorflow/tensorflow/go/core/framework/reader_base_go_proto/reader_base.pb.go new file mode 100644 index 0000000..bcb9559 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/framework/reader_base_go_proto/reader_base.pb.go @@ -0,0 +1,153 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/reader_base.proto + +package reader_base_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// For serializing and restoring the state of ReaderBase, see +// reader_base.h for details. +type ReaderBaseState struct { + state protoimpl.MessageState `protogen:"open.v1"` + WorkStarted int64 `protobuf:"varint,1,opt,name=work_started,json=workStarted,proto3" json:"work_started,omitempty"` + WorkFinished int64 `protobuf:"varint,2,opt,name=work_finished,json=workFinished,proto3" json:"work_finished,omitempty"` + NumRecordsProduced int64 `protobuf:"varint,3,opt,name=num_records_produced,json=numRecordsProduced,proto3" json:"num_records_produced,omitempty"` + CurrentWork []byte `protobuf:"bytes,4,opt,name=current_work,json=currentWork,proto3" json:"current_work,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ReaderBaseState) Reset() { + *x = ReaderBaseState{} + mi := &file_tensorflow_core_framework_reader_base_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ReaderBaseState) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReaderBaseState) ProtoMessage() {} + +func (x *ReaderBaseState) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_reader_base_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReaderBaseState.ProtoReflect.Descriptor instead. +func (*ReaderBaseState) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_reader_base_proto_rawDescGZIP(), []int{0} +} + +func (x *ReaderBaseState) GetWorkStarted() int64 { + if x != nil { + return x.WorkStarted + } + return 0 +} + +func (x *ReaderBaseState) GetWorkFinished() int64 { + if x != nil { + return x.WorkFinished + } + return 0 +} + +func (x *ReaderBaseState) GetNumRecordsProduced() int64 { + if x != nil { + return x.NumRecordsProduced + } + return 0 +} + +func (x *ReaderBaseState) GetCurrentWork() []byte { + if x != nil { + return x.CurrentWork + } + return nil +} + +var File_tensorflow_core_framework_reader_base_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_reader_base_proto_rawDesc = "" + + "\n" + + "+tensorflow/core/framework/reader_base.proto\x12\n" + + "tensorflow\"\xae\x01\n" + + "\x0fReaderBaseState\x12!\n" + + "\fwork_started\x18\x01 \x01(\x03R\vworkStarted\x12#\n" + + "\rwork_finished\x18\x02 \x01(\x03R\fworkFinished\x120\n" + + "\x14num_records_produced\x18\x03 \x01(\x03R\x12numRecordsProduced\x12!\n" + + "\fcurrent_work\x18\x04 \x01(\fR\vcurrentWorkB\x85\x01\n" + + "\x18org.tensorflow.frameworkB\x10ReaderBaseProtosP\x01ZRgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/reader_base_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_reader_base_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_reader_base_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_reader_base_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_reader_base_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_reader_base_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_reader_base_proto_rawDesc), len(file_tensorflow_core_framework_reader_base_proto_rawDesc))) + }) + return file_tensorflow_core_framework_reader_base_proto_rawDescData +} + +var file_tensorflow_core_framework_reader_base_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_tensorflow_core_framework_reader_base_proto_goTypes = []any{ + (*ReaderBaseState)(nil), // 0: tensorflow.ReaderBaseState +} +var file_tensorflow_core_framework_reader_base_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_reader_base_proto_init() } +func file_tensorflow_core_framework_reader_base_proto_init() { + if File_tensorflow_core_framework_reader_base_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_reader_base_proto_rawDesc), len(file_tensorflow_core_framework_reader_base_proto_rawDesc)), + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_reader_base_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_reader_base_proto_depIdxs, + MessageInfos: file_tensorflow_core_framework_reader_base_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_reader_base_proto = out.File + file_tensorflow_core_framework_reader_base_proto_goTypes = nil + file_tensorflow_core_framework_reader_base_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/framework/remote_fused_graph_execute_info_go_proto/remote_fused_graph_execute_info.pb.go b/third_party/go-tensorflow/tensorflow/go/core/framework/remote_fused_graph_execute_info_go_proto/remote_fused_graph_execute_info.pb.go new file mode 100644 index 0000000..c1773c8 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/framework/remote_fused_graph_execute_info_go_proto/remote_fused_graph_execute_info.pb.go @@ -0,0 +1,259 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/remote_fused_graph_execute_info.proto + +package remote_fused_graph_execute_info_go_proto + +import ( + graph_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/graph_go_proto" + tensor_shape_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_shape_go_proto" + types_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/types_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Protocol buffer representing a handle to a tensorflow resource. Handles are +// not valid across executions, but can be serialized back and forth from within +// a single run. +type RemoteFusedGraphExecuteInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Definition of remote graph + RemoteGraph *graph_go_proto.GraphDef `protobuf:"bytes,1,opt,name=remote_graph,json=remoteGraph,proto3" json:"remote_graph,omitempty"` + // Remote fused graph input node name + GraphInputNodeName []string `protobuf:"bytes,2,rep,name=graph_input_node_name,json=graphInputNodeName,proto3" json:"graph_input_node_name,omitempty"` + // Remote fused graph output node name + GraphOutputNodeName []string `protobuf:"bytes,3,rep,name=graph_output_node_name,json=graphOutputNodeName,proto3" json:"graph_output_node_name,omitempty"` + // Executor's name + ExecutorName string `protobuf:"bytes,4,opt,name=executor_name,json=executorName,proto3" json:"executor_name,omitempty"` + // Optional: Parameters given to the executor + SerializedExecutorParameters []byte `protobuf:"bytes,5,opt,name=serialized_executor_parameters,json=serializedExecutorParameters,proto3" json:"serialized_executor_parameters,omitempty"` + // Optional: Default graph input tensor shape used to allocate memory + // before executing op + DefaultGraphInputTensorShape []*RemoteFusedGraphExecuteInfo_TensorShapeTypeProto `protobuf:"bytes,6,rep,name=default_graph_input_tensor_shape,json=defaultGraphInputTensorShape,proto3" json:"default_graph_input_tensor_shape,omitempty"` + // Optional: Default graph input tensor shape used to allocate memory + // before executing op + // TODO(satok): Remote output tensor shape once shape information is stored + // in NodeDef + DefaultGraphOutputTensorShape []*RemoteFusedGraphExecuteInfo_TensorShapeTypeProto `protobuf:"bytes,7,rep,name=default_graph_output_tensor_shape,json=defaultGraphOutputTensorShape,proto3" json:"default_graph_output_tensor_shape,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RemoteFusedGraphExecuteInfo) Reset() { + *x = RemoteFusedGraphExecuteInfo{} + mi := &file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RemoteFusedGraphExecuteInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoteFusedGraphExecuteInfo) ProtoMessage() {} + +func (x *RemoteFusedGraphExecuteInfo) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RemoteFusedGraphExecuteInfo.ProtoReflect.Descriptor instead. +func (*RemoteFusedGraphExecuteInfo) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_rawDescGZIP(), []int{0} +} + +func (x *RemoteFusedGraphExecuteInfo) GetRemoteGraph() *graph_go_proto.GraphDef { + if x != nil { + return x.RemoteGraph + } + return nil +} + +func (x *RemoteFusedGraphExecuteInfo) GetGraphInputNodeName() []string { + if x != nil { + return x.GraphInputNodeName + } + return nil +} + +func (x *RemoteFusedGraphExecuteInfo) GetGraphOutputNodeName() []string { + if x != nil { + return x.GraphOutputNodeName + } + return nil +} + +func (x *RemoteFusedGraphExecuteInfo) GetExecutorName() string { + if x != nil { + return x.ExecutorName + } + return "" +} + +func (x *RemoteFusedGraphExecuteInfo) GetSerializedExecutorParameters() []byte { + if x != nil { + return x.SerializedExecutorParameters + } + return nil +} + +func (x *RemoteFusedGraphExecuteInfo) GetDefaultGraphInputTensorShape() []*RemoteFusedGraphExecuteInfo_TensorShapeTypeProto { + if x != nil { + return x.DefaultGraphInputTensorShape + } + return nil +} + +func (x *RemoteFusedGraphExecuteInfo) GetDefaultGraphOutputTensorShape() []*RemoteFusedGraphExecuteInfo_TensorShapeTypeProto { + if x != nil { + return x.DefaultGraphOutputTensorShape + } + return nil +} + +type RemoteFusedGraphExecuteInfo_TensorShapeTypeProto struct { + state protoimpl.MessageState `protogen:"open.v1"` + Dtype types_go_proto.DataType `protobuf:"varint,1,opt,name=dtype,proto3,enum=tensorflow.DataType" json:"dtype,omitempty"` + Shape *tensor_shape_go_proto.TensorShapeProto `protobuf:"bytes,2,opt,name=shape,proto3" json:"shape,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RemoteFusedGraphExecuteInfo_TensorShapeTypeProto) Reset() { + *x = RemoteFusedGraphExecuteInfo_TensorShapeTypeProto{} + mi := &file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RemoteFusedGraphExecuteInfo_TensorShapeTypeProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoteFusedGraphExecuteInfo_TensorShapeTypeProto) ProtoMessage() {} + +func (x *RemoteFusedGraphExecuteInfo_TensorShapeTypeProto) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RemoteFusedGraphExecuteInfo_TensorShapeTypeProto.ProtoReflect.Descriptor instead. +func (*RemoteFusedGraphExecuteInfo_TensorShapeTypeProto) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *RemoteFusedGraphExecuteInfo_TensorShapeTypeProto) GetDtype() types_go_proto.DataType { + if x != nil { + return x.Dtype + } + return types_go_proto.DataType(0) +} + +func (x *RemoteFusedGraphExecuteInfo_TensorShapeTypeProto) GetShape() *tensor_shape_go_proto.TensorShapeProto { + if x != nil { + return x.Shape + } + return nil +} + +var File_tensorflow_core_framework_remote_fused_graph_execute_info_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_rawDesc = "" + + "\n" + + "?tensorflow/core/framework/remote_fused_graph_execute_info.proto\x12\n" + + "tensorflow\x1a%tensorflow/core/framework/graph.proto\x1a,tensorflow/core/framework/tensor_shape.proto\x1a%tensorflow/core/framework/types.proto\"\xb1\x05\n" + + "\x1bRemoteFusedGraphExecuteInfo\x127\n" + + "\fremote_graph\x18\x01 \x01(\v2\x14.tensorflow.GraphDefR\vremoteGraph\x121\n" + + "\x15graph_input_node_name\x18\x02 \x03(\tR\x12graphInputNodeName\x123\n" + + "\x16graph_output_node_name\x18\x03 \x03(\tR\x13graphOutputNodeName\x12#\n" + + "\rexecutor_name\x18\x04 \x01(\tR\fexecutorName\x12D\n" + + "\x1eserialized_executor_parameters\x18\x05 \x01(\fR\x1cserializedExecutorParameters\x12\x84\x01\n" + + " default_graph_input_tensor_shape\x18\x06 \x03(\v2<.tensorflow.RemoteFusedGraphExecuteInfo.TensorShapeTypeProtoR\x1cdefaultGraphInputTensorShape\x12\x86\x01\n" + + "!default_graph_output_tensor_shape\x18\a \x03(\v2<.tensorflow.RemoteFusedGraphExecuteInfo.TensorShapeTypeProtoR\x1ddefaultGraphOutputTensorShape\x1av\n" + + "\x14TensorShapeTypeProto\x12*\n" + + "\x05dtype\x18\x01 \x01(\x0e2\x14.tensorflow.DataTypeR\x05dtype\x122\n" + + "\x05shape\x18\x02 \x01(\v2\x1c.tensorflow.TensorShapeProtoR\x05shapeB\xa9\x01\n" + + "\x18org.tensorflow.frameworkB RemoteFusedGraphExecuteInfoProtoP\x01Zfgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/remote_fused_graph_execute_info_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_rawDesc), len(file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_rawDesc))) + }) + return file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_rawDescData +} + +var file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_goTypes = []any{ + (*RemoteFusedGraphExecuteInfo)(nil), // 0: tensorflow.RemoteFusedGraphExecuteInfo + (*RemoteFusedGraphExecuteInfo_TensorShapeTypeProto)(nil), // 1: tensorflow.RemoteFusedGraphExecuteInfo.TensorShapeTypeProto + (*graph_go_proto.GraphDef)(nil), // 2: tensorflow.GraphDef + (types_go_proto.DataType)(0), // 3: tensorflow.DataType + (*tensor_shape_go_proto.TensorShapeProto)(nil), // 4: tensorflow.TensorShapeProto +} +var file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_depIdxs = []int32{ + 2, // 0: tensorflow.RemoteFusedGraphExecuteInfo.remote_graph:type_name -> tensorflow.GraphDef + 1, // 1: tensorflow.RemoteFusedGraphExecuteInfo.default_graph_input_tensor_shape:type_name -> tensorflow.RemoteFusedGraphExecuteInfo.TensorShapeTypeProto + 1, // 2: tensorflow.RemoteFusedGraphExecuteInfo.default_graph_output_tensor_shape:type_name -> tensorflow.RemoteFusedGraphExecuteInfo.TensorShapeTypeProto + 3, // 3: tensorflow.RemoteFusedGraphExecuteInfo.TensorShapeTypeProto.dtype:type_name -> tensorflow.DataType + 4, // 4: tensorflow.RemoteFusedGraphExecuteInfo.TensorShapeTypeProto.shape:type_name -> tensorflow.TensorShapeProto + 5, // [5:5] is the sub-list for method output_type + 5, // [5:5] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_init() } +func file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_init() { + if File_tensorflow_core_framework_remote_fused_graph_execute_info_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_rawDesc), len(file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_rawDesc)), + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_depIdxs, + MessageInfos: file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_remote_fused_graph_execute_info_proto = out.File + file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_goTypes = nil + file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/framework/resource_handle_go_proto/resource_handle.pb.go b/third_party/go-tensorflow/tensorflow/go/core/framework/resource_handle_go_proto/resource_handle.pb.go new file mode 100644 index 0000000..13746ba --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/framework/resource_handle_go_proto/resource_handle.pb.go @@ -0,0 +1,244 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/resource_handle.proto + +package resource_handle_go_proto + +import ( + tensor_shape_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_shape_go_proto" + types_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/types_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Protocol buffer representing a handle to a tensorflow resource. Handles are +// not valid across executions, but can be serialized back and forth from within +// a single run. +type ResourceHandleProto struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Unique name for the device containing the resource. + Device string `protobuf:"bytes,1,opt,name=device,proto3" json:"device,omitempty"` + // Container in which this resource is placed. + Container string `protobuf:"bytes,2,opt,name=container,proto3" json:"container,omitempty"` + // Unique name of this resource. + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + // Hash code for the type of the resource. Is only valid in the same device + // and in the same execution. + HashCode uint64 `protobuf:"varint,4,opt,name=hash_code,json=hashCode,proto3" json:"hash_code,omitempty"` + // For debug-only, the name of the type pointed to by this handle, if + // available. + MaybeTypeName string `protobuf:"bytes,5,opt,name=maybe_type_name,json=maybeTypeName,proto3" json:"maybe_type_name,omitempty"` + // Data types and shapes for the underlying resource. + DtypesAndShapes []*ResourceHandleProto_DtypeAndShape `protobuf:"bytes,6,rep,name=dtypes_and_shapes,json=dtypesAndShapes,proto3" json:"dtypes_and_shapes,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ResourceHandleProto) Reset() { + *x = ResourceHandleProto{} + mi := &file_tensorflow_core_framework_resource_handle_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ResourceHandleProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResourceHandleProto) ProtoMessage() {} + +func (x *ResourceHandleProto) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_resource_handle_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ResourceHandleProto.ProtoReflect.Descriptor instead. +func (*ResourceHandleProto) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_resource_handle_proto_rawDescGZIP(), []int{0} +} + +func (x *ResourceHandleProto) GetDevice() string { + if x != nil { + return x.Device + } + return "" +} + +func (x *ResourceHandleProto) GetContainer() string { + if x != nil { + return x.Container + } + return "" +} + +func (x *ResourceHandleProto) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ResourceHandleProto) GetHashCode() uint64 { + if x != nil { + return x.HashCode + } + return 0 +} + +func (x *ResourceHandleProto) GetMaybeTypeName() string { + if x != nil { + return x.MaybeTypeName + } + return "" +} + +func (x *ResourceHandleProto) GetDtypesAndShapes() []*ResourceHandleProto_DtypeAndShape { + if x != nil { + return x.DtypesAndShapes + } + return nil +} + +// Protocol buffer representing a pair of (data type, tensor shape). +type ResourceHandleProto_DtypeAndShape struct { + state protoimpl.MessageState `protogen:"open.v1"` + Dtype types_go_proto.DataType `protobuf:"varint,1,opt,name=dtype,proto3,enum=tensorflow.DataType" json:"dtype,omitempty"` + Shape *tensor_shape_go_proto.TensorShapeProto `protobuf:"bytes,2,opt,name=shape,proto3" json:"shape,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ResourceHandleProto_DtypeAndShape) Reset() { + *x = ResourceHandleProto_DtypeAndShape{} + mi := &file_tensorflow_core_framework_resource_handle_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ResourceHandleProto_DtypeAndShape) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResourceHandleProto_DtypeAndShape) ProtoMessage() {} + +func (x *ResourceHandleProto_DtypeAndShape) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_resource_handle_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ResourceHandleProto_DtypeAndShape.ProtoReflect.Descriptor instead. +func (*ResourceHandleProto_DtypeAndShape) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_resource_handle_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *ResourceHandleProto_DtypeAndShape) GetDtype() types_go_proto.DataType { + if x != nil { + return x.Dtype + } + return types_go_proto.DataType(0) +} + +func (x *ResourceHandleProto_DtypeAndShape) GetShape() *tensor_shape_go_proto.TensorShapeProto { + if x != nil { + return x.Shape + } + return nil +} + +var File_tensorflow_core_framework_resource_handle_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_resource_handle_proto_rawDesc = "" + + "\n" + + "/tensorflow/core/framework/resource_handle.proto\x12\n" + + "tensorflow\x1a,tensorflow/core/framework/tensor_shape.proto\x1a%tensorflow/core/framework/types.proto\"\xf6\x02\n" + + "\x13ResourceHandleProto\x12\x16\n" + + "\x06device\x18\x01 \x01(\tR\x06device\x12\x1c\n" + + "\tcontainer\x18\x02 \x01(\tR\tcontainer\x12\x12\n" + + "\x04name\x18\x03 \x01(\tR\x04name\x12\x1b\n" + + "\thash_code\x18\x04 \x01(\x04R\bhashCode\x12&\n" + + "\x0fmaybe_type_name\x18\x05 \x01(\tR\rmaybeTypeName\x12Y\n" + + "\x11dtypes_and_shapes\x18\x06 \x03(\v2-.tensorflow.ResourceHandleProto.DtypeAndShapeR\x0fdtypesAndShapes\x1ao\n" + + "\rDtypeAndShape\x12*\n" + + "\x05dtype\x18\x01 \x01(\x0e2\x14.tensorflow.DataTypeR\x05dtype\x122\n" + + "\x05shape\x18\x02 \x01(\v2\x1c.tensorflow.TensorShapeProtoR\x05shapeJ\x04\b\a\x10\bB\x87\x01\n" + + "\x18org.tensorflow.frameworkB\x0eResourceHandleP\x01ZVgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/resource_handle_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_resource_handle_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_resource_handle_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_resource_handle_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_resource_handle_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_resource_handle_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_resource_handle_proto_rawDesc), len(file_tensorflow_core_framework_resource_handle_proto_rawDesc))) + }) + return file_tensorflow_core_framework_resource_handle_proto_rawDescData +} + +var file_tensorflow_core_framework_resource_handle_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_tensorflow_core_framework_resource_handle_proto_goTypes = []any{ + (*ResourceHandleProto)(nil), // 0: tensorflow.ResourceHandleProto + (*ResourceHandleProto_DtypeAndShape)(nil), // 1: tensorflow.ResourceHandleProto.DtypeAndShape + (types_go_proto.DataType)(0), // 2: tensorflow.DataType + (*tensor_shape_go_proto.TensorShapeProto)(nil), // 3: tensorflow.TensorShapeProto +} +var file_tensorflow_core_framework_resource_handle_proto_depIdxs = []int32{ + 1, // 0: tensorflow.ResourceHandleProto.dtypes_and_shapes:type_name -> tensorflow.ResourceHandleProto.DtypeAndShape + 2, // 1: tensorflow.ResourceHandleProto.DtypeAndShape.dtype:type_name -> tensorflow.DataType + 3, // 2: tensorflow.ResourceHandleProto.DtypeAndShape.shape:type_name -> tensorflow.TensorShapeProto + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_resource_handle_proto_init() } +func file_tensorflow_core_framework_resource_handle_proto_init() { + if File_tensorflow_core_framework_resource_handle_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_resource_handle_proto_rawDesc), len(file_tensorflow_core_framework_resource_handle_proto_rawDesc)), + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_resource_handle_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_resource_handle_proto_depIdxs, + MessageInfos: file_tensorflow_core_framework_resource_handle_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_resource_handle_proto = out.File + file_tensorflow_core_framework_resource_handle_proto_goTypes = nil + file_tensorflow_core_framework_resource_handle_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/framework/step_stats_go_proto/step_stats.pb.go b/third_party/go-tensorflow/tensorflow/go/core/framework/step_stats_go_proto/step_stats.pb.go new file mode 100644 index 0000000..aded855 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/framework/step_stats_go_proto/step_stats.pb.go @@ -0,0 +1,722 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/step_stats.proto + +package step_stats_go_proto + +import ( + allocation_description_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/allocation_description_go_proto" + tensor_description_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_description_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// An allocation/de-allocation operation performed by the allocator. +type AllocationRecord struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The timestamp of the operation. + AllocMicros int64 `protobuf:"varint,1,opt,name=alloc_micros,json=allocMicros,proto3" json:"alloc_micros,omitempty"` + // Number of bytes allocated, or de-allocated if negative. + AllocBytes int64 `protobuf:"varint,2,opt,name=alloc_bytes,json=allocBytes,proto3" json:"alloc_bytes,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AllocationRecord) Reset() { + *x = AllocationRecord{} + mi := &file_tensorflow_core_framework_step_stats_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AllocationRecord) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AllocationRecord) ProtoMessage() {} + +func (x *AllocationRecord) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_step_stats_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AllocationRecord.ProtoReflect.Descriptor instead. +func (*AllocationRecord) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_step_stats_proto_rawDescGZIP(), []int{0} +} + +func (x *AllocationRecord) GetAllocMicros() int64 { + if x != nil { + return x.AllocMicros + } + return 0 +} + +func (x *AllocationRecord) GetAllocBytes() int64 { + if x != nil { + return x.AllocBytes + } + return 0 +} + +type AllocatorMemoryUsed struct { + state protoimpl.MessageState `protogen:"open.v1"` + AllocatorName string `protobuf:"bytes,1,opt,name=allocator_name,json=allocatorName,proto3" json:"allocator_name,omitempty"` + // These are per-node allocator memory stats. + TotalBytes int64 `protobuf:"varint,2,opt,name=total_bytes,json=totalBytes,proto3" json:"total_bytes,omitempty"` + PeakBytes int64 `protobuf:"varint,3,opt,name=peak_bytes,json=peakBytes,proto3" json:"peak_bytes,omitempty"` + // The bytes that are not deallocated. + LiveBytes int64 `protobuf:"varint,4,opt,name=live_bytes,json=liveBytes,proto3" json:"live_bytes,omitempty"` + // The allocation and deallocation timeline. + AllocationRecords []*AllocationRecord `protobuf:"bytes,6,rep,name=allocation_records,json=allocationRecords,proto3" json:"allocation_records,omitempty"` + // These are snapshots of the overall allocator memory stats. + // The number of live bytes currently allocated by the allocator. + AllocatorBytesInUse int64 `protobuf:"varint,5,opt,name=allocator_bytes_in_use,json=allocatorBytesInUse,proto3" json:"allocator_bytes_in_use,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AllocatorMemoryUsed) Reset() { + *x = AllocatorMemoryUsed{} + mi := &file_tensorflow_core_framework_step_stats_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AllocatorMemoryUsed) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AllocatorMemoryUsed) ProtoMessage() {} + +func (x *AllocatorMemoryUsed) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_step_stats_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AllocatorMemoryUsed.ProtoReflect.Descriptor instead. +func (*AllocatorMemoryUsed) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_step_stats_proto_rawDescGZIP(), []int{1} +} + +func (x *AllocatorMemoryUsed) GetAllocatorName() string { + if x != nil { + return x.AllocatorName + } + return "" +} + +func (x *AllocatorMemoryUsed) GetTotalBytes() int64 { + if x != nil { + return x.TotalBytes + } + return 0 +} + +func (x *AllocatorMemoryUsed) GetPeakBytes() int64 { + if x != nil { + return x.PeakBytes + } + return 0 +} + +func (x *AllocatorMemoryUsed) GetLiveBytes() int64 { + if x != nil { + return x.LiveBytes + } + return 0 +} + +func (x *AllocatorMemoryUsed) GetAllocationRecords() []*AllocationRecord { + if x != nil { + return x.AllocationRecords + } + return nil +} + +func (x *AllocatorMemoryUsed) GetAllocatorBytesInUse() int64 { + if x != nil { + return x.AllocatorBytesInUse + } + return 0 +} + +// Output sizes recorded for a single execution of a graph node. +type NodeOutput struct { + state protoimpl.MessageState `protogen:"open.v1"` + Slot int32 `protobuf:"varint,1,opt,name=slot,proto3" json:"slot,omitempty"` + TensorDescription *tensor_description_go_proto.TensorDescription `protobuf:"bytes,3,opt,name=tensor_description,json=tensorDescription,proto3" json:"tensor_description,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NodeOutput) Reset() { + *x = NodeOutput{} + mi := &file_tensorflow_core_framework_step_stats_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NodeOutput) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NodeOutput) ProtoMessage() {} + +func (x *NodeOutput) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_step_stats_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NodeOutput.ProtoReflect.Descriptor instead. +func (*NodeOutput) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_step_stats_proto_rawDescGZIP(), []int{2} +} + +func (x *NodeOutput) GetSlot() int32 { + if x != nil { + return x.Slot + } + return 0 +} + +func (x *NodeOutput) GetTensorDescription() *tensor_description_go_proto.TensorDescription { + if x != nil { + return x.TensorDescription + } + return nil +} + +// For memory tracking. +type MemoryStats struct { + state protoimpl.MessageState `protogen:"open.v1"` + TempMemorySize int64 `protobuf:"varint,1,opt,name=temp_memory_size,json=tempMemorySize,proto3" json:"temp_memory_size,omitempty"` + PersistentMemorySize int64 `protobuf:"varint,3,opt,name=persistent_memory_size,json=persistentMemorySize,proto3" json:"persistent_memory_size,omitempty"` + PersistentTensorAllocIds []int64 `protobuf:"varint,5,rep,packed,name=persistent_tensor_alloc_ids,json=persistentTensorAllocIds,proto3" json:"persistent_tensor_alloc_ids,omitempty"` + // Deprecated: Marked as deprecated in tensorflow/core/framework/step_stats.proto. + DeviceTempMemorySize int64 `protobuf:"varint,2,opt,name=device_temp_memory_size,json=deviceTempMemorySize,proto3" json:"device_temp_memory_size,omitempty"` + // Deprecated: Marked as deprecated in tensorflow/core/framework/step_stats.proto. + DevicePersistentMemorySize int64 `protobuf:"varint,4,opt,name=device_persistent_memory_size,json=devicePersistentMemorySize,proto3" json:"device_persistent_memory_size,omitempty"` + // Deprecated: Marked as deprecated in tensorflow/core/framework/step_stats.proto. + DevicePersistentTensorAllocIds []int64 `protobuf:"varint,6,rep,packed,name=device_persistent_tensor_alloc_ids,json=devicePersistentTensorAllocIds,proto3" json:"device_persistent_tensor_alloc_ids,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MemoryStats) Reset() { + *x = MemoryStats{} + mi := &file_tensorflow_core_framework_step_stats_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MemoryStats) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MemoryStats) ProtoMessage() {} + +func (x *MemoryStats) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_step_stats_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MemoryStats.ProtoReflect.Descriptor instead. +func (*MemoryStats) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_step_stats_proto_rawDescGZIP(), []int{3} +} + +func (x *MemoryStats) GetTempMemorySize() int64 { + if x != nil { + return x.TempMemorySize + } + return 0 +} + +func (x *MemoryStats) GetPersistentMemorySize() int64 { + if x != nil { + return x.PersistentMemorySize + } + return 0 +} + +func (x *MemoryStats) GetPersistentTensorAllocIds() []int64 { + if x != nil { + return x.PersistentTensorAllocIds + } + return nil +} + +// Deprecated: Marked as deprecated in tensorflow/core/framework/step_stats.proto. +func (x *MemoryStats) GetDeviceTempMemorySize() int64 { + if x != nil { + return x.DeviceTempMemorySize + } + return 0 +} + +// Deprecated: Marked as deprecated in tensorflow/core/framework/step_stats.proto. +func (x *MemoryStats) GetDevicePersistentMemorySize() int64 { + if x != nil { + return x.DevicePersistentMemorySize + } + return 0 +} + +// Deprecated: Marked as deprecated in tensorflow/core/framework/step_stats.proto. +func (x *MemoryStats) GetDevicePersistentTensorAllocIds() []int64 { + if x != nil { + return x.DevicePersistentTensorAllocIds + } + return nil +} + +// Time/size stats recorded for a single execution of a graph node. +type NodeExecStats struct { + state protoimpl.MessageState `protogen:"open.v1"` + // TODO(tucker): Use some more compact form of node identity than + // the full string name. Either all processes should agree on a + // global id (cost_id?) for each node, or we should use a hash of + // the name. + NodeName string `protobuf:"bytes,1,opt,name=node_name,json=nodeName,proto3" json:"node_name,omitempty"` + AllStartMicros int64 `protobuf:"varint,2,opt,name=all_start_micros,json=allStartMicros,proto3" json:"all_start_micros,omitempty"` + OpStartRelMicros int64 `protobuf:"varint,3,opt,name=op_start_rel_micros,json=opStartRelMicros,proto3" json:"op_start_rel_micros,omitempty"` + OpEndRelMicros int64 `protobuf:"varint,4,opt,name=op_end_rel_micros,json=opEndRelMicros,proto3" json:"op_end_rel_micros,omitempty"` + AllEndRelMicros int64 `protobuf:"varint,5,opt,name=all_end_rel_micros,json=allEndRelMicros,proto3" json:"all_end_rel_micros,omitempty"` + Memory []*AllocatorMemoryUsed `protobuf:"bytes,6,rep,name=memory,proto3" json:"memory,omitempty"` + Output []*NodeOutput `protobuf:"bytes,7,rep,name=output,proto3" json:"output,omitempty"` + TimelineLabel string `protobuf:"bytes,8,opt,name=timeline_label,json=timelineLabel,proto3" json:"timeline_label,omitempty"` + ScheduledMicros int64 `protobuf:"varint,9,opt,name=scheduled_micros,json=scheduledMicros,proto3" json:"scheduled_micros,omitempty"` + ThreadId uint32 `protobuf:"varint,10,opt,name=thread_id,json=threadId,proto3" json:"thread_id,omitempty"` + ReferencedTensor []*allocation_description_go_proto.AllocationDescription `protobuf:"bytes,11,rep,name=referenced_tensor,json=referencedTensor,proto3" json:"referenced_tensor,omitempty"` + MemoryStats *MemoryStats `protobuf:"bytes,12,opt,name=memory_stats,json=memoryStats,proto3" json:"memory_stats,omitempty"` + AllStartNanos int64 `protobuf:"varint,13,opt,name=all_start_nanos,json=allStartNanos,proto3" json:"all_start_nanos,omitempty"` + OpStartRelNanos int64 `protobuf:"varint,14,opt,name=op_start_rel_nanos,json=opStartRelNanos,proto3" json:"op_start_rel_nanos,omitempty"` + OpEndRelNanos int64 `protobuf:"varint,15,opt,name=op_end_rel_nanos,json=opEndRelNanos,proto3" json:"op_end_rel_nanos,omitempty"` + AllEndRelNanos int64 `protobuf:"varint,16,opt,name=all_end_rel_nanos,json=allEndRelNanos,proto3" json:"all_end_rel_nanos,omitempty"` + ScheduledNanos int64 `protobuf:"varint,17,opt,name=scheduled_nanos,json=scheduledNanos,proto3" json:"scheduled_nanos,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NodeExecStats) Reset() { + *x = NodeExecStats{} + mi := &file_tensorflow_core_framework_step_stats_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NodeExecStats) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NodeExecStats) ProtoMessage() {} + +func (x *NodeExecStats) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_step_stats_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NodeExecStats.ProtoReflect.Descriptor instead. +func (*NodeExecStats) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_step_stats_proto_rawDescGZIP(), []int{4} +} + +func (x *NodeExecStats) GetNodeName() string { + if x != nil { + return x.NodeName + } + return "" +} + +func (x *NodeExecStats) GetAllStartMicros() int64 { + if x != nil { + return x.AllStartMicros + } + return 0 +} + +func (x *NodeExecStats) GetOpStartRelMicros() int64 { + if x != nil { + return x.OpStartRelMicros + } + return 0 +} + +func (x *NodeExecStats) GetOpEndRelMicros() int64 { + if x != nil { + return x.OpEndRelMicros + } + return 0 +} + +func (x *NodeExecStats) GetAllEndRelMicros() int64 { + if x != nil { + return x.AllEndRelMicros + } + return 0 +} + +func (x *NodeExecStats) GetMemory() []*AllocatorMemoryUsed { + if x != nil { + return x.Memory + } + return nil +} + +func (x *NodeExecStats) GetOutput() []*NodeOutput { + if x != nil { + return x.Output + } + return nil +} + +func (x *NodeExecStats) GetTimelineLabel() string { + if x != nil { + return x.TimelineLabel + } + return "" +} + +func (x *NodeExecStats) GetScheduledMicros() int64 { + if x != nil { + return x.ScheduledMicros + } + return 0 +} + +func (x *NodeExecStats) GetThreadId() uint32 { + if x != nil { + return x.ThreadId + } + return 0 +} + +func (x *NodeExecStats) GetReferencedTensor() []*allocation_description_go_proto.AllocationDescription { + if x != nil { + return x.ReferencedTensor + } + return nil +} + +func (x *NodeExecStats) GetMemoryStats() *MemoryStats { + if x != nil { + return x.MemoryStats + } + return nil +} + +func (x *NodeExecStats) GetAllStartNanos() int64 { + if x != nil { + return x.AllStartNanos + } + return 0 +} + +func (x *NodeExecStats) GetOpStartRelNanos() int64 { + if x != nil { + return x.OpStartRelNanos + } + return 0 +} + +func (x *NodeExecStats) GetOpEndRelNanos() int64 { + if x != nil { + return x.OpEndRelNanos + } + return 0 +} + +func (x *NodeExecStats) GetAllEndRelNanos() int64 { + if x != nil { + return x.AllEndRelNanos + } + return 0 +} + +func (x *NodeExecStats) GetScheduledNanos() int64 { + if x != nil { + return x.ScheduledNanos + } + return 0 +} + +type DeviceStepStats struct { + state protoimpl.MessageState `protogen:"open.v1"` + Device string `protobuf:"bytes,1,opt,name=device,proto3" json:"device,omitempty"` + NodeStats []*NodeExecStats `protobuf:"bytes,2,rep,name=node_stats,json=nodeStats,proto3" json:"node_stats,omitempty"` + // Its key is thread id. + ThreadNames map[uint32]string `protobuf:"bytes,3,rep,name=thread_names,json=threadNames,proto3" json:"thread_names,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeviceStepStats) Reset() { + *x = DeviceStepStats{} + mi := &file_tensorflow_core_framework_step_stats_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeviceStepStats) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeviceStepStats) ProtoMessage() {} + +func (x *DeviceStepStats) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_step_stats_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeviceStepStats.ProtoReflect.Descriptor instead. +func (*DeviceStepStats) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_step_stats_proto_rawDescGZIP(), []int{5} +} + +func (x *DeviceStepStats) GetDevice() string { + if x != nil { + return x.Device + } + return "" +} + +func (x *DeviceStepStats) GetNodeStats() []*NodeExecStats { + if x != nil { + return x.NodeStats + } + return nil +} + +func (x *DeviceStepStats) GetThreadNames() map[uint32]string { + if x != nil { + return x.ThreadNames + } + return nil +} + +type StepStats struct { + state protoimpl.MessageState `protogen:"open.v1"` + DevStats []*DeviceStepStats `protobuf:"bytes,1,rep,name=dev_stats,json=devStats,proto3" json:"dev_stats,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *StepStats) Reset() { + *x = StepStats{} + mi := &file_tensorflow_core_framework_step_stats_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *StepStats) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StepStats) ProtoMessage() {} + +func (x *StepStats) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_step_stats_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StepStats.ProtoReflect.Descriptor instead. +func (*StepStats) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_step_stats_proto_rawDescGZIP(), []int{6} +} + +func (x *StepStats) GetDevStats() []*DeviceStepStats { + if x != nil { + return x.DevStats + } + return nil +} + +var File_tensorflow_core_framework_step_stats_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_step_stats_proto_rawDesc = "" + + "\n" + + "*tensorflow/core/framework/step_stats.proto\x12\n" + + "tensorflow\x1a6tensorflow/core/framework/allocation_description.proto\x1a2tensorflow/core/framework/tensor_description.proto\"V\n" + + "\x10AllocationRecord\x12!\n" + + "\falloc_micros\x18\x01 \x01(\x03R\vallocMicros\x12\x1f\n" + + "\valloc_bytes\x18\x02 \x01(\x03R\n" + + "allocBytes\"\x9d\x02\n" + + "\x13AllocatorMemoryUsed\x12%\n" + + "\x0eallocator_name\x18\x01 \x01(\tR\rallocatorName\x12\x1f\n" + + "\vtotal_bytes\x18\x02 \x01(\x03R\n" + + "totalBytes\x12\x1d\n" + + "\n" + + "peak_bytes\x18\x03 \x01(\x03R\tpeakBytes\x12\x1d\n" + + "\n" + + "live_bytes\x18\x04 \x01(\x03R\tliveBytes\x12K\n" + + "\x12allocation_records\x18\x06 \x03(\v2\x1c.tensorflow.AllocationRecordR\x11allocationRecords\x123\n" + + "\x16allocator_bytes_in_use\x18\x05 \x01(\x03R\x13allocatorBytesInUse\"n\n" + + "\n" + + "NodeOutput\x12\x12\n" + + "\x04slot\x18\x01 \x01(\x05R\x04slot\x12L\n" + + "\x12tensor_description\x18\x03 \x01(\v2\x1d.tensorflow.TensorDescriptionR\x11tensorDescription\"\xfe\x02\n" + + "\vMemoryStats\x12(\n" + + "\x10temp_memory_size\x18\x01 \x01(\x03R\x0etempMemorySize\x124\n" + + "\x16persistent_memory_size\x18\x03 \x01(\x03R\x14persistentMemorySize\x12=\n" + + "\x1bpersistent_tensor_alloc_ids\x18\x05 \x03(\x03R\x18persistentTensorAllocIds\x129\n" + + "\x17device_temp_memory_size\x18\x02 \x01(\x03B\x02\x18\x01R\x14deviceTempMemorySize\x12E\n" + + "\x1ddevice_persistent_memory_size\x18\x04 \x01(\x03B\x02\x18\x01R\x1adevicePersistentMemorySize\x12N\n" + + "\"device_persistent_tensor_alloc_ids\x18\x06 \x03(\x03B\x02\x18\x01R\x1edevicePersistentTensorAllocIds\"\x93\x06\n" + + "\rNodeExecStats\x12\x1b\n" + + "\tnode_name\x18\x01 \x01(\tR\bnodeName\x12(\n" + + "\x10all_start_micros\x18\x02 \x01(\x03R\x0eallStartMicros\x12-\n" + + "\x13op_start_rel_micros\x18\x03 \x01(\x03R\x10opStartRelMicros\x12)\n" + + "\x11op_end_rel_micros\x18\x04 \x01(\x03R\x0eopEndRelMicros\x12+\n" + + "\x12all_end_rel_micros\x18\x05 \x01(\x03R\x0fallEndRelMicros\x127\n" + + "\x06memory\x18\x06 \x03(\v2\x1f.tensorflow.AllocatorMemoryUsedR\x06memory\x12.\n" + + "\x06output\x18\a \x03(\v2\x16.tensorflow.NodeOutputR\x06output\x12%\n" + + "\x0etimeline_label\x18\b \x01(\tR\rtimelineLabel\x12)\n" + + "\x10scheduled_micros\x18\t \x01(\x03R\x0fscheduledMicros\x12\x1b\n" + + "\tthread_id\x18\n" + + " \x01(\rR\bthreadId\x12N\n" + + "\x11referenced_tensor\x18\v \x03(\v2!.tensorflow.AllocationDescriptionR\x10referencedTensor\x12:\n" + + "\fmemory_stats\x18\f \x01(\v2\x17.tensorflow.MemoryStatsR\vmemoryStats\x12&\n" + + "\x0fall_start_nanos\x18\r \x01(\x03R\rallStartNanos\x12+\n" + + "\x12op_start_rel_nanos\x18\x0e \x01(\x03R\x0fopStartRelNanos\x12'\n" + + "\x10op_end_rel_nanos\x18\x0f \x01(\x03R\ropEndRelNanos\x12)\n" + + "\x11all_end_rel_nanos\x18\x10 \x01(\x03R\x0eallEndRelNanos\x12'\n" + + "\x0fscheduled_nanos\x18\x11 \x01(\x03R\x0escheduledNanos\"\xf4\x01\n" + + "\x0fDeviceStepStats\x12\x16\n" + + "\x06device\x18\x01 \x01(\tR\x06device\x128\n" + + "\n" + + "node_stats\x18\x02 \x03(\v2\x19.tensorflow.NodeExecStatsR\tnodeStats\x12O\n" + + "\fthread_names\x18\x03 \x03(\v2,.tensorflow.DeviceStepStats.ThreadNamesEntryR\vthreadNames\x1a>\n" + + "\x10ThreadNamesEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\rR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"E\n" + + "\tStepStats\x128\n" + + "\tdev_stats\x18\x01 \x03(\v2\x1b.tensorflow.DeviceStepStatsR\bdevStatsB\x83\x01\n" + + "\x18org.tensorflow.frameworkB\x0fStepStatsProtosP\x01ZQgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/step_stats_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_step_stats_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_step_stats_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_step_stats_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_step_stats_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_step_stats_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_step_stats_proto_rawDesc), len(file_tensorflow_core_framework_step_stats_proto_rawDesc))) + }) + return file_tensorflow_core_framework_step_stats_proto_rawDescData +} + +var file_tensorflow_core_framework_step_stats_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_tensorflow_core_framework_step_stats_proto_goTypes = []any{ + (*AllocationRecord)(nil), // 0: tensorflow.AllocationRecord + (*AllocatorMemoryUsed)(nil), // 1: tensorflow.AllocatorMemoryUsed + (*NodeOutput)(nil), // 2: tensorflow.NodeOutput + (*MemoryStats)(nil), // 3: tensorflow.MemoryStats + (*NodeExecStats)(nil), // 4: tensorflow.NodeExecStats + (*DeviceStepStats)(nil), // 5: tensorflow.DeviceStepStats + (*StepStats)(nil), // 6: tensorflow.StepStats + nil, // 7: tensorflow.DeviceStepStats.ThreadNamesEntry + (*tensor_description_go_proto.TensorDescription)(nil), // 8: tensorflow.TensorDescription + (*allocation_description_go_proto.AllocationDescription)(nil), // 9: tensorflow.AllocationDescription +} +var file_tensorflow_core_framework_step_stats_proto_depIdxs = []int32{ + 0, // 0: tensorflow.AllocatorMemoryUsed.allocation_records:type_name -> tensorflow.AllocationRecord + 8, // 1: tensorflow.NodeOutput.tensor_description:type_name -> tensorflow.TensorDescription + 1, // 2: tensorflow.NodeExecStats.memory:type_name -> tensorflow.AllocatorMemoryUsed + 2, // 3: tensorflow.NodeExecStats.output:type_name -> tensorflow.NodeOutput + 9, // 4: tensorflow.NodeExecStats.referenced_tensor:type_name -> tensorflow.AllocationDescription + 3, // 5: tensorflow.NodeExecStats.memory_stats:type_name -> tensorflow.MemoryStats + 4, // 6: tensorflow.DeviceStepStats.node_stats:type_name -> tensorflow.NodeExecStats + 7, // 7: tensorflow.DeviceStepStats.thread_names:type_name -> tensorflow.DeviceStepStats.ThreadNamesEntry + 5, // 8: tensorflow.StepStats.dev_stats:type_name -> tensorflow.DeviceStepStats + 9, // [9:9] is the sub-list for method output_type + 9, // [9:9] is the sub-list for method input_type + 9, // [9:9] is the sub-list for extension type_name + 9, // [9:9] is the sub-list for extension extendee + 0, // [0:9] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_step_stats_proto_init() } +func file_tensorflow_core_framework_step_stats_proto_init() { + if File_tensorflow_core_framework_step_stats_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_step_stats_proto_rawDesc), len(file_tensorflow_core_framework_step_stats_proto_rawDesc)), + NumEnums: 0, + NumMessages: 8, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_step_stats_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_step_stats_proto_depIdxs, + MessageInfos: file_tensorflow_core_framework_step_stats_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_step_stats_proto = out.File + file_tensorflow_core_framework_step_stats_proto_goTypes = nil + file_tensorflow_core_framework_step_stats_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/framework/summary_go_proto/summary.pb.go b/third_party/go-tensorflow/tensorflow/go/core/framework/summary_go_proto/summary.pb.go new file mode 100644 index 0000000..3619ae0 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/framework/summary_go_proto/summary.pb.go @@ -0,0 +1,895 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/summary.proto + +package summary_go_proto + +import ( + tensor_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type DataClass int32 + +const ( + // Unknown data class, used (implicitly) for legacy data. Will not be + // processed by data ingestion pipelines. + DataClass_DATA_CLASS_UNKNOWN DataClass = 0 + // Scalar time series. Each `Value` for the corresponding tag must have + // `tensor` set to a rank-0 tensor of floating-point dtype, which will be + // converted to float64. + DataClass_DATA_CLASS_SCALAR DataClass = 1 + // Tensor time series. Each `Value` for the corresponding tag must have + // `tensor` set. The tensor value is arbitrary, but should be small to + // accommodate direct storage in database backends: an upper bound of a few + // kilobytes is a reasonable rule of thumb. + DataClass_DATA_CLASS_TENSOR DataClass = 2 + // Blob sequence time series. Each `Value` for the corresponding tag must + // have `tensor` set to a rank-1 tensor of bytestring dtype. + DataClass_DATA_CLASS_BLOB_SEQUENCE DataClass = 3 +) + +// Enum value maps for DataClass. +var ( + DataClass_name = map[int32]string{ + 0: "DATA_CLASS_UNKNOWN", + 1: "DATA_CLASS_SCALAR", + 2: "DATA_CLASS_TENSOR", + 3: "DATA_CLASS_BLOB_SEQUENCE", + } + DataClass_value = map[string]int32{ + "DATA_CLASS_UNKNOWN": 0, + "DATA_CLASS_SCALAR": 1, + "DATA_CLASS_TENSOR": 2, + "DATA_CLASS_BLOB_SEQUENCE": 3, + } +) + +func (x DataClass) Enum() *DataClass { + p := new(DataClass) + *p = x + return p +} + +func (x DataClass) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (DataClass) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_framework_summary_proto_enumTypes[0].Descriptor() +} + +func (DataClass) Type() protoreflect.EnumType { + return &file_tensorflow_core_framework_summary_proto_enumTypes[0] +} + +func (x DataClass) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use DataClass.Descriptor instead. +func (DataClass) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_framework_summary_proto_rawDescGZIP(), []int{0} +} + +// Metadata associated with a series of Summary data +type SummaryDescription struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Hint on how plugins should process the data in this series. + // Supported values include "scalar", "histogram", "image", "audio" + TypeHint string `protobuf:"bytes,1,opt,name=type_hint,json=typeHint,proto3" json:"type_hint,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SummaryDescription) Reset() { + *x = SummaryDescription{} + mi := &file_tensorflow_core_framework_summary_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SummaryDescription) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SummaryDescription) ProtoMessage() {} + +func (x *SummaryDescription) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_summary_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SummaryDescription.ProtoReflect.Descriptor instead. +func (*SummaryDescription) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_summary_proto_rawDescGZIP(), []int{0} +} + +func (x *SummaryDescription) GetTypeHint() string { + if x != nil { + return x.TypeHint + } + return "" +} + +// Serialization format for histogram module in +// core/lib/histogram/histogram.h +type HistogramProto struct { + state protoimpl.MessageState `protogen:"open.v1"` + Min float64 `protobuf:"fixed64,1,opt,name=min,proto3" json:"min,omitempty"` + Max float64 `protobuf:"fixed64,2,opt,name=max,proto3" json:"max,omitempty"` + Num float64 `protobuf:"fixed64,3,opt,name=num,proto3" json:"num,omitempty"` + Sum float64 `protobuf:"fixed64,4,opt,name=sum,proto3" json:"sum,omitempty"` + SumSquares float64 `protobuf:"fixed64,5,opt,name=sum_squares,json=sumSquares,proto3" json:"sum_squares,omitempty"` + // 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) + BucketLimit []float64 `protobuf:"fixed64,6,rep,packed,name=bucket_limit,json=bucketLimit,proto3" json:"bucket_limit,omitempty"` + Bucket []float64 `protobuf:"fixed64,7,rep,packed,name=bucket,proto3" json:"bucket,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HistogramProto) Reset() { + *x = HistogramProto{} + mi := &file_tensorflow_core_framework_summary_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HistogramProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HistogramProto) ProtoMessage() {} + +func (x *HistogramProto) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_summary_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HistogramProto.ProtoReflect.Descriptor instead. +func (*HistogramProto) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_summary_proto_rawDescGZIP(), []int{1} +} + +func (x *HistogramProto) GetMin() float64 { + if x != nil { + return x.Min + } + return 0 +} + +func (x *HistogramProto) GetMax() float64 { + if x != nil { + return x.Max + } + return 0 +} + +func (x *HistogramProto) GetNum() float64 { + if x != nil { + return x.Num + } + return 0 +} + +func (x *HistogramProto) GetSum() float64 { + if x != nil { + return x.Sum + } + return 0 +} + +func (x *HistogramProto) GetSumSquares() float64 { + if x != nil { + return x.SumSquares + } + return 0 +} + +func (x *HistogramProto) GetBucketLimit() []float64 { + if x != nil { + return x.BucketLimit + } + return nil +} + +func (x *HistogramProto) GetBucket() []float64 { + if x != nil { + return x.Bucket + } + return nil +} + +// A SummaryMetadata encapsulates information on which plugins are able to make +// use of a certain summary value. +type SummaryMetadata struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Data that associates a summary with a certain plugin. + PluginData *SummaryMetadata_PluginData `protobuf:"bytes,1,opt,name=plugin_data,json=pluginData,proto3" json:"plugin_data,omitempty"` + // Display name for viewing in TensorBoard. + DisplayName string `protobuf:"bytes,2,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` + // Longform readable description of the summary sequence. Markdown supported. + SummaryDescription string `protobuf:"bytes,3,opt,name=summary_description,json=summaryDescription,proto3" json:"summary_description,omitempty"` + // Class of data stored in this time series. Required for compatibility with + // TensorBoard's generic data facilities (`DataProvider`, et al.). This value + // imposes constraints on the dtype and shape of the corresponding tensor + // values. See `DataClass` docs for details. + DataClass DataClass `protobuf:"varint,4,opt,name=data_class,json=dataClass,proto3,enum=tensorflow.DataClass" json:"data_class,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SummaryMetadata) Reset() { + *x = SummaryMetadata{} + mi := &file_tensorflow_core_framework_summary_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SummaryMetadata) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SummaryMetadata) ProtoMessage() {} + +func (x *SummaryMetadata) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_summary_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SummaryMetadata.ProtoReflect.Descriptor instead. +func (*SummaryMetadata) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_summary_proto_rawDescGZIP(), []int{2} +} + +func (x *SummaryMetadata) GetPluginData() *SummaryMetadata_PluginData { + if x != nil { + return x.PluginData + } + return nil +} + +func (x *SummaryMetadata) GetDisplayName() string { + if x != nil { + return x.DisplayName + } + return "" +} + +func (x *SummaryMetadata) GetSummaryDescription() string { + if x != nil { + return x.SummaryDescription + } + return "" +} + +func (x *SummaryMetadata) GetDataClass() DataClass { + if x != nil { + return x.DataClass + } + return DataClass_DATA_CLASS_UNKNOWN +} + +// A Summary is a set of named values to be displayed by the +// visualizer. +// +// Summaries are produced regularly during training, as controlled by +// the "summary_interval_secs" attribute of the training operation. +// Summaries are also produced at the end of an evaluation. +type Summary struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Set of values for the summary. + Value []*Summary_Value `protobuf:"bytes,1,rep,name=value,proto3" json:"value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Summary) Reset() { + *x = Summary{} + mi := &file_tensorflow_core_framework_summary_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Summary) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Summary) ProtoMessage() {} + +func (x *Summary) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_summary_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Summary.ProtoReflect.Descriptor instead. +func (*Summary) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_summary_proto_rawDescGZIP(), []int{3} +} + +func (x *Summary) GetValue() []*Summary_Value { + if x != nil { + return x.Value + } + return nil +} + +type SummaryMetadata_PluginData struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The name of the plugin this data pertains to. + PluginName string `protobuf:"bytes,1,opt,name=plugin_name,json=pluginName,proto3" json:"plugin_name,omitempty"` + // The content to store for the plugin. The best practice is for this to be + // a binary serialized protocol buffer. + Content []byte `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SummaryMetadata_PluginData) Reset() { + *x = SummaryMetadata_PluginData{} + mi := &file_tensorflow_core_framework_summary_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SummaryMetadata_PluginData) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SummaryMetadata_PluginData) ProtoMessage() {} + +func (x *SummaryMetadata_PluginData) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_summary_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SummaryMetadata_PluginData.ProtoReflect.Descriptor instead. +func (*SummaryMetadata_PluginData) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_summary_proto_rawDescGZIP(), []int{2, 0} +} + +func (x *SummaryMetadata_PluginData) GetPluginName() string { + if x != nil { + return x.PluginName + } + return "" +} + +func (x *SummaryMetadata_PluginData) GetContent() []byte { + if x != nil { + return x.Content + } + return nil +} + +type Summary_Image struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Dimensions of the image. + Height int32 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + Width int32 `protobuf:"varint,2,opt,name=width,proto3" json:"width,omitempty"` + // Valid colorspace values are + // + // 1 - grayscale + // 2 - grayscale + alpha + // 3 - RGB + // 4 - RGBA + // 5 - DIGITAL_YUV + // 6 - BGRA + Colorspace int32 `protobuf:"varint,3,opt,name=colorspace,proto3" json:"colorspace,omitempty"` + // Image data in encoded format. All image formats supported by + // image_codec::CoderUtil can be stored here. + EncodedImageString []byte `protobuf:"bytes,4,opt,name=encoded_image_string,json=encodedImageString,proto3" json:"encoded_image_string,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Summary_Image) Reset() { + *x = Summary_Image{} + mi := &file_tensorflow_core_framework_summary_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Summary_Image) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Summary_Image) ProtoMessage() {} + +func (x *Summary_Image) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_summary_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Summary_Image.ProtoReflect.Descriptor instead. +func (*Summary_Image) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_summary_proto_rawDescGZIP(), []int{3, 0} +} + +func (x *Summary_Image) GetHeight() int32 { + if x != nil { + return x.Height + } + return 0 +} + +func (x *Summary_Image) GetWidth() int32 { + if x != nil { + return x.Width + } + return 0 +} + +func (x *Summary_Image) GetColorspace() int32 { + if x != nil { + return x.Colorspace + } + return 0 +} + +func (x *Summary_Image) GetEncodedImageString() []byte { + if x != nil { + return x.EncodedImageString + } + return nil +} + +type Summary_Audio struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Sample rate of the audio in Hz. + SampleRate float32 `protobuf:"fixed32,1,opt,name=sample_rate,json=sampleRate,proto3" json:"sample_rate,omitempty"` + // Number of channels of audio. + NumChannels int64 `protobuf:"varint,2,opt,name=num_channels,json=numChannels,proto3" json:"num_channels,omitempty"` + // Length of the audio in frames (samples per channel). + LengthFrames int64 `protobuf:"varint,3,opt,name=length_frames,json=lengthFrames,proto3" json:"length_frames,omitempty"` + // Encoded audio data and its associated RFC 2045 content type (e.g. + // "audio/wav"). + EncodedAudioString []byte `protobuf:"bytes,4,opt,name=encoded_audio_string,json=encodedAudioString,proto3" json:"encoded_audio_string,omitempty"` + ContentType string `protobuf:"bytes,5,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Summary_Audio) Reset() { + *x = Summary_Audio{} + mi := &file_tensorflow_core_framework_summary_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Summary_Audio) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Summary_Audio) ProtoMessage() {} + +func (x *Summary_Audio) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_summary_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Summary_Audio.ProtoReflect.Descriptor instead. +func (*Summary_Audio) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_summary_proto_rawDescGZIP(), []int{3, 1} +} + +func (x *Summary_Audio) GetSampleRate() float32 { + if x != nil { + return x.SampleRate + } + return 0 +} + +func (x *Summary_Audio) GetNumChannels() int64 { + if x != nil { + return x.NumChannels + } + return 0 +} + +func (x *Summary_Audio) GetLengthFrames() int64 { + if x != nil { + return x.LengthFrames + } + return 0 +} + +func (x *Summary_Audio) GetEncodedAudioString() []byte { + if x != nil { + return x.EncodedAudioString + } + return nil +} + +func (x *Summary_Audio) GetContentType() string { + if x != nil { + return x.ContentType + } + return "" +} + +type Summary_Value struct { + state protoimpl.MessageState `protogen:"open.v1"` + // This field is deprecated and will not be set. + NodeName string `protobuf:"bytes,7,opt,name=node_name,json=nodeName,proto3" json:"node_name,omitempty"` + // Tag name for the data. Used by TensorBoard plugins to organize data. Tags + // are often organized by scope (which contains slashes to convey + // hierarchy). For example: foo/bar/0 + Tag string `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"` + // Contains metadata on the summary value such as which plugins may use it. + // Take note that many summary values may lack a metadata field. This is + // because the FileWriter only keeps a metadata object on the first summary + // value with a certain tag for each tag. TensorBoard then remembers which + // tags are associated with which plugins. This saves space. + Metadata *SummaryMetadata `protobuf:"bytes,9,opt,name=metadata,proto3" json:"metadata,omitempty"` + // Value associated with the tag. + // + // Types that are valid to be assigned to Value: + // + // *Summary_Value_SimpleValue + // *Summary_Value_ObsoleteOldStyleHistogram + // *Summary_Value_Image + // *Summary_Value_Histo + // *Summary_Value_Audio + // *Summary_Value_Tensor + Value isSummary_Value_Value `protobuf_oneof:"value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Summary_Value) Reset() { + *x = Summary_Value{} + mi := &file_tensorflow_core_framework_summary_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Summary_Value) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Summary_Value) ProtoMessage() {} + +func (x *Summary_Value) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_summary_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Summary_Value.ProtoReflect.Descriptor instead. +func (*Summary_Value) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_summary_proto_rawDescGZIP(), []int{3, 2} +} + +func (x *Summary_Value) GetNodeName() string { + if x != nil { + return x.NodeName + } + return "" +} + +func (x *Summary_Value) GetTag() string { + if x != nil { + return x.Tag + } + return "" +} + +func (x *Summary_Value) GetMetadata() *SummaryMetadata { + if x != nil { + return x.Metadata + } + return nil +} + +func (x *Summary_Value) GetValue() isSummary_Value_Value { + if x != nil { + return x.Value + } + return nil +} + +func (x *Summary_Value) GetSimpleValue() float32 { + if x != nil { + if x, ok := x.Value.(*Summary_Value_SimpleValue); ok { + return x.SimpleValue + } + } + return 0 +} + +func (x *Summary_Value) GetObsoleteOldStyleHistogram() []byte { + if x != nil { + if x, ok := x.Value.(*Summary_Value_ObsoleteOldStyleHistogram); ok { + return x.ObsoleteOldStyleHistogram + } + } + return nil +} + +func (x *Summary_Value) GetImage() *Summary_Image { + if x != nil { + if x, ok := x.Value.(*Summary_Value_Image); ok { + return x.Image + } + } + return nil +} + +func (x *Summary_Value) GetHisto() *HistogramProto { + if x != nil { + if x, ok := x.Value.(*Summary_Value_Histo); ok { + return x.Histo + } + } + return nil +} + +func (x *Summary_Value) GetAudio() *Summary_Audio { + if x != nil { + if x, ok := x.Value.(*Summary_Value_Audio); ok { + return x.Audio + } + } + return nil +} + +func (x *Summary_Value) GetTensor() *tensor_go_proto.TensorProto { + if x != nil { + if x, ok := x.Value.(*Summary_Value_Tensor); ok { + return x.Tensor + } + } + return nil +} + +type isSummary_Value_Value interface { + isSummary_Value_Value() +} + +type Summary_Value_SimpleValue struct { + SimpleValue float32 `protobuf:"fixed32,2,opt,name=simple_value,json=simpleValue,proto3,oneof"` +} + +type Summary_Value_ObsoleteOldStyleHistogram struct { + ObsoleteOldStyleHistogram []byte `protobuf:"bytes,3,opt,name=obsolete_old_style_histogram,json=obsoleteOldStyleHistogram,proto3,oneof"` +} + +type Summary_Value_Image struct { + Image *Summary_Image `protobuf:"bytes,4,opt,name=image,proto3,oneof"` +} + +type Summary_Value_Histo struct { + Histo *HistogramProto `protobuf:"bytes,5,opt,name=histo,proto3,oneof"` +} + +type Summary_Value_Audio struct { + Audio *Summary_Audio `protobuf:"bytes,6,opt,name=audio,proto3,oneof"` +} + +type Summary_Value_Tensor struct { + Tensor *tensor_go_proto.TensorProto `protobuf:"bytes,8,opt,name=tensor,proto3,oneof"` +} + +func (*Summary_Value_SimpleValue) isSummary_Value_Value() {} + +func (*Summary_Value_ObsoleteOldStyleHistogram) isSummary_Value_Value() {} + +func (*Summary_Value_Image) isSummary_Value_Value() {} + +func (*Summary_Value_Histo) isSummary_Value_Value() {} + +func (*Summary_Value_Audio) isSummary_Value_Value() {} + +func (*Summary_Value_Tensor) isSummary_Value_Value() {} + +var File_tensorflow_core_framework_summary_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_summary_proto_rawDesc = "" + + "\n" + + "'tensorflow/core/framework/summary.proto\x12\n" + + "tensorflow\x1a&tensorflow/core/framework/tensor.proto\"1\n" + + "\x12SummaryDescription\x12\x1b\n" + + "\ttype_hint\x18\x01 \x01(\tR\btypeHint\"\xbc\x01\n" + + "\x0eHistogramProto\x12\x10\n" + + "\x03min\x18\x01 \x01(\x01R\x03min\x12\x10\n" + + "\x03max\x18\x02 \x01(\x01R\x03max\x12\x10\n" + + "\x03num\x18\x03 \x01(\x01R\x03num\x12\x10\n" + + "\x03sum\x18\x04 \x01(\x01R\x03sum\x12\x1f\n" + + "\vsum_squares\x18\x05 \x01(\x01R\n" + + "sumSquares\x12%\n" + + "\fbucket_limit\x18\x06 \x03(\x01B\x02\x10\x01R\vbucketLimit\x12\x1a\n" + + "\x06bucket\x18\a \x03(\x01B\x02\x10\x01R\x06bucket\"\xad\x02\n" + + "\x0fSummaryMetadata\x12G\n" + + "\vplugin_data\x18\x01 \x01(\v2&.tensorflow.SummaryMetadata.PluginDataR\n" + + "pluginData\x12!\n" + + "\fdisplay_name\x18\x02 \x01(\tR\vdisplayName\x12/\n" + + "\x13summary_description\x18\x03 \x01(\tR\x12summaryDescription\x124\n" + + "\n" + + "data_class\x18\x04 \x01(\x0e2\x15.tensorflow.DataClassR\tdataClass\x1aG\n" + + "\n" + + "PluginData\x12\x1f\n" + + "\vplugin_name\x18\x01 \x01(\tR\n" + + "pluginName\x12\x18\n" + + "\acontent\x18\x02 \x01(\fR\acontent\"\xbc\x06\n" + + "\aSummary\x12/\n" + + "\x05value\x18\x01 \x03(\v2\x19.tensorflow.Summary.ValueR\x05value\x1a\x87\x01\n" + + "\x05Image\x12\x16\n" + + "\x06height\x18\x01 \x01(\x05R\x06height\x12\x14\n" + + "\x05width\x18\x02 \x01(\x05R\x05width\x12\x1e\n" + + "\n" + + "colorspace\x18\x03 \x01(\x05R\n" + + "colorspace\x120\n" + + "\x14encoded_image_string\x18\x04 \x01(\fR\x12encodedImageString\x1a\xc5\x01\n" + + "\x05Audio\x12\x1f\n" + + "\vsample_rate\x18\x01 \x01(\x02R\n" + + "sampleRate\x12!\n" + + "\fnum_channels\x18\x02 \x01(\x03R\vnumChannels\x12#\n" + + "\rlength_frames\x18\x03 \x01(\x03R\flengthFrames\x120\n" + + "\x14encoded_audio_string\x18\x04 \x01(\fR\x12encodedAudioString\x12!\n" + + "\fcontent_type\x18\x05 \x01(\tR\vcontentType\x1a\xad\x03\n" + + "\x05Value\x12\x1b\n" + + "\tnode_name\x18\a \x01(\tR\bnodeName\x12\x10\n" + + "\x03tag\x18\x01 \x01(\tR\x03tag\x127\n" + + "\bmetadata\x18\t \x01(\v2\x1b.tensorflow.SummaryMetadataR\bmetadata\x12#\n" + + "\fsimple_value\x18\x02 \x01(\x02H\x00R\vsimpleValue\x12A\n" + + "\x1cobsolete_old_style_histogram\x18\x03 \x01(\fH\x00R\x19obsoleteOldStyleHistogram\x121\n" + + "\x05image\x18\x04 \x01(\v2\x19.tensorflow.Summary.ImageH\x00R\x05image\x122\n" + + "\x05histo\x18\x05 \x01(\v2\x1a.tensorflow.HistogramProtoH\x00R\x05histo\x121\n" + + "\x05audio\x18\x06 \x01(\v2\x19.tensorflow.Summary.AudioH\x00R\x05audio\x121\n" + + "\x06tensor\x18\b \x01(\v2\x17.tensorflow.TensorProtoH\x00R\x06tensorB\a\n" + + "\x05value*o\n" + + "\tDataClass\x12\x16\n" + + "\x12DATA_CLASS_UNKNOWN\x10\x00\x12\x15\n" + + "\x11DATA_CLASS_SCALAR\x10\x01\x12\x15\n" + + "\x11DATA_CLASS_TENSOR\x10\x02\x12\x1c\n" + + "\x18DATA_CLASS_BLOB_SEQUENCE\x10\x03B~\n" + + "\x18org.tensorflow.frameworkB\rSummaryProtosP\x01ZNgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/summary_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_summary_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_summary_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_summary_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_summary_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_summary_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_summary_proto_rawDesc), len(file_tensorflow_core_framework_summary_proto_rawDesc))) + }) + return file_tensorflow_core_framework_summary_proto_rawDescData +} + +var file_tensorflow_core_framework_summary_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_tensorflow_core_framework_summary_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_tensorflow_core_framework_summary_proto_goTypes = []any{ + (DataClass)(0), // 0: tensorflow.DataClass + (*SummaryDescription)(nil), // 1: tensorflow.SummaryDescription + (*HistogramProto)(nil), // 2: tensorflow.HistogramProto + (*SummaryMetadata)(nil), // 3: tensorflow.SummaryMetadata + (*Summary)(nil), // 4: tensorflow.Summary + (*SummaryMetadata_PluginData)(nil), // 5: tensorflow.SummaryMetadata.PluginData + (*Summary_Image)(nil), // 6: tensorflow.Summary.Image + (*Summary_Audio)(nil), // 7: tensorflow.Summary.Audio + (*Summary_Value)(nil), // 8: tensorflow.Summary.Value + (*tensor_go_proto.TensorProto)(nil), // 9: tensorflow.TensorProto +} +var file_tensorflow_core_framework_summary_proto_depIdxs = []int32{ + 5, // 0: tensorflow.SummaryMetadata.plugin_data:type_name -> tensorflow.SummaryMetadata.PluginData + 0, // 1: tensorflow.SummaryMetadata.data_class:type_name -> tensorflow.DataClass + 8, // 2: tensorflow.Summary.value:type_name -> tensorflow.Summary.Value + 3, // 3: tensorflow.Summary.Value.metadata:type_name -> tensorflow.SummaryMetadata + 6, // 4: tensorflow.Summary.Value.image:type_name -> tensorflow.Summary.Image + 2, // 5: tensorflow.Summary.Value.histo:type_name -> tensorflow.HistogramProto + 7, // 6: tensorflow.Summary.Value.audio:type_name -> tensorflow.Summary.Audio + 9, // 7: tensorflow.Summary.Value.tensor:type_name -> tensorflow.TensorProto + 8, // [8:8] is the sub-list for method output_type + 8, // [8:8] is the sub-list for method input_type + 8, // [8:8] is the sub-list for extension type_name + 8, // [8:8] is the sub-list for extension extendee + 0, // [0:8] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_summary_proto_init() } +func file_tensorflow_core_framework_summary_proto_init() { + if File_tensorflow_core_framework_summary_proto != nil { + return + } + file_tensorflow_core_framework_summary_proto_msgTypes[7].OneofWrappers = []any{ + (*Summary_Value_SimpleValue)(nil), + (*Summary_Value_ObsoleteOldStyleHistogram)(nil), + (*Summary_Value_Image)(nil), + (*Summary_Value_Histo)(nil), + (*Summary_Value_Audio)(nil), + (*Summary_Value_Tensor)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_summary_proto_rawDesc), len(file_tensorflow_core_framework_summary_proto_rawDesc)), + NumEnums: 1, + NumMessages: 8, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_summary_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_summary_proto_depIdxs, + EnumInfos: file_tensorflow_core_framework_summary_proto_enumTypes, + MessageInfos: file_tensorflow_core_framework_summary_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_summary_proto = out.File + file_tensorflow_core_framework_summary_proto_goTypes = nil + file_tensorflow_core_framework_summary_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/framework/tensor_description_go_proto/tensor_description.pb.go b/third_party/go-tensorflow/tensorflow/go/core/framework/tensor_description_go_proto/tensor_description.pb.go new file mode 100644 index 0000000..de32d25 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/framework/tensor_description_go_proto/tensor_description.pb.go @@ -0,0 +1,154 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/tensor_description.proto + +package tensor_description_go_proto + +import ( + allocation_description_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/allocation_description_go_proto" + tensor_shape_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_shape_go_proto" + types_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/types_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type TensorDescription struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Data type of tensor elements + Dtype types_go_proto.DataType `protobuf:"varint,1,opt,name=dtype,proto3,enum=tensorflow.DataType" json:"dtype,omitempty"` + // Shape of the tensor. + Shape *tensor_shape_go_proto.TensorShapeProto `protobuf:"bytes,2,opt,name=shape,proto3" json:"shape,omitempty"` + // Information about the size and allocator used for the data + AllocationDescription *allocation_description_go_proto.AllocationDescription `protobuf:"bytes,4,opt,name=allocation_description,json=allocationDescription,proto3" json:"allocation_description,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TensorDescription) Reset() { + *x = TensorDescription{} + mi := &file_tensorflow_core_framework_tensor_description_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TensorDescription) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TensorDescription) ProtoMessage() {} + +func (x *TensorDescription) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_tensor_description_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TensorDescription.ProtoReflect.Descriptor instead. +func (*TensorDescription) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_tensor_description_proto_rawDescGZIP(), []int{0} +} + +func (x *TensorDescription) GetDtype() types_go_proto.DataType { + if x != nil { + return x.Dtype + } + return types_go_proto.DataType(0) +} + +func (x *TensorDescription) GetShape() *tensor_shape_go_proto.TensorShapeProto { + if x != nil { + return x.Shape + } + return nil +} + +func (x *TensorDescription) GetAllocationDescription() *allocation_description_go_proto.AllocationDescription { + if x != nil { + return x.AllocationDescription + } + return nil +} + +var File_tensorflow_core_framework_tensor_description_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_tensor_description_proto_rawDesc = "" + + "\n" + + "2tensorflow/core/framework/tensor_description.proto\x12\n" + + "tensorflow\x1a6tensorflow/core/framework/allocation_description.proto\x1a,tensorflow/core/framework/tensor_shape.proto\x1a%tensorflow/core/framework/types.proto\"\xcd\x01\n" + + "\x11TensorDescription\x12*\n" + + "\x05dtype\x18\x01 \x01(\x0e2\x14.tensorflow.DataTypeR\x05dtype\x122\n" + + "\x05shape\x18\x02 \x01(\v2\x1c.tensorflow.TensorShapeProtoR\x05shape\x12X\n" + + "\x16allocation_description\x18\x04 \x01(\v2!.tensorflow.AllocationDescriptionR\x15allocationDescriptionB\x93\x01\n" + + "\x18org.tensorflow.frameworkB\x17TensorDescriptionProtosP\x01ZYgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_description_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_tensor_description_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_tensor_description_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_tensor_description_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_tensor_description_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_tensor_description_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_tensor_description_proto_rawDesc), len(file_tensorflow_core_framework_tensor_description_proto_rawDesc))) + }) + return file_tensorflow_core_framework_tensor_description_proto_rawDescData +} + +var file_tensorflow_core_framework_tensor_description_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_tensorflow_core_framework_tensor_description_proto_goTypes = []any{ + (*TensorDescription)(nil), // 0: tensorflow.TensorDescription + (types_go_proto.DataType)(0), // 1: tensorflow.DataType + (*tensor_shape_go_proto.TensorShapeProto)(nil), // 2: tensorflow.TensorShapeProto + (*allocation_description_go_proto.AllocationDescription)(nil), // 3: tensorflow.AllocationDescription +} +var file_tensorflow_core_framework_tensor_description_proto_depIdxs = []int32{ + 1, // 0: tensorflow.TensorDescription.dtype:type_name -> tensorflow.DataType + 2, // 1: tensorflow.TensorDescription.shape:type_name -> tensorflow.TensorShapeProto + 3, // 2: tensorflow.TensorDescription.allocation_description:type_name -> tensorflow.AllocationDescription + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_tensor_description_proto_init() } +func file_tensorflow_core_framework_tensor_description_proto_init() { + if File_tensorflow_core_framework_tensor_description_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_tensor_description_proto_rawDesc), len(file_tensorflow_core_framework_tensor_description_proto_rawDesc)), + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_tensor_description_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_tensor_description_proto_depIdxs, + MessageInfos: file_tensorflow_core_framework_tensor_description_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_tensor_description_proto = out.File + file_tensorflow_core_framework_tensor_description_proto_goTypes = nil + file_tensorflow_core_framework_tensor_description_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/framework/tensor_go_proto/tensor.pb.go b/third_party/go-tensorflow/tensorflow/go/core/framework/tensor_go_proto/tensor.pb.go new file mode 100644 index 0000000..bcd95ac --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/framework/tensor_go_proto/tensor.pb.go @@ -0,0 +1,382 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/tensor.proto + +package tensor_go_proto + +import ( + resource_handle_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/resource_handle_go_proto" + tensor_shape_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_shape_go_proto" + types_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/types_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Protocol buffer representing a tensor. +type TensorProto struct { + state protoimpl.MessageState `protogen:"open.v1"` + Dtype types_go_proto.DataType `protobuf:"varint,1,opt,name=dtype,proto3,enum=tensorflow.DataType" json:"dtype,omitempty"` + // Shape of the tensor. TODO(touts): sort out the 0-rank issues. + TensorShape *tensor_shape_go_proto.TensorShapeProto `protobuf:"bytes,2,opt,name=tensor_shape,json=tensorShape,proto3" json:"tensor_shape,omitempty"` + // Version number. + // + // In version 0, if the "repeated xxx" representations contain only one + // element, that element is repeated to fill the shape. This makes it easy + // to represent a constant Tensor with a single value. + VersionNumber int32 `protobuf:"varint,3,opt,name=version_number,json=versionNumber,proto3" json:"version_number,omitempty"` + // Serialized raw tensor content from either Tensor::AsProtoTensorContent or + // memcpy in tensorflow::grpc::EncodeTensorToByteBuffer. This representation + // can be used for all tensor types. The purpose of this representation is to + // reduce serialization overhead during RPC call by avoiding serialization of + // many repeated small items. + TensorContent []byte `protobuf:"bytes,4,opt,name=tensor_content,json=tensorContent,proto3" json:"tensor_content,omitempty"` + // DT_HALF, DT_BFLOAT16. Note that since protobuf has no int16 type, we'll + // have some pointless zero padding for each value here. + HalfVal []int32 `protobuf:"varint,13,rep,packed,name=half_val,json=halfVal,proto3" json:"half_val,omitempty"` + // DT_FLOAT. + FloatVal []float32 `protobuf:"fixed32,5,rep,packed,name=float_val,json=floatVal,proto3" json:"float_val,omitempty"` + // DT_DOUBLE. + DoubleVal []float64 `protobuf:"fixed64,6,rep,packed,name=double_val,json=doubleVal,proto3" json:"double_val,omitempty"` + // DT_INT32, DT_INT16, DT_INT8, DT_UINT8. + IntVal []int32 `protobuf:"varint,7,rep,packed,name=int_val,json=intVal,proto3" json:"int_val,omitempty"` + // DT_STRING + StringVal [][]byte `protobuf:"bytes,8,rep,name=string_val,json=stringVal,proto3" json:"string_val,omitempty"` + // DT_COMPLEX64. scomplex_val(2*i) and scomplex_val(2*i+1) are real + // and imaginary parts of i-th single precision complex. + ScomplexVal []float32 `protobuf:"fixed32,9,rep,packed,name=scomplex_val,json=scomplexVal,proto3" json:"scomplex_val,omitempty"` + // DT_INT64 + Int64Val []int64 `protobuf:"varint,10,rep,packed,name=int64_val,json=int64Val,proto3" json:"int64_val,omitempty"` + // DT_BOOL + BoolVal []bool `protobuf:"varint,11,rep,packed,name=bool_val,json=boolVal,proto3" json:"bool_val,omitempty"` + // DT_COMPLEX128. dcomplex_val(2*i) and dcomplex_val(2*i+1) are real + // and imaginary parts of i-th double precision complex. + DcomplexVal []float64 `protobuf:"fixed64,12,rep,packed,name=dcomplex_val,json=dcomplexVal,proto3" json:"dcomplex_val,omitempty"` + // DT_RESOURCE + ResourceHandleVal []*resource_handle_go_proto.ResourceHandleProto `protobuf:"bytes,14,rep,name=resource_handle_val,json=resourceHandleVal,proto3" json:"resource_handle_val,omitempty"` + // DT_VARIANT + VariantVal []*VariantTensorDataProto `protobuf:"bytes,15,rep,name=variant_val,json=variantVal,proto3" json:"variant_val,omitempty"` + // DT_UINT32 + Uint32Val []uint32 `protobuf:"varint,16,rep,packed,name=uint32_val,json=uint32Val,proto3" json:"uint32_val,omitempty"` + // DT_UINT64 + Uint64Val []uint64 `protobuf:"varint,17,rep,packed,name=uint64_val,json=uint64Val,proto3" json:"uint64_val,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TensorProto) Reset() { + *x = TensorProto{} + mi := &file_tensorflow_core_framework_tensor_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TensorProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TensorProto) ProtoMessage() {} + +func (x *TensorProto) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_tensor_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TensorProto.ProtoReflect.Descriptor instead. +func (*TensorProto) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_tensor_proto_rawDescGZIP(), []int{0} +} + +func (x *TensorProto) GetDtype() types_go_proto.DataType { + if x != nil { + return x.Dtype + } + return types_go_proto.DataType(0) +} + +func (x *TensorProto) GetTensorShape() *tensor_shape_go_proto.TensorShapeProto { + if x != nil { + return x.TensorShape + } + return nil +} + +func (x *TensorProto) GetVersionNumber() int32 { + if x != nil { + return x.VersionNumber + } + return 0 +} + +func (x *TensorProto) GetTensorContent() []byte { + if x != nil { + return x.TensorContent + } + return nil +} + +func (x *TensorProto) GetHalfVal() []int32 { + if x != nil { + return x.HalfVal + } + return nil +} + +func (x *TensorProto) GetFloatVal() []float32 { + if x != nil { + return x.FloatVal + } + return nil +} + +func (x *TensorProto) GetDoubleVal() []float64 { + if x != nil { + return x.DoubleVal + } + return nil +} + +func (x *TensorProto) GetIntVal() []int32 { + if x != nil { + return x.IntVal + } + return nil +} + +func (x *TensorProto) GetStringVal() [][]byte { + if x != nil { + return x.StringVal + } + return nil +} + +func (x *TensorProto) GetScomplexVal() []float32 { + if x != nil { + return x.ScomplexVal + } + return nil +} + +func (x *TensorProto) GetInt64Val() []int64 { + if x != nil { + return x.Int64Val + } + return nil +} + +func (x *TensorProto) GetBoolVal() []bool { + if x != nil { + return x.BoolVal + } + return nil +} + +func (x *TensorProto) GetDcomplexVal() []float64 { + if x != nil { + return x.DcomplexVal + } + return nil +} + +func (x *TensorProto) GetResourceHandleVal() []*resource_handle_go_proto.ResourceHandleProto { + if x != nil { + return x.ResourceHandleVal + } + return nil +} + +func (x *TensorProto) GetVariantVal() []*VariantTensorDataProto { + if x != nil { + return x.VariantVal + } + return nil +} + +func (x *TensorProto) GetUint32Val() []uint32 { + if x != nil { + return x.Uint32Val + } + return nil +} + +func (x *TensorProto) GetUint64Val() []uint64 { + if x != nil { + return x.Uint64Val + } + return nil +} + +// Protocol buffer representing the serialization format of DT_VARIANT tensors. +type VariantTensorDataProto struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Name of the type of objects being serialized. + TypeName string `protobuf:"bytes,1,opt,name=type_name,json=typeName,proto3" json:"type_name,omitempty"` + // Portions of the object that are not Tensors. + Metadata []byte `protobuf:"bytes,2,opt,name=metadata,proto3" json:"metadata,omitempty"` + // Tensors contained within objects being serialized. + Tensors []*TensorProto `protobuf:"bytes,3,rep,name=tensors,proto3" json:"tensors,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *VariantTensorDataProto) Reset() { + *x = VariantTensorDataProto{} + mi := &file_tensorflow_core_framework_tensor_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *VariantTensorDataProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VariantTensorDataProto) ProtoMessage() {} + +func (x *VariantTensorDataProto) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_tensor_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use VariantTensorDataProto.ProtoReflect.Descriptor instead. +func (*VariantTensorDataProto) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_tensor_proto_rawDescGZIP(), []int{1} +} + +func (x *VariantTensorDataProto) GetTypeName() string { + if x != nil { + return x.TypeName + } + return "" +} + +func (x *VariantTensorDataProto) GetMetadata() []byte { + if x != nil { + return x.Metadata + } + return nil +} + +func (x *VariantTensorDataProto) GetTensors() []*TensorProto { + if x != nil { + return x.Tensors + } + return nil +} + +var File_tensorflow_core_framework_tensor_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_tensor_proto_rawDesc = "" + + "\n" + + "&tensorflow/core/framework/tensor.proto\x12\n" + + "tensorflow\x1a/tensorflow/core/framework/resource_handle.proto\x1a,tensorflow/core/framework/tensor_shape.proto\x1a%tensorflow/core/framework/types.proto\"\xd1\x05\n" + + "\vTensorProto\x12*\n" + + "\x05dtype\x18\x01 \x01(\x0e2\x14.tensorflow.DataTypeR\x05dtype\x12?\n" + + "\ftensor_shape\x18\x02 \x01(\v2\x1c.tensorflow.TensorShapeProtoR\vtensorShape\x12%\n" + + "\x0eversion_number\x18\x03 \x01(\x05R\rversionNumber\x12%\n" + + "\x0etensor_content\x18\x04 \x01(\fR\rtensorContent\x12\x1d\n" + + "\bhalf_val\x18\r \x03(\x05B\x02\x10\x01R\ahalfVal\x12\x1f\n" + + "\tfloat_val\x18\x05 \x03(\x02B\x02\x10\x01R\bfloatVal\x12!\n" + + "\n" + + "double_val\x18\x06 \x03(\x01B\x02\x10\x01R\tdoubleVal\x12\x1b\n" + + "\aint_val\x18\a \x03(\x05B\x02\x10\x01R\x06intVal\x12\x1d\n" + + "\n" + + "string_val\x18\b \x03(\fR\tstringVal\x12%\n" + + "\fscomplex_val\x18\t \x03(\x02B\x02\x10\x01R\vscomplexVal\x12\x1f\n" + + "\tint64_val\x18\n" + + " \x03(\x03B\x02\x10\x01R\bint64Val\x12\x1d\n" + + "\bbool_val\x18\v \x03(\bB\x02\x10\x01R\aboolVal\x12%\n" + + "\fdcomplex_val\x18\f \x03(\x01B\x02\x10\x01R\vdcomplexVal\x12O\n" + + "\x13resource_handle_val\x18\x0e \x03(\v2\x1f.tensorflow.ResourceHandleProtoR\x11resourceHandleVal\x12C\n" + + "\vvariant_val\x18\x0f \x03(\v2\".tensorflow.VariantTensorDataProtoR\n" + + "variantVal\x12!\n" + + "\n" + + "uint32_val\x18\x10 \x03(\rB\x02\x10\x01R\tuint32Val\x12!\n" + + "\n" + + "uint64_val\x18\x11 \x03(\x04B\x02\x10\x01R\tuint64Val\"\x84\x01\n" + + "\x16VariantTensorDataProto\x12\x1b\n" + + "\ttype_name\x18\x01 \x01(\tR\btypeName\x12\x1a\n" + + "\bmetadata\x18\x02 \x01(\fR\bmetadata\x121\n" + + "\atensors\x18\x03 \x03(\v2\x17.tensorflow.TensorProtoR\atensorsB|\n" + + "\x18org.tensorflow.frameworkB\fTensorProtosP\x01ZMgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_tensor_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_tensor_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_tensor_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_tensor_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_tensor_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_tensor_proto_rawDesc), len(file_tensorflow_core_framework_tensor_proto_rawDesc))) + }) + return file_tensorflow_core_framework_tensor_proto_rawDescData +} + +var file_tensorflow_core_framework_tensor_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_tensorflow_core_framework_tensor_proto_goTypes = []any{ + (*TensorProto)(nil), // 0: tensorflow.TensorProto + (*VariantTensorDataProto)(nil), // 1: tensorflow.VariantTensorDataProto + (types_go_proto.DataType)(0), // 2: tensorflow.DataType + (*tensor_shape_go_proto.TensorShapeProto)(nil), // 3: tensorflow.TensorShapeProto + (*resource_handle_go_proto.ResourceHandleProto)(nil), // 4: tensorflow.ResourceHandleProto +} +var file_tensorflow_core_framework_tensor_proto_depIdxs = []int32{ + 2, // 0: tensorflow.TensorProto.dtype:type_name -> tensorflow.DataType + 3, // 1: tensorflow.TensorProto.tensor_shape:type_name -> tensorflow.TensorShapeProto + 4, // 2: tensorflow.TensorProto.resource_handle_val:type_name -> tensorflow.ResourceHandleProto + 1, // 3: tensorflow.TensorProto.variant_val:type_name -> tensorflow.VariantTensorDataProto + 0, // 4: tensorflow.VariantTensorDataProto.tensors:type_name -> tensorflow.TensorProto + 5, // [5:5] is the sub-list for method output_type + 5, // [5:5] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_tensor_proto_init() } +func file_tensorflow_core_framework_tensor_proto_init() { + if File_tensorflow_core_framework_tensor_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_tensor_proto_rawDesc), len(file_tensorflow_core_framework_tensor_proto_rawDesc)), + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_tensor_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_tensor_proto_depIdxs, + MessageInfos: file_tensorflow_core_framework_tensor_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_tensor_proto = out.File + file_tensorflow_core_framework_tensor_proto_goTypes = nil + file_tensorflow_core_framework_tensor_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/framework/tensor_shape_go_proto/tensor_shape.pb.go b/third_party/go-tensorflow/tensorflow/go/core/framework/tensor_shape_go_proto/tensor_shape.pb.go new file mode 100644 index 0000000..e0160c2 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/framework/tensor_shape_go_proto/tensor_shape.pb.go @@ -0,0 +1,216 @@ +// Protocol buffer representing the shape of tensors. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/tensor_shape.proto + +package tensor_shape_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Dimensions of a tensor. +type TensorShapeProto struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Dimensions of the tensor, such as {"input", 30}, {"output", 40} + // for a 30 x 40 2D tensor. If an entry has size -1, this + // corresponds to a dimension of unknown size. The names are + // optional. + // + // The order of entries in "dim" matters: It indicates the layout of the + // values in the tensor in-memory representation. + // + // The first entry in "dim" is the outermost dimension used to layout the + // values, the last entry is the innermost dimension. This matches the + // in-memory layout of RowMajor Eigen tensors. + // + // If "dim.size()" > 0, "unknown_rank" must be false. + Dim []*TensorShapeProto_Dim `protobuf:"bytes,2,rep,name=dim,proto3" json:"dim,omitempty"` + // If true, the number of dimensions in the shape is unknown. + // + // If true, "dim.size()" must be 0. + UnknownRank bool `protobuf:"varint,3,opt,name=unknown_rank,json=unknownRank,proto3" json:"unknown_rank,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TensorShapeProto) Reset() { + *x = TensorShapeProto{} + mi := &file_tensorflow_core_framework_tensor_shape_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TensorShapeProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TensorShapeProto) ProtoMessage() {} + +func (x *TensorShapeProto) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_tensor_shape_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TensorShapeProto.ProtoReflect.Descriptor instead. +func (*TensorShapeProto) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_tensor_shape_proto_rawDescGZIP(), []int{0} +} + +func (x *TensorShapeProto) GetDim() []*TensorShapeProto_Dim { + if x != nil { + return x.Dim + } + return nil +} + +func (x *TensorShapeProto) GetUnknownRank() bool { + if x != nil { + return x.UnknownRank + } + return false +} + +// One dimension of the tensor. +type TensorShapeProto_Dim struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Size of the tensor in that dimension. + // This value must be >= -1, but values of -1 are reserved for "unknown" + // shapes (values of -1 mean "unknown" dimension). Certain wrappers + // that work with TensorShapeProto may fail at runtime when deserializing + // a TensorShapeProto containing a dim value of -1. + Size int64 `protobuf:"varint,1,opt,name=size,proto3" json:"size,omitempty"` + // Optional name of the tensor dimension. + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TensorShapeProto_Dim) Reset() { + *x = TensorShapeProto_Dim{} + mi := &file_tensorflow_core_framework_tensor_shape_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TensorShapeProto_Dim) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TensorShapeProto_Dim) ProtoMessage() {} + +func (x *TensorShapeProto_Dim) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_tensor_shape_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TensorShapeProto_Dim.ProtoReflect.Descriptor instead. +func (*TensorShapeProto_Dim) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_tensor_shape_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *TensorShapeProto_Dim) GetSize() int64 { + if x != nil { + return x.Size + } + return 0 +} + +func (x *TensorShapeProto_Dim) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +var File_tensorflow_core_framework_tensor_shape_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_tensor_shape_proto_rawDesc = "" + + "\n" + + ",tensorflow/core/framework/tensor_shape.proto\x12\n" + + "tensorflow\"\x98\x01\n" + + "\x10TensorShapeProto\x122\n" + + "\x03dim\x18\x02 \x03(\v2 .tensorflow.TensorShapeProto.DimR\x03dim\x12!\n" + + "\funknown_rank\x18\x03 \x01(\bR\vunknownRank\x1a-\n" + + "\x03Dim\x12\x12\n" + + "\x04size\x18\x01 \x01(\x03R\x04size\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04nameB\x87\x01\n" + + "\x18org.tensorflow.frameworkB\x11TensorShapeProtosP\x01ZSgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_shape_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_tensor_shape_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_tensor_shape_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_tensor_shape_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_tensor_shape_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_tensor_shape_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_tensor_shape_proto_rawDesc), len(file_tensorflow_core_framework_tensor_shape_proto_rawDesc))) + }) + return file_tensorflow_core_framework_tensor_shape_proto_rawDescData +} + +var file_tensorflow_core_framework_tensor_shape_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_tensorflow_core_framework_tensor_shape_proto_goTypes = []any{ + (*TensorShapeProto)(nil), // 0: tensorflow.TensorShapeProto + (*TensorShapeProto_Dim)(nil), // 1: tensorflow.TensorShapeProto.Dim +} +var file_tensorflow_core_framework_tensor_shape_proto_depIdxs = []int32{ + 1, // 0: tensorflow.TensorShapeProto.dim:type_name -> tensorflow.TensorShapeProto.Dim + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_tensor_shape_proto_init() } +func file_tensorflow_core_framework_tensor_shape_proto_init() { + if File_tensorflow_core_framework_tensor_shape_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_tensor_shape_proto_rawDesc), len(file_tensorflow_core_framework_tensor_shape_proto_rawDesc)), + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_tensor_shape_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_tensor_shape_proto_depIdxs, + MessageInfos: file_tensorflow_core_framework_tensor_shape_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_tensor_shape_proto = out.File + file_tensorflow_core_framework_tensor_shape_proto_goTypes = nil + file_tensorflow_core_framework_tensor_shape_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/framework/tensor_slice_go_proto/tensor_slice.pb.go b/third_party/go-tensorflow/tensorflow/go/core/framework/tensor_slice_go_proto/tensor_slice.pb.go new file mode 100644 index 0000000..a579c51 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/framework/tensor_slice_go_proto/tensor_slice.pb.go @@ -0,0 +1,224 @@ +// Protocol buffer representing slices of a tensor + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/tensor_slice.proto + +package tensor_slice_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Can only be interpreted if you know the corresponding TensorShape. +type TensorSliceProto struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Extent of the slice in all tensor dimensions. + // + // Must have one entry for each of the dimension of the tensor that this + // slice belongs to. The order of sizes is the same as the order of + // dimensions in the TensorShape. + Extent []*TensorSliceProto_Extent `protobuf:"bytes,1,rep,name=extent,proto3" json:"extent,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TensorSliceProto) Reset() { + *x = TensorSliceProto{} + mi := &file_tensorflow_core_framework_tensor_slice_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TensorSliceProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TensorSliceProto) ProtoMessage() {} + +func (x *TensorSliceProto) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_tensor_slice_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TensorSliceProto.ProtoReflect.Descriptor instead. +func (*TensorSliceProto) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_tensor_slice_proto_rawDescGZIP(), []int{0} +} + +func (x *TensorSliceProto) GetExtent() []*TensorSliceProto_Extent { + if x != nil { + return x.Extent + } + return nil +} + +// Extent of the slice in one dimension. +type TensorSliceProto_Extent struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Start index of the slice, starting at 0. + Start int64 `protobuf:"varint,1,opt,name=start,proto3" json:"start,omitempty"` + // Length of the slice: if the length is missing or -1 we will + // interpret this as "everything in this dimension". We use + // "oneof" to preserve information about whether the length is + // present without changing the serialization format from the + // prior proto2 version of this proto. + // + // Types that are valid to be assigned to HasLength: + // + // *TensorSliceProto_Extent_Length + HasLength isTensorSliceProto_Extent_HasLength `protobuf_oneof:"has_length"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TensorSliceProto_Extent) Reset() { + *x = TensorSliceProto_Extent{} + mi := &file_tensorflow_core_framework_tensor_slice_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TensorSliceProto_Extent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TensorSliceProto_Extent) ProtoMessage() {} + +func (x *TensorSliceProto_Extent) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_tensor_slice_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TensorSliceProto_Extent.ProtoReflect.Descriptor instead. +func (*TensorSliceProto_Extent) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_tensor_slice_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *TensorSliceProto_Extent) GetStart() int64 { + if x != nil { + return x.Start + } + return 0 +} + +func (x *TensorSliceProto_Extent) GetHasLength() isTensorSliceProto_Extent_HasLength { + if x != nil { + return x.HasLength + } + return nil +} + +func (x *TensorSliceProto_Extent) GetLength() int64 { + if x != nil { + if x, ok := x.HasLength.(*TensorSliceProto_Extent_Length); ok { + return x.Length + } + } + return 0 +} + +type isTensorSliceProto_Extent_HasLength interface { + isTensorSliceProto_Extent_HasLength() +} + +type TensorSliceProto_Extent_Length struct { + Length int64 `protobuf:"varint,2,opt,name=length,proto3,oneof"` +} + +func (*TensorSliceProto_Extent_Length) isTensorSliceProto_Extent_HasLength() {} + +var File_tensorflow_core_framework_tensor_slice_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_tensor_slice_proto_rawDesc = "" + + "\n" + + ",tensorflow/core/framework/tensor_slice.proto\x12\n" + + "tensorflow\"\x97\x01\n" + + "\x10TensorSliceProto\x12;\n" + + "\x06extent\x18\x01 \x03(\v2#.tensorflow.TensorSliceProto.ExtentR\x06extent\x1aF\n" + + "\x06Extent\x12\x14\n" + + "\x05start\x18\x01 \x01(\x03R\x05start\x12\x18\n" + + "\x06length\x18\x02 \x01(\x03H\x00R\x06lengthB\f\n" + + "\n" + + "has_lengthB\x87\x01\n" + + "\x18org.tensorflow.frameworkB\x11TensorSliceProtosP\x01ZSgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_slice_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_tensor_slice_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_tensor_slice_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_tensor_slice_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_tensor_slice_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_tensor_slice_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_tensor_slice_proto_rawDesc), len(file_tensorflow_core_framework_tensor_slice_proto_rawDesc))) + }) + return file_tensorflow_core_framework_tensor_slice_proto_rawDescData +} + +var file_tensorflow_core_framework_tensor_slice_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_tensorflow_core_framework_tensor_slice_proto_goTypes = []any{ + (*TensorSliceProto)(nil), // 0: tensorflow.TensorSliceProto + (*TensorSliceProto_Extent)(nil), // 1: tensorflow.TensorSliceProto.Extent +} +var file_tensorflow_core_framework_tensor_slice_proto_depIdxs = []int32{ + 1, // 0: tensorflow.TensorSliceProto.extent:type_name -> tensorflow.TensorSliceProto.Extent + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_tensor_slice_proto_init() } +func file_tensorflow_core_framework_tensor_slice_proto_init() { + if File_tensorflow_core_framework_tensor_slice_proto != nil { + return + } + file_tensorflow_core_framework_tensor_slice_proto_msgTypes[1].OneofWrappers = []any{ + (*TensorSliceProto_Extent_Length)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_tensor_slice_proto_rawDesc), len(file_tensorflow_core_framework_tensor_slice_proto_rawDesc)), + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_tensor_slice_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_tensor_slice_proto_depIdxs, + MessageInfos: file_tensorflow_core_framework_tensor_slice_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_tensor_slice_proto = out.File + file_tensorflow_core_framework_tensor_slice_proto_goTypes = nil + file_tensorflow_core_framework_tensor_slice_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/framework/types_go_proto/types.pb.go b/third_party/go-tensorflow/tensorflow/go/core/framework/types_go_proto/types.pb.go new file mode 100644 index 0000000..cbfd2e6 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/framework/types_go_proto/types.pb.go @@ -0,0 +1,376 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/types.proto + +package types_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// (== suppress_warning documentation-presence ==) +// LINT.IfChange +type DataType int32 + +const ( + // Not a legal value for DataType. Used to indicate a DataType field + // has not been set. + DataType_DT_INVALID DataType = 0 + // Data types that all computation devices are expected to be + // capable to support. + DataType_DT_FLOAT DataType = 1 + DataType_DT_DOUBLE DataType = 2 + DataType_DT_INT32 DataType = 3 + DataType_DT_UINT8 DataType = 4 + DataType_DT_INT16 DataType = 5 + DataType_DT_INT8 DataType = 6 + DataType_DT_STRING DataType = 7 + DataType_DT_COMPLEX64 DataType = 8 // Single-precision complex + DataType_DT_INT64 DataType = 9 + DataType_DT_BOOL DataType = 10 + DataType_DT_QINT8 DataType = 11 // Quantized int8 + DataType_DT_QUINT8 DataType = 12 // Quantized uint8 + DataType_DT_QINT32 DataType = 13 // Quantized int32 + DataType_DT_BFLOAT16 DataType = 14 // Float32 truncated to 16 bits. Only for cast ops. + DataType_DT_QINT16 DataType = 15 // Quantized int16 + DataType_DT_QUINT16 DataType = 16 // Quantized uint16 + DataType_DT_UINT16 DataType = 17 + DataType_DT_COMPLEX128 DataType = 18 // Double-precision complex + DataType_DT_HALF DataType = 19 + DataType_DT_RESOURCE DataType = 20 + DataType_DT_VARIANT DataType = 21 // Arbitrary C++ data types + DataType_DT_UINT32 DataType = 22 + DataType_DT_UINT64 DataType = 23 + // Do not use! These are only for parameters. Every enum above + // should have a corresponding value below (verified by types_test). + DataType_DT_FLOAT_REF DataType = 101 + DataType_DT_DOUBLE_REF DataType = 102 + DataType_DT_INT32_REF DataType = 103 + DataType_DT_UINT8_REF DataType = 104 + DataType_DT_INT16_REF DataType = 105 + DataType_DT_INT8_REF DataType = 106 + DataType_DT_STRING_REF DataType = 107 + DataType_DT_COMPLEX64_REF DataType = 108 + DataType_DT_INT64_REF DataType = 109 + DataType_DT_BOOL_REF DataType = 110 + DataType_DT_QINT8_REF DataType = 111 + DataType_DT_QUINT8_REF DataType = 112 + DataType_DT_QINT32_REF DataType = 113 + DataType_DT_BFLOAT16_REF DataType = 114 + DataType_DT_QINT16_REF DataType = 115 + DataType_DT_QUINT16_REF DataType = 116 + DataType_DT_UINT16_REF DataType = 117 + DataType_DT_COMPLEX128_REF DataType = 118 + DataType_DT_HALF_REF DataType = 119 + DataType_DT_RESOURCE_REF DataType = 120 + DataType_DT_VARIANT_REF DataType = 121 + DataType_DT_UINT32_REF DataType = 122 + DataType_DT_UINT64_REF DataType = 123 +) + +// Enum value maps for DataType. +var ( + DataType_name = map[int32]string{ + 0: "DT_INVALID", + 1: "DT_FLOAT", + 2: "DT_DOUBLE", + 3: "DT_INT32", + 4: "DT_UINT8", + 5: "DT_INT16", + 6: "DT_INT8", + 7: "DT_STRING", + 8: "DT_COMPLEX64", + 9: "DT_INT64", + 10: "DT_BOOL", + 11: "DT_QINT8", + 12: "DT_QUINT8", + 13: "DT_QINT32", + 14: "DT_BFLOAT16", + 15: "DT_QINT16", + 16: "DT_QUINT16", + 17: "DT_UINT16", + 18: "DT_COMPLEX128", + 19: "DT_HALF", + 20: "DT_RESOURCE", + 21: "DT_VARIANT", + 22: "DT_UINT32", + 23: "DT_UINT64", + 101: "DT_FLOAT_REF", + 102: "DT_DOUBLE_REF", + 103: "DT_INT32_REF", + 104: "DT_UINT8_REF", + 105: "DT_INT16_REF", + 106: "DT_INT8_REF", + 107: "DT_STRING_REF", + 108: "DT_COMPLEX64_REF", + 109: "DT_INT64_REF", + 110: "DT_BOOL_REF", + 111: "DT_QINT8_REF", + 112: "DT_QUINT8_REF", + 113: "DT_QINT32_REF", + 114: "DT_BFLOAT16_REF", + 115: "DT_QINT16_REF", + 116: "DT_QUINT16_REF", + 117: "DT_UINT16_REF", + 118: "DT_COMPLEX128_REF", + 119: "DT_HALF_REF", + 120: "DT_RESOURCE_REF", + 121: "DT_VARIANT_REF", + 122: "DT_UINT32_REF", + 123: "DT_UINT64_REF", + } + DataType_value = map[string]int32{ + "DT_INVALID": 0, + "DT_FLOAT": 1, + "DT_DOUBLE": 2, + "DT_INT32": 3, + "DT_UINT8": 4, + "DT_INT16": 5, + "DT_INT8": 6, + "DT_STRING": 7, + "DT_COMPLEX64": 8, + "DT_INT64": 9, + "DT_BOOL": 10, + "DT_QINT8": 11, + "DT_QUINT8": 12, + "DT_QINT32": 13, + "DT_BFLOAT16": 14, + "DT_QINT16": 15, + "DT_QUINT16": 16, + "DT_UINT16": 17, + "DT_COMPLEX128": 18, + "DT_HALF": 19, + "DT_RESOURCE": 20, + "DT_VARIANT": 21, + "DT_UINT32": 22, + "DT_UINT64": 23, + "DT_FLOAT_REF": 101, + "DT_DOUBLE_REF": 102, + "DT_INT32_REF": 103, + "DT_UINT8_REF": 104, + "DT_INT16_REF": 105, + "DT_INT8_REF": 106, + "DT_STRING_REF": 107, + "DT_COMPLEX64_REF": 108, + "DT_INT64_REF": 109, + "DT_BOOL_REF": 110, + "DT_QINT8_REF": 111, + "DT_QUINT8_REF": 112, + "DT_QINT32_REF": 113, + "DT_BFLOAT16_REF": 114, + "DT_QINT16_REF": 115, + "DT_QUINT16_REF": 116, + "DT_UINT16_REF": 117, + "DT_COMPLEX128_REF": 118, + "DT_HALF_REF": 119, + "DT_RESOURCE_REF": 120, + "DT_VARIANT_REF": 121, + "DT_UINT32_REF": 122, + "DT_UINT64_REF": 123, + } +) + +func (x DataType) Enum() *DataType { + p := new(DataType) + *p = x + return p +} + +func (x DataType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (DataType) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_framework_types_proto_enumTypes[0].Descriptor() +} + +func (DataType) Type() protoreflect.EnumType { + return &file_tensorflow_core_framework_types_proto_enumTypes[0] +} + +func (x DataType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use DataType.Descriptor instead. +func (DataType) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_framework_types_proto_rawDescGZIP(), []int{0} +} + +// For identifying the underlying type of a variant. For variants, the types +// listed here are a subset of the types in the variant type registry, +// corresponding to commonly used variants which must occasionally be +// special-cased. +type SpecializedType int32 + +const ( + // Invalid/unknown specialized type. + SpecializedType_ST_INVALID SpecializedType = 0 + // "tensorflow::TensorList" in the variant type registry. + SpecializedType_ST_TENSOR_LIST SpecializedType = 1 +) + +// Enum value maps for SpecializedType. +var ( + SpecializedType_name = map[int32]string{ + 0: "ST_INVALID", + 1: "ST_TENSOR_LIST", + } + SpecializedType_value = map[string]int32{ + "ST_INVALID": 0, + "ST_TENSOR_LIST": 1, + } +) + +func (x SpecializedType) Enum() *SpecializedType { + p := new(SpecializedType) + *p = x + return p +} + +func (x SpecializedType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (SpecializedType) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_framework_types_proto_enumTypes[1].Descriptor() +} + +func (SpecializedType) Type() protoreflect.EnumType { + return &file_tensorflow_core_framework_types_proto_enumTypes[1] +} + +func (x SpecializedType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use SpecializedType.Descriptor instead. +func (SpecializedType) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_framework_types_proto_rawDescGZIP(), []int{1} +} + +var File_tensorflow_core_framework_types_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_types_proto_rawDesc = "" + + "\n" + + "%tensorflow/core/framework/types.proto\x12\n" + + "tensorflow*\xaa\x06\n" + + "\bDataType\x12\x0e\n" + + "\n" + + "DT_INVALID\x10\x00\x12\f\n" + + "\bDT_FLOAT\x10\x01\x12\r\n" + + "\tDT_DOUBLE\x10\x02\x12\f\n" + + "\bDT_INT32\x10\x03\x12\f\n" + + "\bDT_UINT8\x10\x04\x12\f\n" + + "\bDT_INT16\x10\x05\x12\v\n" + + "\aDT_INT8\x10\x06\x12\r\n" + + "\tDT_STRING\x10\a\x12\x10\n" + + "\fDT_COMPLEX64\x10\b\x12\f\n" + + "\bDT_INT64\x10\t\x12\v\n" + + "\aDT_BOOL\x10\n" + + "\x12\f\n" + + "\bDT_QINT8\x10\v\x12\r\n" + + "\tDT_QUINT8\x10\f\x12\r\n" + + "\tDT_QINT32\x10\r\x12\x0f\n" + + "\vDT_BFLOAT16\x10\x0e\x12\r\n" + + "\tDT_QINT16\x10\x0f\x12\x0e\n" + + "\n" + + "DT_QUINT16\x10\x10\x12\r\n" + + "\tDT_UINT16\x10\x11\x12\x11\n" + + "\rDT_COMPLEX128\x10\x12\x12\v\n" + + "\aDT_HALF\x10\x13\x12\x0f\n" + + "\vDT_RESOURCE\x10\x14\x12\x0e\n" + + "\n" + + "DT_VARIANT\x10\x15\x12\r\n" + + "\tDT_UINT32\x10\x16\x12\r\n" + + "\tDT_UINT64\x10\x17\x12\x10\n" + + "\fDT_FLOAT_REF\x10e\x12\x11\n" + + "\rDT_DOUBLE_REF\x10f\x12\x10\n" + + "\fDT_INT32_REF\x10g\x12\x10\n" + + "\fDT_UINT8_REF\x10h\x12\x10\n" + + "\fDT_INT16_REF\x10i\x12\x0f\n" + + "\vDT_INT8_REF\x10j\x12\x11\n" + + "\rDT_STRING_REF\x10k\x12\x14\n" + + "\x10DT_COMPLEX64_REF\x10l\x12\x10\n" + + "\fDT_INT64_REF\x10m\x12\x0f\n" + + "\vDT_BOOL_REF\x10n\x12\x10\n" + + "\fDT_QINT8_REF\x10o\x12\x11\n" + + "\rDT_QUINT8_REF\x10p\x12\x11\n" + + "\rDT_QINT32_REF\x10q\x12\x13\n" + + "\x0fDT_BFLOAT16_REF\x10r\x12\x11\n" + + "\rDT_QINT16_REF\x10s\x12\x12\n" + + "\x0eDT_QUINT16_REF\x10t\x12\x11\n" + + "\rDT_UINT16_REF\x10u\x12\x15\n" + + "\x11DT_COMPLEX128_REF\x10v\x12\x0f\n" + + "\vDT_HALF_REF\x10w\x12\x13\n" + + "\x0fDT_RESOURCE_REF\x10x\x12\x12\n" + + "\x0eDT_VARIANT_REF\x10y\x12\x11\n" + + "\rDT_UINT32_REF\x10z\x12\x11\n" + + "\rDT_UINT64_REF\x10{*5\n" + + "\x0fSpecializedType\x12\x0e\n" + + "\n" + + "ST_INVALID\x10\x00\x12\x12\n" + + "\x0eST_TENSOR_LIST\x10\x01Bz\n" + + "\x18org.tensorflow.frameworkB\vTypesProtosP\x01ZLgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/types_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_types_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_types_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_types_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_types_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_types_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_types_proto_rawDesc), len(file_tensorflow_core_framework_types_proto_rawDesc))) + }) + return file_tensorflow_core_framework_types_proto_rawDescData +} + +var file_tensorflow_core_framework_types_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_tensorflow_core_framework_types_proto_goTypes = []any{ + (DataType)(0), // 0: tensorflow.DataType + (SpecializedType)(0), // 1: tensorflow.SpecializedType +} +var file_tensorflow_core_framework_types_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_types_proto_init() } +func file_tensorflow_core_framework_types_proto_init() { + if File_tensorflow_core_framework_types_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_types_proto_rawDesc), len(file_tensorflow_core_framework_types_proto_rawDesc)), + NumEnums: 2, + NumMessages: 0, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_types_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_types_proto_depIdxs, + EnumInfos: file_tensorflow_core_framework_types_proto_enumTypes, + }.Build() + File_tensorflow_core_framework_types_proto = out.File + file_tensorflow_core_framework_types_proto_goTypes = nil + file_tensorflow_core_framework_types_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/framework/variable_go_proto/variable.pb.go b/third_party/go-tensorflow/tensorflow/go/core/framework/variable_go_proto/variable.pb.go new file mode 100644 index 0000000..8aafb07 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/framework/variable_go_proto/variable.pb.go @@ -0,0 +1,428 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/variable.proto + +package variable_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Indicates when a distributed variable will be synced. +type VariableSynchronization int32 + +const ( + // `AUTO`: Indicates that the synchronization will be determined by the + // current `DistributionStrategy` (eg. With `MirroredStrategy` this would be + // `ON_WRITE`). + VariableSynchronization_VARIABLE_SYNCHRONIZATION_AUTO VariableSynchronization = 0 + // `NONE`: Indicates that there will only be one copy of the variable, so + // there is no need to sync. + VariableSynchronization_VARIABLE_SYNCHRONIZATION_NONE VariableSynchronization = 1 + // `ON_WRITE`: Indicates that the variable will be updated across devices + // every time it is written. + VariableSynchronization_VARIABLE_SYNCHRONIZATION_ON_WRITE VariableSynchronization = 2 + // `ON_READ`: Indicates that the variable will be aggregated across devices + // when it is read (eg. when checkpointing or when evaluating an op that uses + // the variable). + VariableSynchronization_VARIABLE_SYNCHRONIZATION_ON_READ VariableSynchronization = 3 +) + +// Enum value maps for VariableSynchronization. +var ( + VariableSynchronization_name = map[int32]string{ + 0: "VARIABLE_SYNCHRONIZATION_AUTO", + 1: "VARIABLE_SYNCHRONIZATION_NONE", + 2: "VARIABLE_SYNCHRONIZATION_ON_WRITE", + 3: "VARIABLE_SYNCHRONIZATION_ON_READ", + } + VariableSynchronization_value = map[string]int32{ + "VARIABLE_SYNCHRONIZATION_AUTO": 0, + "VARIABLE_SYNCHRONIZATION_NONE": 1, + "VARIABLE_SYNCHRONIZATION_ON_WRITE": 2, + "VARIABLE_SYNCHRONIZATION_ON_READ": 3, + } +) + +func (x VariableSynchronization) Enum() *VariableSynchronization { + p := new(VariableSynchronization) + *p = x + return p +} + +func (x VariableSynchronization) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (VariableSynchronization) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_framework_variable_proto_enumTypes[0].Descriptor() +} + +func (VariableSynchronization) Type() protoreflect.EnumType { + return &file_tensorflow_core_framework_variable_proto_enumTypes[0] +} + +func (x VariableSynchronization) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use VariableSynchronization.Descriptor instead. +func (VariableSynchronization) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_framework_variable_proto_rawDescGZIP(), []int{0} +} + +// Indicates how a distributed variable will be aggregated. +type VariableAggregation int32 + +const ( + // `NONE`: This is the default, giving an error if you use a + // variable-update operation with multiple replicas. + VariableAggregation_VARIABLE_AGGREGATION_NONE VariableAggregation = 0 + // `SUM`: Add the updates across replicas. + VariableAggregation_VARIABLE_AGGREGATION_SUM VariableAggregation = 1 + // `MEAN`: Take the arithmetic mean ("average") of the updates across + // replicas. + VariableAggregation_VARIABLE_AGGREGATION_MEAN VariableAggregation = 2 + // `ONLY_FIRST_REPLICA`: This is for when every replica is performing the same + // update, but we only want to perform the update once. Used, e.g., for the + // global step counter. + VariableAggregation_VARIABLE_AGGREGATION_ONLY_FIRST_REPLICA VariableAggregation = 3 +) + +// Enum value maps for VariableAggregation. +var ( + VariableAggregation_name = map[int32]string{ + 0: "VARIABLE_AGGREGATION_NONE", + 1: "VARIABLE_AGGREGATION_SUM", + 2: "VARIABLE_AGGREGATION_MEAN", + 3: "VARIABLE_AGGREGATION_ONLY_FIRST_REPLICA", + } + VariableAggregation_value = map[string]int32{ + "VARIABLE_AGGREGATION_NONE": 0, + "VARIABLE_AGGREGATION_SUM": 1, + "VARIABLE_AGGREGATION_MEAN": 2, + "VARIABLE_AGGREGATION_ONLY_FIRST_REPLICA": 3, + } +) + +func (x VariableAggregation) Enum() *VariableAggregation { + p := new(VariableAggregation) + *p = x + return p +} + +func (x VariableAggregation) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (VariableAggregation) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_framework_variable_proto_enumTypes[1].Descriptor() +} + +func (VariableAggregation) Type() protoreflect.EnumType { + return &file_tensorflow_core_framework_variable_proto_enumTypes[1] +} + +func (x VariableAggregation) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use VariableAggregation.Descriptor instead. +func (VariableAggregation) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_framework_variable_proto_rawDescGZIP(), []int{1} +} + +// Protocol buffer representing a Variable. +type VariableDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Name of the variable tensor. + VariableName string `protobuf:"bytes,1,opt,name=variable_name,json=variableName,proto3" json:"variable_name,omitempty"` + // Name of the tensor holding the variable's initial value. + InitialValueName string `protobuf:"bytes,6,opt,name=initial_value_name,json=initialValueName,proto3" json:"initial_value_name,omitempty"` + // Name of the initializer op. + InitializerName string `protobuf:"bytes,2,opt,name=initializer_name,json=initializerName,proto3" json:"initializer_name,omitempty"` + // Name of the snapshot tensor. + SnapshotName string `protobuf:"bytes,3,opt,name=snapshot_name,json=snapshotName,proto3" json:"snapshot_name,omitempty"` + // Support for saving variables as slices of a larger variable. + SaveSliceInfoDef *SaveSliceInfoDef `protobuf:"bytes,4,opt,name=save_slice_info_def,json=saveSliceInfoDef,proto3" json:"save_slice_info_def,omitempty"` + // Whether to represent this as a ResourceVariable. + IsResource bool `protobuf:"varint,5,opt,name=is_resource,json=isResource,proto3" json:"is_resource,omitempty"` + // Whether this variable should be trained. + Trainable bool `protobuf:"varint,7,opt,name=trainable,proto3" json:"trainable,omitempty"` + // Indicates when a distributed variable will be synced. + Synchronization VariableSynchronization `protobuf:"varint,8,opt,name=synchronization,proto3,enum=tensorflow.VariableSynchronization" json:"synchronization,omitempty"` + // Indicates how a distributed variable will be aggregated. + Aggregation VariableAggregation `protobuf:"varint,9,opt,name=aggregation,proto3,enum=tensorflow.VariableAggregation" json:"aggregation,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *VariableDef) Reset() { + *x = VariableDef{} + mi := &file_tensorflow_core_framework_variable_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *VariableDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VariableDef) ProtoMessage() {} + +func (x *VariableDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_variable_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use VariableDef.ProtoReflect.Descriptor instead. +func (*VariableDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_variable_proto_rawDescGZIP(), []int{0} +} + +func (x *VariableDef) GetVariableName() string { + if x != nil { + return x.VariableName + } + return "" +} + +func (x *VariableDef) GetInitialValueName() string { + if x != nil { + return x.InitialValueName + } + return "" +} + +func (x *VariableDef) GetInitializerName() string { + if x != nil { + return x.InitializerName + } + return "" +} + +func (x *VariableDef) GetSnapshotName() string { + if x != nil { + return x.SnapshotName + } + return "" +} + +func (x *VariableDef) GetSaveSliceInfoDef() *SaveSliceInfoDef { + if x != nil { + return x.SaveSliceInfoDef + } + return nil +} + +func (x *VariableDef) GetIsResource() bool { + if x != nil { + return x.IsResource + } + return false +} + +func (x *VariableDef) GetTrainable() bool { + if x != nil { + return x.Trainable + } + return false +} + +func (x *VariableDef) GetSynchronization() VariableSynchronization { + if x != nil { + return x.Synchronization + } + return VariableSynchronization_VARIABLE_SYNCHRONIZATION_AUTO +} + +func (x *VariableDef) GetAggregation() VariableAggregation { + if x != nil { + return x.Aggregation + } + return VariableAggregation_VARIABLE_AGGREGATION_NONE +} + +type SaveSliceInfoDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Name of the full variable of which this is a slice. + FullName string `protobuf:"bytes,1,opt,name=full_name,json=fullName,proto3" json:"full_name,omitempty"` + // Shape of the full variable. + FullShape []int64 `protobuf:"varint,2,rep,packed,name=full_shape,json=fullShape,proto3" json:"full_shape,omitempty"` + // Offset of this variable into the full variable. + VarOffset []int64 `protobuf:"varint,3,rep,packed,name=var_offset,json=varOffset,proto3" json:"var_offset,omitempty"` + // Shape of this variable. + VarShape []int64 `protobuf:"varint,4,rep,packed,name=var_shape,json=varShape,proto3" json:"var_shape,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SaveSliceInfoDef) Reset() { + *x = SaveSliceInfoDef{} + mi := &file_tensorflow_core_framework_variable_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SaveSliceInfoDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SaveSliceInfoDef) ProtoMessage() {} + +func (x *SaveSliceInfoDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_variable_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SaveSliceInfoDef.ProtoReflect.Descriptor instead. +func (*SaveSliceInfoDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_variable_proto_rawDescGZIP(), []int{1} +} + +func (x *SaveSliceInfoDef) GetFullName() string { + if x != nil { + return x.FullName + } + return "" +} + +func (x *SaveSliceInfoDef) GetFullShape() []int64 { + if x != nil { + return x.FullShape + } + return nil +} + +func (x *SaveSliceInfoDef) GetVarOffset() []int64 { + if x != nil { + return x.VarOffset + } + return nil +} + +func (x *SaveSliceInfoDef) GetVarShape() []int64 { + if x != nil { + return x.VarShape + } + return nil +} + +var File_tensorflow_core_framework_variable_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_variable_proto_rawDesc = "" + + "\n" + + "(tensorflow/core/framework/variable.proto\x12\n" + + "tensorflow\"\xce\x03\n" + + "\vVariableDef\x12#\n" + + "\rvariable_name\x18\x01 \x01(\tR\fvariableName\x12,\n" + + "\x12initial_value_name\x18\x06 \x01(\tR\x10initialValueName\x12)\n" + + "\x10initializer_name\x18\x02 \x01(\tR\x0finitializerName\x12#\n" + + "\rsnapshot_name\x18\x03 \x01(\tR\fsnapshotName\x12K\n" + + "\x13save_slice_info_def\x18\x04 \x01(\v2\x1c.tensorflow.SaveSliceInfoDefR\x10saveSliceInfoDef\x12\x1f\n" + + "\vis_resource\x18\x05 \x01(\bR\n" + + "isResource\x12\x1c\n" + + "\ttrainable\x18\a \x01(\bR\ttrainable\x12M\n" + + "\x0fsynchronization\x18\b \x01(\x0e2#.tensorflow.VariableSynchronizationR\x0fsynchronization\x12A\n" + + "\vaggregation\x18\t \x01(\x0e2\x1f.tensorflow.VariableAggregationR\vaggregation\"\x8a\x01\n" + + "\x10SaveSliceInfoDef\x12\x1b\n" + + "\tfull_name\x18\x01 \x01(\tR\bfullName\x12\x1d\n" + + "\n" + + "full_shape\x18\x02 \x03(\x03R\tfullShape\x12\x1d\n" + + "\n" + + "var_offset\x18\x03 \x03(\x03R\tvarOffset\x12\x1b\n" + + "\tvar_shape\x18\x04 \x03(\x03R\bvarShape*\xac\x01\n" + + "\x17VariableSynchronization\x12!\n" + + "\x1dVARIABLE_SYNCHRONIZATION_AUTO\x10\x00\x12!\n" + + "\x1dVARIABLE_SYNCHRONIZATION_NONE\x10\x01\x12%\n" + + "!VARIABLE_SYNCHRONIZATION_ON_WRITE\x10\x02\x12$\n" + + " VARIABLE_SYNCHRONIZATION_ON_READ\x10\x03*\x9e\x01\n" + + "\x13VariableAggregation\x12\x1d\n" + + "\x19VARIABLE_AGGREGATION_NONE\x10\x00\x12\x1c\n" + + "\x18VARIABLE_AGGREGATION_SUM\x10\x01\x12\x1d\n" + + "\x19VARIABLE_AGGREGATION_MEAN\x10\x02\x12+\n" + + "'VARIABLE_AGGREGATION_ONLY_FIRST_REPLICA\x10\x03B\x80\x01\n" + + "\x18org.tensorflow.frameworkB\x0eVariableProtosP\x01ZOgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/variable_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_variable_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_variable_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_variable_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_variable_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_variable_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_variable_proto_rawDesc), len(file_tensorflow_core_framework_variable_proto_rawDesc))) + }) + return file_tensorflow_core_framework_variable_proto_rawDescData +} + +var file_tensorflow_core_framework_variable_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_tensorflow_core_framework_variable_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_tensorflow_core_framework_variable_proto_goTypes = []any{ + (VariableSynchronization)(0), // 0: tensorflow.VariableSynchronization + (VariableAggregation)(0), // 1: tensorflow.VariableAggregation + (*VariableDef)(nil), // 2: tensorflow.VariableDef + (*SaveSliceInfoDef)(nil), // 3: tensorflow.SaveSliceInfoDef +} +var file_tensorflow_core_framework_variable_proto_depIdxs = []int32{ + 3, // 0: tensorflow.VariableDef.save_slice_info_def:type_name -> tensorflow.SaveSliceInfoDef + 0, // 1: tensorflow.VariableDef.synchronization:type_name -> tensorflow.VariableSynchronization + 1, // 2: tensorflow.VariableDef.aggregation:type_name -> tensorflow.VariableAggregation + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_variable_proto_init() } +func file_tensorflow_core_framework_variable_proto_init() { + if File_tensorflow_core_framework_variable_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_variable_proto_rawDesc), len(file_tensorflow_core_framework_variable_proto_rawDesc)), + NumEnums: 2, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_variable_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_variable_proto_depIdxs, + EnumInfos: file_tensorflow_core_framework_variable_proto_enumTypes, + MessageInfos: file_tensorflow_core_framework_variable_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_variable_proto = out.File + file_tensorflow_core_framework_variable_proto_goTypes = nil + file_tensorflow_core_framework_variable_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/framework/versions_go_proto/versions.pb.go b/third_party/go-tensorflow/tensorflow/go/core/framework/versions_go_proto/versions.pb.go new file mode 100644 index 0000000..b1d4377 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/framework/versions_go_proto/versions.pb.go @@ -0,0 +1,158 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/versions.proto + +package versions_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Version information for a piece of serialized data +// +// There are different types of versions for each type of data +// (GraphDef, etc.), but they all have the same common shape +// described here. +// +// Each consumer has "consumer" and "min_producer" versions (specified +// elsewhere). A consumer is allowed to consume this data if +// +// producer >= min_producer +// consumer >= min_consumer +// consumer not in bad_consumers +type VersionDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The version of the code that produced this data. + Producer int32 `protobuf:"varint,1,opt,name=producer,proto3" json:"producer,omitempty"` + // Any consumer below this version is not allowed to consume this data. + MinConsumer int32 `protobuf:"varint,2,opt,name=min_consumer,json=minConsumer,proto3" json:"min_consumer,omitempty"` + // Specific consumer versions which are disallowed (e.g. due to bugs). + BadConsumers []int32 `protobuf:"varint,3,rep,packed,name=bad_consumers,json=badConsumers,proto3" json:"bad_consumers,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *VersionDef) Reset() { + *x = VersionDef{} + mi := &file_tensorflow_core_framework_versions_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *VersionDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VersionDef) ProtoMessage() {} + +func (x *VersionDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_versions_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use VersionDef.ProtoReflect.Descriptor instead. +func (*VersionDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_versions_proto_rawDescGZIP(), []int{0} +} + +func (x *VersionDef) GetProducer() int32 { + if x != nil { + return x.Producer + } + return 0 +} + +func (x *VersionDef) GetMinConsumer() int32 { + if x != nil { + return x.MinConsumer + } + return 0 +} + +func (x *VersionDef) GetBadConsumers() []int32 { + if x != nil { + return x.BadConsumers + } + return nil +} + +var File_tensorflow_core_framework_versions_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_versions_proto_rawDesc = "" + + "\n" + + "(tensorflow/core/framework/versions.proto\x12\n" + + "tensorflow\"p\n" + + "\n" + + "VersionDef\x12\x1a\n" + + "\bproducer\x18\x01 \x01(\x05R\bproducer\x12!\n" + + "\fmin_consumer\x18\x02 \x01(\x05R\vminConsumer\x12#\n" + + "\rbad_consumers\x18\x03 \x03(\x05R\fbadConsumersB\x80\x01\n" + + "\x18org.tensorflow.frameworkB\x0eVersionsProtosP\x01ZOgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/versions_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_versions_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_versions_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_versions_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_versions_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_versions_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_versions_proto_rawDesc), len(file_tensorflow_core_framework_versions_proto_rawDesc))) + }) + return file_tensorflow_core_framework_versions_proto_rawDescData +} + +var file_tensorflow_core_framework_versions_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_tensorflow_core_framework_versions_proto_goTypes = []any{ + (*VersionDef)(nil), // 0: tensorflow.VersionDef +} +var file_tensorflow_core_framework_versions_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_versions_proto_init() } +func file_tensorflow_core_framework_versions_proto_init() { + if File_tensorflow_core_framework_versions_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_versions_proto_rawDesc), len(file_tensorflow_core_framework_versions_proto_rawDesc)), + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_versions_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_versions_proto_depIdxs, + MessageInfos: file_tensorflow_core_framework_versions_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_versions_proto = out.File + file_tensorflow_core_framework_versions_proto_goTypes = nil + file_tensorflow_core_framework_versions_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/autotuning.pb.go b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/autotuning.pb.go new file mode 100644 index 0000000..afb80c2 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/autotuning.pb.go @@ -0,0 +1,714 @@ +// This file defines protos that store the results of autotuning various +// operations. +// +// They are in proto format because we want to log them structured. They offer +// tremendous statistical, testing, and debugging value. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/autotuning.proto + +package for_core_protos_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + anypb "google.golang.org/protobuf/types/known/anypb" + durationpb "google.golang.org/protobuf/types/known/durationpb" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type AutotuneResult_FailureKind int32 + +const ( + AutotuneResult_UNKNOWN AutotuneResult_FailureKind = 0 + AutotuneResult_REDZONE_MODIFIED AutotuneResult_FailureKind = 1 + AutotuneResult_WRONG_RESULT AutotuneResult_FailureKind = 2 +) + +// Enum value maps for AutotuneResult_FailureKind. +var ( + AutotuneResult_FailureKind_name = map[int32]string{ + 0: "UNKNOWN", + 1: "REDZONE_MODIFIED", + 2: "WRONG_RESULT", + } + AutotuneResult_FailureKind_value = map[string]int32{ + "UNKNOWN": 0, + "REDZONE_MODIFIED": 1, + "WRONG_RESULT": 2, + } +) + +func (x AutotuneResult_FailureKind) Enum() *AutotuneResult_FailureKind { + p := new(AutotuneResult_FailureKind) + *p = x + return p +} + +func (x AutotuneResult_FailureKind) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (AutotuneResult_FailureKind) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_protobuf_autotuning_proto_enumTypes[0].Descriptor() +} + +func (AutotuneResult_FailureKind) Type() protoreflect.EnumType { + return &file_tensorflow_core_protobuf_autotuning_proto_enumTypes[0] +} + +func (x AutotuneResult_FailureKind) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use AutotuneResult_FailureKind.Descriptor instead. +func (AutotuneResult_FailureKind) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_autotuning_proto_rawDescGZIP(), []int{2, 0} +} + +type CudnnVersion struct { + state protoimpl.MessageState `protogen:"open.v1"` + Major int32 `protobuf:"varint,1,opt,name=major,proto3" json:"major,omitempty"` + Minor int32 `protobuf:"varint,2,opt,name=minor,proto3" json:"minor,omitempty"` + Patch int32 `protobuf:"varint,3,opt,name=patch,proto3" json:"patch,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CudnnVersion) Reset() { + *x = CudnnVersion{} + mi := &file_tensorflow_core_protobuf_autotuning_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CudnnVersion) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CudnnVersion) ProtoMessage() {} + +func (x *CudnnVersion) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_autotuning_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CudnnVersion.ProtoReflect.Descriptor instead. +func (*CudnnVersion) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_autotuning_proto_rawDescGZIP(), []int{0} +} + +func (x *CudnnVersion) GetMajor() int32 { + if x != nil { + return x.Major + } + return 0 +} + +func (x *CudnnVersion) GetMinor() int32 { + if x != nil { + return x.Minor + } + return 0 +} + +func (x *CudnnVersion) GetPatch() int32 { + if x != nil { + return x.Patch + } + return 0 +} + +type ComputeCapability struct { + state protoimpl.MessageState `protogen:"open.v1"` + Major int32 `protobuf:"varint,1,opt,name=major,proto3" json:"major,omitempty"` + Minor int32 `protobuf:"varint,2,opt,name=minor,proto3" json:"minor,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ComputeCapability) Reset() { + *x = ComputeCapability{} + mi := &file_tensorflow_core_protobuf_autotuning_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ComputeCapability) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ComputeCapability) ProtoMessage() {} + +func (x *ComputeCapability) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_autotuning_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ComputeCapability.ProtoReflect.Descriptor instead. +func (*ComputeCapability) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_autotuning_proto_rawDescGZIP(), []int{1} +} + +func (x *ComputeCapability) GetMajor() int32 { + if x != nil { + return x.Major + } + return 0 +} + +func (x *ComputeCapability) GetMinor() int32 { + if x != nil { + return x.Minor + } + return 0 +} + +type AutotuneResult struct { + state protoimpl.MessageState `protogen:"open.v1"` + ScratchBytes int64 `protobuf:"varint,8,opt,name=scratch_bytes,json=scratchBytes,proto3" json:"scratch_bytes,omitempty"` + RunTime *durationpb.Duration `protobuf:"bytes,9,opt,name=run_time,json=runTime,proto3" json:"run_time,omitempty"` + Failure *AutotuneResult_FailureResult `protobuf:"bytes,7,opt,name=failure,proto3" json:"failure,omitempty"` + // Types that are valid to be assigned to Key: + // + // *AutotuneResult_Conv + // *AutotuneResult_Gemm + Key isAutotuneResult_Key `protobuf_oneof:"key"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AutotuneResult) Reset() { + *x = AutotuneResult{} + mi := &file_tensorflow_core_protobuf_autotuning_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AutotuneResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AutotuneResult) ProtoMessage() {} + +func (x *AutotuneResult) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_autotuning_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AutotuneResult.ProtoReflect.Descriptor instead. +func (*AutotuneResult) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_autotuning_proto_rawDescGZIP(), []int{2} +} + +func (x *AutotuneResult) GetScratchBytes() int64 { + if x != nil { + return x.ScratchBytes + } + return 0 +} + +func (x *AutotuneResult) GetRunTime() *durationpb.Duration { + if x != nil { + return x.RunTime + } + return nil +} + +func (x *AutotuneResult) GetFailure() *AutotuneResult_FailureResult { + if x != nil { + return x.Failure + } + return nil +} + +func (x *AutotuneResult) GetKey() isAutotuneResult_Key { + if x != nil { + return x.Key + } + return nil +} + +func (x *AutotuneResult) GetConv() *AutotuneResult_ConvKey { + if x != nil { + if x, ok := x.Key.(*AutotuneResult_Conv); ok { + return x.Conv + } + } + return nil +} + +func (x *AutotuneResult) GetGemm() *AutotuneResult_GemmKey { + if x != nil { + if x, ok := x.Key.(*AutotuneResult_Gemm); ok { + return x.Gemm + } + } + return nil +} + +type isAutotuneResult_Key interface { + isAutotuneResult_Key() +} + +type AutotuneResult_Conv struct { + Conv *AutotuneResult_ConvKey `protobuf:"bytes,5,opt,name=conv,proto3,oneof"` +} + +type AutotuneResult_Gemm struct { + Gemm *AutotuneResult_GemmKey `protobuf:"bytes,6,opt,name=gemm,proto3,oneof"` +} + +func (*AutotuneResult_Conv) isAutotuneResult_Key() {} + +func (*AutotuneResult_Gemm) isAutotuneResult_Key() {} + +type AutotuningLog struct { + state protoimpl.MessageState `protogen:"open.v1"` + Instr *anypb.Any `protobuf:"bytes,1,opt,name=instr,proto3" json:"instr,omitempty"` + // Records all auto-tuning results per algorithm. + Results []*AutotuneResult `protobuf:"bytes,2,rep,name=results,proto3" json:"results,omitempty"` + CudnnVersion *CudnnVersion `protobuf:"bytes,3,opt,name=cudnn_version,json=cudnnVersion,proto3" json:"cudnn_version,omitempty"` + ComputeCapability *ComputeCapability `protobuf:"bytes,4,opt,name=compute_capability,json=computeCapability,proto3" json:"compute_capability,omitempty"` + // stream_executor::DeviceDescription::pci_bus_id. + DevicePciBusId string `protobuf:"bytes,5,opt,name=device_pci_bus_id,json=devicePciBusId,proto3" json:"device_pci_bus_id,omitempty"` + BlasVersion string `protobuf:"bytes,6,opt,name=blas_version,json=blasVersion,proto3" json:"blas_version,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AutotuningLog) Reset() { + *x = AutotuningLog{} + mi := &file_tensorflow_core_protobuf_autotuning_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AutotuningLog) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AutotuningLog) ProtoMessage() {} + +func (x *AutotuningLog) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_autotuning_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AutotuningLog.ProtoReflect.Descriptor instead. +func (*AutotuningLog) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_autotuning_proto_rawDescGZIP(), []int{3} +} + +func (x *AutotuningLog) GetInstr() *anypb.Any { + if x != nil { + return x.Instr + } + return nil +} + +func (x *AutotuningLog) GetResults() []*AutotuneResult { + if x != nil { + return x.Results + } + return nil +} + +func (x *AutotuningLog) GetCudnnVersion() *CudnnVersion { + if x != nil { + return x.CudnnVersion + } + return nil +} + +func (x *AutotuningLog) GetComputeCapability() *ComputeCapability { + if x != nil { + return x.ComputeCapability + } + return nil +} + +func (x *AutotuningLog) GetDevicePciBusId() string { + if x != nil { + return x.DevicePciBusId + } + return "" +} + +func (x *AutotuningLog) GetBlasVersion() string { + if x != nil { + return x.BlasVersion + } + return "" +} + +type AutotuneResult_FailureResult struct { + state protoimpl.MessageState `protogen:"open.v1"` + Kind AutotuneResult_FailureKind `protobuf:"varint,1,opt,name=kind,proto3,enum=tensorflow.AutotuneResult_FailureKind" json:"kind,omitempty"` + Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` + // For failure_kind == WRONG_RESULT, this field indicates the reference + // configuration that we compared against. + // + // Note that the reference algorithm isn't always correct. However, + // empirically it's more correct, as it's "algo 0", less fancy than the + // compared one. + // + // Types that are valid to be assigned to Key: + // + // *AutotuneResult_FailureResult_ReferenceConv + // *AutotuneResult_FailureResult_ReferenceGemm + Key isAutotuneResult_FailureResult_Key `protobuf_oneof:"key"` + BufferAddress int64 `protobuf:"varint,13,opt,name=buffer_address,json=bufferAddress,proto3" json:"buffer_address,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AutotuneResult_FailureResult) Reset() { + *x = AutotuneResult_FailureResult{} + mi := &file_tensorflow_core_protobuf_autotuning_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AutotuneResult_FailureResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AutotuneResult_FailureResult) ProtoMessage() {} + +func (x *AutotuneResult_FailureResult) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_autotuning_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AutotuneResult_FailureResult.ProtoReflect.Descriptor instead. +func (*AutotuneResult_FailureResult) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_autotuning_proto_rawDescGZIP(), []int{2, 0} +} + +func (x *AutotuneResult_FailureResult) GetKind() AutotuneResult_FailureKind { + if x != nil { + return x.Kind + } + return AutotuneResult_UNKNOWN +} + +func (x *AutotuneResult_FailureResult) GetMsg() string { + if x != nil { + return x.Msg + } + return "" +} + +func (x *AutotuneResult_FailureResult) GetKey() isAutotuneResult_FailureResult_Key { + if x != nil { + return x.Key + } + return nil +} + +func (x *AutotuneResult_FailureResult) GetReferenceConv() *AutotuneResult_ConvKey { + if x != nil { + if x, ok := x.Key.(*AutotuneResult_FailureResult_ReferenceConv); ok { + return x.ReferenceConv + } + } + return nil +} + +func (x *AutotuneResult_FailureResult) GetReferenceGemm() *AutotuneResult_GemmKey { + if x != nil { + if x, ok := x.Key.(*AutotuneResult_FailureResult_ReferenceGemm); ok { + return x.ReferenceGemm + } + } + return nil +} + +func (x *AutotuneResult_FailureResult) GetBufferAddress() int64 { + if x != nil { + return x.BufferAddress + } + return 0 +} + +type isAutotuneResult_FailureResult_Key interface { + isAutotuneResult_FailureResult_Key() +} + +type AutotuneResult_FailureResult_ReferenceConv struct { + ReferenceConv *AutotuneResult_ConvKey `protobuf:"bytes,11,opt,name=reference_conv,json=referenceConv,proto3,oneof"` +} + +type AutotuneResult_FailureResult_ReferenceGemm struct { + ReferenceGemm *AutotuneResult_GemmKey `protobuf:"bytes,12,opt,name=reference_gemm,json=referenceGemm,proto3,oneof"` +} + +func (*AutotuneResult_FailureResult_ReferenceConv) isAutotuneResult_FailureResult_Key() {} + +func (*AutotuneResult_FailureResult_ReferenceGemm) isAutotuneResult_FailureResult_Key() {} + +type AutotuneResult_ConvKey struct { + state protoimpl.MessageState `protogen:"open.v1"` + Algorithm int64 `protobuf:"varint,1,opt,name=algorithm,proto3" json:"algorithm,omitempty"` + TensorOpsEnabled bool `protobuf:"varint,2,opt,name=tensor_ops_enabled,json=tensorOpsEnabled,proto3" json:"tensor_ops_enabled,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AutotuneResult_ConvKey) Reset() { + *x = AutotuneResult_ConvKey{} + mi := &file_tensorflow_core_protobuf_autotuning_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AutotuneResult_ConvKey) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AutotuneResult_ConvKey) ProtoMessage() {} + +func (x *AutotuneResult_ConvKey) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_autotuning_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AutotuneResult_ConvKey.ProtoReflect.Descriptor instead. +func (*AutotuneResult_ConvKey) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_autotuning_proto_rawDescGZIP(), []int{2, 1} +} + +func (x *AutotuneResult_ConvKey) GetAlgorithm() int64 { + if x != nil { + return x.Algorithm + } + return 0 +} + +func (x *AutotuneResult_ConvKey) GetTensorOpsEnabled() bool { + if x != nil { + return x.TensorOpsEnabled + } + return false +} + +type AutotuneResult_GemmKey struct { + state protoimpl.MessageState `protogen:"open.v1"` + Algorithm int64 `protobuf:"varint,1,opt,name=algorithm,proto3" json:"algorithm,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AutotuneResult_GemmKey) Reset() { + *x = AutotuneResult_GemmKey{} + mi := &file_tensorflow_core_protobuf_autotuning_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AutotuneResult_GemmKey) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AutotuneResult_GemmKey) ProtoMessage() {} + +func (x *AutotuneResult_GemmKey) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_autotuning_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AutotuneResult_GemmKey.ProtoReflect.Descriptor instead. +func (*AutotuneResult_GemmKey) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_autotuning_proto_rawDescGZIP(), []int{2, 2} +} + +func (x *AutotuneResult_GemmKey) GetAlgorithm() int64 { + if x != nil { + return x.Algorithm + } + return 0 +} + +var File_tensorflow_core_protobuf_autotuning_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_autotuning_proto_rawDesc = "" + + "\n" + + ")tensorflow/core/protobuf/autotuning.proto\x12\n" + + "tensorflow\x1a\x19google/protobuf/any.proto\x1a\x1egoogle/protobuf/duration.proto\"P\n" + + "\fCudnnVersion\x12\x14\n" + + "\x05major\x18\x01 \x01(\x05R\x05major\x12\x14\n" + + "\x05minor\x18\x02 \x01(\x05R\x05minor\x12\x14\n" + + "\x05patch\x18\x03 \x01(\x05R\x05patch\"?\n" + + "\x11ComputeCapability\x12\x14\n" + + "\x05major\x18\x01 \x01(\x05R\x05major\x12\x14\n" + + "\x05minor\x18\x02 \x01(\x05R\x05minor\"\x96\x06\n" + + "\x0eAutotuneResult\x12#\n" + + "\rscratch_bytes\x18\b \x01(\x03R\fscratchBytes\x124\n" + + "\brun_time\x18\t \x01(\v2\x19.google.protobuf.DurationR\arunTime\x12B\n" + + "\afailure\x18\a \x01(\v2(.tensorflow.AutotuneResult.FailureResultR\afailure\x128\n" + + "\x04conv\x18\x05 \x01(\v2\".tensorflow.AutotuneResult.ConvKeyH\x00R\x04conv\x128\n" + + "\x04gemm\x18\x06 \x01(\v2\".tensorflow.AutotuneResult.GemmKeyH\x00R\x04gemm\x1a\xa5\x02\n" + + "\rFailureResult\x12:\n" + + "\x04kind\x18\x01 \x01(\x0e2&.tensorflow.AutotuneResult.FailureKindR\x04kind\x12\x10\n" + + "\x03msg\x18\x02 \x01(\tR\x03msg\x12K\n" + + "\x0ereference_conv\x18\v \x01(\v2\".tensorflow.AutotuneResult.ConvKeyH\x00R\rreferenceConv\x12K\n" + + "\x0ereference_gemm\x18\f \x01(\v2\".tensorflow.AutotuneResult.GemmKeyH\x00R\rreferenceGemm\x12%\n" + + "\x0ebuffer_address\x18\r \x01(\x03R\rbufferAddressB\x05\n" + + "\x03key\x1aU\n" + + "\aConvKey\x12\x1c\n" + + "\talgorithm\x18\x01 \x01(\x03R\talgorithm\x12,\n" + + "\x12tensor_ops_enabled\x18\x02 \x01(\bR\x10tensorOpsEnabled\x1a'\n" + + "\aGemmKey\x12\x1c\n" + + "\talgorithm\x18\x01 \x01(\x03R\talgorithm\"B\n" + + "\vFailureKind\x12\v\n" + + "\aUNKNOWN\x10\x00\x12\x14\n" + + "\x10REDZONE_MODIFIED\x10\x01\x12\x10\n" + + "\fWRONG_RESULT\x10\x02B\x05\n" + + "\x03key\"\xcc\x02\n" + + "\rAutotuningLog\x12*\n" + + "\x05instr\x18\x01 \x01(\v2\x14.google.protobuf.AnyR\x05instr\x124\n" + + "\aresults\x18\x02 \x03(\v2\x1a.tensorflow.AutotuneResultR\aresults\x12=\n" + + "\rcudnn_version\x18\x03 \x01(\v2\x18.tensorflow.CudnnVersionR\fcudnnVersion\x12L\n" + + "\x12compute_capability\x18\x04 \x01(\v2\x1d.tensorflow.ComputeCapabilityR\x11computeCapability\x12)\n" + + "\x11device_pci_bus_id\x18\x05 \x01(\tR\x0edevicePciBusId\x12!\n" + + "\fblas_version\x18\x06 \x01(\tR\vblasVersionBWZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_protob\x06proto3" + +var ( + file_tensorflow_core_protobuf_autotuning_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_autotuning_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_autotuning_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_autotuning_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_autotuning_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_autotuning_proto_rawDesc), len(file_tensorflow_core_protobuf_autotuning_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_autotuning_proto_rawDescData +} + +var file_tensorflow_core_protobuf_autotuning_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_tensorflow_core_protobuf_autotuning_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_tensorflow_core_protobuf_autotuning_proto_goTypes = []any{ + (AutotuneResult_FailureKind)(0), // 0: tensorflow.AutotuneResult.FailureKind + (*CudnnVersion)(nil), // 1: tensorflow.CudnnVersion + (*ComputeCapability)(nil), // 2: tensorflow.ComputeCapability + (*AutotuneResult)(nil), // 3: tensorflow.AutotuneResult + (*AutotuningLog)(nil), // 4: tensorflow.AutotuningLog + (*AutotuneResult_FailureResult)(nil), // 5: tensorflow.AutotuneResult.FailureResult + (*AutotuneResult_ConvKey)(nil), // 6: tensorflow.AutotuneResult.ConvKey + (*AutotuneResult_GemmKey)(nil), // 7: tensorflow.AutotuneResult.GemmKey + (*durationpb.Duration)(nil), // 8: google.protobuf.Duration + (*anypb.Any)(nil), // 9: google.protobuf.Any +} +var file_tensorflow_core_protobuf_autotuning_proto_depIdxs = []int32{ + 8, // 0: tensorflow.AutotuneResult.run_time:type_name -> google.protobuf.Duration + 5, // 1: tensorflow.AutotuneResult.failure:type_name -> tensorflow.AutotuneResult.FailureResult + 6, // 2: tensorflow.AutotuneResult.conv:type_name -> tensorflow.AutotuneResult.ConvKey + 7, // 3: tensorflow.AutotuneResult.gemm:type_name -> tensorflow.AutotuneResult.GemmKey + 9, // 4: tensorflow.AutotuningLog.instr:type_name -> google.protobuf.Any + 3, // 5: tensorflow.AutotuningLog.results:type_name -> tensorflow.AutotuneResult + 1, // 6: tensorflow.AutotuningLog.cudnn_version:type_name -> tensorflow.CudnnVersion + 2, // 7: tensorflow.AutotuningLog.compute_capability:type_name -> tensorflow.ComputeCapability + 0, // 8: tensorflow.AutotuneResult.FailureResult.kind:type_name -> tensorflow.AutotuneResult.FailureKind + 6, // 9: tensorflow.AutotuneResult.FailureResult.reference_conv:type_name -> tensorflow.AutotuneResult.ConvKey + 7, // 10: tensorflow.AutotuneResult.FailureResult.reference_gemm:type_name -> tensorflow.AutotuneResult.GemmKey + 11, // [11:11] is the sub-list for method output_type + 11, // [11:11] is the sub-list for method input_type + 11, // [11:11] is the sub-list for extension type_name + 11, // [11:11] is the sub-list for extension extendee + 0, // [0:11] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_autotuning_proto_init() } +func file_tensorflow_core_protobuf_autotuning_proto_init() { + if File_tensorflow_core_protobuf_autotuning_proto != nil { + return + } + file_tensorflow_core_protobuf_autotuning_proto_msgTypes[2].OneofWrappers = []any{ + (*AutotuneResult_Conv)(nil), + (*AutotuneResult_Gemm)(nil), + } + file_tensorflow_core_protobuf_autotuning_proto_msgTypes[4].OneofWrappers = []any{ + (*AutotuneResult_FailureResult_ReferenceConv)(nil), + (*AutotuneResult_FailureResult_ReferenceGemm)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_autotuning_proto_rawDesc), len(file_tensorflow_core_protobuf_autotuning_proto_rawDesc)), + NumEnums: 1, + NumMessages: 7, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_autotuning_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_autotuning_proto_depIdxs, + EnumInfos: file_tensorflow_core_protobuf_autotuning_proto_enumTypes, + MessageInfos: file_tensorflow_core_protobuf_autotuning_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_autotuning_proto = out.File + file_tensorflow_core_protobuf_autotuning_proto_goTypes = nil + file_tensorflow_core_protobuf_autotuning_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/bfc_memory_map.pb.go b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/bfc_memory_map.pb.go new file mode 100644 index 0000000..3bd352f --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/bfc_memory_map.pb.go @@ -0,0 +1,510 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/bfc_memory_map.proto + +package for_core_protos_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Some of the data from AllocatorStats +type MemAllocatorStats struct { + state protoimpl.MessageState `protogen:"open.v1"` + NumAllocs int64 `protobuf:"varint,1,opt,name=num_allocs,json=numAllocs,proto3" json:"num_allocs,omitempty"` + BytesInUse int64 `protobuf:"varint,2,opt,name=bytes_in_use,json=bytesInUse,proto3" json:"bytes_in_use,omitempty"` + PeakBytesInUse int64 `protobuf:"varint,3,opt,name=peak_bytes_in_use,json=peakBytesInUse,proto3" json:"peak_bytes_in_use,omitempty"` + LargestAllocSize int64 `protobuf:"varint,4,opt,name=largest_alloc_size,json=largestAllocSize,proto3" json:"largest_alloc_size,omitempty"` + FragmentationMetric float32 `protobuf:"fixed32,5,opt,name=fragmentation_metric,json=fragmentationMetric,proto3" json:"fragmentation_metric,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MemAllocatorStats) Reset() { + *x = MemAllocatorStats{} + mi := &file_tensorflow_core_protobuf_bfc_memory_map_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MemAllocatorStats) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MemAllocatorStats) ProtoMessage() {} + +func (x *MemAllocatorStats) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_bfc_memory_map_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MemAllocatorStats.ProtoReflect.Descriptor instead. +func (*MemAllocatorStats) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_bfc_memory_map_proto_rawDescGZIP(), []int{0} +} + +func (x *MemAllocatorStats) GetNumAllocs() int64 { + if x != nil { + return x.NumAllocs + } + return 0 +} + +func (x *MemAllocatorStats) GetBytesInUse() int64 { + if x != nil { + return x.BytesInUse + } + return 0 +} + +func (x *MemAllocatorStats) GetPeakBytesInUse() int64 { + if x != nil { + return x.PeakBytesInUse + } + return 0 +} + +func (x *MemAllocatorStats) GetLargestAllocSize() int64 { + if x != nil { + return x.LargestAllocSize + } + return 0 +} + +func (x *MemAllocatorStats) GetFragmentationMetric() float32 { + if x != nil { + return x.FragmentationMetric + } + return 0 +} + +type MemChunk struct { + state protoimpl.MessageState `protogen:"open.v1"` + Address uint64 `protobuf:"varint,1,opt,name=address,proto3" json:"address,omitempty"` + Size int64 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"` + RequestedSize int64 `protobuf:"varint,3,opt,name=requested_size,json=requestedSize,proto3" json:"requested_size,omitempty"` + Bin int32 `protobuf:"varint,4,opt,name=bin,proto3" json:"bin,omitempty"` + OpName string `protobuf:"bytes,5,opt,name=op_name,json=opName,proto3" json:"op_name,omitempty"` + FreedAtCount uint64 `protobuf:"varint,6,opt,name=freed_at_count,json=freedAtCount,proto3" json:"freed_at_count,omitempty"` + ActionCount uint64 `protobuf:"varint,7,opt,name=action_count,json=actionCount,proto3" json:"action_count,omitempty"` + InUse bool `protobuf:"varint,8,opt,name=in_use,json=inUse,proto3" json:"in_use,omitempty"` + StepId uint64 `protobuf:"varint,9,opt,name=step_id,json=stepId,proto3" json:"step_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MemChunk) Reset() { + *x = MemChunk{} + mi := &file_tensorflow_core_protobuf_bfc_memory_map_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MemChunk) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MemChunk) ProtoMessage() {} + +func (x *MemChunk) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_bfc_memory_map_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MemChunk.ProtoReflect.Descriptor instead. +func (*MemChunk) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_bfc_memory_map_proto_rawDescGZIP(), []int{1} +} + +func (x *MemChunk) GetAddress() uint64 { + if x != nil { + return x.Address + } + return 0 +} + +func (x *MemChunk) GetSize() int64 { + if x != nil { + return x.Size + } + return 0 +} + +func (x *MemChunk) GetRequestedSize() int64 { + if x != nil { + return x.RequestedSize + } + return 0 +} + +func (x *MemChunk) GetBin() int32 { + if x != nil { + return x.Bin + } + return 0 +} + +func (x *MemChunk) GetOpName() string { + if x != nil { + return x.OpName + } + return "" +} + +func (x *MemChunk) GetFreedAtCount() uint64 { + if x != nil { + return x.FreedAtCount + } + return 0 +} + +func (x *MemChunk) GetActionCount() uint64 { + if x != nil { + return x.ActionCount + } + return 0 +} + +func (x *MemChunk) GetInUse() bool { + if x != nil { + return x.InUse + } + return false +} + +func (x *MemChunk) GetStepId() uint64 { + if x != nil { + return x.StepId + } + return 0 +} + +type BinSummary struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bin int32 `protobuf:"varint,1,opt,name=bin,proto3" json:"bin,omitempty"` + TotalBytesInUse int64 `protobuf:"varint,2,opt,name=total_bytes_in_use,json=totalBytesInUse,proto3" json:"total_bytes_in_use,omitempty"` + TotalBytesInBin int64 `protobuf:"varint,3,opt,name=total_bytes_in_bin,json=totalBytesInBin,proto3" json:"total_bytes_in_bin,omitempty"` + TotalChunksInUse int64 `protobuf:"varint,4,opt,name=total_chunks_in_use,json=totalChunksInUse,proto3" json:"total_chunks_in_use,omitempty"` + TotalChunksInBin int64 `protobuf:"varint,5,opt,name=total_chunks_in_bin,json=totalChunksInBin,proto3" json:"total_chunks_in_bin,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BinSummary) Reset() { + *x = BinSummary{} + mi := &file_tensorflow_core_protobuf_bfc_memory_map_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BinSummary) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BinSummary) ProtoMessage() {} + +func (x *BinSummary) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_bfc_memory_map_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BinSummary.ProtoReflect.Descriptor instead. +func (*BinSummary) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_bfc_memory_map_proto_rawDescGZIP(), []int{2} +} + +func (x *BinSummary) GetBin() int32 { + if x != nil { + return x.Bin + } + return 0 +} + +func (x *BinSummary) GetTotalBytesInUse() int64 { + if x != nil { + return x.TotalBytesInUse + } + return 0 +} + +func (x *BinSummary) GetTotalBytesInBin() int64 { + if x != nil { + return x.TotalBytesInBin + } + return 0 +} + +func (x *BinSummary) GetTotalChunksInUse() int64 { + if x != nil { + return x.TotalChunksInUse + } + return 0 +} + +func (x *BinSummary) GetTotalChunksInBin() int64 { + if x != nil { + return x.TotalChunksInBin + } + return 0 +} + +type SnapShot struct { + state protoimpl.MessageState `protogen:"open.v1"` + ActionCount uint64 `protobuf:"varint,1,opt,name=action_count,json=actionCount,proto3" json:"action_count,omitempty"` + Size int64 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SnapShot) Reset() { + *x = SnapShot{} + mi := &file_tensorflow_core_protobuf_bfc_memory_map_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SnapShot) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SnapShot) ProtoMessage() {} + +func (x *SnapShot) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_bfc_memory_map_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SnapShot.ProtoReflect.Descriptor instead. +func (*SnapShot) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_bfc_memory_map_proto_rawDescGZIP(), []int{3} +} + +func (x *SnapShot) GetActionCount() uint64 { + if x != nil { + return x.ActionCount + } + return 0 +} + +func (x *SnapShot) GetSize() int64 { + if x != nil { + return x.Size + } + return 0 +} + +type MemoryDump struct { + state protoimpl.MessageState `protogen:"open.v1"` + AllocatorName string `protobuf:"bytes,1,opt,name=allocator_name,json=allocatorName,proto3" json:"allocator_name,omitempty"` + BinSummary []*BinSummary `protobuf:"bytes,2,rep,name=bin_summary,json=binSummary,proto3" json:"bin_summary,omitempty"` + Chunk []*MemChunk `protobuf:"bytes,3,rep,name=chunk,proto3" json:"chunk,omitempty"` + SnapShot []*SnapShot `protobuf:"bytes,4,rep,name=snap_shot,json=snapShot,proto3" json:"snap_shot,omitempty"` + Stats *MemAllocatorStats `protobuf:"bytes,5,opt,name=stats,proto3" json:"stats,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MemoryDump) Reset() { + *x = MemoryDump{} + mi := &file_tensorflow_core_protobuf_bfc_memory_map_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MemoryDump) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MemoryDump) ProtoMessage() {} + +func (x *MemoryDump) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_bfc_memory_map_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MemoryDump.ProtoReflect.Descriptor instead. +func (*MemoryDump) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_bfc_memory_map_proto_rawDescGZIP(), []int{4} +} + +func (x *MemoryDump) GetAllocatorName() string { + if x != nil { + return x.AllocatorName + } + return "" +} + +func (x *MemoryDump) GetBinSummary() []*BinSummary { + if x != nil { + return x.BinSummary + } + return nil +} + +func (x *MemoryDump) GetChunk() []*MemChunk { + if x != nil { + return x.Chunk + } + return nil +} + +func (x *MemoryDump) GetSnapShot() []*SnapShot { + if x != nil { + return x.SnapShot + } + return nil +} + +func (x *MemoryDump) GetStats() *MemAllocatorStats { + if x != nil { + return x.Stats + } + return nil +} + +var File_tensorflow_core_protobuf_bfc_memory_map_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_bfc_memory_map_proto_rawDesc = "" + + "\n" + + "-tensorflow/core/protobuf/bfc_memory_map.proto\x12\n" + + "tensorflow\"\xe0\x01\n" + + "\x11MemAllocatorStats\x12\x1d\n" + + "\n" + + "num_allocs\x18\x01 \x01(\x03R\tnumAllocs\x12 \n" + + "\fbytes_in_use\x18\x02 \x01(\x03R\n" + + "bytesInUse\x12)\n" + + "\x11peak_bytes_in_use\x18\x03 \x01(\x03R\x0epeakBytesInUse\x12,\n" + + "\x12largest_alloc_size\x18\x04 \x01(\x03R\x10largestAllocSize\x121\n" + + "\x14fragmentation_metric\x18\x05 \x01(\x02R\x13fragmentationMetric\"\x83\x02\n" + + "\bMemChunk\x12\x18\n" + + "\aaddress\x18\x01 \x01(\x04R\aaddress\x12\x12\n" + + "\x04size\x18\x02 \x01(\x03R\x04size\x12%\n" + + "\x0erequested_size\x18\x03 \x01(\x03R\rrequestedSize\x12\x10\n" + + "\x03bin\x18\x04 \x01(\x05R\x03bin\x12\x17\n" + + "\aop_name\x18\x05 \x01(\tR\x06opName\x12$\n" + + "\x0efreed_at_count\x18\x06 \x01(\x04R\ffreedAtCount\x12!\n" + + "\faction_count\x18\a \x01(\x04R\vactionCount\x12\x15\n" + + "\x06in_use\x18\b \x01(\bR\x05inUse\x12\x17\n" + + "\astep_id\x18\t \x01(\x04R\x06stepId\"\xd6\x01\n" + + "\n" + + "BinSummary\x12\x10\n" + + "\x03bin\x18\x01 \x01(\x05R\x03bin\x12+\n" + + "\x12total_bytes_in_use\x18\x02 \x01(\x03R\x0ftotalBytesInUse\x12+\n" + + "\x12total_bytes_in_bin\x18\x03 \x01(\x03R\x0ftotalBytesInBin\x12-\n" + + "\x13total_chunks_in_use\x18\x04 \x01(\x03R\x10totalChunksInUse\x12-\n" + + "\x13total_chunks_in_bin\x18\x05 \x01(\x03R\x10totalChunksInBin\"A\n" + + "\bSnapShot\x12!\n" + + "\faction_count\x18\x01 \x01(\x04R\vactionCount\x12\x12\n" + + "\x04size\x18\x02 \x01(\x03R\x04size\"\x80\x02\n" + + "\n" + + "MemoryDump\x12%\n" + + "\x0eallocator_name\x18\x01 \x01(\tR\rallocatorName\x127\n" + + "\vbin_summary\x18\x02 \x03(\v2\x16.tensorflow.BinSummaryR\n" + + "binSummary\x12*\n" + + "\x05chunk\x18\x03 \x03(\v2\x14.tensorflow.MemChunkR\x05chunk\x121\n" + + "\tsnap_shot\x18\x04 \x03(\v2\x14.tensorflow.SnapShotR\bsnapShot\x123\n" + + "\x05stats\x18\x05 \x01(\v2\x1d.tensorflow.MemAllocatorStatsR\x05statsBWZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_protob\x06proto3" + +var ( + file_tensorflow_core_protobuf_bfc_memory_map_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_bfc_memory_map_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_bfc_memory_map_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_bfc_memory_map_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_bfc_memory_map_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_bfc_memory_map_proto_rawDesc), len(file_tensorflow_core_protobuf_bfc_memory_map_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_bfc_memory_map_proto_rawDescData +} + +var file_tensorflow_core_protobuf_bfc_memory_map_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_tensorflow_core_protobuf_bfc_memory_map_proto_goTypes = []any{ + (*MemAllocatorStats)(nil), // 0: tensorflow.MemAllocatorStats + (*MemChunk)(nil), // 1: tensorflow.MemChunk + (*BinSummary)(nil), // 2: tensorflow.BinSummary + (*SnapShot)(nil), // 3: tensorflow.SnapShot + (*MemoryDump)(nil), // 4: tensorflow.MemoryDump +} +var file_tensorflow_core_protobuf_bfc_memory_map_proto_depIdxs = []int32{ + 2, // 0: tensorflow.MemoryDump.bin_summary:type_name -> tensorflow.BinSummary + 1, // 1: tensorflow.MemoryDump.chunk:type_name -> tensorflow.MemChunk + 3, // 2: tensorflow.MemoryDump.snap_shot:type_name -> tensorflow.SnapShot + 0, // 3: tensorflow.MemoryDump.stats:type_name -> tensorflow.MemAllocatorStats + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_bfc_memory_map_proto_init() } +func file_tensorflow_core_protobuf_bfc_memory_map_proto_init() { + if File_tensorflow_core_protobuf_bfc_memory_map_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_bfc_memory_map_proto_rawDesc), len(file_tensorflow_core_protobuf_bfc_memory_map_proto_rawDesc)), + NumEnums: 0, + NumMessages: 5, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_bfc_memory_map_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_bfc_memory_map_proto_depIdxs, + MessageInfos: file_tensorflow_core_protobuf_bfc_memory_map_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_bfc_memory_map_proto = out.File + file_tensorflow_core_protobuf_bfc_memory_map_proto_goTypes = nil + file_tensorflow_core_protobuf_bfc_memory_map_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/cluster.pb.go b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/cluster.pb.go new file mode 100644 index 0000000..827b6cd --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/cluster.pb.go @@ -0,0 +1,212 @@ +// Copyright 2016 The TensorFlow Authors. All Rights Reserved. +// +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +//============================================================================== + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/cluster.proto + +package for_core_protos_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Defines a single job in a TensorFlow cluster. +type JobDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The name of this job. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Mapping from task ID to "hostname:port" string. + // + // If the `name` field contains "worker", and the `tasks` map contains a + // mapping from 7 to "example.org:2222", then the device prefix + // "/job:worker/task:7" will be assigned to "example.org:2222". + Tasks map[int32]string `protobuf:"bytes,2,rep,name=tasks,proto3" json:"tasks,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *JobDef) Reset() { + *x = JobDef{} + mi := &file_tensorflow_core_protobuf_cluster_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *JobDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*JobDef) ProtoMessage() {} + +func (x *JobDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_cluster_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use JobDef.ProtoReflect.Descriptor instead. +func (*JobDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_cluster_proto_rawDescGZIP(), []int{0} +} + +func (x *JobDef) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *JobDef) GetTasks() map[int32]string { + if x != nil { + return x.Tasks + } + return nil +} + +// Defines a TensorFlow cluster as a set of jobs. +type ClusterDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The jobs that comprise the cluster. + Job []*JobDef `protobuf:"bytes,1,rep,name=job,proto3" json:"job,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ClusterDef) Reset() { + *x = ClusterDef{} + mi := &file_tensorflow_core_protobuf_cluster_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ClusterDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ClusterDef) ProtoMessage() {} + +func (x *ClusterDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_cluster_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ClusterDef.ProtoReflect.Descriptor instead. +func (*ClusterDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_cluster_proto_rawDescGZIP(), []int{1} +} + +func (x *ClusterDef) GetJob() []*JobDef { + if x != nil { + return x.Job + } + return nil +} + +var File_tensorflow_core_protobuf_cluster_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_cluster_proto_rawDesc = "" + + "\n" + + "&tensorflow/core/protobuf/cluster.proto\x12\n" + + "tensorflow\"\x8b\x01\n" + + "\x06JobDef\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x123\n" + + "\x05tasks\x18\x02 \x03(\v2\x1d.tensorflow.JobDef.TasksEntryR\x05tasks\x1a8\n" + + "\n" + + "TasksEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\x05R\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"2\n" + + "\n" + + "ClusterDef\x12$\n" + + "\x03job\x18\x01 \x03(\v2\x12.tensorflow.JobDefR\x03jobB\x87\x01\n" + + "\x1aorg.tensorflow.distruntimeB\rClusterProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_cluster_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_cluster_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_cluster_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_cluster_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_cluster_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_cluster_proto_rawDesc), len(file_tensorflow_core_protobuf_cluster_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_cluster_proto_rawDescData +} + +var file_tensorflow_core_protobuf_cluster_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_tensorflow_core_protobuf_cluster_proto_goTypes = []any{ + (*JobDef)(nil), // 0: tensorflow.JobDef + (*ClusterDef)(nil), // 1: tensorflow.ClusterDef + nil, // 2: tensorflow.JobDef.TasksEntry +} +var file_tensorflow_core_protobuf_cluster_proto_depIdxs = []int32{ + 2, // 0: tensorflow.JobDef.tasks:type_name -> tensorflow.JobDef.TasksEntry + 0, // 1: tensorflow.ClusterDef.job:type_name -> tensorflow.JobDef + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_cluster_proto_init() } +func file_tensorflow_core_protobuf_cluster_proto_init() { + if File_tensorflow_core_protobuf_cluster_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_cluster_proto_rawDesc), len(file_tensorflow_core_protobuf_cluster_proto_rawDesc)), + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_cluster_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_cluster_proto_depIdxs, + MessageInfos: file_tensorflow_core_protobuf_cluster_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_cluster_proto = out.File + file_tensorflow_core_protobuf_cluster_proto_goTypes = nil + file_tensorflow_core_protobuf_cluster_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/config.pb.go b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/config.pb.go new file mode 100644 index 0000000..612494a --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/config.pb.go @@ -0,0 +1,2496 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/config.proto + +package for_core_protos_go_proto + +import ( + cost_graph_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/cost_graph_go_proto" + graph_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/graph_go_proto" + step_stats_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/step_stats_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Optimization level +type OptimizerOptions_Level int32 + +const ( + // L1 is the default level. + // Optimization performed at L1 : + // 1. Common subexpression elimination + // 2. Constant folding + OptimizerOptions_L1 OptimizerOptions_Level = 0 + // No optimizations + OptimizerOptions_L0 OptimizerOptions_Level = -1 +) + +// Enum value maps for OptimizerOptions_Level. +var ( + OptimizerOptions_Level_name = map[int32]string{ + 0: "L1", + -1: "L0", + } + OptimizerOptions_Level_value = map[string]int32{ + "L1": 0, + "L0": -1, + } +) + +func (x OptimizerOptions_Level) Enum() *OptimizerOptions_Level { + p := new(OptimizerOptions_Level) + *p = x + return p +} + +func (x OptimizerOptions_Level) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (OptimizerOptions_Level) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_protobuf_config_proto_enumTypes[0].Descriptor() +} + +func (OptimizerOptions_Level) Type() protoreflect.EnumType { + return &file_tensorflow_core_protobuf_config_proto_enumTypes[0] +} + +func (x OptimizerOptions_Level) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use OptimizerOptions_Level.Descriptor instead. +func (OptimizerOptions_Level) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_config_proto_rawDescGZIP(), []int{1, 0} +} + +// Control the use of the compiler/jit. Experimental. +type OptimizerOptions_GlobalJitLevel int32 + +const ( + OptimizerOptions_DEFAULT OptimizerOptions_GlobalJitLevel = 0 // Default setting ("off" now, but later expected to be "on") + OptimizerOptions_OFF OptimizerOptions_GlobalJitLevel = -1 + // The following settings turn on compilation, with higher values being + // more aggressive. Higher values may reduce opportunities for parallelism + // and may use more memory. (At present, there is no distinction, but this + // is expected to change.) + OptimizerOptions_ON_1 OptimizerOptions_GlobalJitLevel = 1 + OptimizerOptions_ON_2 OptimizerOptions_GlobalJitLevel = 2 +) + +// Enum value maps for OptimizerOptions_GlobalJitLevel. +var ( + OptimizerOptions_GlobalJitLevel_name = map[int32]string{ + 0: "DEFAULT", + -1: "OFF", + 1: "ON_1", + 2: "ON_2", + } + OptimizerOptions_GlobalJitLevel_value = map[string]int32{ + "DEFAULT": 0, + "OFF": -1, + "ON_1": 1, + "ON_2": 2, + } +) + +func (x OptimizerOptions_GlobalJitLevel) Enum() *OptimizerOptions_GlobalJitLevel { + p := new(OptimizerOptions_GlobalJitLevel) + *p = x + return p +} + +func (x OptimizerOptions_GlobalJitLevel) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (OptimizerOptions_GlobalJitLevel) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_protobuf_config_proto_enumTypes[1].Descriptor() +} + +func (OptimizerOptions_GlobalJitLevel) Type() protoreflect.EnumType { + return &file_tensorflow_core_protobuf_config_proto_enumTypes[1] +} + +func (x OptimizerOptions_GlobalJitLevel) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use OptimizerOptions_GlobalJitLevel.Descriptor instead. +func (OptimizerOptions_GlobalJitLevel) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_config_proto_rawDescGZIP(), []int{1, 1} +} + +// An enum that describes the state of the MLIR bridge rollout. +type ConfigProto_Experimental_MlirBridgeRollout int32 + +const ( + // If this field is left unspecified, the MLIR bridge may be selectively + // enabled on a per graph basis. + ConfigProto_Experimental_MLIR_BRIDGE_ROLLOUT_UNSPECIFIED ConfigProto_Experimental_MlirBridgeRollout = 0 + // Enabling the MLIR bridge enables it for all graphs in this session. + ConfigProto_Experimental_MLIR_BRIDGE_ROLLOUT_ENABLED ConfigProto_Experimental_MlirBridgeRollout = 1 + // Disabling the MLIR bridge disables it for all graphs in this session. + ConfigProto_Experimental_MLIR_BRIDGE_ROLLOUT_DISABLED ConfigProto_Experimental_MlirBridgeRollout = 2 +) + +// Enum value maps for ConfigProto_Experimental_MlirBridgeRollout. +var ( + ConfigProto_Experimental_MlirBridgeRollout_name = map[int32]string{ + 0: "MLIR_BRIDGE_ROLLOUT_UNSPECIFIED", + 1: "MLIR_BRIDGE_ROLLOUT_ENABLED", + 2: "MLIR_BRIDGE_ROLLOUT_DISABLED", + } + ConfigProto_Experimental_MlirBridgeRollout_value = map[string]int32{ + "MLIR_BRIDGE_ROLLOUT_UNSPECIFIED": 0, + "MLIR_BRIDGE_ROLLOUT_ENABLED": 1, + "MLIR_BRIDGE_ROLLOUT_DISABLED": 2, + } +) + +func (x ConfigProto_Experimental_MlirBridgeRollout) Enum() *ConfigProto_Experimental_MlirBridgeRollout { + p := new(ConfigProto_Experimental_MlirBridgeRollout) + *p = x + return p +} + +func (x ConfigProto_Experimental_MlirBridgeRollout) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ConfigProto_Experimental_MlirBridgeRollout) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_protobuf_config_proto_enumTypes[2].Descriptor() +} + +func (ConfigProto_Experimental_MlirBridgeRollout) Type() protoreflect.EnumType { + return &file_tensorflow_core_protobuf_config_proto_enumTypes[2] +} + +func (x ConfigProto_Experimental_MlirBridgeRollout) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ConfigProto_Experimental_MlirBridgeRollout.Descriptor instead. +func (ConfigProto_Experimental_MlirBridgeRollout) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_config_proto_rawDescGZIP(), []int{6, 1, 0} +} + +// TODO(pbar) Turn this into a TraceOptions proto which allows +// tracing to be controlled in a more orthogonal manner? +type RunOptions_TraceLevel int32 + +const ( + RunOptions_NO_TRACE RunOptions_TraceLevel = 0 + RunOptions_SOFTWARE_TRACE RunOptions_TraceLevel = 1 + RunOptions_HARDWARE_TRACE RunOptions_TraceLevel = 2 + RunOptions_FULL_TRACE RunOptions_TraceLevel = 3 +) + +// Enum value maps for RunOptions_TraceLevel. +var ( + RunOptions_TraceLevel_name = map[int32]string{ + 0: "NO_TRACE", + 1: "SOFTWARE_TRACE", + 2: "HARDWARE_TRACE", + 3: "FULL_TRACE", + } + RunOptions_TraceLevel_value = map[string]int32{ + "NO_TRACE": 0, + "SOFTWARE_TRACE": 1, + "HARDWARE_TRACE": 2, + "FULL_TRACE": 3, + } +) + +func (x RunOptions_TraceLevel) Enum() *RunOptions_TraceLevel { + p := new(RunOptions_TraceLevel) + *p = x + return p +} + +func (x RunOptions_TraceLevel) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (RunOptions_TraceLevel) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_protobuf_config_proto_enumTypes[3].Descriptor() +} + +func (RunOptions_TraceLevel) Type() protoreflect.EnumType { + return &file_tensorflow_core_protobuf_config_proto_enumTypes[3] +} + +func (x RunOptions_TraceLevel) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use RunOptions_TraceLevel.Descriptor instead. +func (RunOptions_TraceLevel) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_config_proto_rawDescGZIP(), []int{7, 0} +} + +type GPUOptions struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Fraction of the available GPU memory to allocate for each process. + // 1 means to allocate all of the GPU memory, 0.5 means the process + // allocates up to ~50% of the available GPU memory. + // + // GPU memory is pre-allocated unless the allow_growth option is enabled. + // + // If greater than 1.0, uses CUDA unified memory to potentially oversubscribe + // the amount of memory available on the GPU device by using host memory as a + // swap space. Accessing memory not available on the device will be + // significantly slower as that would require memory transfer between the host + // and the device. Options to reduce the memory requirement should be + // considered before enabling this option as this may come with a negative + // performance impact. Oversubscription using the unified memory requires + // Pascal class or newer GPUs and it is currently only supported on the Linux + // operating system. See + // https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#um-requirements + // for the detailed requirements. + PerProcessGpuMemoryFraction float64 `protobuf:"fixed64,1,opt,name=per_process_gpu_memory_fraction,json=perProcessGpuMemoryFraction,proto3" json:"per_process_gpu_memory_fraction,omitempty"` + // If true, the allocator does not pre-allocate the entire specified + // GPU memory region, instead starting small and growing as needed. + AllowGrowth bool `protobuf:"varint,4,opt,name=allow_growth,json=allowGrowth,proto3" json:"allow_growth,omitempty"` + // The type of GPU allocation strategy to use. + // + // Allowed values: + // "": The empty string (default) uses a system-chosen default + // + // which may change over time. + // + // "BFC": A "Best-fit with coalescing" algorithm, simplified from a + // + // version of dlmalloc. + AllocatorType string `protobuf:"bytes,2,opt,name=allocator_type,json=allocatorType,proto3" json:"allocator_type,omitempty"` + // Delay deletion of up to this many bytes to reduce the number of + // interactions with gpu driver code. If 0, the system chooses + // a reasonable default (several MBs). + DeferredDeletionBytes int64 `protobuf:"varint,3,opt,name=deferred_deletion_bytes,json=deferredDeletionBytes,proto3" json:"deferred_deletion_bytes,omitempty"` + // A comma-separated list of GPU ids that determines the 'visible' + // to 'virtual' mapping of GPU devices. For example, if TensorFlow + // can see 8 GPU devices in the process, and one wanted to map + // visible GPU devices 5 and 3 as "/device:GPU:0", and "/device:GPU:1", + // then one would specify this field as "5,3". This field is similar in + // spirit to the CUDA_VISIBLE_DEVICES environment variable, except + // it applies to the visible GPU devices in the process. + // + // NOTE: + // 1. The GPU driver provides the process with the visible GPUs + // in an order which is not guaranteed to have any correlation to + // the *physical* GPU id in the machine. This field is used for + // remapping "visible" to "virtual", which means this operates only + // after the process starts. Users are required to use vendor + // specific mechanisms (e.g., CUDA_VISIBLE_DEVICES) to control the + // physical to visible device mapping prior to invoking TensorFlow. + // 2. In the code, the ids in this list are also called "platform GPU id"s, + // and the 'virtual' ids of GPU devices (i.e. the ids in the device + // name "/device:GPU:") are also called "TF GPU id"s. Please + // refer to third_party/tensorflow/core/common_runtime/gpu/gpu_id.h + // for more information. + VisibleDeviceList string `protobuf:"bytes,5,opt,name=visible_device_list,json=visibleDeviceList,proto3" json:"visible_device_list,omitempty"` + // In the event polling loop sleep this many microseconds between + // PollEvents calls, when the queue is not empty. If value is not + // set or set to 0, gets set to a non-zero default. + PollingActiveDelayUsecs int32 `protobuf:"varint,6,opt,name=polling_active_delay_usecs,json=pollingActiveDelayUsecs,proto3" json:"polling_active_delay_usecs,omitempty"` + // This field is deprecated and ignored. + PollingInactiveDelayMsecs int32 `protobuf:"varint,7,opt,name=polling_inactive_delay_msecs,json=pollingInactiveDelayMsecs,proto3" json:"polling_inactive_delay_msecs,omitempty"` + // Force all tensors to be gpu_compatible. On a GPU-enabled TensorFlow, + // enabling this option forces all CPU tensors to be allocated with Cuda + // pinned memory. Normally, TensorFlow will infer which tensors should be + // allocated as the pinned memory. But in case where the inference is + // incomplete, this option can significantly speed up the cross-device memory + // copy performance as long as it fits the memory. + // Note that this option is not something that should be + // enabled by default for unknown or very large models, since all Cuda pinned + // memory is unpageable, having too much pinned memory might negatively impact + // the overall host system performance. + ForceGpuCompatible bool `protobuf:"varint,8,opt,name=force_gpu_compatible,json=forceGpuCompatible,proto3" json:"force_gpu_compatible,omitempty"` + // Everything inside experimental is subject to change and is not subject + // to API stability guarantees in + // https://www.tensorflow.org/guide/version_compat. + Experimental *GPUOptions_Experimental `protobuf:"bytes,9,opt,name=experimental,proto3" json:"experimental,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GPUOptions) Reset() { + *x = GPUOptions{} + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GPUOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GPUOptions) ProtoMessage() {} + +func (x *GPUOptions) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GPUOptions.ProtoReflect.Descriptor instead. +func (*GPUOptions) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_config_proto_rawDescGZIP(), []int{0} +} + +func (x *GPUOptions) GetPerProcessGpuMemoryFraction() float64 { + if x != nil { + return x.PerProcessGpuMemoryFraction + } + return 0 +} + +func (x *GPUOptions) GetAllowGrowth() bool { + if x != nil { + return x.AllowGrowth + } + return false +} + +func (x *GPUOptions) GetAllocatorType() string { + if x != nil { + return x.AllocatorType + } + return "" +} + +func (x *GPUOptions) GetDeferredDeletionBytes() int64 { + if x != nil { + return x.DeferredDeletionBytes + } + return 0 +} + +func (x *GPUOptions) GetVisibleDeviceList() string { + if x != nil { + return x.VisibleDeviceList + } + return "" +} + +func (x *GPUOptions) GetPollingActiveDelayUsecs() int32 { + if x != nil { + return x.PollingActiveDelayUsecs + } + return 0 +} + +func (x *GPUOptions) GetPollingInactiveDelayMsecs() int32 { + if x != nil { + return x.PollingInactiveDelayMsecs + } + return 0 +} + +func (x *GPUOptions) GetForceGpuCompatible() bool { + if x != nil { + return x.ForceGpuCompatible + } + return false +} + +func (x *GPUOptions) GetExperimental() *GPUOptions_Experimental { + if x != nil { + return x.Experimental + } + return nil +} + +// Options passed to the graph optimizer +type OptimizerOptions struct { + state protoimpl.MessageState `protogen:"open.v1"` + // If true, optimize the graph using common subexpression elimination. + DoCommonSubexpressionElimination bool `protobuf:"varint,1,opt,name=do_common_subexpression_elimination,json=doCommonSubexpressionElimination,proto3" json:"do_common_subexpression_elimination,omitempty"` + // If true, perform constant folding optimization on the graph. + DoConstantFolding bool `protobuf:"varint,2,opt,name=do_constant_folding,json=doConstantFolding,proto3" json:"do_constant_folding,omitempty"` + // Constant folding optimization replaces tensors whose values can be + // predetermined, with constant nodes. To avoid inserting too large constants, + // the size of each constant created can be limited. If this value is zero, a + // default limit of 10 MiB will be applied. If constant folding optimization + // is disabled, this value is ignored. + MaxFoldedConstantInBytes int64 `protobuf:"varint,6,opt,name=max_folded_constant_in_bytes,json=maxFoldedConstantInBytes,proto3" json:"max_folded_constant_in_bytes,omitempty"` + // If true, perform function inlining on the graph. + DoFunctionInlining bool `protobuf:"varint,4,opt,name=do_function_inlining,json=doFunctionInlining,proto3" json:"do_function_inlining,omitempty"` + // Overall optimization level. The actual optimizations applied will be the + // logical OR of the flags that this level implies and any flags already set. + OptLevel OptimizerOptions_Level `protobuf:"varint,3,opt,name=opt_level,json=optLevel,proto3,enum=tensorflow.OptimizerOptions_Level" json:"opt_level,omitempty"` + GlobalJitLevel OptimizerOptions_GlobalJitLevel `protobuf:"varint,5,opt,name=global_jit_level,json=globalJitLevel,proto3,enum=tensorflow.OptimizerOptions_GlobalJitLevel" json:"global_jit_level,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *OptimizerOptions) Reset() { + *x = OptimizerOptions{} + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *OptimizerOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OptimizerOptions) ProtoMessage() {} + +func (x *OptimizerOptions) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OptimizerOptions.ProtoReflect.Descriptor instead. +func (*OptimizerOptions) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_config_proto_rawDescGZIP(), []int{1} +} + +func (x *OptimizerOptions) GetDoCommonSubexpressionElimination() bool { + if x != nil { + return x.DoCommonSubexpressionElimination + } + return false +} + +func (x *OptimizerOptions) GetDoConstantFolding() bool { + if x != nil { + return x.DoConstantFolding + } + return false +} + +func (x *OptimizerOptions) GetMaxFoldedConstantInBytes() int64 { + if x != nil { + return x.MaxFoldedConstantInBytes + } + return 0 +} + +func (x *OptimizerOptions) GetDoFunctionInlining() bool { + if x != nil { + return x.DoFunctionInlining + } + return false +} + +func (x *OptimizerOptions) GetOptLevel() OptimizerOptions_Level { + if x != nil { + return x.OptLevel + } + return OptimizerOptions_L1 +} + +func (x *OptimizerOptions) GetGlobalJitLevel() OptimizerOptions_GlobalJitLevel { + if x != nil { + return x.GlobalJitLevel + } + return OptimizerOptions_DEFAULT +} + +type GraphOptions struct { + state protoimpl.MessageState `protogen:"open.v1"` + // If true, use control flow to schedule the activation of Recv nodes. + // (Currently ignored.) + EnableRecvScheduling bool `protobuf:"varint,2,opt,name=enable_recv_scheduling,json=enableRecvScheduling,proto3" json:"enable_recv_scheduling,omitempty"` + // Options controlling how graph is optimized. + OptimizerOptions *OptimizerOptions `protobuf:"bytes,3,opt,name=optimizer_options,json=optimizerOptions,proto3" json:"optimizer_options,omitempty"` + // The number of steps to run before returning a cost model detailing + // the memory usage and performance of each node of the graph. 0 means + // no cost model. + BuildCostModel int64 `protobuf:"varint,4,opt,name=build_cost_model,json=buildCostModel,proto3" json:"build_cost_model,omitempty"` + // The number of steps to skip before collecting statistics for the + // cost model. + BuildCostModelAfter int64 `protobuf:"varint,9,opt,name=build_cost_model_after,json=buildCostModelAfter,proto3" json:"build_cost_model_after,omitempty"` + // Annotate each Node with Op output shape data, to the extent it can + // be statically inferred. + InferShapes bool `protobuf:"varint,5,opt,name=infer_shapes,json=inferShapes,proto3" json:"infer_shapes,omitempty"` + // Only place the subgraphs that are run, rather than the entire graph. + // + // This is useful for interactive graph building, where one might + // produce graphs that cannot be placed during the debugging + // process. In particular, it allows the client to continue work in + // a session after adding a node to a graph whose placement + // constraints are unsatisfiable. + PlacePrunedGraph bool `protobuf:"varint,6,opt,name=place_pruned_graph,json=placePrunedGraph,proto3" json:"place_pruned_graph,omitempty"` + // If true, transfer float values between processes as bfloat16. + EnableBfloat16Sendrecv bool `protobuf:"varint,7,opt,name=enable_bfloat16_sendrecv,json=enableBfloat16Sendrecv,proto3" json:"enable_bfloat16_sendrecv,omitempty"` + // If > 0, record a timeline every this many steps. + // EXPERIMENTAL: This currently has no effect in MasterSession. + TimelineStep int32 `protobuf:"varint,8,opt,name=timeline_step,json=timelineStep,proto3" json:"timeline_step,omitempty"` + // Options that control the type and amount of graph rewriting. + // Not currently configurable via the public Python API (i.e. there is no API + // stability guarantee if you import RewriterConfig explicitly). + RewriteOptions *RewriterConfig `protobuf:"bytes,10,opt,name=rewrite_options,json=rewriteOptions,proto3" json:"rewrite_options,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GraphOptions) Reset() { + *x = GraphOptions{} + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GraphOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GraphOptions) ProtoMessage() {} + +func (x *GraphOptions) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GraphOptions.ProtoReflect.Descriptor instead. +func (*GraphOptions) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_config_proto_rawDescGZIP(), []int{2} +} + +func (x *GraphOptions) GetEnableRecvScheduling() bool { + if x != nil { + return x.EnableRecvScheduling + } + return false +} + +func (x *GraphOptions) GetOptimizerOptions() *OptimizerOptions { + if x != nil { + return x.OptimizerOptions + } + return nil +} + +func (x *GraphOptions) GetBuildCostModel() int64 { + if x != nil { + return x.BuildCostModel + } + return 0 +} + +func (x *GraphOptions) GetBuildCostModelAfter() int64 { + if x != nil { + return x.BuildCostModelAfter + } + return 0 +} + +func (x *GraphOptions) GetInferShapes() bool { + if x != nil { + return x.InferShapes + } + return false +} + +func (x *GraphOptions) GetPlacePrunedGraph() bool { + if x != nil { + return x.PlacePrunedGraph + } + return false +} + +func (x *GraphOptions) GetEnableBfloat16Sendrecv() bool { + if x != nil { + return x.EnableBfloat16Sendrecv + } + return false +} + +func (x *GraphOptions) GetTimelineStep() int32 { + if x != nil { + return x.TimelineStep + } + return 0 +} + +func (x *GraphOptions) GetRewriteOptions() *RewriterConfig { + if x != nil { + return x.RewriteOptions + } + return nil +} + +type ThreadPoolOptionProto struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The number of threads in the pool. + // + // 0 means the system picks a value based on where this option proto is used + // (see the declaration of the specific field for more info). + NumThreads int32 `protobuf:"varint,1,opt,name=num_threads,json=numThreads,proto3" json:"num_threads,omitempty"` + // The global name of the threadpool. + // + // If empty, then the threadpool is made and used according to the scope it's + // in - e.g., for a session threadpool, it is used by that session only. + // + // If non-empty, then: + // - a global threadpool associated with this name is looked + // up or created. This allows, for example, sharing one threadpool across + // many sessions (e.g., like the default behavior, if + // inter_op_parallelism_threads is not configured), but still partitioning + // into a large and small pool. + // - if the threadpool for this global_name already exists, then it is an + // error if the existing pool was created using a different num_threads + // value as is specified on this call. + // - threadpools created this way are never garbage collected. + GlobalName string `protobuf:"bytes,2,opt,name=global_name,json=globalName,proto3" json:"global_name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ThreadPoolOptionProto) Reset() { + *x = ThreadPoolOptionProto{} + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ThreadPoolOptionProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ThreadPoolOptionProto) ProtoMessage() {} + +func (x *ThreadPoolOptionProto) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ThreadPoolOptionProto.ProtoReflect.Descriptor instead. +func (*ThreadPoolOptionProto) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_config_proto_rawDescGZIP(), []int{3} +} + +func (x *ThreadPoolOptionProto) GetNumThreads() int32 { + if x != nil { + return x.NumThreads + } + return 0 +} + +func (x *ThreadPoolOptionProto) GetGlobalName() string { + if x != nil { + return x.GlobalName + } + return "" +} + +type RPCOptions struct { + state protoimpl.MessageState `protogen:"open.v1"` + // If true, always use RPC to contact the session target. + // + // If false (the default option), TensorFlow may use an optimized + // transport for client-master communication that avoids the RPC + // stack. This option is primarily for used testing the RPC stack. + UseRpcForInprocessMaster bool `protobuf:"varint,1,opt,name=use_rpc_for_inprocess_master,json=useRpcForInprocessMaster,proto3" json:"use_rpc_for_inprocess_master,omitempty"` + // The compression algorithm to be used. One of "deflate", "gzip". + CompressionAlgorithm string `protobuf:"bytes,2,opt,name=compression_algorithm,json=compressionAlgorithm,proto3" json:"compression_algorithm,omitempty"` + // If compression_algorithm is set, the compression level to be used. + // From 0 (no compression), up to 3. + CompressionLevel int32 `protobuf:"varint,3,opt,name=compression_level,json=compressionLevel,proto3" json:"compression_level,omitempty"` + // Setting cache_rpc_response to true will enable sender side caching of + // response for RecvTensorAsync and RecvBufAsync to allow receiver to retry + // requests . This is only necessary when the network fabric is experiencing a + // significant error rate. Without it we'll fail a step on an network error, + // while with it we'll be able to complete long steps (like complex + // initializations) in the face of some network errors during RecvTensor. + CacheRpcResponse bool `protobuf:"varint,4,opt,name=cache_rpc_response,json=cacheRpcResponse,proto3" json:"cache_rpc_response,omitempty"` + // Disables TCP connection sharing when opening a new RPC channel. + DisableSessionConnectionSharing bool `protobuf:"varint,5,opt,name=disable_session_connection_sharing,json=disableSessionConnectionSharing,proto3" json:"disable_session_connection_sharing,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RPCOptions) Reset() { + *x = RPCOptions{} + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RPCOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RPCOptions) ProtoMessage() {} + +func (x *RPCOptions) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RPCOptions.ProtoReflect.Descriptor instead. +func (*RPCOptions) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_config_proto_rawDescGZIP(), []int{4} +} + +func (x *RPCOptions) GetUseRpcForInprocessMaster() bool { + if x != nil { + return x.UseRpcForInprocessMaster + } + return false +} + +func (x *RPCOptions) GetCompressionAlgorithm() string { + if x != nil { + return x.CompressionAlgorithm + } + return "" +} + +func (x *RPCOptions) GetCompressionLevel() int32 { + if x != nil { + return x.CompressionLevel + } + return 0 +} + +func (x *RPCOptions) GetCacheRpcResponse() bool { + if x != nil { + return x.CacheRpcResponse + } + return false +} + +func (x *RPCOptions) GetDisableSessionConnectionSharing() bool { + if x != nil { + return x.DisableSessionConnectionSharing + } + return false +} + +// 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. +type SessionMetadata struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // The version is optional. If set, needs to be >= 0. + Version int64 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SessionMetadata) Reset() { + *x = SessionMetadata{} + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SessionMetadata) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SessionMetadata) ProtoMessage() {} + +func (x *SessionMetadata) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SessionMetadata.ProtoReflect.Descriptor instead. +func (*SessionMetadata) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_config_proto_rawDescGZIP(), []int{5} +} + +func (x *SessionMetadata) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *SessionMetadata) GetVersion() int64 { + if x != nil { + return x.Version + } + return 0 +} + +// Session configuration parameters. +// The system picks appropriate values for fields that are not set. +type ConfigProto struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Map from device type name (e.g., "CPU" or "GPU" ) to maximum + // number of devices of that type to use. If a particular device + // type is not found in the map, the system picks an appropriate + // number. + DeviceCount map[string]int32 `protobuf:"bytes,1,rep,name=device_count,json=deviceCount,proto3" json:"device_count,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"` + // The execution of an individual op (for some op types) can be + // parallelized on a pool of intra_op_parallelism_threads. + // 0 means the system picks an appropriate number. + // + // If you create an ordinary session, e.g., from Python or C++, + // then there is exactly one intra op thread pool per process. + // The first session created determines the number of threads in this pool. + // All subsequent sessions reuse/share this one global pool. + // + // There are notable exceptions to the default behavior describe above: + // 1. There is an environment variable for overriding this thread pool, + // named TF_OVERRIDE_GLOBAL_THREADPOOL. + // 2. When connecting to a server, such as a remote `tf.train.Server` + // instance, then this option will be ignored altogether. + IntraOpParallelismThreads int32 `protobuf:"varint,2,opt,name=intra_op_parallelism_threads,json=intraOpParallelismThreads,proto3" json:"intra_op_parallelism_threads,omitempty"` + // Nodes that perform blocking operations are enqueued on a pool of + // inter_op_parallelism_threads available in each process. + // + // 0 means the system picks an appropriate number. + // Negative means all operations are performed in caller's thread. + // + // Note that the first Session created in the process sets the + // number of threads for all future sessions unless use_per_session_threads is + // true or session_inter_op_thread_pool is configured. + InterOpParallelismThreads int32 `protobuf:"varint,5,opt,name=inter_op_parallelism_threads,json=interOpParallelismThreads,proto3" json:"inter_op_parallelism_threads,omitempty"` + // If true, use a new set of threads for this session rather than the global + // pool of threads. Only supported by direct sessions. + // + // If false, use the global threads created by the first session, or the + // per-session thread pools configured by session_inter_op_thread_pool. + // + // This option is deprecated. The same effect can be achieved by setting + // session_inter_op_thread_pool to have one element, whose num_threads equals + // inter_op_parallelism_threads. + UsePerSessionThreads bool `protobuf:"varint,9,opt,name=use_per_session_threads,json=usePerSessionThreads,proto3" json:"use_per_session_threads,omitempty"` + // This option is experimental - it may be replaced with a different mechanism + // in the future. + // + // Configures session thread pools. If this is configured, then RunOptions for + // a Run call can select the thread pool to use. + // + // The intended use is for when some session invocations need to run in a + // background pool limited to a small number of threads: + // - For example, a session may be configured to have one large pool (for + // regular compute) and one small pool (for periodic, low priority work); + // using the small pool is currently the mechanism for limiting the inter-op + // parallelism of the low priority work. Note that it does not limit the + // parallelism of work spawned by a single op kernel implementation. + // - Using this setting is normally not needed in training, but may help some + // serving use cases. + // - It is also generally recommended to set the global_name field of this + // proto, to avoid creating multiple large pools. It is typically better to + // run the non-low-priority work, even across sessions, in a single large + // pool. + SessionInterOpThreadPool []*ThreadPoolOptionProto `protobuf:"bytes,12,rep,name=session_inter_op_thread_pool,json=sessionInterOpThreadPool,proto3" json:"session_inter_op_thread_pool,omitempty"` + // Assignment of Nodes to Devices is recomputed every placement_period + // steps until the system warms up (at which point the recomputation + // typically slows down automatically). + PlacementPeriod int32 `protobuf:"varint,3,opt,name=placement_period,json=placementPeriod,proto3" json:"placement_period,omitempty"` + // When any filters are present sessions will ignore all devices which do not + // match the filters. Each filter can be partially specified, e.g. "/job:ps" + // "/job:worker/replica:3", etc. + DeviceFilters []string `protobuf:"bytes,4,rep,name=device_filters,json=deviceFilters,proto3" json:"device_filters,omitempty"` + // Options that apply to all GPUs. + GpuOptions *GPUOptions `protobuf:"bytes,6,opt,name=gpu_options,json=gpuOptions,proto3" json:"gpu_options,omitempty"` + // Whether soft placement is allowed. If allow_soft_placement is true, + // an op will be placed on CPU if + // 1. there's no GPU implementation for the OP + // + // or + // 2. no GPU devices are known or registered + // + // or + // 3. need to co-locate with reftype input(s) which are from CPU. + AllowSoftPlacement bool `protobuf:"varint,7,opt,name=allow_soft_placement,json=allowSoftPlacement,proto3" json:"allow_soft_placement,omitempty"` + // Whether device placements should be logged. + LogDevicePlacement bool `protobuf:"varint,8,opt,name=log_device_placement,json=logDevicePlacement,proto3" json:"log_device_placement,omitempty"` + // Options that apply to all graphs. + GraphOptions *GraphOptions `protobuf:"bytes,10,opt,name=graph_options,json=graphOptions,proto3" json:"graph_options,omitempty"` + // Global timeout for all blocking operations in this session. If non-zero, + // and not overridden on a per-operation basis, this value will be used as the + // deadline for all blocking operations. + OperationTimeoutInMs int64 `protobuf:"varint,11,opt,name=operation_timeout_in_ms,json=operationTimeoutInMs,proto3" json:"operation_timeout_in_ms,omitempty"` + // Options that apply when this session uses the distributed runtime. + RpcOptions *RPCOptions `protobuf:"bytes,13,opt,name=rpc_options,json=rpcOptions,proto3" json:"rpc_options,omitempty"` + // Optional list of all workers to use in this session. + ClusterDef *ClusterDef `protobuf:"bytes,14,opt,name=cluster_def,json=clusterDef,proto3" json:"cluster_def,omitempty"` + // If true, any resources such as Variables used in the session will not be + // shared with other sessions. However, when clusterspec propagation is + // enabled, this field is ignored and sessions are always isolated. + IsolateSessionState bool `protobuf:"varint,15,opt,name=isolate_session_state,json=isolateSessionState,proto3" json:"isolate_session_state,omitempty"` + // When true, WorkerSessions are created with device attributes from the + // full cluster. + // This is helpful when a worker wants to partition a graph + // (for example during a PartitionedCallOp). + ShareClusterDevicesInSession bool `protobuf:"varint,17,opt,name=share_cluster_devices_in_session,json=shareClusterDevicesInSession,proto3" json:"share_cluster_devices_in_session,omitempty"` + Experimental *ConfigProto_Experimental `protobuf:"bytes,16,opt,name=experimental,proto3" json:"experimental,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ConfigProto) Reset() { + *x = ConfigProto{} + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ConfigProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConfigProto) ProtoMessage() {} + +func (x *ConfigProto) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConfigProto.ProtoReflect.Descriptor instead. +func (*ConfigProto) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_config_proto_rawDescGZIP(), []int{6} +} + +func (x *ConfigProto) GetDeviceCount() map[string]int32 { + if x != nil { + return x.DeviceCount + } + return nil +} + +func (x *ConfigProto) GetIntraOpParallelismThreads() int32 { + if x != nil { + return x.IntraOpParallelismThreads + } + return 0 +} + +func (x *ConfigProto) GetInterOpParallelismThreads() int32 { + if x != nil { + return x.InterOpParallelismThreads + } + return 0 +} + +func (x *ConfigProto) GetUsePerSessionThreads() bool { + if x != nil { + return x.UsePerSessionThreads + } + return false +} + +func (x *ConfigProto) GetSessionInterOpThreadPool() []*ThreadPoolOptionProto { + if x != nil { + return x.SessionInterOpThreadPool + } + return nil +} + +func (x *ConfigProto) GetPlacementPeriod() int32 { + if x != nil { + return x.PlacementPeriod + } + return 0 +} + +func (x *ConfigProto) GetDeviceFilters() []string { + if x != nil { + return x.DeviceFilters + } + return nil +} + +func (x *ConfigProto) GetGpuOptions() *GPUOptions { + if x != nil { + return x.GpuOptions + } + return nil +} + +func (x *ConfigProto) GetAllowSoftPlacement() bool { + if x != nil { + return x.AllowSoftPlacement + } + return false +} + +func (x *ConfigProto) GetLogDevicePlacement() bool { + if x != nil { + return x.LogDevicePlacement + } + return false +} + +func (x *ConfigProto) GetGraphOptions() *GraphOptions { + if x != nil { + return x.GraphOptions + } + return nil +} + +func (x *ConfigProto) GetOperationTimeoutInMs() int64 { + if x != nil { + return x.OperationTimeoutInMs + } + return 0 +} + +func (x *ConfigProto) GetRpcOptions() *RPCOptions { + if x != nil { + return x.RpcOptions + } + return nil +} + +func (x *ConfigProto) GetClusterDef() *ClusterDef { + if x != nil { + return x.ClusterDef + } + return nil +} + +func (x *ConfigProto) GetIsolateSessionState() bool { + if x != nil { + return x.IsolateSessionState + } + return false +} + +func (x *ConfigProto) GetShareClusterDevicesInSession() bool { + if x != nil { + return x.ShareClusterDevicesInSession + } + return false +} + +func (x *ConfigProto) GetExperimental() *ConfigProto_Experimental { + if x != nil { + return x.Experimental + } + return nil +} + +// Options for a single Run() call. +type RunOptions struct { + state protoimpl.MessageState `protogen:"open.v1"` + TraceLevel RunOptions_TraceLevel `protobuf:"varint,1,opt,name=trace_level,json=traceLevel,proto3,enum=tensorflow.RunOptions_TraceLevel" json:"trace_level,omitempty"` + // Time to wait for operation to complete in milliseconds. + TimeoutInMs int64 `protobuf:"varint,2,opt,name=timeout_in_ms,json=timeoutInMs,proto3" json:"timeout_in_ms,omitempty"` + // The thread pool to use, if session_inter_op_thread_pool is configured. + // To use the caller thread set this to -1 - this uses the caller thread + // to execute Session::Run() and thus avoids a context switch. Using the + // caller thread to execute Session::Run() should be done ONLY for simple + // graphs, where the overhead of an additional context switch is + // comparable with the overhead of Session::Run(). + InterOpThreadPool int32 `protobuf:"varint,3,opt,name=inter_op_thread_pool,json=interOpThreadPool,proto3" json:"inter_op_thread_pool,omitempty"` + // Whether the partition graph(s) executed by the executor(s) should be + // outputted via RunMetadata. + OutputPartitionGraphs bool `protobuf:"varint,5,opt,name=output_partition_graphs,json=outputPartitionGraphs,proto3" json:"output_partition_graphs,omitempty"` + // EXPERIMENTAL. Options used to initialize DebuggerState, if enabled. + DebugOptions *DebugOptions `protobuf:"bytes,6,opt,name=debug_options,json=debugOptions,proto3" json:"debug_options,omitempty"` + // When enabled, causes tensor allocation information to be included in + // the error message when the Run() call fails because the allocator ran + // out of memory (OOM). + // + // Enabling this option can slow down the Run() call. + ReportTensorAllocationsUponOom bool `protobuf:"varint,7,opt,name=report_tensor_allocations_upon_oom,json=reportTensorAllocationsUponOom,proto3" json:"report_tensor_allocations_upon_oom,omitempty"` + Experimental *RunOptions_Experimental `protobuf:"bytes,8,opt,name=experimental,proto3" json:"experimental,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RunOptions) Reset() { + *x = RunOptions{} + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RunOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RunOptions) ProtoMessage() {} + +func (x *RunOptions) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RunOptions.ProtoReflect.Descriptor instead. +func (*RunOptions) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_config_proto_rawDescGZIP(), []int{7} +} + +func (x *RunOptions) GetTraceLevel() RunOptions_TraceLevel { + if x != nil { + return x.TraceLevel + } + return RunOptions_NO_TRACE +} + +func (x *RunOptions) GetTimeoutInMs() int64 { + if x != nil { + return x.TimeoutInMs + } + return 0 +} + +func (x *RunOptions) GetInterOpThreadPool() int32 { + if x != nil { + return x.InterOpThreadPool + } + return 0 +} + +func (x *RunOptions) GetOutputPartitionGraphs() bool { + if x != nil { + return x.OutputPartitionGraphs + } + return false +} + +func (x *RunOptions) GetDebugOptions() *DebugOptions { + if x != nil { + return x.DebugOptions + } + return nil +} + +func (x *RunOptions) GetReportTensorAllocationsUponOom() bool { + if x != nil { + return x.ReportTensorAllocationsUponOom + } + return false +} + +func (x *RunOptions) GetExperimental() *RunOptions_Experimental { + if x != nil { + return x.Experimental + } + return nil +} + +// Metadata output (i.e., non-Tensor) for a single Run() call. +type RunMetadata struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Statistics traced for this step. Populated if tracing is turned on via the + // "RunOptions" proto. + // EXPERIMENTAL: The format and set of events may change in future versions. + StepStats *step_stats_go_proto.StepStats `protobuf:"bytes,1,opt,name=step_stats,json=stepStats,proto3" json:"step_stats,omitempty"` + // The cost graph for the computation defined by the run call. + CostGraph *cost_graph_go_proto.CostGraphDef `protobuf:"bytes,2,opt,name=cost_graph,json=costGraph,proto3" json:"cost_graph,omitempty"` + // Graphs of the partitions executed by executors. + PartitionGraphs []*graph_go_proto.GraphDef `protobuf:"bytes,3,rep,name=partition_graphs,json=partitionGraphs,proto3" json:"partition_graphs,omitempty"` + // This is only populated for graphs that are run as functions in TensorFlow + // V2. There will be an entry below for each function that is traced. + // The main use cases of the post_optimization_graph and the partition_graphs + // is to give the caller insight into the graphs that were actually run by the + // runtime. Additional information (such as those in step_stats) will match + // these graphs. + // We also include the pre_optimization_graph since it is usually easier to + // read, and is helpful in situations where the caller wants to get a high + // level idea of what the built graph looks like (since the various graph + // optimization passes might change the structure of the graph significantly). + FunctionGraphs []*RunMetadata_FunctionGraphs `protobuf:"bytes,4,rep,name=function_graphs,json=functionGraphs,proto3" json:"function_graphs,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RunMetadata) Reset() { + *x = RunMetadata{} + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RunMetadata) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RunMetadata) ProtoMessage() {} + +func (x *RunMetadata) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RunMetadata.ProtoReflect.Descriptor instead. +func (*RunMetadata) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_config_proto_rawDescGZIP(), []int{8} +} + +func (x *RunMetadata) GetStepStats() *step_stats_go_proto.StepStats { + if x != nil { + return x.StepStats + } + return nil +} + +func (x *RunMetadata) GetCostGraph() *cost_graph_go_proto.CostGraphDef { + if x != nil { + return x.CostGraph + } + return nil +} + +func (x *RunMetadata) GetPartitionGraphs() []*graph_go_proto.GraphDef { + if x != nil { + return x.PartitionGraphs + } + return nil +} + +func (x *RunMetadata) GetFunctionGraphs() []*RunMetadata_FunctionGraphs { + if x != nil { + return x.FunctionGraphs + } + return nil +} + +// Defines a connection between two tensors in a `GraphDef`. +type TensorConnection struct { + state protoimpl.MessageState `protogen:"open.v1"` + // A tensor name. The value of this tensor will be substituted for + // the tensor named in `to_tensor`. + FromTensor string `protobuf:"bytes,1,opt,name=from_tensor,json=fromTensor,proto3" json:"from_tensor,omitempty"` + // A tensor name. The value of this tensor will be bound to the + // value of the tensor named in `from_tensor`. + ToTensor string `protobuf:"bytes,2,opt,name=to_tensor,json=toTensor,proto3" json:"to_tensor,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TensorConnection) Reset() { + *x = TensorConnection{} + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TensorConnection) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TensorConnection) ProtoMessage() {} + +func (x *TensorConnection) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TensorConnection.ProtoReflect.Descriptor instead. +func (*TensorConnection) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_config_proto_rawDescGZIP(), []int{9} +} + +func (x *TensorConnection) GetFromTensor() string { + if x != nil { + return x.FromTensor + } + return "" +} + +func (x *TensorConnection) GetToTensor() string { + if x != nil { + return x.ToTensor + } + return "" +} + +// Defines a subgraph in another `GraphDef` as a set of feed points and nodes +// to be fetched or executed. +// +// Compare with the arguments to `Session::Run()`. +type CallableOptions struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Tensors to be fed in the callable. Each feed is the name of a tensor. + Feed []string `protobuf:"bytes,1,rep,name=feed,proto3" json:"feed,omitempty"` + // Fetches. A list of tensor names. The caller of the callable expects a + // tensor to be returned for each fetch[i] (see RunStepResponse.tensor). The + // order of specified fetches does not change the execution order. + Fetch []string `protobuf:"bytes,2,rep,name=fetch,proto3" json:"fetch,omitempty"` + // Target Nodes. A list of node names. The named nodes will be run by the + // callable but their outputs will not be returned. + Target []string `protobuf:"bytes,3,rep,name=target,proto3" json:"target,omitempty"` + // Options that will be applied to each run. + RunOptions *RunOptions `protobuf:"bytes,4,opt,name=run_options,json=runOptions,proto3" json:"run_options,omitempty"` + // Tensors to be connected in the callable. Each TensorConnection denotes + // a pair of tensors in the graph, between which an edge will be created + // in the callable. + TensorConnection []*TensorConnection `protobuf:"bytes,5,rep,name=tensor_connection,json=tensorConnection,proto3" json:"tensor_connection,omitempty"` + // The Tensor objects fed in the callable and fetched from the callable + // are expected to be backed by host (CPU) memory by default. + // + // The options below allow changing that - feeding tensors backed by + // device memory, or returning tensors that are backed by device memory. + // + // The maps below map the name of a feed/fetch tensor (which appears in + // 'feed' or 'fetch' fields above), to the fully qualified name of the device + // owning the memory backing the contents of the tensor. + // + // For example, creating a callable with the following options: + // + // CallableOptions { + // feed: "a:0" + // feed: "b:0" + // + // fetch: "x:0" + // fetch: "y:0" + // + // feed_devices: { + // "a:0": "/job:localhost/replica:0/task:0/device:GPU:0" + // } + // + // fetch_devices: { + // "y:0": "/job:localhost/replica:0/task:0/device:GPU:0" + // } + // } + // + // means that the Callable expects: + // - The first argument ("a:0") is a Tensor backed by GPU memory. + // - The second argument ("b:0") is a Tensor backed by host memory. + // and of its return values: + // - The first output ("x:0") will be backed by host memory. + // - The second output ("y:0") will be backed by GPU memory. + // + // FEEDS: + // It is the responsibility of the caller to ensure that the memory of the fed + // tensors will be correctly initialized and synchronized before it is + // accessed by operations executed during the call to Session::RunCallable(). + // + // This is typically ensured by using the TensorFlow memory allocators + // (Device::GetAllocator()) to create the Tensor to be fed. + // + // Alternatively, for CUDA-enabled GPU devices, this typically means that the + // operation that produced the contents of the tensor has completed, i.e., the + // CUDA stream has been synchronized (e.g., via cuCtxSynchronize() or + // cuStreamSynchronize()). + FeedDevices map[string]string `protobuf:"bytes,6,rep,name=feed_devices,json=feedDevices,proto3" json:"feed_devices,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + FetchDevices map[string]string `protobuf:"bytes,7,rep,name=fetch_devices,json=fetchDevices,proto3" json:"fetch_devices,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // By default, RunCallable() will synchronize the GPU stream before returning + // fetched tensors on a GPU device, to ensure that the values in those tensors + // have been produced. This simplifies interacting with the tensors, but + // potentially incurs a performance hit. + // + // If this options is set to true, the caller is responsible for ensuring + // that the values in the fetched tensors have been produced before they are + // used. The caller can do this by invoking `Device::Sync()` on the underlying + // device(s), or by feeding the tensors back to the same Session using + // `feed_devices` with the same corresponding device name. + FetchSkipSync bool `protobuf:"varint,8,opt,name=fetch_skip_sync,json=fetchSkipSync,proto3" json:"fetch_skip_sync,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CallableOptions) Reset() { + *x = CallableOptions{} + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CallableOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CallableOptions) ProtoMessage() {} + +func (x *CallableOptions) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CallableOptions.ProtoReflect.Descriptor instead. +func (*CallableOptions) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_config_proto_rawDescGZIP(), []int{10} +} + +func (x *CallableOptions) GetFeed() []string { + if x != nil { + return x.Feed + } + return nil +} + +func (x *CallableOptions) GetFetch() []string { + if x != nil { + return x.Fetch + } + return nil +} + +func (x *CallableOptions) GetTarget() []string { + if x != nil { + return x.Target + } + return nil +} + +func (x *CallableOptions) GetRunOptions() *RunOptions { + if x != nil { + return x.RunOptions + } + return nil +} + +func (x *CallableOptions) GetTensorConnection() []*TensorConnection { + if x != nil { + return x.TensorConnection + } + return nil +} + +func (x *CallableOptions) GetFeedDevices() map[string]string { + if x != nil { + return x.FeedDevices + } + return nil +} + +func (x *CallableOptions) GetFetchDevices() map[string]string { + if x != nil { + return x.FetchDevices + } + return nil +} + +func (x *CallableOptions) GetFetchSkipSync() bool { + if x != nil { + return x.FetchSkipSync + } + return false +} + +type GPUOptions_Experimental struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The multi virtual device settings. If empty (not set), it will create + // single virtual device on each visible GPU, according to the settings + // in "visible_device_list" above. Otherwise, the number of elements in the + // list must be the same as the number of visible GPUs (after + // "visible_device_list" filtering if it is set), and the string represented + // device names (e.g. /device:GPU:) will refer to the virtual + // devices and have the 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, + // + // visible_device_list = "1,0" + // virtual_devices { memory_limit: 1GB memory_limit: 2GB } + // virtual_devices {} + // + // will create three 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 + // + // NOTE: + // 1. It's invalid to set both this and "per_process_gpu_memory_fraction" + // at the same time. + // 2. Currently this setting is per-process, not per-session. Using + // different settings in different sessions within same process will + // result in undefined behavior. + VirtualDevices []*GPUOptions_Experimental_VirtualDevices `protobuf:"bytes,1,rep,name=virtual_devices,json=virtualDevices,proto3" json:"virtual_devices,omitempty"` + // If true, uses CUDA unified memory for memory allocations. If + // per_process_gpu_memory_fraction option is greater than 1.0, then unified + // memory is used regardless of the value for this field. See comments for + // per_process_gpu_memory_fraction field for more details and requirements + // of the unified memory. This option is useful to oversubscribe memory if + // multiple processes are sharing a single GPU while individually using less + // than 1.0 per process memory fraction. + UseUnifiedMemory bool `protobuf:"varint,2,opt,name=use_unified_memory,json=useUnifiedMemory,proto3" json:"use_unified_memory,omitempty"` + // If > 1, the number of device-to-device copy streams to create + // for each GPUDevice. Default value is 0, which is automatically + // converted to 1. + NumDevToDevCopyStreams int32 `protobuf:"varint,3,opt,name=num_dev_to_dev_copy_streams,json=numDevToDevCopyStreams,proto3" json:"num_dev_to_dev_copy_streams,omitempty"` + // If non-empty, defines a good GPU ring order on a single worker based on + // device interconnect. This assumes that all workers have the same GPU + // topology. Specify as a comma-separated string, e.g. "3,2,1,0,7,6,5,4". + // This ring order is used by the RingReducer implementation of + // CollectiveReduce, and serves as an override to automatic ring order + // generation in OrderTaskDeviceMap() during CollectiveParam resolution. + CollectiveRingOrder string `protobuf:"bytes,4,opt,name=collective_ring_order,json=collectiveRingOrder,proto3" json:"collective_ring_order,omitempty"` + // If true then extra work is done by GPUDevice and GPUBFCAllocator to + // keep track of when GPU memory is freed and when kernels actually + // complete so that we can know when a nominally free memory chunk + // is really not subject to pending use. + TimestampedAllocator bool `protobuf:"varint,5,opt,name=timestamped_allocator,json=timestampedAllocator,proto3" json:"timestamped_allocator,omitempty"` + // Parameters for GPUKernelTracker. By default no kernel tracking is done. + // Note that timestamped_allocator is only effective if some tracking is + // specified. + // + // If kernel_tracker_max_interval = n > 0, then a tracking event + // is inserted after every n kernels without an event. + KernelTrackerMaxInterval int32 `protobuf:"varint,7,opt,name=kernel_tracker_max_interval,json=kernelTrackerMaxInterval,proto3" json:"kernel_tracker_max_interval,omitempty"` + // If kernel_tracker_max_bytes = n > 0, then a tracking event is + // inserted after every series of kernels allocating a sum of + // memory >= n. If one kernel allocates b * n bytes, then one + // event will be inserted after it, but it will count as b against + // the pending limit. + KernelTrackerMaxBytes int32 `protobuf:"varint,8,opt,name=kernel_tracker_max_bytes,json=kernelTrackerMaxBytes,proto3" json:"kernel_tracker_max_bytes,omitempty"` + // If kernel_tracker_max_pending > 0 then no more than this many + // tracking events can be outstanding at a time. An attempt to + // launch an additional kernel will stall until an event + // completes. + KernelTrackerMaxPending int32 `protobuf:"varint,9,opt,name=kernel_tracker_max_pending,json=kernelTrackerMaxPending,proto3" json:"kernel_tracker_max_pending,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GPUOptions_Experimental) Reset() { + *x = GPUOptions_Experimental{} + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GPUOptions_Experimental) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GPUOptions_Experimental) ProtoMessage() {} + +func (x *GPUOptions_Experimental) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GPUOptions_Experimental.ProtoReflect.Descriptor instead. +func (*GPUOptions_Experimental) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_config_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *GPUOptions_Experimental) GetVirtualDevices() []*GPUOptions_Experimental_VirtualDevices { + if x != nil { + return x.VirtualDevices + } + return nil +} + +func (x *GPUOptions_Experimental) GetUseUnifiedMemory() bool { + if x != nil { + return x.UseUnifiedMemory + } + return false +} + +func (x *GPUOptions_Experimental) GetNumDevToDevCopyStreams() int32 { + if x != nil { + return x.NumDevToDevCopyStreams + } + return 0 +} + +func (x *GPUOptions_Experimental) GetCollectiveRingOrder() string { + if x != nil { + return x.CollectiveRingOrder + } + return "" +} + +func (x *GPUOptions_Experimental) GetTimestampedAllocator() bool { + if x != nil { + return x.TimestampedAllocator + } + return false +} + +func (x *GPUOptions_Experimental) GetKernelTrackerMaxInterval() int32 { + if x != nil { + return x.KernelTrackerMaxInterval + } + return 0 +} + +func (x *GPUOptions_Experimental) GetKernelTrackerMaxBytes() int32 { + if x != nil { + return x.KernelTrackerMaxBytes + } + return 0 +} + +func (x *GPUOptions_Experimental) GetKernelTrackerMaxPending() int32 { + if x != nil { + return x.KernelTrackerMaxPending + } + return 0 +} + +// Configuration for breaking down a visible GPU into multiple "virtual" +// devices. +type GPUOptions_Experimental_VirtualDevices struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Per "virtual" device memory limit, in MB. The number of elements in + // the list is the number of virtual devices to create on the + // corresponding visible GPU (see "virtual_devices" below). + // If empty, it will create single virtual device taking all available + // memory from the device. + // + // For the concept of "visible" and "virtual" GPU, see the comments for + // "visible_device_list" above for more information. + MemoryLimitMb []float32 `protobuf:"fixed32,1,rep,packed,name=memory_limit_mb,json=memoryLimitMb,proto3" json:"memory_limit_mb,omitempty"` + // Priority values to use with the virtual devices. Use the cuda function + // cudaDeviceGetStreamPriorityRange to query for valid range of values for + // priority. + // + // On a P4000 GPU with cuda 10.1, the priority range reported was 0 for + // least priority and -1 for greatest priority. + // + // If this field is not specified, then the virtual devices will be + // created with the default. If this field has values set, then the size + // of this must match with the above memory_limit_mb. + Priority []int32 `protobuf:"varint,2,rep,packed,name=priority,proto3" json:"priority,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GPUOptions_Experimental_VirtualDevices) Reset() { + *x = GPUOptions_Experimental_VirtualDevices{} + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GPUOptions_Experimental_VirtualDevices) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GPUOptions_Experimental_VirtualDevices) ProtoMessage() {} + +func (x *GPUOptions_Experimental_VirtualDevices) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GPUOptions_Experimental_VirtualDevices.ProtoReflect.Descriptor instead. +func (*GPUOptions_Experimental_VirtualDevices) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_config_proto_rawDescGZIP(), []int{0, 0, 0} +} + +func (x *GPUOptions_Experimental_VirtualDevices) GetMemoryLimitMb() []float32 { + if x != nil { + return x.MemoryLimitMb + } + return nil +} + +func (x *GPUOptions_Experimental_VirtualDevices) GetPriority() []int32 { + if x != nil { + return x.Priority + } + return nil +} + +// Everything inside Experimental is subject to change and is not subject +// to API stability guarantees in +// https://www.tensorflow.org/guide/version_compat. +type ConfigProto_Experimental struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Task name for group resolution. + CollectiveGroupLeader string `protobuf:"bytes,1,opt,name=collective_group_leader,json=collectiveGroupLeader,proto3" json:"collective_group_leader,omitempty"` + // Which executor to use, the default executor will be used + // if it is an empty string or "DEFAULT" + ExecutorType string `protobuf:"bytes,3,opt,name=executor_type,json=executorType,proto3" json:"executor_type,omitempty"` + // Guidance to formatting of large RecvBuf fields for transfer. + // Any positive value sets the max chunk size. 0 defaults to 4096. + // Any negative value indicates no max, i.e. one chunk only. + RecvBufMaxChunk int32 `protobuf:"varint,4,opt,name=recv_buf_max_chunk,json=recvBufMaxChunk,proto3" json:"recv_buf_max_chunk,omitempty"` + // If true, and supported by the platform, the runtime will attempt to + // use NUMA affinity where applicable. One consequence will be the + // existence of as many CPU devices as there are available NUMA nodes. + UseNumaAffinity bool `protobuf:"varint,5,opt,name=use_numa_affinity,json=useNumaAffinity,proto3" json:"use_numa_affinity,omitempty"` + // If true, make collective op execution order sequential and deterministic + // for potentially concurrent collective instances. + CollectiveDeterministicSequentialExecution bool `protobuf:"varint,6,opt,name=collective_deterministic_sequential_execution,json=collectiveDeterministicSequentialExecution,proto3" json:"collective_deterministic_sequential_execution,omitempty"` + // If true, use NCCL for CollectiveOps. This feature is highly + // experimental. + CollectiveNccl bool `protobuf:"varint,7,opt,name=collective_nccl,json=collectiveNccl,proto3" json:"collective_nccl,omitempty"` + // In the following, session state means the value of a variable, elements + // in a hash table, or any other resource, accessible by worker sessions + // held by a TF server. + // + // When ClusterSpec propagation is enabled, the value of + // isolate_session_state is ignored when deciding whether to share session + // states in a TF server (for backwards compatibility reasons). + // - If share_session_state_in_clusterspec_propagation is true, the session + // states are shared. + // - If share_session_state_in_clusterspec_propagation is false, session + // states are isolated. + // + // When clusterspec propagation is not used, the value of + // share_session_state_in_clusterspec_propagation is ignored when deciding + // whether to share session states in a TF server. + // - If isolate_session_state is true, session states are isolated. + // - If isolate_session_state is false, session states are shared. + // + // TODO(b/129330037): Add a single API that consistently treats + // isolate_session_state and ClusterSpec propagation. + ShareSessionStateInClusterspecPropagation bool `protobuf:"varint,8,opt,name=share_session_state_in_clusterspec_propagation,json=shareSessionStateInClusterspecPropagation,proto3" json:"share_session_state_in_clusterspec_propagation,omitempty"` + // If using a direct session, disable spinning while waiting for work in + // the thread pool. This may result in higher latency for completing ops, + // but in the case where there is a lot of spinning may result in lower + // CPU usage. + DisableThreadSpinning bool `protobuf:"varint,9,opt,name=disable_thread_spinning,json=disableThreadSpinning,proto3" json:"disable_thread_spinning,omitempty"` + // This was promoted to a non-experimental API. Please use + // ConfigProto.share_cluster_devices_in_session instead. + ShareClusterDevicesInSession bool `protobuf:"varint,10,opt,name=share_cluster_devices_in_session,json=shareClusterDevicesInSession,proto3" json:"share_cluster_devices_in_session,omitempty"` + // Metadata about the session. + // + // If set, this can be used by the runtime and the Ops for debugging, + // monitoring, etc. + // + // NOTE: This is currently used and propagated only by the direct session. + SessionMetadata *SessionMetadata `protobuf:"bytes,11,opt,name=session_metadata,json=sessionMetadata,proto3" json:"session_metadata,omitempty"` + // If true, the session may treat the graph as being static for optimization + // purposes. + // + // If this option is set to true when a session is created, the full + // GraphDef must be passed in a single call to Session::Create(), and + // Session::Extend() may not be supported. + OptimizeForStaticGraph bool `protobuf:"varint,12,opt,name=optimize_for_static_graph,json=optimizeForStaticGraph,proto3" json:"optimize_for_static_graph,omitempty"` + // This field will eventually be deprecated and replaced by + // mlir_bridge_rollout (b/166038521). + // + // Whether to enable the MLIR-based TF->XLA bridge. + // + // This is a replacement to the existing bridge, and not ready for + // production usage yet. + // If this option is set to true when a session is created, MLIR is used to + // perform the set of graph transformations to put the graph in a form that + // can be executed with delegation of some computations to an accelerator. + // This builds on the model of XLA where a subset of the graph is + // encapsulated and attached to a "compile" operation, whose result is fed + // to an "execute" operation. The kernel for these operations is responsible + // to lower the encapsulated graph to a particular device. + EnableMlirBridge bool `protobuf:"varint,13,opt,name=enable_mlir_bridge,json=enableMlirBridge,proto3" json:"enable_mlir_bridge,omitempty"` + // This field is underdevelopment, for now use enable_mlir_bridge + // (b/166038521). + // + // Whether to enable the MLIR-based TF->XLA bridge. + MlirBridgeRollout ConfigProto_Experimental_MlirBridgeRollout `protobuf:"varint,17,opt,name=mlir_bridge_rollout,json=mlirBridgeRollout,proto3,enum=tensorflow.ConfigProto_Experimental_MlirBridgeRollout" json:"mlir_bridge_rollout,omitempty"` + // Whether to enable the MLIR-based Graph optimizations. + // + // This will become a part of standard Tensorflow graph optimization + // pipeline, currently this is only used for gradual migration and testing + // new passes that are replacing existing optimizations in Grappler. + EnableMlirGraphOptimization bool `protobuf:"varint,16,opt,name=enable_mlir_graph_optimization,json=enableMlirGraphOptimization,proto3" json:"enable_mlir_graph_optimization,omitempty"` + // If true, the session will not store an additional copy of the graph for + // each subgraph. + // + // If this option is set to true when a session is created, the + // `RunOptions.output_partition_graphs` options must not be set. + DisableOutputPartitionGraphs bool `protobuf:"varint,14,opt,name=disable_output_partition_graphs,json=disableOutputPartitionGraphs,proto3" json:"disable_output_partition_graphs,omitempty"` + // Minimum number of batches run through the XLA graph before XLA fusion + // autotuner is enabled. Default value of zero disables the autotuner. + // + // The XLA fusion autotuner can improve performance by executing a heuristic + // search on the compiler parameters. + XlaFusionAutotunerThresh int64 `protobuf:"varint,15,opt,name=xla_fusion_autotuner_thresh,json=xlaFusionAutotunerThresh,proto3" json:"xla_fusion_autotuner_thresh,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ConfigProto_Experimental) Reset() { + *x = ConfigProto_Experimental{} + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ConfigProto_Experimental) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConfigProto_Experimental) ProtoMessage() {} + +func (x *ConfigProto_Experimental) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[14] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConfigProto_Experimental.ProtoReflect.Descriptor instead. +func (*ConfigProto_Experimental) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_config_proto_rawDescGZIP(), []int{6, 1} +} + +func (x *ConfigProto_Experimental) GetCollectiveGroupLeader() string { + if x != nil { + return x.CollectiveGroupLeader + } + return "" +} + +func (x *ConfigProto_Experimental) GetExecutorType() string { + if x != nil { + return x.ExecutorType + } + return "" +} + +func (x *ConfigProto_Experimental) GetRecvBufMaxChunk() int32 { + if x != nil { + return x.RecvBufMaxChunk + } + return 0 +} + +func (x *ConfigProto_Experimental) GetUseNumaAffinity() bool { + if x != nil { + return x.UseNumaAffinity + } + return false +} + +func (x *ConfigProto_Experimental) GetCollectiveDeterministicSequentialExecution() bool { + if x != nil { + return x.CollectiveDeterministicSequentialExecution + } + return false +} + +func (x *ConfigProto_Experimental) GetCollectiveNccl() bool { + if x != nil { + return x.CollectiveNccl + } + return false +} + +func (x *ConfigProto_Experimental) GetShareSessionStateInClusterspecPropagation() bool { + if x != nil { + return x.ShareSessionStateInClusterspecPropagation + } + return false +} + +func (x *ConfigProto_Experimental) GetDisableThreadSpinning() bool { + if x != nil { + return x.DisableThreadSpinning + } + return false +} + +func (x *ConfigProto_Experimental) GetShareClusterDevicesInSession() bool { + if x != nil { + return x.ShareClusterDevicesInSession + } + return false +} + +func (x *ConfigProto_Experimental) GetSessionMetadata() *SessionMetadata { + if x != nil { + return x.SessionMetadata + } + return nil +} + +func (x *ConfigProto_Experimental) GetOptimizeForStaticGraph() bool { + if x != nil { + return x.OptimizeForStaticGraph + } + return false +} + +func (x *ConfigProto_Experimental) GetEnableMlirBridge() bool { + if x != nil { + return x.EnableMlirBridge + } + return false +} + +func (x *ConfigProto_Experimental) GetMlirBridgeRollout() ConfigProto_Experimental_MlirBridgeRollout { + if x != nil { + return x.MlirBridgeRollout + } + return ConfigProto_Experimental_MLIR_BRIDGE_ROLLOUT_UNSPECIFIED +} + +func (x *ConfigProto_Experimental) GetEnableMlirGraphOptimization() bool { + if x != nil { + return x.EnableMlirGraphOptimization + } + return false +} + +func (x *ConfigProto_Experimental) GetDisableOutputPartitionGraphs() bool { + if x != nil { + return x.DisableOutputPartitionGraphs + } + return false +} + +func (x *ConfigProto_Experimental) GetXlaFusionAutotunerThresh() int64 { + if x != nil { + return x.XlaFusionAutotunerThresh + } + return 0 +} + +// Everything inside Experimental is subject to change and is not subject +// to API stability guarantees in +// https://www.tensorflow.org/guide/version_compat. +type RunOptions_Experimental struct { + state protoimpl.MessageState `protogen:"open.v1"` + // If non-zero, declares that this graph is going to use collective + // ops and must synchronize step_ids with any other graph with this + // same group_key value (in a distributed computation where tasks + // run disjoint graphs). + CollectiveGraphKey int64 `protobuf:"varint,1,opt,name=collective_graph_key,json=collectiveGraphKey,proto3" json:"collective_graph_key,omitempty"` + // If true, then operations (using the inter-op pool) across all + // session::run() calls will be centrally scheduled, optimizing for (median + // and tail) latency. + // Consider using this option for CPU-bound workloads like inference. + UseRunHandlerPool bool `protobuf:"varint,2,opt,name=use_run_handler_pool,json=useRunHandlerPool,proto3" json:"use_run_handler_pool,omitempty"` + RunHandlerPoolOptions *RunOptions_Experimental_RunHandlerPoolOptions `protobuf:"bytes,3,opt,name=run_handler_pool_options,json=runHandlerPoolOptions,proto3" json:"run_handler_pool_options,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RunOptions_Experimental) Reset() { + *x = RunOptions_Experimental{} + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RunOptions_Experimental) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RunOptions_Experimental) ProtoMessage() {} + +func (x *RunOptions_Experimental) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[15] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RunOptions_Experimental.ProtoReflect.Descriptor instead. +func (*RunOptions_Experimental) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_config_proto_rawDescGZIP(), []int{7, 0} +} + +func (x *RunOptions_Experimental) GetCollectiveGraphKey() int64 { + if x != nil { + return x.CollectiveGraphKey + } + return 0 +} + +func (x *RunOptions_Experimental) GetUseRunHandlerPool() bool { + if x != nil { + return x.UseRunHandlerPool + } + return false +} + +func (x *RunOptions_Experimental) GetRunHandlerPoolOptions() *RunOptions_Experimental_RunHandlerPoolOptions { + if x != nil { + return x.RunHandlerPoolOptions + } + return nil +} + +// Options for run handler thread pool. +type RunOptions_Experimental_RunHandlerPoolOptions struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Priority of the request. The run handler thread pool will schedule ops + // based on the priority number. The larger number means higher priority. + Priority int64 `protobuf:"varint,1,opt,name=priority,proto3" json:"priority,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RunOptions_Experimental_RunHandlerPoolOptions) Reset() { + *x = RunOptions_Experimental_RunHandlerPoolOptions{} + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RunOptions_Experimental_RunHandlerPoolOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RunOptions_Experimental_RunHandlerPoolOptions) ProtoMessage() {} + +func (x *RunOptions_Experimental_RunHandlerPoolOptions) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[16] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RunOptions_Experimental_RunHandlerPoolOptions.ProtoReflect.Descriptor instead. +func (*RunOptions_Experimental_RunHandlerPoolOptions) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_config_proto_rawDescGZIP(), []int{7, 0, 0} +} + +func (x *RunOptions_Experimental_RunHandlerPoolOptions) GetPriority() int64 { + if x != nil { + return x.Priority + } + return 0 +} + +type RunMetadata_FunctionGraphs struct { + state protoimpl.MessageState `protogen:"open.v1"` + // TODO(nareshmodi): Include some sort of function/cache-key identifier? + PartitionGraphs []*graph_go_proto.GraphDef `protobuf:"bytes,1,rep,name=partition_graphs,json=partitionGraphs,proto3" json:"partition_graphs,omitempty"` + PreOptimizationGraph *graph_go_proto.GraphDef `protobuf:"bytes,2,opt,name=pre_optimization_graph,json=preOptimizationGraph,proto3" json:"pre_optimization_graph,omitempty"` + PostOptimizationGraph *graph_go_proto.GraphDef `protobuf:"bytes,3,opt,name=post_optimization_graph,json=postOptimizationGraph,proto3" json:"post_optimization_graph,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RunMetadata_FunctionGraphs) Reset() { + *x = RunMetadata_FunctionGraphs{} + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RunMetadata_FunctionGraphs) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RunMetadata_FunctionGraphs) ProtoMessage() {} + +func (x *RunMetadata_FunctionGraphs) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[17] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RunMetadata_FunctionGraphs.ProtoReflect.Descriptor instead. +func (*RunMetadata_FunctionGraphs) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_config_proto_rawDescGZIP(), []int{8, 0} +} + +func (x *RunMetadata_FunctionGraphs) GetPartitionGraphs() []*graph_go_proto.GraphDef { + if x != nil { + return x.PartitionGraphs + } + return nil +} + +func (x *RunMetadata_FunctionGraphs) GetPreOptimizationGraph() *graph_go_proto.GraphDef { + if x != nil { + return x.PreOptimizationGraph + } + return nil +} + +func (x *RunMetadata_FunctionGraphs) GetPostOptimizationGraph() *graph_go_proto.GraphDef { + if x != nil { + return x.PostOptimizationGraph + } + return nil +} + +var File_tensorflow_core_protobuf_config_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_config_proto_rawDesc = "" + + "\n" + + "%tensorflow/core/protobuf/config.proto\x12\n" + + "tensorflow\x1a*tensorflow/core/framework/cost_graph.proto\x1a%tensorflow/core/framework/graph.proto\x1a*tensorflow/core/framework/step_stats.proto\x1a&tensorflow/core/protobuf/cluster.proto\x1a$tensorflow/core/protobuf/debug.proto\x1a.tensorflow/core/protobuf/rewriter_config.proto\"\xca\b\n" + + "\n" + + "GPUOptions\x12D\n" + + "\x1fper_process_gpu_memory_fraction\x18\x01 \x01(\x01R\x1bperProcessGpuMemoryFraction\x12!\n" + + "\fallow_growth\x18\x04 \x01(\bR\vallowGrowth\x12%\n" + + "\x0eallocator_type\x18\x02 \x01(\tR\rallocatorType\x126\n" + + "\x17deferred_deletion_bytes\x18\x03 \x01(\x03R\x15deferredDeletionBytes\x12.\n" + + "\x13visible_device_list\x18\x05 \x01(\tR\x11visibleDeviceList\x12;\n" + + "\x1apolling_active_delay_usecs\x18\x06 \x01(\x05R\x17pollingActiveDelayUsecs\x12?\n" + + "\x1cpolling_inactive_delay_msecs\x18\a \x01(\x05R\x19pollingInactiveDelayMsecs\x120\n" + + "\x14force_gpu_compatible\x18\b \x01(\bR\x12forceGpuCompatible\x12G\n" + + "\fexperimental\x18\t \x01(\v2#.tensorflow.GPUOptions.ExperimentalR\fexperimental\x1a\xca\x04\n" + + "\fExperimental\x12[\n" + + "\x0fvirtual_devices\x18\x01 \x03(\v22.tensorflow.GPUOptions.Experimental.VirtualDevicesR\x0evirtualDevices\x12,\n" + + "\x12use_unified_memory\x18\x02 \x01(\bR\x10useUnifiedMemory\x12;\n" + + "\x1bnum_dev_to_dev_copy_streams\x18\x03 \x01(\x05R\x16numDevToDevCopyStreams\x122\n" + + "\x15collective_ring_order\x18\x04 \x01(\tR\x13collectiveRingOrder\x123\n" + + "\x15timestamped_allocator\x18\x05 \x01(\bR\x14timestampedAllocator\x12=\n" + + "\x1bkernel_tracker_max_interval\x18\a \x01(\x05R\x18kernelTrackerMaxInterval\x127\n" + + "\x18kernel_tracker_max_bytes\x18\b \x01(\x05R\x15kernelTrackerMaxBytes\x12;\n" + + "\x1akernel_tracker_max_pending\x18\t \x01(\x05R\x17kernelTrackerMaxPending\x1aT\n" + + "\x0eVirtualDevices\x12&\n" + + "\x0fmemory_limit_mb\x18\x01 \x03(\x02R\rmemoryLimitMb\x12\x1a\n" + + "\bpriority\x18\x02 \x03(\x05R\bpriority\"\x82\x04\n" + + "\x10OptimizerOptions\x12M\n" + + "#do_common_subexpression_elimination\x18\x01 \x01(\bR doCommonSubexpressionElimination\x12.\n" + + "\x13do_constant_folding\x18\x02 \x01(\bR\x11doConstantFolding\x12>\n" + + "\x1cmax_folded_constant_in_bytes\x18\x06 \x01(\x03R\x18maxFoldedConstantInBytes\x120\n" + + "\x14do_function_inlining\x18\x04 \x01(\bR\x12doFunctionInlining\x12?\n" + + "\topt_level\x18\x03 \x01(\x0e2\".tensorflow.OptimizerOptions.LevelR\boptLevel\x12U\n" + + "\x10global_jit_level\x18\x05 \x01(\x0e2+.tensorflow.OptimizerOptions.GlobalJitLevelR\x0eglobalJitLevel\" \n" + + "\x05Level\x12\x06\n" + + "\x02L1\x10\x00\x12\x0f\n" + + "\x02L0\x10\xff\xff\xff\xff\xff\xff\xff\xff\xff\x01\"C\n" + + "\x0eGlobalJitLevel\x12\v\n" + + "\aDEFAULT\x10\x00\x12\x10\n" + + "\x03OFF\x10\xff\xff\xff\xff\xff\xff\xff\xff\xff\x01\x12\b\n" + + "\x04ON_1\x10\x01\x12\b\n" + + "\x04ON_2\x10\x02\"\x90\x04\n" + + "\fGraphOptions\x124\n" + + "\x16enable_recv_scheduling\x18\x02 \x01(\bR\x14enableRecvScheduling\x12I\n" + + "\x11optimizer_options\x18\x03 \x01(\v2\x1c.tensorflow.OptimizerOptionsR\x10optimizerOptions\x12(\n" + + "\x10build_cost_model\x18\x04 \x01(\x03R\x0ebuildCostModel\x123\n" + + "\x16build_cost_model_after\x18\t \x01(\x03R\x13buildCostModelAfter\x12!\n" + + "\finfer_shapes\x18\x05 \x01(\bR\vinferShapes\x12,\n" + + "\x12place_pruned_graph\x18\x06 \x01(\bR\x10placePrunedGraph\x128\n" + + "\x18enable_bfloat16_sendrecv\x18\a \x01(\bR\x16enableBfloat16Sendrecv\x12#\n" + + "\rtimeline_step\x18\b \x01(\x05R\ftimelineStep\x12C\n" + + "\x0frewrite_options\x18\n" + + " \x01(\v2\x1a.tensorflow.RewriterConfigR\x0erewriteOptionsJ\x04\b\x01\x10\x02R%skip_common_subexpression_elimination\"Y\n" + + "\x15ThreadPoolOptionProto\x12\x1f\n" + + "\vnum_threads\x18\x01 \x01(\x05R\n" + + "numThreads\x12\x1f\n" + + "\vglobal_name\x18\x02 \x01(\tR\n" + + "globalName\"\xa9\x02\n" + + "\n" + + "RPCOptions\x12>\n" + + "\x1cuse_rpc_for_inprocess_master\x18\x01 \x01(\bR\x18useRpcForInprocessMaster\x123\n" + + "\x15compression_algorithm\x18\x02 \x01(\tR\x14compressionAlgorithm\x12+\n" + + "\x11compression_level\x18\x03 \x01(\x05R\x10compressionLevel\x12,\n" + + "\x12cache_rpc_response\x18\x04 \x01(\bR\x10cacheRpcResponse\x12K\n" + + "\"disable_session_connection_sharing\x18\x05 \x01(\bR\x1fdisableSessionConnectionSharing\"?\n" + + "\x0fSessionMetadata\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x18\n" + + "\aversion\x18\x02 \x01(\x03R\aversion\"\xf0\x11\n" + + "\vConfigProto\x12K\n" + + "\fdevice_count\x18\x01 \x03(\v2(.tensorflow.ConfigProto.DeviceCountEntryR\vdeviceCount\x12?\n" + + "\x1cintra_op_parallelism_threads\x18\x02 \x01(\x05R\x19intraOpParallelismThreads\x12?\n" + + "\x1cinter_op_parallelism_threads\x18\x05 \x01(\x05R\x19interOpParallelismThreads\x125\n" + + "\x17use_per_session_threads\x18\t \x01(\bR\x14usePerSessionThreads\x12a\n" + + "\x1csession_inter_op_thread_pool\x18\f \x03(\v2!.tensorflow.ThreadPoolOptionProtoR\x18sessionInterOpThreadPool\x12)\n" + + "\x10placement_period\x18\x03 \x01(\x05R\x0fplacementPeriod\x12%\n" + + "\x0edevice_filters\x18\x04 \x03(\tR\rdeviceFilters\x127\n" + + "\vgpu_options\x18\x06 \x01(\v2\x16.tensorflow.GPUOptionsR\n" + + "gpuOptions\x120\n" + + "\x14allow_soft_placement\x18\a \x01(\bR\x12allowSoftPlacement\x120\n" + + "\x14log_device_placement\x18\b \x01(\bR\x12logDevicePlacement\x12=\n" + + "\rgraph_options\x18\n" + + " \x01(\v2\x18.tensorflow.GraphOptionsR\fgraphOptions\x125\n" + + "\x17operation_timeout_in_ms\x18\v \x01(\x03R\x14operationTimeoutInMs\x127\n" + + "\vrpc_options\x18\r \x01(\v2\x16.tensorflow.RPCOptionsR\n" + + "rpcOptions\x127\n" + + "\vcluster_def\x18\x0e \x01(\v2\x16.tensorflow.ClusterDefR\n" + + "clusterDef\x122\n" + + "\x15isolate_session_state\x18\x0f \x01(\bR\x13isolateSessionState\x12F\n" + + " share_cluster_devices_in_session\x18\x11 \x01(\bR\x1cshareClusterDevicesInSession\x12H\n" + + "\fexperimental\x18\x10 \x01(\v2$.tensorflow.ConfigProto.ExperimentalR\fexperimental\x1a>\n" + + "\x10DeviceCountEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\x05R\x05value:\x028\x01\x1a\x9a\t\n" + + "\fExperimental\x126\n" + + "\x17collective_group_leader\x18\x01 \x01(\tR\x15collectiveGroupLeader\x12#\n" + + "\rexecutor_type\x18\x03 \x01(\tR\fexecutorType\x12+\n" + + "\x12recv_buf_max_chunk\x18\x04 \x01(\x05R\x0frecvBufMaxChunk\x12*\n" + + "\x11use_numa_affinity\x18\x05 \x01(\bR\x0fuseNumaAffinity\x12a\n" + + "-collective_deterministic_sequential_execution\x18\x06 \x01(\bR*collectiveDeterministicSequentialExecution\x12'\n" + + "\x0fcollective_nccl\x18\a \x01(\bR\x0ecollectiveNccl\x12a\n" + + ".share_session_state_in_clusterspec_propagation\x18\b \x01(\bR)shareSessionStateInClusterspecPropagation\x126\n" + + "\x17disable_thread_spinning\x18\t \x01(\bR\x15disableThreadSpinning\x12F\n" + + " share_cluster_devices_in_session\x18\n" + + " \x01(\bR\x1cshareClusterDevicesInSession\x12F\n" + + "\x10session_metadata\x18\v \x01(\v2\x1b.tensorflow.SessionMetadataR\x0fsessionMetadata\x129\n" + + "\x19optimize_for_static_graph\x18\f \x01(\bR\x16optimizeForStaticGraph\x12,\n" + + "\x12enable_mlir_bridge\x18\r \x01(\bR\x10enableMlirBridge\x12f\n" + + "\x13mlir_bridge_rollout\x18\x11 \x01(\x0e26.tensorflow.ConfigProto.Experimental.MlirBridgeRolloutR\x11mlirBridgeRollout\x12C\n" + + "\x1eenable_mlir_graph_optimization\x18\x10 \x01(\bR\x1benableMlirGraphOptimization\x12E\n" + + "\x1fdisable_output_partition_graphs\x18\x0e \x01(\bR\x1cdisableOutputPartitionGraphs\x12=\n" + + "\x1bxla_fusion_autotuner_thresh\x18\x0f \x01(\x03R\x18xlaFusionAutotunerThresh\"{\n" + + "\x11MlirBridgeRollout\x12#\n" + + "\x1fMLIR_BRIDGE_ROLLOUT_UNSPECIFIED\x10\x00\x12\x1f\n" + + "\x1bMLIR_BRIDGE_ROLLOUT_ENABLED\x10\x01\x12 \n" + + "\x1cMLIR_BRIDGE_ROLLOUT_DISABLED\x10\x02J\x04\b\x02\x10\x03\"\xa8\x06\n" + + "\n" + + "RunOptions\x12B\n" + + "\vtrace_level\x18\x01 \x01(\x0e2!.tensorflow.RunOptions.TraceLevelR\n" + + "traceLevel\x12\"\n" + + "\rtimeout_in_ms\x18\x02 \x01(\x03R\vtimeoutInMs\x12/\n" + + "\x14inter_op_thread_pool\x18\x03 \x01(\x05R\x11interOpThreadPool\x126\n" + + "\x17output_partition_graphs\x18\x05 \x01(\bR\x15outputPartitionGraphs\x12=\n" + + "\rdebug_options\x18\x06 \x01(\v2\x18.tensorflow.DebugOptionsR\fdebugOptions\x12J\n" + + "\"report_tensor_allocations_upon_oom\x18\a \x01(\bR\x1ereportTensorAllocationsUponOom\x12G\n" + + "\fexperimental\x18\b \x01(\v2#.tensorflow.RunOptions.ExperimentalR\fexperimental\x1a\x9a\x02\n" + + "\fExperimental\x120\n" + + "\x14collective_graph_key\x18\x01 \x01(\x03R\x12collectiveGraphKey\x12/\n" + + "\x14use_run_handler_pool\x18\x02 \x01(\bR\x11useRunHandlerPool\x12r\n" + + "\x18run_handler_pool_options\x18\x03 \x01(\v29.tensorflow.RunOptions.Experimental.RunHandlerPoolOptionsR\x15runHandlerPoolOptions\x1a3\n" + + "\x15RunHandlerPoolOptions\x12\x1a\n" + + "\bpriority\x18\x01 \x01(\x03R\bpriority\"R\n" + + "\n" + + "TraceLevel\x12\f\n" + + "\bNO_TRACE\x10\x00\x12\x12\n" + + "\x0eSOFTWARE_TRACE\x10\x01\x12\x12\n" + + "\x0eHARDWARE_TRACE\x10\x02\x12\x0e\n" + + "\n" + + "FULL_TRACE\x10\x03J\x04\b\x04\x10\x05\"\xfc\x03\n" + + "\vRunMetadata\x124\n" + + "\n" + + "step_stats\x18\x01 \x01(\v2\x15.tensorflow.StepStatsR\tstepStats\x127\n" + + "\n" + + "cost_graph\x18\x02 \x01(\v2\x18.tensorflow.CostGraphDefR\tcostGraph\x12?\n" + + "\x10partition_graphs\x18\x03 \x03(\v2\x14.tensorflow.GraphDefR\x0fpartitionGraphs\x12O\n" + + "\x0ffunction_graphs\x18\x04 \x03(\v2&.tensorflow.RunMetadata.FunctionGraphsR\x0efunctionGraphs\x1a\xeb\x01\n" + + "\x0eFunctionGraphs\x12?\n" + + "\x10partition_graphs\x18\x01 \x03(\v2\x14.tensorflow.GraphDefR\x0fpartitionGraphs\x12J\n" + + "\x16pre_optimization_graph\x18\x02 \x01(\v2\x14.tensorflow.GraphDefR\x14preOptimizationGraph\x12L\n" + + "\x17post_optimization_graph\x18\x03 \x01(\v2\x14.tensorflow.GraphDefR\x15postOptimizationGraph\"P\n" + + "\x10TensorConnection\x12\x1f\n" + + "\vfrom_tensor\x18\x01 \x01(\tR\n" + + "fromTensor\x12\x1b\n" + + "\tto_tensor\x18\x02 \x01(\tR\btoTensor\"\xa5\x04\n" + + "\x0fCallableOptions\x12\x12\n" + + "\x04feed\x18\x01 \x03(\tR\x04feed\x12\x14\n" + + "\x05fetch\x18\x02 \x03(\tR\x05fetch\x12\x16\n" + + "\x06target\x18\x03 \x03(\tR\x06target\x127\n" + + "\vrun_options\x18\x04 \x01(\v2\x16.tensorflow.RunOptionsR\n" + + "runOptions\x12I\n" + + "\x11tensor_connection\x18\x05 \x03(\v2\x1c.tensorflow.TensorConnectionR\x10tensorConnection\x12O\n" + + "\ffeed_devices\x18\x06 \x03(\v2,.tensorflow.CallableOptions.FeedDevicesEntryR\vfeedDevices\x12R\n" + + "\rfetch_devices\x18\a \x03(\v2-.tensorflow.CallableOptions.FetchDevicesEntryR\ffetchDevices\x12&\n" + + "\x0ffetch_skip_sync\x18\b \x01(\bR\rfetchSkipSync\x1a>\n" + + "\x10FeedDevicesEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\x1a?\n" + + "\x11FetchDevicesEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01B\x84\x01\n" + + "\x18org.tensorflow.frameworkB\fConfigProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_config_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_config_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_config_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_config_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_config_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_config_proto_rawDesc), len(file_tensorflow_core_protobuf_config_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_config_proto_rawDescData +} + +var file_tensorflow_core_protobuf_config_proto_enumTypes = make([]protoimpl.EnumInfo, 4) +var file_tensorflow_core_protobuf_config_proto_msgTypes = make([]protoimpl.MessageInfo, 20) +var file_tensorflow_core_protobuf_config_proto_goTypes = []any{ + (OptimizerOptions_Level)(0), // 0: tensorflow.OptimizerOptions.Level + (OptimizerOptions_GlobalJitLevel)(0), // 1: tensorflow.OptimizerOptions.GlobalJitLevel + (ConfigProto_Experimental_MlirBridgeRollout)(0), // 2: tensorflow.ConfigProto.Experimental.MlirBridgeRollout + (RunOptions_TraceLevel)(0), // 3: tensorflow.RunOptions.TraceLevel + (*GPUOptions)(nil), // 4: tensorflow.GPUOptions + (*OptimizerOptions)(nil), // 5: tensorflow.OptimizerOptions + (*GraphOptions)(nil), // 6: tensorflow.GraphOptions + (*ThreadPoolOptionProto)(nil), // 7: tensorflow.ThreadPoolOptionProto + (*RPCOptions)(nil), // 8: tensorflow.RPCOptions + (*SessionMetadata)(nil), // 9: tensorflow.SessionMetadata + (*ConfigProto)(nil), // 10: tensorflow.ConfigProto + (*RunOptions)(nil), // 11: tensorflow.RunOptions + (*RunMetadata)(nil), // 12: tensorflow.RunMetadata + (*TensorConnection)(nil), // 13: tensorflow.TensorConnection + (*CallableOptions)(nil), // 14: tensorflow.CallableOptions + (*GPUOptions_Experimental)(nil), // 15: tensorflow.GPUOptions.Experimental + (*GPUOptions_Experimental_VirtualDevices)(nil), // 16: tensorflow.GPUOptions.Experimental.VirtualDevices + nil, // 17: tensorflow.ConfigProto.DeviceCountEntry + (*ConfigProto_Experimental)(nil), // 18: tensorflow.ConfigProto.Experimental + (*RunOptions_Experimental)(nil), // 19: tensorflow.RunOptions.Experimental + (*RunOptions_Experimental_RunHandlerPoolOptions)(nil), // 20: tensorflow.RunOptions.Experimental.RunHandlerPoolOptions + (*RunMetadata_FunctionGraphs)(nil), // 21: tensorflow.RunMetadata.FunctionGraphs + nil, // 22: tensorflow.CallableOptions.FeedDevicesEntry + nil, // 23: tensorflow.CallableOptions.FetchDevicesEntry + (*RewriterConfig)(nil), // 24: tensorflow.RewriterConfig + (*ClusterDef)(nil), // 25: tensorflow.ClusterDef + (*DebugOptions)(nil), // 26: tensorflow.DebugOptions + (*step_stats_go_proto.StepStats)(nil), // 27: tensorflow.StepStats + (*cost_graph_go_proto.CostGraphDef)(nil), // 28: tensorflow.CostGraphDef + (*graph_go_proto.GraphDef)(nil), // 29: tensorflow.GraphDef +} +var file_tensorflow_core_protobuf_config_proto_depIdxs = []int32{ + 15, // 0: tensorflow.GPUOptions.experimental:type_name -> tensorflow.GPUOptions.Experimental + 0, // 1: tensorflow.OptimizerOptions.opt_level:type_name -> tensorflow.OptimizerOptions.Level + 1, // 2: tensorflow.OptimizerOptions.global_jit_level:type_name -> tensorflow.OptimizerOptions.GlobalJitLevel + 5, // 3: tensorflow.GraphOptions.optimizer_options:type_name -> tensorflow.OptimizerOptions + 24, // 4: tensorflow.GraphOptions.rewrite_options:type_name -> tensorflow.RewriterConfig + 17, // 5: tensorflow.ConfigProto.device_count:type_name -> tensorflow.ConfigProto.DeviceCountEntry + 7, // 6: tensorflow.ConfigProto.session_inter_op_thread_pool:type_name -> tensorflow.ThreadPoolOptionProto + 4, // 7: tensorflow.ConfigProto.gpu_options:type_name -> tensorflow.GPUOptions + 6, // 8: tensorflow.ConfigProto.graph_options:type_name -> tensorflow.GraphOptions + 8, // 9: tensorflow.ConfigProto.rpc_options:type_name -> tensorflow.RPCOptions + 25, // 10: tensorflow.ConfigProto.cluster_def:type_name -> tensorflow.ClusterDef + 18, // 11: tensorflow.ConfigProto.experimental:type_name -> tensorflow.ConfigProto.Experimental + 3, // 12: tensorflow.RunOptions.trace_level:type_name -> tensorflow.RunOptions.TraceLevel + 26, // 13: tensorflow.RunOptions.debug_options:type_name -> tensorflow.DebugOptions + 19, // 14: tensorflow.RunOptions.experimental:type_name -> tensorflow.RunOptions.Experimental + 27, // 15: tensorflow.RunMetadata.step_stats:type_name -> tensorflow.StepStats + 28, // 16: tensorflow.RunMetadata.cost_graph:type_name -> tensorflow.CostGraphDef + 29, // 17: tensorflow.RunMetadata.partition_graphs:type_name -> tensorflow.GraphDef + 21, // 18: tensorflow.RunMetadata.function_graphs:type_name -> tensorflow.RunMetadata.FunctionGraphs + 11, // 19: tensorflow.CallableOptions.run_options:type_name -> tensorflow.RunOptions + 13, // 20: tensorflow.CallableOptions.tensor_connection:type_name -> tensorflow.TensorConnection + 22, // 21: tensorflow.CallableOptions.feed_devices:type_name -> tensorflow.CallableOptions.FeedDevicesEntry + 23, // 22: tensorflow.CallableOptions.fetch_devices:type_name -> tensorflow.CallableOptions.FetchDevicesEntry + 16, // 23: tensorflow.GPUOptions.Experimental.virtual_devices:type_name -> tensorflow.GPUOptions.Experimental.VirtualDevices + 9, // 24: tensorflow.ConfigProto.Experimental.session_metadata:type_name -> tensorflow.SessionMetadata + 2, // 25: tensorflow.ConfigProto.Experimental.mlir_bridge_rollout:type_name -> tensorflow.ConfigProto.Experimental.MlirBridgeRollout + 20, // 26: tensorflow.RunOptions.Experimental.run_handler_pool_options:type_name -> tensorflow.RunOptions.Experimental.RunHandlerPoolOptions + 29, // 27: tensorflow.RunMetadata.FunctionGraphs.partition_graphs:type_name -> tensorflow.GraphDef + 29, // 28: tensorflow.RunMetadata.FunctionGraphs.pre_optimization_graph:type_name -> tensorflow.GraphDef + 29, // 29: tensorflow.RunMetadata.FunctionGraphs.post_optimization_graph:type_name -> tensorflow.GraphDef + 30, // [30:30] is the sub-list for method output_type + 30, // [30:30] is the sub-list for method input_type + 30, // [30:30] is the sub-list for extension type_name + 30, // [30:30] is the sub-list for extension extendee + 0, // [0:30] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_config_proto_init() } +func file_tensorflow_core_protobuf_config_proto_init() { + if File_tensorflow_core_protobuf_config_proto != nil { + return + } + file_tensorflow_core_protobuf_cluster_proto_init() + file_tensorflow_core_protobuf_debug_proto_init() + file_tensorflow_core_protobuf_rewriter_config_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_config_proto_rawDesc), len(file_tensorflow_core_protobuf_config_proto_rawDesc)), + NumEnums: 4, + NumMessages: 20, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_config_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_config_proto_depIdxs, + EnumInfos: file_tensorflow_core_protobuf_config_proto_enumTypes, + MessageInfos: file_tensorflow_core_protobuf_config_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_config_proto = out.File + file_tensorflow_core_protobuf_config_proto_goTypes = nil + file_tensorflow_core_protobuf_config_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/control_flow.pb.go b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/control_flow.pb.go new file mode 100644 index 0000000..af927f9 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/control_flow.pb.go @@ -0,0 +1,505 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/control_flow.proto + +package for_core_protos_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Protocol buffer representing the values in ControlFlowContext. +type ValuesDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Value names that have been seen in this context. + Values []string `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"` + // Value names referenced by but external to this context. + ExternalValues map[string]string `protobuf:"bytes,2,rep,name=external_values,json=externalValues,proto3" json:"external_values,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ValuesDef) Reset() { + *x = ValuesDef{} + mi := &file_tensorflow_core_protobuf_control_flow_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ValuesDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ValuesDef) ProtoMessage() {} + +func (x *ValuesDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_control_flow_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ValuesDef.ProtoReflect.Descriptor instead. +func (*ValuesDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_control_flow_proto_rawDescGZIP(), []int{0} +} + +func (x *ValuesDef) GetValues() []string { + if x != nil { + return x.Values + } + return nil +} + +func (x *ValuesDef) GetExternalValues() map[string]string { + if x != nil { + return x.ExternalValues + } + return nil +} + +// Container for any kind of control flow context. Any other control flow +// contexts that are added below should also be added here. +type ControlFlowContextDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Ctxt: + // + // *ControlFlowContextDef_CondCtxt + // *ControlFlowContextDef_WhileCtxt + Ctxt isControlFlowContextDef_Ctxt `protobuf_oneof:"ctxt"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ControlFlowContextDef) Reset() { + *x = ControlFlowContextDef{} + mi := &file_tensorflow_core_protobuf_control_flow_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ControlFlowContextDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ControlFlowContextDef) ProtoMessage() {} + +func (x *ControlFlowContextDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_control_flow_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ControlFlowContextDef.ProtoReflect.Descriptor instead. +func (*ControlFlowContextDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_control_flow_proto_rawDescGZIP(), []int{1} +} + +func (x *ControlFlowContextDef) GetCtxt() isControlFlowContextDef_Ctxt { + if x != nil { + return x.Ctxt + } + return nil +} + +func (x *ControlFlowContextDef) GetCondCtxt() *CondContextDef { + if x != nil { + if x, ok := x.Ctxt.(*ControlFlowContextDef_CondCtxt); ok { + return x.CondCtxt + } + } + return nil +} + +func (x *ControlFlowContextDef) GetWhileCtxt() *WhileContextDef { + if x != nil { + if x, ok := x.Ctxt.(*ControlFlowContextDef_WhileCtxt); ok { + return x.WhileCtxt + } + } + return nil +} + +type isControlFlowContextDef_Ctxt interface { + isControlFlowContextDef_Ctxt() +} + +type ControlFlowContextDef_CondCtxt struct { + CondCtxt *CondContextDef `protobuf:"bytes,1,opt,name=cond_ctxt,json=condCtxt,proto3,oneof"` +} + +type ControlFlowContextDef_WhileCtxt struct { + WhileCtxt *WhileContextDef `protobuf:"bytes,2,opt,name=while_ctxt,json=whileCtxt,proto3,oneof"` +} + +func (*ControlFlowContextDef_CondCtxt) isControlFlowContextDef_Ctxt() {} + +func (*ControlFlowContextDef_WhileCtxt) isControlFlowContextDef_Ctxt() {} + +// Protocol buffer representing a CondContext object. +type CondContextDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Name of the context. + ContextName string `protobuf:"bytes,1,opt,name=context_name,json=contextName,proto3" json:"context_name,omitempty"` + // Name of the pred tensor. + PredName string `protobuf:"bytes,2,opt,name=pred_name,json=predName,proto3" json:"pred_name,omitempty"` + // Name of the pivot tensor. + PivotName string `protobuf:"bytes,3,opt,name=pivot_name,json=pivotName,proto3" json:"pivot_name,omitempty"` + // Branch prediction. 0 or 1. + Branch int32 `protobuf:"varint,4,opt,name=branch,proto3" json:"branch,omitempty"` + // Values and external values in control flow context. + ValuesDef *ValuesDef `protobuf:"bytes,5,opt,name=values_def,json=valuesDef,proto3" json:"values_def,omitempty"` + // Contexts contained inside this context (e.g. nested conds). + NestedContexts []*ControlFlowContextDef `protobuf:"bytes,6,rep,name=nested_contexts,json=nestedContexts,proto3" json:"nested_contexts,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CondContextDef) Reset() { + *x = CondContextDef{} + mi := &file_tensorflow_core_protobuf_control_flow_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CondContextDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CondContextDef) ProtoMessage() {} + +func (x *CondContextDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_control_flow_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CondContextDef.ProtoReflect.Descriptor instead. +func (*CondContextDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_control_flow_proto_rawDescGZIP(), []int{2} +} + +func (x *CondContextDef) GetContextName() string { + if x != nil { + return x.ContextName + } + return "" +} + +func (x *CondContextDef) GetPredName() string { + if x != nil { + return x.PredName + } + return "" +} + +func (x *CondContextDef) GetPivotName() string { + if x != nil { + return x.PivotName + } + return "" +} + +func (x *CondContextDef) GetBranch() int32 { + if x != nil { + return x.Branch + } + return 0 +} + +func (x *CondContextDef) GetValuesDef() *ValuesDef { + if x != nil { + return x.ValuesDef + } + return nil +} + +func (x *CondContextDef) GetNestedContexts() []*ControlFlowContextDef { + if x != nil { + return x.NestedContexts + } + return nil +} + +// Protocol buffer representing a WhileContext object. +type WhileContextDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Name of the context. + ContextName string `protobuf:"bytes,1,opt,name=context_name,json=contextName,proto3" json:"context_name,omitempty"` + // The number of iterations allowed to run in parallel. + ParallelIterations int32 `protobuf:"varint,2,opt,name=parallel_iterations,json=parallelIterations,proto3" json:"parallel_iterations,omitempty"` + // Whether backprop is enabled for this while loop. + BackProp bool `protobuf:"varint,3,opt,name=back_prop,json=backProp,proto3" json:"back_prop,omitempty"` + // Whether GPU-CPU memory swap is enabled for this loop. + SwapMemory bool `protobuf:"varint,4,opt,name=swap_memory,json=swapMemory,proto3" json:"swap_memory,omitempty"` + // Name of the pivot tensor. + PivotName string `protobuf:"bytes,5,opt,name=pivot_name,json=pivotName,proto3" json:"pivot_name,omitempty"` + // Name of the pivot_for_pred tensor. + PivotForPredName string `protobuf:"bytes,6,opt,name=pivot_for_pred_name,json=pivotForPredName,proto3" json:"pivot_for_pred_name,omitempty"` + // Name of the pivot_for_body tensor. + PivotForBodyName string `protobuf:"bytes,7,opt,name=pivot_for_body_name,json=pivotForBodyName,proto3" json:"pivot_for_body_name,omitempty"` + // List of names for exit tensors. + LoopExitNames []string `protobuf:"bytes,8,rep,name=loop_exit_names,json=loopExitNames,proto3" json:"loop_exit_names,omitempty"` + // List of names for enter tensors. + LoopEnterNames []string `protobuf:"bytes,10,rep,name=loop_enter_names,json=loopEnterNames,proto3" json:"loop_enter_names,omitempty"` + // Values and external values in control flow context. + ValuesDef *ValuesDef `protobuf:"bytes,9,opt,name=values_def,json=valuesDef,proto3" json:"values_def,omitempty"` + // Optional name of the maximum_iterations tensor. + MaximumIterationsName string `protobuf:"bytes,11,opt,name=maximum_iterations_name,json=maximumIterationsName,proto3" json:"maximum_iterations_name,omitempty"` + // Contexts contained inside this context (e.g. nested whiles). + NestedContexts []*ControlFlowContextDef `protobuf:"bytes,12,rep,name=nested_contexts,json=nestedContexts,proto3" json:"nested_contexts,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *WhileContextDef) Reset() { + *x = WhileContextDef{} + mi := &file_tensorflow_core_protobuf_control_flow_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *WhileContextDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WhileContextDef) ProtoMessage() {} + +func (x *WhileContextDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_control_flow_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WhileContextDef.ProtoReflect.Descriptor instead. +func (*WhileContextDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_control_flow_proto_rawDescGZIP(), []int{3} +} + +func (x *WhileContextDef) GetContextName() string { + if x != nil { + return x.ContextName + } + return "" +} + +func (x *WhileContextDef) GetParallelIterations() int32 { + if x != nil { + return x.ParallelIterations + } + return 0 +} + +func (x *WhileContextDef) GetBackProp() bool { + if x != nil { + return x.BackProp + } + return false +} + +func (x *WhileContextDef) GetSwapMemory() bool { + if x != nil { + return x.SwapMemory + } + return false +} + +func (x *WhileContextDef) GetPivotName() string { + if x != nil { + return x.PivotName + } + return "" +} + +func (x *WhileContextDef) GetPivotForPredName() string { + if x != nil { + return x.PivotForPredName + } + return "" +} + +func (x *WhileContextDef) GetPivotForBodyName() string { + if x != nil { + return x.PivotForBodyName + } + return "" +} + +func (x *WhileContextDef) GetLoopExitNames() []string { + if x != nil { + return x.LoopExitNames + } + return nil +} + +func (x *WhileContextDef) GetLoopEnterNames() []string { + if x != nil { + return x.LoopEnterNames + } + return nil +} + +func (x *WhileContextDef) GetValuesDef() *ValuesDef { + if x != nil { + return x.ValuesDef + } + return nil +} + +func (x *WhileContextDef) GetMaximumIterationsName() string { + if x != nil { + return x.MaximumIterationsName + } + return "" +} + +func (x *WhileContextDef) GetNestedContexts() []*ControlFlowContextDef { + if x != nil { + return x.NestedContexts + } + return nil +} + +var File_tensorflow_core_protobuf_control_flow_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_control_flow_proto_rawDesc = "" + + "\n" + + "+tensorflow/core/protobuf/control_flow.proto\x12\n" + + "tensorflow\"\xba\x01\n" + + "\tValuesDef\x12\x16\n" + + "\x06values\x18\x01 \x03(\tR\x06values\x12R\n" + + "\x0fexternal_values\x18\x02 \x03(\v2).tensorflow.ValuesDef.ExternalValuesEntryR\x0eexternalValues\x1aA\n" + + "\x13ExternalValuesEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\x98\x01\n" + + "\x15ControlFlowContextDef\x129\n" + + "\tcond_ctxt\x18\x01 \x01(\v2\x1a.tensorflow.CondContextDefH\x00R\bcondCtxt\x12<\n" + + "\n" + + "while_ctxt\x18\x02 \x01(\v2\x1b.tensorflow.WhileContextDefH\x00R\twhileCtxtB\x06\n" + + "\x04ctxt\"\x89\x02\n" + + "\x0eCondContextDef\x12!\n" + + "\fcontext_name\x18\x01 \x01(\tR\vcontextName\x12\x1b\n" + + "\tpred_name\x18\x02 \x01(\tR\bpredName\x12\x1d\n" + + "\n" + + "pivot_name\x18\x03 \x01(\tR\tpivotName\x12\x16\n" + + "\x06branch\x18\x04 \x01(\x05R\x06branch\x124\n" + + "\n" + + "values_def\x18\x05 \x01(\v2\x15.tensorflow.ValuesDefR\tvaluesDef\x12J\n" + + "\x0fnested_contexts\x18\x06 \x03(\v2!.tensorflow.ControlFlowContextDefR\x0enestedContexts\"\xac\x04\n" + + "\x0fWhileContextDef\x12!\n" + + "\fcontext_name\x18\x01 \x01(\tR\vcontextName\x12/\n" + + "\x13parallel_iterations\x18\x02 \x01(\x05R\x12parallelIterations\x12\x1b\n" + + "\tback_prop\x18\x03 \x01(\bR\bbackProp\x12\x1f\n" + + "\vswap_memory\x18\x04 \x01(\bR\n" + + "swapMemory\x12\x1d\n" + + "\n" + + "pivot_name\x18\x05 \x01(\tR\tpivotName\x12-\n" + + "\x13pivot_for_pred_name\x18\x06 \x01(\tR\x10pivotForPredName\x12-\n" + + "\x13pivot_for_body_name\x18\a \x01(\tR\x10pivotForBodyName\x12&\n" + + "\x0floop_exit_names\x18\b \x03(\tR\rloopExitNames\x12(\n" + + "\x10loop_enter_names\x18\n" + + " \x03(\tR\x0eloopEnterNames\x124\n" + + "\n" + + "values_def\x18\t \x01(\v2\x15.tensorflow.ValuesDefR\tvaluesDef\x126\n" + + "\x17maximum_iterations_name\x18\v \x01(\tR\x15maximumIterationsName\x12J\n" + + "\x0fnested_contexts\x18\f \x03(\v2!.tensorflow.ControlFlowContextDefR\x0enestedContextsB\x89\x01\n" + + "\x18org.tensorflow.frameworkB\x11ControlFlowProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_control_flow_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_control_flow_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_control_flow_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_control_flow_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_control_flow_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_control_flow_proto_rawDesc), len(file_tensorflow_core_protobuf_control_flow_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_control_flow_proto_rawDescData +} + +var file_tensorflow_core_protobuf_control_flow_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_tensorflow_core_protobuf_control_flow_proto_goTypes = []any{ + (*ValuesDef)(nil), // 0: tensorflow.ValuesDef + (*ControlFlowContextDef)(nil), // 1: tensorflow.ControlFlowContextDef + (*CondContextDef)(nil), // 2: tensorflow.CondContextDef + (*WhileContextDef)(nil), // 3: tensorflow.WhileContextDef + nil, // 4: tensorflow.ValuesDef.ExternalValuesEntry +} +var file_tensorflow_core_protobuf_control_flow_proto_depIdxs = []int32{ + 4, // 0: tensorflow.ValuesDef.external_values:type_name -> tensorflow.ValuesDef.ExternalValuesEntry + 2, // 1: tensorflow.ControlFlowContextDef.cond_ctxt:type_name -> tensorflow.CondContextDef + 3, // 2: tensorflow.ControlFlowContextDef.while_ctxt:type_name -> tensorflow.WhileContextDef + 0, // 3: tensorflow.CondContextDef.values_def:type_name -> tensorflow.ValuesDef + 1, // 4: tensorflow.CondContextDef.nested_contexts:type_name -> tensorflow.ControlFlowContextDef + 0, // 5: tensorflow.WhileContextDef.values_def:type_name -> tensorflow.ValuesDef + 1, // 6: tensorflow.WhileContextDef.nested_contexts:type_name -> tensorflow.ControlFlowContextDef + 7, // [7:7] is the sub-list for method output_type + 7, // [7:7] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_control_flow_proto_init() } +func file_tensorflow_core_protobuf_control_flow_proto_init() { + if File_tensorflow_core_protobuf_control_flow_proto != nil { + return + } + file_tensorflow_core_protobuf_control_flow_proto_msgTypes[1].OneofWrappers = []any{ + (*ControlFlowContextDef_CondCtxt)(nil), + (*ControlFlowContextDef_WhileCtxt)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_control_flow_proto_rawDesc), len(file_tensorflow_core_protobuf_control_flow_proto_rawDesc)), + NumEnums: 0, + NumMessages: 5, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_control_flow_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_control_flow_proto_depIdxs, + MessageInfos: file_tensorflow_core_protobuf_control_flow_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_control_flow_proto = out.File + file_tensorflow_core_protobuf_control_flow_proto_goTypes = nil + file_tensorflow_core_protobuf_control_flow_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/conv_autotuning.pb.go b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/conv_autotuning.pb.go new file mode 100644 index 0000000..81d033e --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/conv_autotuning.pb.go @@ -0,0 +1,254 @@ +// This is used for convolution logging. Also see +// tensorflow/core/protobuf/autotuing.h + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/conv_autotuning.proto + +package for_core_protos_go_proto + +import ( + stream_executor "github.com/tensorflow/tensorflow/tensorflow/go/stream_executor" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// A convolution. Currently it's only used for logging. In the future, we may +// want to use it in the API as well. +type ConvolutionProto struct { + state protoimpl.MessageState `protogen:"open.v1"` + Kind stream_executor.ConvolutionKind `protobuf:"varint,1,opt,name=kind,proto3,enum=stream_executor.dnn.ConvolutionKind" json:"kind,omitempty"` + Input *stream_executor.TensorDescriptorProto `protobuf:"bytes,2,opt,name=input,proto3" json:"input,omitempty"` + Filter *stream_executor.TensorDescriptorProto `protobuf:"bytes,3,opt,name=filter,proto3" json:"filter,omitempty"` + Output *stream_executor.TensorDescriptorProto `protobuf:"bytes,4,opt,name=output,proto3" json:"output,omitempty"` + ConvDesc *stream_executor.ConvolutionDescriptorProto `protobuf:"bytes,5,opt,name=conv_desc,json=convDesc,proto3" json:"conv_desc,omitempty"` + // result = conv_scale * conv(...) + side_value_scale * side_value. + // side_value is an arbitrary buffer if activation is not none. Otherwise, it + // has to be the result buffer (using its old values). + ConvScale float64 `protobuf:"fixed64,6,opt,name=conv_scale,json=convScale,proto3" json:"conv_scale,omitempty"` + SideValueScale float64 `protobuf:"fixed64,7,opt,name=side_value_scale,json=sideValueScale,proto3" json:"side_value_scale,omitempty"` + Activation stream_executor.ActivationMode `protobuf:"varint,8,opt,name=activation,proto3,enum=stream_executor.dnn.ActivationMode" json:"activation,omitempty"` + InputAddress int64 `protobuf:"varint,9,opt,name=input_address,json=inputAddress,proto3" json:"input_address,omitempty"` + FilterAddress int64 `protobuf:"varint,10,opt,name=filter_address,json=filterAddress,proto3" json:"filter_address,omitempty"` + OutputAddress int64 `protobuf:"varint,11,opt,name=output_address,json=outputAddress,proto3" json:"output_address,omitempty"` + BiasAddress int64 `protobuf:"varint,12,opt,name=bias_address,json=biasAddress,proto3" json:"bias_address,omitempty"` + SideInputAddress int64 `protobuf:"varint,13,opt,name=side_input_address,json=sideInputAddress,proto3" json:"side_input_address,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ConvolutionProto) Reset() { + *x = ConvolutionProto{} + mi := &file_tensorflow_core_protobuf_conv_autotuning_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ConvolutionProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConvolutionProto) ProtoMessage() {} + +func (x *ConvolutionProto) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_conv_autotuning_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConvolutionProto.ProtoReflect.Descriptor instead. +func (*ConvolutionProto) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_conv_autotuning_proto_rawDescGZIP(), []int{0} +} + +func (x *ConvolutionProto) GetKind() stream_executor.ConvolutionKind { + if x != nil { + return x.Kind + } + return stream_executor.ConvolutionKind(0) +} + +func (x *ConvolutionProto) GetInput() *stream_executor.TensorDescriptorProto { + if x != nil { + return x.Input + } + return nil +} + +func (x *ConvolutionProto) GetFilter() *stream_executor.TensorDescriptorProto { + if x != nil { + return x.Filter + } + return nil +} + +func (x *ConvolutionProto) GetOutput() *stream_executor.TensorDescriptorProto { + if x != nil { + return x.Output + } + return nil +} + +func (x *ConvolutionProto) GetConvDesc() *stream_executor.ConvolutionDescriptorProto { + if x != nil { + return x.ConvDesc + } + return nil +} + +func (x *ConvolutionProto) GetConvScale() float64 { + if x != nil { + return x.ConvScale + } + return 0 +} + +func (x *ConvolutionProto) GetSideValueScale() float64 { + if x != nil { + return x.SideValueScale + } + return 0 +} + +func (x *ConvolutionProto) GetActivation() stream_executor.ActivationMode { + if x != nil { + return x.Activation + } + return stream_executor.ActivationMode(0) +} + +func (x *ConvolutionProto) GetInputAddress() int64 { + if x != nil { + return x.InputAddress + } + return 0 +} + +func (x *ConvolutionProto) GetFilterAddress() int64 { + if x != nil { + return x.FilterAddress + } + return 0 +} + +func (x *ConvolutionProto) GetOutputAddress() int64 { + if x != nil { + return x.OutputAddress + } + return 0 +} + +func (x *ConvolutionProto) GetBiasAddress() int64 { + if x != nil { + return x.BiasAddress + } + return 0 +} + +func (x *ConvolutionProto) GetSideInputAddress() int64 { + if x != nil { + return x.SideInputAddress + } + return 0 +} + +var File_tensorflow_core_protobuf_conv_autotuning_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_conv_autotuning_proto_rawDesc = "" + + "\n" + + ".tensorflow/core/protobuf/conv_autotuning.proto\x12\n" + + "tensorflow\x1a$tensorflow/stream_executor/dnn.proto\"\xb6\x05\n" + + "\x10ConvolutionProto\x128\n" + + "\x04kind\x18\x01 \x01(\x0e2$.stream_executor.dnn.ConvolutionKindR\x04kind\x12@\n" + + "\x05input\x18\x02 \x01(\v2*.stream_executor.dnn.TensorDescriptorProtoR\x05input\x12B\n" + + "\x06filter\x18\x03 \x01(\v2*.stream_executor.dnn.TensorDescriptorProtoR\x06filter\x12B\n" + + "\x06output\x18\x04 \x01(\v2*.stream_executor.dnn.TensorDescriptorProtoR\x06output\x12L\n" + + "\tconv_desc\x18\x05 \x01(\v2/.stream_executor.dnn.ConvolutionDescriptorProtoR\bconvDesc\x12\x1d\n" + + "\n" + + "conv_scale\x18\x06 \x01(\x01R\tconvScale\x12(\n" + + "\x10side_value_scale\x18\a \x01(\x01R\x0esideValueScale\x12C\n" + + "\n" + + "activation\x18\b \x01(\x0e2#.stream_executor.dnn.ActivationModeR\n" + + "activation\x12#\n" + + "\rinput_address\x18\t \x01(\x03R\finputAddress\x12%\n" + + "\x0efilter_address\x18\n" + + " \x01(\x03R\rfilterAddress\x12%\n" + + "\x0eoutput_address\x18\v \x01(\x03R\routputAddress\x12!\n" + + "\fbias_address\x18\f \x01(\x03R\vbiasAddress\x12,\n" + + "\x12side_input_address\x18\r \x01(\x03R\x10sideInputAddressBWZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_protob\x06proto3" + +var ( + file_tensorflow_core_protobuf_conv_autotuning_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_conv_autotuning_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_conv_autotuning_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_conv_autotuning_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_conv_autotuning_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_conv_autotuning_proto_rawDesc), len(file_tensorflow_core_protobuf_conv_autotuning_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_conv_autotuning_proto_rawDescData +} + +var file_tensorflow_core_protobuf_conv_autotuning_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_tensorflow_core_protobuf_conv_autotuning_proto_goTypes = []any{ + (*ConvolutionProto)(nil), // 0: tensorflow.ConvolutionProto + (stream_executor.ConvolutionKind)(0), // 1: stream_executor.dnn.ConvolutionKind + (*stream_executor.TensorDescriptorProto)(nil), // 2: stream_executor.dnn.TensorDescriptorProto + (*stream_executor.ConvolutionDescriptorProto)(nil), // 3: stream_executor.dnn.ConvolutionDescriptorProto + (stream_executor.ActivationMode)(0), // 4: stream_executor.dnn.ActivationMode +} +var file_tensorflow_core_protobuf_conv_autotuning_proto_depIdxs = []int32{ + 1, // 0: tensorflow.ConvolutionProto.kind:type_name -> stream_executor.dnn.ConvolutionKind + 2, // 1: tensorflow.ConvolutionProto.input:type_name -> stream_executor.dnn.TensorDescriptorProto + 2, // 2: tensorflow.ConvolutionProto.filter:type_name -> stream_executor.dnn.TensorDescriptorProto + 2, // 3: tensorflow.ConvolutionProto.output:type_name -> stream_executor.dnn.TensorDescriptorProto + 3, // 4: tensorflow.ConvolutionProto.conv_desc:type_name -> stream_executor.dnn.ConvolutionDescriptorProto + 4, // 5: tensorflow.ConvolutionProto.activation:type_name -> stream_executor.dnn.ActivationMode + 6, // [6:6] is the sub-list for method output_type + 6, // [6:6] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_conv_autotuning_proto_init() } +func file_tensorflow_core_protobuf_conv_autotuning_proto_init() { + if File_tensorflow_core_protobuf_conv_autotuning_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_conv_autotuning_proto_rawDesc), len(file_tensorflow_core_protobuf_conv_autotuning_proto_rawDesc)), + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_conv_autotuning_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_conv_autotuning_proto_depIdxs, + MessageInfos: file_tensorflow_core_protobuf_conv_autotuning_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_conv_autotuning_proto = out.File + file_tensorflow_core_protobuf_conv_autotuning_proto_goTypes = nil + file_tensorflow_core_protobuf_conv_autotuning_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/critical_section.pb.go b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/critical_section.pb.go new file mode 100644 index 0000000..be27b5e --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/critical_section.pb.go @@ -0,0 +1,186 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/critical_section.proto + +package for_core_protos_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Protocol buffer representing a CriticalSection. +type CriticalSectionDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Name of the critical section handle. + CriticalSectionName string `protobuf:"bytes,1,opt,name=critical_section_name,json=criticalSectionName,proto3" json:"critical_section_name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CriticalSectionDef) Reset() { + *x = CriticalSectionDef{} + mi := &file_tensorflow_core_protobuf_critical_section_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CriticalSectionDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CriticalSectionDef) ProtoMessage() {} + +func (x *CriticalSectionDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_critical_section_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CriticalSectionDef.ProtoReflect.Descriptor instead. +func (*CriticalSectionDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_critical_section_proto_rawDescGZIP(), []int{0} +} + +func (x *CriticalSectionDef) GetCriticalSectionName() string { + if x != nil { + return x.CriticalSectionName + } + return "" +} + +// Protocol buffer representing a CriticalSection execution. +type CriticalSectionExecutionDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Name of the critical section handle. + ExecuteInCriticalSectionName string `protobuf:"bytes,1,opt,name=execute_in_critical_section_name,json=executeInCriticalSectionName,proto3" json:"execute_in_critical_section_name,omitempty"` + // Whether this operation requires exclusive access to its resources, + // (i.e., no other CriticalSections may request the same resources). + ExclusiveResourceAccess bool `protobuf:"varint,2,opt,name=exclusive_resource_access,json=exclusiveResourceAccess,proto3" json:"exclusive_resource_access,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CriticalSectionExecutionDef) Reset() { + *x = CriticalSectionExecutionDef{} + mi := &file_tensorflow_core_protobuf_critical_section_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CriticalSectionExecutionDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CriticalSectionExecutionDef) ProtoMessage() {} + +func (x *CriticalSectionExecutionDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_critical_section_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CriticalSectionExecutionDef.ProtoReflect.Descriptor instead. +func (*CriticalSectionExecutionDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_critical_section_proto_rawDescGZIP(), []int{1} +} + +func (x *CriticalSectionExecutionDef) GetExecuteInCriticalSectionName() string { + if x != nil { + return x.ExecuteInCriticalSectionName + } + return "" +} + +func (x *CriticalSectionExecutionDef) GetExclusiveResourceAccess() bool { + if x != nil { + return x.ExclusiveResourceAccess + } + return false +} + +var File_tensorflow_core_protobuf_critical_section_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_critical_section_proto_rawDesc = "" + + "\n" + + "/tensorflow/core/protobuf/critical_section.proto\x12\n" + + "tensorflow\"H\n" + + "\x12CriticalSectionDef\x122\n" + + "\x15critical_section_name\x18\x01 \x01(\tR\x13criticalSectionName\"\xa1\x01\n" + + "\x1bCriticalSectionExecutionDef\x12F\n" + + " execute_in_critical_section_name\x18\x01 \x01(\tR\x1cexecuteInCriticalSectionName\x12:\n" + + "\x19exclusive_resource_access\x18\x02 \x01(\bR\x17exclusiveResourceAccessB\x8d\x01\n" + + "\x18org.tensorflow.frameworkB\x15CriticalSectionProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_critical_section_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_critical_section_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_critical_section_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_critical_section_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_critical_section_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_critical_section_proto_rawDesc), len(file_tensorflow_core_protobuf_critical_section_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_critical_section_proto_rawDescData +} + +var file_tensorflow_core_protobuf_critical_section_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_tensorflow_core_protobuf_critical_section_proto_goTypes = []any{ + (*CriticalSectionDef)(nil), // 0: tensorflow.CriticalSectionDef + (*CriticalSectionExecutionDef)(nil), // 1: tensorflow.CriticalSectionExecutionDef +} +var file_tensorflow_core_protobuf_critical_section_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_critical_section_proto_init() } +func file_tensorflow_core_protobuf_critical_section_proto_init() { + if File_tensorflow_core_protobuf_critical_section_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_critical_section_proto_rawDesc), len(file_tensorflow_core_protobuf_critical_section_proto_rawDesc)), + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_critical_section_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_critical_section_proto_depIdxs, + MessageInfos: file_tensorflow_core_protobuf_critical_section_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_critical_section_proto = out.File + file_tensorflow_core_protobuf_critical_section_proto_goTypes = nil + file_tensorflow_core_protobuf_critical_section_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/debug.pb.go b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/debug.pb.go new file mode 100644 index 0000000..f6c4cf4 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/debug.pb.go @@ -0,0 +1,410 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/debug.proto + +package for_core_protos_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Option for watching a node in TensorFlow Debugger (tfdbg). +type DebugTensorWatch struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Name of the node to watch. + // Use "*" for wildcard. But note: currently, regex is not supported in + // general. + NodeName string `protobuf:"bytes,1,opt,name=node_name,json=nodeName,proto3" json:"node_name,omitempty"` + // Output slot to watch. + // The semantics of output_slot == -1 is that all outputs of the node + // will be watched (i.e., a wildcard). + // Other negative values of output_slot are invalid and will lead to + // errors currently. + OutputSlot int32 `protobuf:"varint,2,opt,name=output_slot,json=outputSlot,proto3" json:"output_slot,omitempty"` + // Name(s) of the debugging op(s). + // One or more than one probes on a tensor. + // e.g., {"DebugIdentity", "DebugNanCount"} + DebugOps []string `protobuf:"bytes,3,rep,name=debug_ops,json=debugOps,proto3" json:"debug_ops,omitempty"` + // URL(s) for debug targets(s). + // + // Supported URL formats are: + // - file:///foo/tfdbg_dump: Writes out Event content to file + // /foo/tfdbg_dump. Assumes all directories can be created if they don't + // already exist. + // - grpc://localhost:11011: Sends an RPC request to an EventListener + // service running at localhost:11011 with the event. + // - memcbk:///event_key: Routes tensors to clients using the + // callback registered with the DebugCallbackRegistry for event_key. + // + // Each debug op listed in debug_ops will publish its output tensor (debug + // signal) to all URLs in debug_urls. + // + // N.B. Session::Run() supports concurrent invocations of the same inputs + // (feed keys), outputs and target nodes. If such concurrent invocations + // are to be debugged, the callers of Session::Run() must use distinct + // debug_urls to make sure that the streamed or dumped events do not overlap + // among the invocations. + // TODO(cais): More visible documentation of this in g3docs. + DebugUrls []string `protobuf:"bytes,4,rep,name=debug_urls,json=debugUrls,proto3" json:"debug_urls,omitempty"` + // Do not error out if debug op creation fails (e.g., due to dtype + // incompatibility). Instead, just log the failure. + TolerateDebugOpCreationFailures bool `protobuf:"varint,5,opt,name=tolerate_debug_op_creation_failures,json=tolerateDebugOpCreationFailures,proto3" json:"tolerate_debug_op_creation_failures,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DebugTensorWatch) Reset() { + *x = DebugTensorWatch{} + mi := &file_tensorflow_core_protobuf_debug_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DebugTensorWatch) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DebugTensorWatch) ProtoMessage() {} + +func (x *DebugTensorWatch) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_debug_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DebugTensorWatch.ProtoReflect.Descriptor instead. +func (*DebugTensorWatch) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_debug_proto_rawDescGZIP(), []int{0} +} + +func (x *DebugTensorWatch) GetNodeName() string { + if x != nil { + return x.NodeName + } + return "" +} + +func (x *DebugTensorWatch) GetOutputSlot() int32 { + if x != nil { + return x.OutputSlot + } + return 0 +} + +func (x *DebugTensorWatch) GetDebugOps() []string { + if x != nil { + return x.DebugOps + } + return nil +} + +func (x *DebugTensorWatch) GetDebugUrls() []string { + if x != nil { + return x.DebugUrls + } + return nil +} + +func (x *DebugTensorWatch) GetTolerateDebugOpCreationFailures() bool { + if x != nil { + return x.TolerateDebugOpCreationFailures + } + return false +} + +// Options for initializing DebuggerState in TensorFlow Debugger (tfdbg). +type DebugOptions struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Debugging options + DebugTensorWatchOpts []*DebugTensorWatch `protobuf:"bytes,4,rep,name=debug_tensor_watch_opts,json=debugTensorWatchOpts,proto3" json:"debug_tensor_watch_opts,omitempty"` + // Caller-specified global step count. + // Note that this is distinct from the session run count and the executor + // step count. + GlobalStep int64 `protobuf:"varint,10,opt,name=global_step,json=globalStep,proto3" json:"global_step,omitempty"` + // Whether the total disk usage of tfdbg is to be reset to zero + // in this Session.run call. This is used by wrappers and hooks + // such as the local CLI ones to indicate that the dumped tensors + // are cleaned up from the disk after each Session.run. + ResetDiskByteUsage bool `protobuf:"varint,11,opt,name=reset_disk_byte_usage,json=resetDiskByteUsage,proto3" json:"reset_disk_byte_usage,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DebugOptions) Reset() { + *x = DebugOptions{} + mi := &file_tensorflow_core_protobuf_debug_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DebugOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DebugOptions) ProtoMessage() {} + +func (x *DebugOptions) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_debug_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DebugOptions.ProtoReflect.Descriptor instead. +func (*DebugOptions) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_debug_proto_rawDescGZIP(), []int{1} +} + +func (x *DebugOptions) GetDebugTensorWatchOpts() []*DebugTensorWatch { + if x != nil { + return x.DebugTensorWatchOpts + } + return nil +} + +func (x *DebugOptions) GetGlobalStep() int64 { + if x != nil { + return x.GlobalStep + } + return 0 +} + +func (x *DebugOptions) GetResetDiskByteUsage() bool { + if x != nil { + return x.ResetDiskByteUsage + } + return false +} + +type DebuggedSourceFile struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The host name on which a source code file is located. + Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"` + // Path to the source code file. + FilePath string `protobuf:"bytes,2,opt,name=file_path,json=filePath,proto3" json:"file_path,omitempty"` + // The timestamp at which the source code file is last modified. + LastModified int64 `protobuf:"varint,3,opt,name=last_modified,json=lastModified,proto3" json:"last_modified,omitempty"` + // Byte size of the file. + Bytes int64 `protobuf:"varint,4,opt,name=bytes,proto3" json:"bytes,omitempty"` + // Line-by-line content of the source code file. + Lines []string `protobuf:"bytes,5,rep,name=lines,proto3" json:"lines,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DebuggedSourceFile) Reset() { + *x = DebuggedSourceFile{} + mi := &file_tensorflow_core_protobuf_debug_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DebuggedSourceFile) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DebuggedSourceFile) ProtoMessage() {} + +func (x *DebuggedSourceFile) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_debug_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DebuggedSourceFile.ProtoReflect.Descriptor instead. +func (*DebuggedSourceFile) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_debug_proto_rawDescGZIP(), []int{2} +} + +func (x *DebuggedSourceFile) GetHost() string { + if x != nil { + return x.Host + } + return "" +} + +func (x *DebuggedSourceFile) GetFilePath() string { + if x != nil { + return x.FilePath + } + return "" +} + +func (x *DebuggedSourceFile) GetLastModified() int64 { + if x != nil { + return x.LastModified + } + return 0 +} + +func (x *DebuggedSourceFile) GetBytes() int64 { + if x != nil { + return x.Bytes + } + return 0 +} + +func (x *DebuggedSourceFile) GetLines() []string { + if x != nil { + return x.Lines + } + return nil +} + +type DebuggedSourceFiles struct { + state protoimpl.MessageState `protogen:"open.v1"` + // A collection of source code files. + SourceFiles []*DebuggedSourceFile `protobuf:"bytes,1,rep,name=source_files,json=sourceFiles,proto3" json:"source_files,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DebuggedSourceFiles) Reset() { + *x = DebuggedSourceFiles{} + mi := &file_tensorflow_core_protobuf_debug_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DebuggedSourceFiles) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DebuggedSourceFiles) ProtoMessage() {} + +func (x *DebuggedSourceFiles) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_debug_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DebuggedSourceFiles.ProtoReflect.Descriptor instead. +func (*DebuggedSourceFiles) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_debug_proto_rawDescGZIP(), []int{3} +} + +func (x *DebuggedSourceFiles) GetSourceFiles() []*DebuggedSourceFile { + if x != nil { + return x.SourceFiles + } + return nil +} + +var File_tensorflow_core_protobuf_debug_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_debug_proto_rawDesc = "" + + "\n" + + "$tensorflow/core/protobuf/debug.proto\x12\n" + + "tensorflow\"\xda\x01\n" + + "\x10DebugTensorWatch\x12\x1b\n" + + "\tnode_name\x18\x01 \x01(\tR\bnodeName\x12\x1f\n" + + "\voutput_slot\x18\x02 \x01(\x05R\n" + + "outputSlot\x12\x1b\n" + + "\tdebug_ops\x18\x03 \x03(\tR\bdebugOps\x12\x1d\n" + + "\n" + + "debug_urls\x18\x04 \x03(\tR\tdebugUrls\x12L\n" + + "#tolerate_debug_op_creation_failures\x18\x05 \x01(\bR\x1ftolerateDebugOpCreationFailures\"\xb7\x01\n" + + "\fDebugOptions\x12S\n" + + "\x17debug_tensor_watch_opts\x18\x04 \x03(\v2\x1c.tensorflow.DebugTensorWatchR\x14debugTensorWatchOpts\x12\x1f\n" + + "\vglobal_step\x18\n" + + " \x01(\x03R\n" + + "globalStep\x121\n" + + "\x15reset_disk_byte_usage\x18\v \x01(\bR\x12resetDiskByteUsage\"\x96\x01\n" + + "\x12DebuggedSourceFile\x12\x12\n" + + "\x04host\x18\x01 \x01(\tR\x04host\x12\x1b\n" + + "\tfile_path\x18\x02 \x01(\tR\bfilePath\x12#\n" + + "\rlast_modified\x18\x03 \x01(\x03R\flastModified\x12\x14\n" + + "\x05bytes\x18\x04 \x01(\x03R\x05bytes\x12\x14\n" + + "\x05lines\x18\x05 \x03(\tR\x05lines\"X\n" + + "\x13DebuggedSourceFiles\x12A\n" + + "\fsource_files\x18\x01 \x03(\v2\x1e.tensorflow.DebuggedSourceFileR\vsourceFilesB\x83\x01\n" + + "\x18org.tensorflow.frameworkB\vDebugProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_debug_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_debug_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_debug_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_debug_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_debug_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_debug_proto_rawDesc), len(file_tensorflow_core_protobuf_debug_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_debug_proto_rawDescData +} + +var file_tensorflow_core_protobuf_debug_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_tensorflow_core_protobuf_debug_proto_goTypes = []any{ + (*DebugTensorWatch)(nil), // 0: tensorflow.DebugTensorWatch + (*DebugOptions)(nil), // 1: tensorflow.DebugOptions + (*DebuggedSourceFile)(nil), // 2: tensorflow.DebuggedSourceFile + (*DebuggedSourceFiles)(nil), // 3: tensorflow.DebuggedSourceFiles +} +var file_tensorflow_core_protobuf_debug_proto_depIdxs = []int32{ + 0, // 0: tensorflow.DebugOptions.debug_tensor_watch_opts:type_name -> tensorflow.DebugTensorWatch + 2, // 1: tensorflow.DebuggedSourceFiles.source_files:type_name -> tensorflow.DebuggedSourceFile + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_debug_proto_init() } +func file_tensorflow_core_protobuf_debug_proto_init() { + if File_tensorflow_core_protobuf_debug_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_debug_proto_rawDesc), len(file_tensorflow_core_protobuf_debug_proto_rawDesc)), + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_debug_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_debug_proto_depIdxs, + MessageInfos: file_tensorflow_core_protobuf_debug_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_debug_proto = out.File + file_tensorflow_core_protobuf_debug_proto_goTypes = nil + file_tensorflow_core_protobuf_debug_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/debug_event.pb.go b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/debug_event.pb.go new file mode 100644 index 0000000..6adc6ae --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/debug_event.pb.go @@ -0,0 +1,1282 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/debug_event.proto + +package for_core_protos_go_proto + +import ( + tensor_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Available modes for extracting debugging information from a Tensor. +// TODO(cais): Document the detailed column names and semantics in a separate +// markdown file once the implementation settles. +type TensorDebugMode int32 + +const ( + TensorDebugMode_UNSPECIFIED TensorDebugMode = 0 + // Only records what tensors are computed, eagerly or in graphs. + // No information regarding the value of the tensor is available. + TensorDebugMode_NO_TENSOR TensorDebugMode = 1 + // A minimalist health summary for float-type tensors. + // Contains information only about the presence/absence of pathological + // values including Infinity and NaN. + // Applicable only to float dtypes. + TensorDebugMode_CURT_HEALTH TensorDebugMode = 2 + // A concise health summary for float-type tensors. + // Contains more information that CURT_HEALTH. + // Infinity and NaN are treated differently. + // Applicable only to float and integer dtypes. + TensorDebugMode_CONCISE_HEALTH TensorDebugMode = 3 + // A detailed health summary. + // Contains further detailed information than `CONCISE_HEALTH`. + // Information about device, dtype and shape are included. + // Counts for various types of values (Infinity, NaN, negative, zero, + // positive) are included. + // Applicable to float, integer and boolean dtypes. + TensorDebugMode_FULL_HEALTH TensorDebugMode = 4 + // Provides full runtime shape information, up to a maximum rank, beyond + // which the dimension sizes are truncated. + TensorDebugMode_SHAPE TensorDebugMode = 5 + // Full numeric summary. + // Including device, dtype, shape, counts of various types of values + // (Infinity, NaN, negative, zero, positive), and summary statistics + // (minimum, maximum, mean and variance). + // Applicable to float, integer and boolean dtypes. + TensorDebugMode_FULL_NUMERICS TensorDebugMode = 6 + // Full tensor value. + TensorDebugMode_FULL_TENSOR TensorDebugMode = 7 + // Reduce the elements of a tensor to a rank-1 tensor of shape [3], in which + // - the 1st element is -inf if any element of the tensor is -inf, + // or zero otherwise. + // - the 2nd element is +inf if any element of the tensor is +inf, + // or zero otherwise. + // - the 3rd element is nan if any element of the tensor is nan, or zero + // otherwise. + TensorDebugMode_REDUCE_INF_NAN_THREE_SLOTS TensorDebugMode = 8 +) + +// Enum value maps for TensorDebugMode. +var ( + TensorDebugMode_name = map[int32]string{ + 0: "UNSPECIFIED", + 1: "NO_TENSOR", + 2: "CURT_HEALTH", + 3: "CONCISE_HEALTH", + 4: "FULL_HEALTH", + 5: "SHAPE", + 6: "FULL_NUMERICS", + 7: "FULL_TENSOR", + 8: "REDUCE_INF_NAN_THREE_SLOTS", + } + TensorDebugMode_value = map[string]int32{ + "UNSPECIFIED": 0, + "NO_TENSOR": 1, + "CURT_HEALTH": 2, + "CONCISE_HEALTH": 3, + "FULL_HEALTH": 4, + "SHAPE": 5, + "FULL_NUMERICS": 6, + "FULL_TENSOR": 7, + "REDUCE_INF_NAN_THREE_SLOTS": 8, + } +) + +func (x TensorDebugMode) Enum() *TensorDebugMode { + p := new(TensorDebugMode) + *p = x + return p +} + +func (x TensorDebugMode) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (TensorDebugMode) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_protobuf_debug_event_proto_enumTypes[0].Descriptor() +} + +func (TensorDebugMode) Type() protoreflect.EnumType { + return &file_tensorflow_core_protobuf_debug_event_proto_enumTypes[0] +} + +func (x TensorDebugMode) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use TensorDebugMode.Descriptor instead. +func (TensorDebugMode) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_debug_event_proto_rawDescGZIP(), []int{0} +} + +// An Event related to the debugging of a TensorFlow program. +type DebugEvent struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Timestamp in seconds (with microsecond precision). + WallTime float64 `protobuf:"fixed64,1,opt,name=wall_time,json=wallTime,proto3" json:"wall_time,omitempty"` + // Step of training (if available). + Step int64 `protobuf:"varint,2,opt,name=step,proto3" json:"step,omitempty"` + // Types that are valid to be assigned to What: + // + // *DebugEvent_DebugMetadata + // *DebugEvent_SourceFile + // *DebugEvent_StackFrameWithId + // *DebugEvent_GraphOpCreation + // *DebugEvent_DebuggedGraph + // *DebugEvent_Execution + // *DebugEvent_GraphExecutionTrace + // *DebugEvent_GraphId + // *DebugEvent_DebuggedDevice + What isDebugEvent_What `protobuf_oneof:"what"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DebugEvent) Reset() { + *x = DebugEvent{} + mi := &file_tensorflow_core_protobuf_debug_event_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DebugEvent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DebugEvent) ProtoMessage() {} + +func (x *DebugEvent) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_debug_event_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DebugEvent.ProtoReflect.Descriptor instead. +func (*DebugEvent) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_debug_event_proto_rawDescGZIP(), []int{0} +} + +func (x *DebugEvent) GetWallTime() float64 { + if x != nil { + return x.WallTime + } + return 0 +} + +func (x *DebugEvent) GetStep() int64 { + if x != nil { + return x.Step + } + return 0 +} + +func (x *DebugEvent) GetWhat() isDebugEvent_What { + if x != nil { + return x.What + } + return nil +} + +func (x *DebugEvent) GetDebugMetadata() *DebugMetadata { + if x != nil { + if x, ok := x.What.(*DebugEvent_DebugMetadata); ok { + return x.DebugMetadata + } + } + return nil +} + +func (x *DebugEvent) GetSourceFile() *SourceFile { + if x != nil { + if x, ok := x.What.(*DebugEvent_SourceFile); ok { + return x.SourceFile + } + } + return nil +} + +func (x *DebugEvent) GetStackFrameWithId() *StackFrameWithId { + if x != nil { + if x, ok := x.What.(*DebugEvent_StackFrameWithId); ok { + return x.StackFrameWithId + } + } + return nil +} + +func (x *DebugEvent) GetGraphOpCreation() *GraphOpCreation { + if x != nil { + if x, ok := x.What.(*DebugEvent_GraphOpCreation); ok { + return x.GraphOpCreation + } + } + return nil +} + +func (x *DebugEvent) GetDebuggedGraph() *DebuggedGraph { + if x != nil { + if x, ok := x.What.(*DebugEvent_DebuggedGraph); ok { + return x.DebuggedGraph + } + } + return nil +} + +func (x *DebugEvent) GetExecution() *Execution { + if x != nil { + if x, ok := x.What.(*DebugEvent_Execution); ok { + return x.Execution + } + } + return nil +} + +func (x *DebugEvent) GetGraphExecutionTrace() *GraphExecutionTrace { + if x != nil { + if x, ok := x.What.(*DebugEvent_GraphExecutionTrace); ok { + return x.GraphExecutionTrace + } + } + return nil +} + +func (x *DebugEvent) GetGraphId() string { + if x != nil { + if x, ok := x.What.(*DebugEvent_GraphId); ok { + return x.GraphId + } + } + return "" +} + +func (x *DebugEvent) GetDebuggedDevice() *DebuggedDevice { + if x != nil { + if x, ok := x.What.(*DebugEvent_DebuggedDevice); ok { + return x.DebuggedDevice + } + } + return nil +} + +type isDebugEvent_What interface { + isDebugEvent_What() +} + +type DebugEvent_DebugMetadata struct { + // Metadata related to this debugging data. + DebugMetadata *DebugMetadata `protobuf:"bytes,3,opt,name=debug_metadata,json=debugMetadata,proto3,oneof"` +} + +type DebugEvent_SourceFile struct { + // The content of a source file. + SourceFile *SourceFile `protobuf:"bytes,4,opt,name=source_file,json=sourceFile,proto3,oneof"` +} + +type DebugEvent_StackFrameWithId struct { + // A stack frame (filename, line number and column number, function name and + // code string) with ID. + StackFrameWithId *StackFrameWithId `protobuf:"bytes,6,opt,name=stack_frame_with_id,json=stackFrameWithId,proto3,oneof"` +} + +type DebugEvent_GraphOpCreation struct { + // The creation of an op within a graph (e.g., a FuncGraph compiled from + // a Python function). + GraphOpCreation *GraphOpCreation `protobuf:"bytes,7,opt,name=graph_op_creation,json=graphOpCreation,proto3,oneof"` +} + +type DebugEvent_DebuggedGraph struct { + // Information about a debugged graph. + DebuggedGraph *DebuggedGraph `protobuf:"bytes,8,opt,name=debugged_graph,json=debuggedGraph,proto3,oneof"` +} + +type DebugEvent_Execution struct { + // Execution of an op or a Graph (e.g., a tf.function). + Execution *Execution `protobuf:"bytes,9,opt,name=execution,proto3,oneof"` +} + +type DebugEvent_GraphExecutionTrace struct { + // A graph execution trace: Contains information about the intermediate + // tensors computed during the graph execution. + GraphExecutionTrace *GraphExecutionTrace `protobuf:"bytes,10,opt,name=graph_execution_trace,json=graphExecutionTrace,proto3,oneof"` +} + +type DebugEvent_GraphId struct { + // The ID of the graph (i.e., FuncGraph) executed here: applicable only + // to the execution of a FuncGraph. + GraphId string `protobuf:"bytes,11,opt,name=graph_id,json=graphId,proto3,oneof"` +} + +type DebugEvent_DebuggedDevice struct { + // A device on which debugger-instrumented ops and/or tensors reside. + DebuggedDevice *DebuggedDevice `protobuf:"bytes,12,opt,name=debugged_device,json=debuggedDevice,proto3,oneof"` +} + +func (*DebugEvent_DebugMetadata) isDebugEvent_What() {} + +func (*DebugEvent_SourceFile) isDebugEvent_What() {} + +func (*DebugEvent_StackFrameWithId) isDebugEvent_What() {} + +func (*DebugEvent_GraphOpCreation) isDebugEvent_What() {} + +func (*DebugEvent_DebuggedGraph) isDebugEvent_What() {} + +func (*DebugEvent_Execution) isDebugEvent_What() {} + +func (*DebugEvent_GraphExecutionTrace) isDebugEvent_What() {} + +func (*DebugEvent_GraphId) isDebugEvent_What() {} + +func (*DebugEvent_DebuggedDevice) isDebugEvent_What() {} + +// Metadata about the debugger and the debugged TensorFlow program. +type DebugMetadata struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Version of TensorFlow. + TensorflowVersion string `protobuf:"bytes,1,opt,name=tensorflow_version,json=tensorflowVersion,proto3" json:"tensorflow_version,omitempty"` + // Version of the DebugEvent file format. + // Has a format of "debug.Event:", e.g., "debug.Event:1". + FileVersion string `protobuf:"bytes,2,opt,name=file_version,json=fileVersion,proto3" json:"file_version,omitempty"` + // A unique ID for the current run of tfdbg. + // A run of tfdbg is defined as a TensorFlow job instrumented by tfdbg. + // Multiple hosts in a distributed TensorFlow job instrumented by tfdbg + // have the same ID. + TfdbgRunId string `protobuf:"bytes,3,opt,name=tfdbg_run_id,json=tfdbgRunId,proto3" json:"tfdbg_run_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DebugMetadata) Reset() { + *x = DebugMetadata{} + mi := &file_tensorflow_core_protobuf_debug_event_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DebugMetadata) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DebugMetadata) ProtoMessage() {} + +func (x *DebugMetadata) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_debug_event_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DebugMetadata.ProtoReflect.Descriptor instead. +func (*DebugMetadata) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_debug_event_proto_rawDescGZIP(), []int{1} +} + +func (x *DebugMetadata) GetTensorflowVersion() string { + if x != nil { + return x.TensorflowVersion + } + return "" +} + +func (x *DebugMetadata) GetFileVersion() string { + if x != nil { + return x.FileVersion + } + return "" +} + +func (x *DebugMetadata) GetTfdbgRunId() string { + if x != nil { + return x.TfdbgRunId + } + return "" +} + +// Content of a source file involved in the execution of the debugged TensorFlow +// program. +type SourceFile struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Path to the file. + FilePath string `protobuf:"bytes,1,opt,name=file_path,json=filePath,proto3" json:"file_path,omitempty"` + // Name of the host on which the file is located. + HostName string `protobuf:"bytes,2,opt,name=host_name,json=hostName,proto3" json:"host_name,omitempty"` + // Line-by-line content of the file. + Lines []string `protobuf:"bytes,3,rep,name=lines,proto3" json:"lines,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SourceFile) Reset() { + *x = SourceFile{} + mi := &file_tensorflow_core_protobuf_debug_event_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SourceFile) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SourceFile) ProtoMessage() {} + +func (x *SourceFile) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_debug_event_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SourceFile.ProtoReflect.Descriptor instead. +func (*SourceFile) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_debug_event_proto_rawDescGZIP(), []int{2} +} + +func (x *SourceFile) GetFilePath() string { + if x != nil { + return x.FilePath + } + return "" +} + +func (x *SourceFile) GetHostName() string { + if x != nil { + return x.HostName + } + return "" +} + +func (x *SourceFile) GetLines() []string { + if x != nil { + return x.Lines + } + return nil +} + +// A stack frame with ID. +type StackFrameWithId struct { + state protoimpl.MessageState `protogen:"open.v1"` + // A unique ID for the stack frame: A UUID-like string. + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // Stack frame, i.e., a frame of a stack trace, containing information + // regarding the file name, line number, function name, code content + // of the line, and column number (if available). + FileLineCol *GraphDebugInfo_FileLineCol `protobuf:"bytes,2,opt,name=file_line_col,json=fileLineCol,proto3" json:"file_line_col,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *StackFrameWithId) Reset() { + *x = StackFrameWithId{} + mi := &file_tensorflow_core_protobuf_debug_event_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *StackFrameWithId) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StackFrameWithId) ProtoMessage() {} + +func (x *StackFrameWithId) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_debug_event_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StackFrameWithId.ProtoReflect.Descriptor instead. +func (*StackFrameWithId) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_debug_event_proto_rawDescGZIP(), []int{3} +} + +func (x *StackFrameWithId) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *StackFrameWithId) GetFileLineCol() *GraphDebugInfo_FileLineCol { + if x != nil { + return x.FileLineCol + } + return nil +} + +// Code location information: A stack trace with host-name information. +// Instead of encoding the detailed stack trace, this proto refers to IDs of +// stack frames stored as `StackFrameWithId` protos. +type CodeLocation struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Host name on which the source files are located. + HostName string `protobuf:"bytes,1,opt,name=host_name,json=hostName,proto3" json:"host_name,omitempty"` + // ID to a stack frame, each of which is pointed to + // by a unique ID. The ordering of the frames is consistent with Python's + // `traceback.extract_tb()`. + StackFrameIds []string `protobuf:"bytes,2,rep,name=stack_frame_ids,json=stackFrameIds,proto3" json:"stack_frame_ids,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CodeLocation) Reset() { + *x = CodeLocation{} + mi := &file_tensorflow_core_protobuf_debug_event_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CodeLocation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CodeLocation) ProtoMessage() {} + +func (x *CodeLocation) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_debug_event_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CodeLocation.ProtoReflect.Descriptor instead. +func (*CodeLocation) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_debug_event_proto_rawDescGZIP(), []int{4} +} + +func (x *CodeLocation) GetHostName() string { + if x != nil { + return x.HostName + } + return "" +} + +func (x *CodeLocation) GetStackFrameIds() []string { + if x != nil { + return x.StackFrameIds + } + return nil +} + +// The creation of an op in a TensorFlow Graph (e.g., FuncGraph in TF2). +type GraphOpCreation struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Type of the op (e.g., "MatMul"). + OpType string `protobuf:"bytes,1,opt,name=op_type,json=opType,proto3" json:"op_type,omitempty"` + // Name of the op (e.g., "Dense/MatMul_1"). + OpName string `protobuf:"bytes,2,opt,name=op_name,json=opName,proto3" json:"op_name,omitempty"` + // Name of the graph that the op is a part of (if available). + GraphName string `protobuf:"bytes,3,opt,name=graph_name,json=graphName,proto3" json:"graph_name,omitempty"` + // Unique ID of the graph (generated by debugger). + // This is the ID of the immediately-enclosing graph. + GraphId string `protobuf:"bytes,4,opt,name=graph_id,json=graphId,proto3" json:"graph_id,omitempty"` + // Name of the device that the op is assigned to (if available). + DeviceName string `protobuf:"bytes,5,opt,name=device_name,json=deviceName,proto3" json:"device_name,omitempty"` + // Names of the input tensors to the op. + InputNames []string `protobuf:"bytes,6,rep,name=input_names,json=inputNames,proto3" json:"input_names,omitempty"` + // Number of output tensors emitted by the op. + NumOutputs int32 `protobuf:"varint,7,opt,name=num_outputs,json=numOutputs,proto3" json:"num_outputs,omitempty"` + // The unique ID for code location (stack trace) of the op's creation. + CodeLocation *CodeLocation `protobuf:"bytes,8,opt,name=code_location,json=codeLocation,proto3" json:"code_location,omitempty"` + // Unique IDs for the output tensors of this op. + OutputTensorIds []int32 `protobuf:"varint,9,rep,packed,name=output_tensor_ids,json=outputTensorIds,proto3" json:"output_tensor_ids,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GraphOpCreation) Reset() { + *x = GraphOpCreation{} + mi := &file_tensorflow_core_protobuf_debug_event_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GraphOpCreation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GraphOpCreation) ProtoMessage() {} + +func (x *GraphOpCreation) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_debug_event_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GraphOpCreation.ProtoReflect.Descriptor instead. +func (*GraphOpCreation) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_debug_event_proto_rawDescGZIP(), []int{5} +} + +func (x *GraphOpCreation) GetOpType() string { + if x != nil { + return x.OpType + } + return "" +} + +func (x *GraphOpCreation) GetOpName() string { + if x != nil { + return x.OpName + } + return "" +} + +func (x *GraphOpCreation) GetGraphName() string { + if x != nil { + return x.GraphName + } + return "" +} + +func (x *GraphOpCreation) GetGraphId() string { + if x != nil { + return x.GraphId + } + return "" +} + +func (x *GraphOpCreation) GetDeviceName() string { + if x != nil { + return x.DeviceName + } + return "" +} + +func (x *GraphOpCreation) GetInputNames() []string { + if x != nil { + return x.InputNames + } + return nil +} + +func (x *GraphOpCreation) GetNumOutputs() int32 { + if x != nil { + return x.NumOutputs + } + return 0 +} + +func (x *GraphOpCreation) GetCodeLocation() *CodeLocation { + if x != nil { + return x.CodeLocation + } + return nil +} + +func (x *GraphOpCreation) GetOutputTensorIds() []int32 { + if x != nil { + return x.OutputTensorIds + } + return nil +} + +// A debugger-instrumented graph. +type DebuggedGraph struct { + state protoimpl.MessageState `protogen:"open.v1"` + // An ID for the graph. + // This can be used up to look up graph names. Generated by the debugger. + GraphId string `protobuf:"bytes,1,opt,name=graph_id,json=graphId,proto3" json:"graph_id,omitempty"` + // Name of the graph (if available). + GraphName string `protobuf:"bytes,2,opt,name=graph_name,json=graphName,proto3" json:"graph_name,omitempty"` + // Names of the instrumented ops. This can be used to look up op name + // based on the numeric-summary tensors (2nd column). + InstrumentedOps []string `protobuf:"bytes,3,rep,name=instrumented_ops,json=instrumentedOps,proto3" json:"instrumented_ops,omitempty"` + // Original (uninstrumented) GraphDef (if available). + OriginalGraphDef []byte `protobuf:"bytes,4,opt,name=original_graph_def,json=originalGraphDef,proto3" json:"original_graph_def,omitempty"` + // An encoded version of a GraphDef. + // This graph may include the debugger-inserted ops. + InstrumentedGraphDef []byte `protobuf:"bytes,5,opt,name=instrumented_graph_def,json=instrumentedGraphDef,proto3" json:"instrumented_graph_def,omitempty"` + // IDs of the immediate enclosing context (graph), if any. + OuterContextId string `protobuf:"bytes,6,opt,name=outer_context_id,json=outerContextId,proto3" json:"outer_context_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DebuggedGraph) Reset() { + *x = DebuggedGraph{} + mi := &file_tensorflow_core_protobuf_debug_event_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DebuggedGraph) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DebuggedGraph) ProtoMessage() {} + +func (x *DebuggedGraph) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_debug_event_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DebuggedGraph.ProtoReflect.Descriptor instead. +func (*DebuggedGraph) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_debug_event_proto_rawDescGZIP(), []int{6} +} + +func (x *DebuggedGraph) GetGraphId() string { + if x != nil { + return x.GraphId + } + return "" +} + +func (x *DebuggedGraph) GetGraphName() string { + if x != nil { + return x.GraphName + } + return "" +} + +func (x *DebuggedGraph) GetInstrumentedOps() []string { + if x != nil { + return x.InstrumentedOps + } + return nil +} + +func (x *DebuggedGraph) GetOriginalGraphDef() []byte { + if x != nil { + return x.OriginalGraphDef + } + return nil +} + +func (x *DebuggedGraph) GetInstrumentedGraphDef() []byte { + if x != nil { + return x.InstrumentedGraphDef + } + return nil +} + +func (x *DebuggedGraph) GetOuterContextId() string { + if x != nil { + return x.OuterContextId + } + return "" +} + +// A device on which ops and/or tensors are instrumented by the debugger. +type DebuggedDevice struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Name of the device. + DeviceName string `protobuf:"bytes,1,opt,name=device_name,json=deviceName,proto3" json:"device_name,omitempty"` + // A debugger-generated ID for the device. Guaranteed to be unique within + // the scope of the debugged TensorFlow program, including single-host and + // multi-host settings. + // TODO(cais): Test the uniqueness guarantee in multi-host settings. + DeviceId int32 `protobuf:"varint,2,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DebuggedDevice) Reset() { + *x = DebuggedDevice{} + mi := &file_tensorflow_core_protobuf_debug_event_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DebuggedDevice) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DebuggedDevice) ProtoMessage() {} + +func (x *DebuggedDevice) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_debug_event_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DebuggedDevice.ProtoReflect.Descriptor instead. +func (*DebuggedDevice) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_debug_event_proto_rawDescGZIP(), []int{7} +} + +func (x *DebuggedDevice) GetDeviceName() string { + if x != nil { + return x.DeviceName + } + return "" +} + +func (x *DebuggedDevice) GetDeviceId() int32 { + if x != nil { + return x.DeviceId + } + return 0 +} + +// Data relating to the eager execution of an op or a Graph. +// For a op that generates N output tensors (N >= 0), only one +// Execution proto will be used to describe the execution event. +type Execution struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Op type (e.g., "MatMul"). + // In the case of a Graph, this is the name of the Graph. + OpType string `protobuf:"bytes,1,opt,name=op_type,json=opType,proto3" json:"op_type,omitempty"` + // Number of output tensors. + NumOutputs int32 `protobuf:"varint,2,opt,name=num_outputs,json=numOutputs,proto3" json:"num_outputs,omitempty"` + // The graph that's executed: applicable only to the eager + // execution of a FuncGraph. + GraphId string `protobuf:"bytes,3,opt,name=graph_id,json=graphId,proto3" json:"graph_id,omitempty"` + // IDs of the input tensors (if available). + InputTensorIds []int64 `protobuf:"varint,4,rep,packed,name=input_tensor_ids,json=inputTensorIds,proto3" json:"input_tensor_ids,omitempty"` + // IDs of the output tensors (if availbable). + // If specified, must have the same length as tensor_protos. + OutputTensorIds []int64 `protobuf:"varint,5,rep,packed,name=output_tensor_ids,json=outputTensorIds,proto3" json:"output_tensor_ids,omitempty"` + // Type of the tensor value encapsulated in this proto. + TensorDebugMode TensorDebugMode `protobuf:"varint,6,opt,name=tensor_debug_mode,json=tensorDebugMode,proto3,enum=tensorflow.TensorDebugMode" json:"tensor_debug_mode,omitempty"` + // Output Tensor values in the type described by `tensor_value_type`. + // The length of this should match `num_outputs`. + TensorProtos []*tensor_go_proto.TensorProto `protobuf:"bytes,7,rep,name=tensor_protos,json=tensorProtos,proto3" json:"tensor_protos,omitempty"` + // Stack trace of the eager execution. + CodeLocation *CodeLocation `protobuf:"bytes,8,opt,name=code_location,json=codeLocation,proto3" json:"code_location,omitempty"` + // Debugged-generated IDs of the devices on which the output tensors reside. + // To look up details about the device (e.g., name), cross-reference this + // field with the DebuggedDevice messages. + OutputTensorDeviceIds []int32 `protobuf:"varint,9,rep,packed,name=output_tensor_device_ids,json=outputTensorDeviceIds,proto3" json:"output_tensor_device_ids,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Execution) Reset() { + *x = Execution{} + mi := &file_tensorflow_core_protobuf_debug_event_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Execution) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Execution) ProtoMessage() {} + +func (x *Execution) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_debug_event_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Execution.ProtoReflect.Descriptor instead. +func (*Execution) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_debug_event_proto_rawDescGZIP(), []int{8} +} + +func (x *Execution) GetOpType() string { + if x != nil { + return x.OpType + } + return "" +} + +func (x *Execution) GetNumOutputs() int32 { + if x != nil { + return x.NumOutputs + } + return 0 +} + +func (x *Execution) GetGraphId() string { + if x != nil { + return x.GraphId + } + return "" +} + +func (x *Execution) GetInputTensorIds() []int64 { + if x != nil { + return x.InputTensorIds + } + return nil +} + +func (x *Execution) GetOutputTensorIds() []int64 { + if x != nil { + return x.OutputTensorIds + } + return nil +} + +func (x *Execution) GetTensorDebugMode() TensorDebugMode { + if x != nil { + return x.TensorDebugMode + } + return TensorDebugMode_UNSPECIFIED +} + +func (x *Execution) GetTensorProtos() []*tensor_go_proto.TensorProto { + if x != nil { + return x.TensorProtos + } + return nil +} + +func (x *Execution) GetCodeLocation() *CodeLocation { + if x != nil { + return x.CodeLocation + } + return nil +} + +func (x *Execution) GetOutputTensorDeviceIds() []int32 { + if x != nil { + return x.OutputTensorDeviceIds + } + return nil +} + +// Data relating to an execution of a Graph (e.g., an eager execution of a +// FuncGraph). +// The values of the intermediate tensors computed in the graph are recorded +// in this proto. A graph execution may correspond to one or more pieces of +// `GraphExecutionTrace`, depending on whether the instrumented tensor values +// are summarized in an aggregated or separate fashion. +type GraphExecutionTrace struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Unique ID of the context that the executed op(s) belong to (e.g., a + // compiled concrete tf.function). + TfdbgContextId string `protobuf:"bytes,1,opt,name=tfdbg_context_id,json=tfdbgContextId,proto3" json:"tfdbg_context_id,omitempty"` + // Name of the op (applicable only in the case of the `FULL_TENSOR` trace + // level). + OpName string `protobuf:"bytes,2,opt,name=op_name,json=opName,proto3" json:"op_name,omitempty"` + // Output slot of the tensor (applicable only in the case of the `FULL_TENSOR` + // trace level). + OutputSlot int32 `protobuf:"varint,3,opt,name=output_slot,json=outputSlot,proto3" json:"output_slot,omitempty"` + // Type of the tensor value encapsulated in this proto. + TensorDebugMode TensorDebugMode `protobuf:"varint,4,opt,name=tensor_debug_mode,json=tensorDebugMode,proto3,enum=tensorflow.TensorDebugMode" json:"tensor_debug_mode,omitempty"` + // Tensor value in the type described by `tensor_value_type`. + // This tensor may summarize the value of a single intermediate op of the + // graph, or those of multiple intermediate tensors. + TensorProto *tensor_go_proto.TensorProto `protobuf:"bytes,5,opt,name=tensor_proto,json=tensorProto,proto3" json:"tensor_proto,omitempty"` + // Name of the device that the op belongs to. + DeviceName string `protobuf:"bytes,6,opt,name=device_name,json=deviceName,proto3" json:"device_name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GraphExecutionTrace) Reset() { + *x = GraphExecutionTrace{} + mi := &file_tensorflow_core_protobuf_debug_event_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GraphExecutionTrace) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GraphExecutionTrace) ProtoMessage() {} + +func (x *GraphExecutionTrace) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_debug_event_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GraphExecutionTrace.ProtoReflect.Descriptor instead. +func (*GraphExecutionTrace) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_debug_event_proto_rawDescGZIP(), []int{9} +} + +func (x *GraphExecutionTrace) GetTfdbgContextId() string { + if x != nil { + return x.TfdbgContextId + } + return "" +} + +func (x *GraphExecutionTrace) GetOpName() string { + if x != nil { + return x.OpName + } + return "" +} + +func (x *GraphExecutionTrace) GetOutputSlot() int32 { + if x != nil { + return x.OutputSlot + } + return 0 +} + +func (x *GraphExecutionTrace) GetTensorDebugMode() TensorDebugMode { + if x != nil { + return x.TensorDebugMode + } + return TensorDebugMode_UNSPECIFIED +} + +func (x *GraphExecutionTrace) GetTensorProto() *tensor_go_proto.TensorProto { + if x != nil { + return x.TensorProto + } + return nil +} + +func (x *GraphExecutionTrace) GetDeviceName() string { + if x != nil { + return x.DeviceName + } + return "" +} + +var File_tensorflow_core_protobuf_debug_event_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_debug_event_proto_rawDesc = "" + + "\n" + + "*tensorflow/core/protobuf/debug_event.proto\x12\n" + + "tensorflow\x1a&tensorflow/core/framework/tensor.proto\x1a/tensorflow/core/protobuf/graph_debug_info.proto\"\x94\x05\n" + + "\n" + + "DebugEvent\x12\x1b\n" + + "\twall_time\x18\x01 \x01(\x01R\bwallTime\x12\x12\n" + + "\x04step\x18\x02 \x01(\x03R\x04step\x12B\n" + + "\x0edebug_metadata\x18\x03 \x01(\v2\x19.tensorflow.DebugMetadataH\x00R\rdebugMetadata\x129\n" + + "\vsource_file\x18\x04 \x01(\v2\x16.tensorflow.SourceFileH\x00R\n" + + "sourceFile\x12M\n" + + "\x13stack_frame_with_id\x18\x06 \x01(\v2\x1c.tensorflow.StackFrameWithIdH\x00R\x10stackFrameWithId\x12I\n" + + "\x11graph_op_creation\x18\a \x01(\v2\x1b.tensorflow.GraphOpCreationH\x00R\x0fgraphOpCreation\x12B\n" + + "\x0edebugged_graph\x18\b \x01(\v2\x19.tensorflow.DebuggedGraphH\x00R\rdebuggedGraph\x125\n" + + "\texecution\x18\t \x01(\v2\x15.tensorflow.ExecutionH\x00R\texecution\x12U\n" + + "\x15graph_execution_trace\x18\n" + + " \x01(\v2\x1f.tensorflow.GraphExecutionTraceH\x00R\x13graphExecutionTrace\x12\x1b\n" + + "\bgraph_id\x18\v \x01(\tH\x00R\agraphId\x12E\n" + + "\x0fdebugged_device\x18\f \x01(\v2\x1a.tensorflow.DebuggedDeviceH\x00R\x0edebuggedDeviceB\x06\n" + + "\x04what\"\x83\x01\n" + + "\rDebugMetadata\x12-\n" + + "\x12tensorflow_version\x18\x01 \x01(\tR\x11tensorflowVersion\x12!\n" + + "\ffile_version\x18\x02 \x01(\tR\vfileVersion\x12 \n" + + "\ftfdbg_run_id\x18\x03 \x01(\tR\n" + + "tfdbgRunId\"\\\n" + + "\n" + + "SourceFile\x12\x1b\n" + + "\tfile_path\x18\x01 \x01(\tR\bfilePath\x12\x1b\n" + + "\thost_name\x18\x02 \x01(\tR\bhostName\x12\x14\n" + + "\x05lines\x18\x03 \x03(\tR\x05lines\"n\n" + + "\x10StackFrameWithId\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12J\n" + + "\rfile_line_col\x18\x02 \x01(\v2&.tensorflow.GraphDebugInfo.FileLineColR\vfileLineCol\"S\n" + + "\fCodeLocation\x12\x1b\n" + + "\thost_name\x18\x01 \x01(\tR\bhostName\x12&\n" + + "\x0fstack_frame_ids\x18\x02 \x03(\tR\rstackFrameIds\"\xcb\x02\n" + + "\x0fGraphOpCreation\x12\x17\n" + + "\aop_type\x18\x01 \x01(\tR\x06opType\x12\x17\n" + + "\aop_name\x18\x02 \x01(\tR\x06opName\x12\x1d\n" + + "\n" + + "graph_name\x18\x03 \x01(\tR\tgraphName\x12\x19\n" + + "\bgraph_id\x18\x04 \x01(\tR\agraphId\x12\x1f\n" + + "\vdevice_name\x18\x05 \x01(\tR\n" + + "deviceName\x12\x1f\n" + + "\vinput_names\x18\x06 \x03(\tR\n" + + "inputNames\x12\x1f\n" + + "\vnum_outputs\x18\a \x01(\x05R\n" + + "numOutputs\x12=\n" + + "\rcode_location\x18\b \x01(\v2\x18.tensorflow.CodeLocationR\fcodeLocation\x12*\n" + + "\x11output_tensor_ids\x18\t \x03(\x05R\x0foutputTensorIds\"\x82\x02\n" + + "\rDebuggedGraph\x12\x19\n" + + "\bgraph_id\x18\x01 \x01(\tR\agraphId\x12\x1d\n" + + "\n" + + "graph_name\x18\x02 \x01(\tR\tgraphName\x12)\n" + + "\x10instrumented_ops\x18\x03 \x03(\tR\x0finstrumentedOps\x12,\n" + + "\x12original_graph_def\x18\x04 \x01(\fR\x10originalGraphDef\x124\n" + + "\x16instrumented_graph_def\x18\x05 \x01(\fR\x14instrumentedGraphDef\x12(\n" + + "\x10outer_context_id\x18\x06 \x01(\tR\x0eouterContextId\"N\n" + + "\x0eDebuggedDevice\x12\x1f\n" + + "\vdevice_name\x18\x01 \x01(\tR\n" + + "deviceName\x12\x1b\n" + + "\tdevice_id\x18\x02 \x01(\x05R\bdeviceId\"\xb5\x03\n" + + "\tExecution\x12\x17\n" + + "\aop_type\x18\x01 \x01(\tR\x06opType\x12\x1f\n" + + "\vnum_outputs\x18\x02 \x01(\x05R\n" + + "numOutputs\x12\x19\n" + + "\bgraph_id\x18\x03 \x01(\tR\agraphId\x12(\n" + + "\x10input_tensor_ids\x18\x04 \x03(\x03R\x0einputTensorIds\x12*\n" + + "\x11output_tensor_ids\x18\x05 \x03(\x03R\x0foutputTensorIds\x12G\n" + + "\x11tensor_debug_mode\x18\x06 \x01(\x0e2\x1b.tensorflow.TensorDebugModeR\x0ftensorDebugMode\x12<\n" + + "\rtensor_protos\x18\a \x03(\v2\x17.tensorflow.TensorProtoR\ftensorProtos\x12=\n" + + "\rcode_location\x18\b \x01(\v2\x18.tensorflow.CodeLocationR\fcodeLocation\x127\n" + + "\x18output_tensor_device_ids\x18\t \x03(\x05R\x15outputTensorDeviceIds\"\x9f\x02\n" + + "\x13GraphExecutionTrace\x12(\n" + + "\x10tfdbg_context_id\x18\x01 \x01(\tR\x0etfdbgContextId\x12\x17\n" + + "\aop_name\x18\x02 \x01(\tR\x06opName\x12\x1f\n" + + "\voutput_slot\x18\x03 \x01(\x05R\n" + + "outputSlot\x12G\n" + + "\x11tensor_debug_mode\x18\x04 \x01(\x0e2\x1b.tensorflow.TensorDebugModeR\x0ftensorDebugMode\x12:\n" + + "\ftensor_proto\x18\x05 \x01(\v2\x17.tensorflow.TensorProtoR\vtensorProto\x12\x1f\n" + + "\vdevice_name\x18\x06 \x01(\tR\n" + + "deviceName*\xb6\x01\n" + + "\x0fTensorDebugMode\x12\x0f\n" + + "\vUNSPECIFIED\x10\x00\x12\r\n" + + "\tNO_TENSOR\x10\x01\x12\x0f\n" + + "\vCURT_HEALTH\x10\x02\x12\x12\n" + + "\x0eCONCISE_HEALTH\x10\x03\x12\x0f\n" + + "\vFULL_HEALTH\x10\x04\x12\t\n" + + "\x05SHAPE\x10\x05\x12\x11\n" + + "\rFULL_NUMERICS\x10\x06\x12\x0f\n" + + "\vFULL_TENSOR\x10\a\x12\x1e\n" + + "\x1aREDUCE_INF_NAN_THREE_SLOTS\x10\bB\x83\x01\n" + + "\x13org.tensorflow.utilB\x10DebugEventProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_debug_event_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_debug_event_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_debug_event_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_debug_event_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_debug_event_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_debug_event_proto_rawDesc), len(file_tensorflow_core_protobuf_debug_event_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_debug_event_proto_rawDescData +} + +var file_tensorflow_core_protobuf_debug_event_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_tensorflow_core_protobuf_debug_event_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_tensorflow_core_protobuf_debug_event_proto_goTypes = []any{ + (TensorDebugMode)(0), // 0: tensorflow.TensorDebugMode + (*DebugEvent)(nil), // 1: tensorflow.DebugEvent + (*DebugMetadata)(nil), // 2: tensorflow.DebugMetadata + (*SourceFile)(nil), // 3: tensorflow.SourceFile + (*StackFrameWithId)(nil), // 4: tensorflow.StackFrameWithId + (*CodeLocation)(nil), // 5: tensorflow.CodeLocation + (*GraphOpCreation)(nil), // 6: tensorflow.GraphOpCreation + (*DebuggedGraph)(nil), // 7: tensorflow.DebuggedGraph + (*DebuggedDevice)(nil), // 8: tensorflow.DebuggedDevice + (*Execution)(nil), // 9: tensorflow.Execution + (*GraphExecutionTrace)(nil), // 10: tensorflow.GraphExecutionTrace + (*GraphDebugInfo_FileLineCol)(nil), // 11: tensorflow.GraphDebugInfo.FileLineCol + (*tensor_go_proto.TensorProto)(nil), // 12: tensorflow.TensorProto +} +var file_tensorflow_core_protobuf_debug_event_proto_depIdxs = []int32{ + 2, // 0: tensorflow.DebugEvent.debug_metadata:type_name -> tensorflow.DebugMetadata + 3, // 1: tensorflow.DebugEvent.source_file:type_name -> tensorflow.SourceFile + 4, // 2: tensorflow.DebugEvent.stack_frame_with_id:type_name -> tensorflow.StackFrameWithId + 6, // 3: tensorflow.DebugEvent.graph_op_creation:type_name -> tensorflow.GraphOpCreation + 7, // 4: tensorflow.DebugEvent.debugged_graph:type_name -> tensorflow.DebuggedGraph + 9, // 5: tensorflow.DebugEvent.execution:type_name -> tensorflow.Execution + 10, // 6: tensorflow.DebugEvent.graph_execution_trace:type_name -> tensorflow.GraphExecutionTrace + 8, // 7: tensorflow.DebugEvent.debugged_device:type_name -> tensorflow.DebuggedDevice + 11, // 8: tensorflow.StackFrameWithId.file_line_col:type_name -> tensorflow.GraphDebugInfo.FileLineCol + 5, // 9: tensorflow.GraphOpCreation.code_location:type_name -> tensorflow.CodeLocation + 0, // 10: tensorflow.Execution.tensor_debug_mode:type_name -> tensorflow.TensorDebugMode + 12, // 11: tensorflow.Execution.tensor_protos:type_name -> tensorflow.TensorProto + 5, // 12: tensorflow.Execution.code_location:type_name -> tensorflow.CodeLocation + 0, // 13: tensorflow.GraphExecutionTrace.tensor_debug_mode:type_name -> tensorflow.TensorDebugMode + 12, // 14: tensorflow.GraphExecutionTrace.tensor_proto:type_name -> tensorflow.TensorProto + 15, // [15:15] is the sub-list for method output_type + 15, // [15:15] is the sub-list for method input_type + 15, // [15:15] is the sub-list for extension type_name + 15, // [15:15] is the sub-list for extension extendee + 0, // [0:15] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_debug_event_proto_init() } +func file_tensorflow_core_protobuf_debug_event_proto_init() { + if File_tensorflow_core_protobuf_debug_event_proto != nil { + return + } + file_tensorflow_core_protobuf_graph_debug_info_proto_init() + file_tensorflow_core_protobuf_debug_event_proto_msgTypes[0].OneofWrappers = []any{ + (*DebugEvent_DebugMetadata)(nil), + (*DebugEvent_SourceFile)(nil), + (*DebugEvent_StackFrameWithId)(nil), + (*DebugEvent_GraphOpCreation)(nil), + (*DebugEvent_DebuggedGraph)(nil), + (*DebugEvent_Execution)(nil), + (*DebugEvent_GraphExecutionTrace)(nil), + (*DebugEvent_GraphId)(nil), + (*DebugEvent_DebuggedDevice)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_debug_event_proto_rawDesc), len(file_tensorflow_core_protobuf_debug_event_proto_rawDesc)), + NumEnums: 1, + NumMessages: 10, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_debug_event_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_debug_event_proto_depIdxs, + EnumInfos: file_tensorflow_core_protobuf_debug_event_proto_enumTypes, + MessageInfos: file_tensorflow_core_protobuf_debug_event_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_debug_event_proto = out.File + file_tensorflow_core_protobuf_debug_event_proto_goTypes = nil + file_tensorflow_core_protobuf_debug_event_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/device_filters.pb.go b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/device_filters.pb.go new file mode 100644 index 0000000..54b448d --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/device_filters.pb.go @@ -0,0 +1,255 @@ +// Copyright 2020 The TensorFlow Authors. All Rights Reserved. +// +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +//============================================================================== + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/device_filters.proto + +package for_core_protos_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Defines the device filters for a remote task. +type TaskDeviceFilters struct { + state protoimpl.MessageState `protogen:"open.v1"` + DeviceFilters []string `protobuf:"bytes,1,rep,name=device_filters,json=deviceFilters,proto3" json:"device_filters,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TaskDeviceFilters) Reset() { + *x = TaskDeviceFilters{} + mi := &file_tensorflow_core_protobuf_device_filters_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TaskDeviceFilters) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TaskDeviceFilters) ProtoMessage() {} + +func (x *TaskDeviceFilters) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_device_filters_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TaskDeviceFilters.ProtoReflect.Descriptor instead. +func (*TaskDeviceFilters) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_device_filters_proto_rawDescGZIP(), []int{0} +} + +func (x *TaskDeviceFilters) GetDeviceFilters() []string { + if x != nil { + return x.DeviceFilters + } + return nil +} + +// Defines the device filters for tasks in a job. +type JobDeviceFilters struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The name of this job. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Mapping from task ID to task device filters. + Tasks map[int32]*TaskDeviceFilters `protobuf:"bytes,2,rep,name=tasks,proto3" json:"tasks,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *JobDeviceFilters) Reset() { + *x = JobDeviceFilters{} + mi := &file_tensorflow_core_protobuf_device_filters_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *JobDeviceFilters) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*JobDeviceFilters) ProtoMessage() {} + +func (x *JobDeviceFilters) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_device_filters_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use JobDeviceFilters.ProtoReflect.Descriptor instead. +func (*JobDeviceFilters) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_device_filters_proto_rawDescGZIP(), []int{1} +} + +func (x *JobDeviceFilters) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *JobDeviceFilters) GetTasks() map[int32]*TaskDeviceFilters { + if x != nil { + return x.Tasks + } + return nil +} + +// Defines the device filters for jobs in a cluster. +type ClusterDeviceFilters struct { + state protoimpl.MessageState `protogen:"open.v1"` + Jobs []*JobDeviceFilters `protobuf:"bytes,1,rep,name=jobs,proto3" json:"jobs,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ClusterDeviceFilters) Reset() { + *x = ClusterDeviceFilters{} + mi := &file_tensorflow_core_protobuf_device_filters_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ClusterDeviceFilters) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ClusterDeviceFilters) ProtoMessage() {} + +func (x *ClusterDeviceFilters) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_device_filters_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ClusterDeviceFilters.ProtoReflect.Descriptor instead. +func (*ClusterDeviceFilters) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_device_filters_proto_rawDescGZIP(), []int{2} +} + +func (x *ClusterDeviceFilters) GetJobs() []*JobDeviceFilters { + if x != nil { + return x.Jobs + } + return nil +} + +var File_tensorflow_core_protobuf_device_filters_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_device_filters_proto_rawDesc = "" + + "\n" + + "-tensorflow/core/protobuf/device_filters.proto\x12\n" + + "tensorflow\":\n" + + "\x11TaskDeviceFilters\x12%\n" + + "\x0edevice_filters\x18\x01 \x03(\tR\rdeviceFilters\"\xbe\x01\n" + + "\x10JobDeviceFilters\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12=\n" + + "\x05tasks\x18\x02 \x03(\v2'.tensorflow.JobDeviceFilters.TasksEntryR\x05tasks\x1aW\n" + + "\n" + + "TasksEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\x05R\x03key\x123\n" + + "\x05value\x18\x02 \x01(\v2\x1d.tensorflow.TaskDeviceFiltersR\x05value:\x028\x01\"H\n" + + "\x14ClusterDeviceFilters\x120\n" + + "\x04jobs\x18\x01 \x03(\v2\x1c.tensorflow.JobDeviceFiltersR\x04jobsB\x8d\x01\n" + + "\x1aorg.tensorflow.distruntimeB\x13DeviceFiltersProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_device_filters_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_device_filters_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_device_filters_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_device_filters_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_device_filters_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_device_filters_proto_rawDesc), len(file_tensorflow_core_protobuf_device_filters_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_device_filters_proto_rawDescData +} + +var file_tensorflow_core_protobuf_device_filters_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_tensorflow_core_protobuf_device_filters_proto_goTypes = []any{ + (*TaskDeviceFilters)(nil), // 0: tensorflow.TaskDeviceFilters + (*JobDeviceFilters)(nil), // 1: tensorflow.JobDeviceFilters + (*ClusterDeviceFilters)(nil), // 2: tensorflow.ClusterDeviceFilters + nil, // 3: tensorflow.JobDeviceFilters.TasksEntry +} +var file_tensorflow_core_protobuf_device_filters_proto_depIdxs = []int32{ + 3, // 0: tensorflow.JobDeviceFilters.tasks:type_name -> tensorflow.JobDeviceFilters.TasksEntry + 1, // 1: tensorflow.ClusterDeviceFilters.jobs:type_name -> tensorflow.JobDeviceFilters + 0, // 2: tensorflow.JobDeviceFilters.TasksEntry.value:type_name -> tensorflow.TaskDeviceFilters + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_device_filters_proto_init() } +func file_tensorflow_core_protobuf_device_filters_proto_init() { + if File_tensorflow_core_protobuf_device_filters_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_device_filters_proto_rawDesc), len(file_tensorflow_core_protobuf_device_filters_proto_rawDesc)), + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_device_filters_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_device_filters_proto_depIdxs, + MessageInfos: file_tensorflow_core_protobuf_device_filters_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_device_filters_proto = out.File + file_tensorflow_core_protobuf_device_filters_proto_goTypes = nil + file_tensorflow_core_protobuf_device_filters_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/device_properties.pb.go b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/device_properties.pb.go new file mode 100644 index 0000000..f27f9f9 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/device_properties.pb.go @@ -0,0 +1,327 @@ +// Copyright 2017 The TensorFlow Authors. All Rights Reserved. +// +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +//============================================================================== + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/device_properties.proto + +package for_core_protos_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type DeviceProperties struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Device type (CPU, GPU, ...) + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + // Vendor (Intel, nvidia, ...) + Vendor string `protobuf:"bytes,2,opt,name=vendor,proto3" json:"vendor,omitempty"` + // Model (Haswell, K40, ...) + Model string `protobuf:"bytes,3,opt,name=model,proto3" json:"model,omitempty"` + // Core Frequency in Mhz + Frequency int64 `protobuf:"varint,4,opt,name=frequency,proto3" json:"frequency,omitempty"` + // Number of cores + NumCores int64 `protobuf:"varint,5,opt,name=num_cores,json=numCores,proto3" json:"num_cores,omitempty"` + // Version of the tools and libraries used with this device (e.g. gcc 4.9, + // cudnn 5.1) + Environment map[string]string `protobuf:"bytes,6,rep,name=environment,proto3" json:"environment,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // Number of registers per core. + NumRegisters int64 `protobuf:"varint,7,opt,name=num_registers,json=numRegisters,proto3" json:"num_registers,omitempty"` + // L1 cache size in bytes + L1CacheSize int64 `protobuf:"varint,8,opt,name=l1_cache_size,json=l1CacheSize,proto3" json:"l1_cache_size,omitempty"` + // L2 cache size in bytes + L2CacheSize int64 `protobuf:"varint,9,opt,name=l2_cache_size,json=l2CacheSize,proto3" json:"l2_cache_size,omitempty"` + // L3 cache size in bytes + L3CacheSize int64 `protobuf:"varint,10,opt,name=l3_cache_size,json=l3CacheSize,proto3" json:"l3_cache_size,omitempty"` + // Shared memory size per multiprocessor in bytes. This field is + // applicable to GPUs only. + SharedMemorySizePerMultiprocessor int64 `protobuf:"varint,11,opt,name=shared_memory_size_per_multiprocessor,json=sharedMemorySizePerMultiprocessor,proto3" json:"shared_memory_size_per_multiprocessor,omitempty"` + // Memory size in bytes + MemorySize int64 `protobuf:"varint,12,opt,name=memory_size,json=memorySize,proto3" json:"memory_size,omitempty"` + // Memory bandwidth in KB/s + Bandwidth int64 `protobuf:"varint,13,opt,name=bandwidth,proto3" json:"bandwidth,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeviceProperties) Reset() { + *x = DeviceProperties{} + mi := &file_tensorflow_core_protobuf_device_properties_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeviceProperties) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeviceProperties) ProtoMessage() {} + +func (x *DeviceProperties) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_device_properties_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeviceProperties.ProtoReflect.Descriptor instead. +func (*DeviceProperties) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_device_properties_proto_rawDescGZIP(), []int{0} +} + +func (x *DeviceProperties) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *DeviceProperties) GetVendor() string { + if x != nil { + return x.Vendor + } + return "" +} + +func (x *DeviceProperties) GetModel() string { + if x != nil { + return x.Model + } + return "" +} + +func (x *DeviceProperties) GetFrequency() int64 { + if x != nil { + return x.Frequency + } + return 0 +} + +func (x *DeviceProperties) GetNumCores() int64 { + if x != nil { + return x.NumCores + } + return 0 +} + +func (x *DeviceProperties) GetEnvironment() map[string]string { + if x != nil { + return x.Environment + } + return nil +} + +func (x *DeviceProperties) GetNumRegisters() int64 { + if x != nil { + return x.NumRegisters + } + return 0 +} + +func (x *DeviceProperties) GetL1CacheSize() int64 { + if x != nil { + return x.L1CacheSize + } + return 0 +} + +func (x *DeviceProperties) GetL2CacheSize() int64 { + if x != nil { + return x.L2CacheSize + } + return 0 +} + +func (x *DeviceProperties) GetL3CacheSize() int64 { + if x != nil { + return x.L3CacheSize + } + return 0 +} + +func (x *DeviceProperties) GetSharedMemorySizePerMultiprocessor() int64 { + if x != nil { + return x.SharedMemorySizePerMultiprocessor + } + return 0 +} + +func (x *DeviceProperties) GetMemorySize() int64 { + if x != nil { + return x.MemorySize + } + return 0 +} + +func (x *DeviceProperties) GetBandwidth() int64 { + if x != nil { + return x.Bandwidth + } + return 0 +} + +type NamedDevice struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Properties *DeviceProperties `protobuf:"bytes,2,opt,name=properties,proto3" json:"properties,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NamedDevice) Reset() { + *x = NamedDevice{} + mi := &file_tensorflow_core_protobuf_device_properties_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NamedDevice) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NamedDevice) ProtoMessage() {} + +func (x *NamedDevice) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_device_properties_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NamedDevice.ProtoReflect.Descriptor instead. +func (*NamedDevice) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_device_properties_proto_rawDescGZIP(), []int{1} +} + +func (x *NamedDevice) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *NamedDevice) GetProperties() *DeviceProperties { + if x != nil { + return x.Properties + } + return nil +} + +var File_tensorflow_core_protobuf_device_properties_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_device_properties_proto_rawDesc = "" + + "\n" + + "0tensorflow/core/protobuf/device_properties.proto\x12\n" + + "tensorflow\"\xc2\x04\n" + + "\x10DeviceProperties\x12\x12\n" + + "\x04type\x18\x01 \x01(\tR\x04type\x12\x16\n" + + "\x06vendor\x18\x02 \x01(\tR\x06vendor\x12\x14\n" + + "\x05model\x18\x03 \x01(\tR\x05model\x12\x1c\n" + + "\tfrequency\x18\x04 \x01(\x03R\tfrequency\x12\x1b\n" + + "\tnum_cores\x18\x05 \x01(\x03R\bnumCores\x12O\n" + + "\venvironment\x18\x06 \x03(\v2-.tensorflow.DeviceProperties.EnvironmentEntryR\venvironment\x12#\n" + + "\rnum_registers\x18\a \x01(\x03R\fnumRegisters\x12\"\n" + + "\rl1_cache_size\x18\b \x01(\x03R\vl1CacheSize\x12\"\n" + + "\rl2_cache_size\x18\t \x01(\x03R\vl2CacheSize\x12\"\n" + + "\rl3_cache_size\x18\n" + + " \x01(\x03R\vl3CacheSize\x12P\n" + + "%shared_memory_size_per_multiprocessor\x18\v \x01(\x03R!sharedMemorySizePerMultiprocessor\x12\x1f\n" + + "\vmemory_size\x18\f \x01(\x03R\n" + + "memorySize\x12\x1c\n" + + "\tbandwidth\x18\r \x01(\x03R\tbandwidth\x1a>\n" + + "\x10EnvironmentEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"_\n" + + "\vNamedDevice\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12<\n" + + "\n" + + "properties\x18\x02 \x01(\v2\x1c.tensorflow.DevicePropertiesR\n" + + "propertiesBrB\x16DevicePropertiesProtosZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_device_properties_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_device_properties_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_device_properties_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_device_properties_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_device_properties_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_device_properties_proto_rawDesc), len(file_tensorflow_core_protobuf_device_properties_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_device_properties_proto_rawDescData +} + +var file_tensorflow_core_protobuf_device_properties_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_tensorflow_core_protobuf_device_properties_proto_goTypes = []any{ + (*DeviceProperties)(nil), // 0: tensorflow.DeviceProperties + (*NamedDevice)(nil), // 1: tensorflow.NamedDevice + nil, // 2: tensorflow.DeviceProperties.EnvironmentEntry +} +var file_tensorflow_core_protobuf_device_properties_proto_depIdxs = []int32{ + 2, // 0: tensorflow.DeviceProperties.environment:type_name -> tensorflow.DeviceProperties.EnvironmentEntry + 0, // 1: tensorflow.NamedDevice.properties:type_name -> tensorflow.DeviceProperties + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_device_properties_proto_init() } +func file_tensorflow_core_protobuf_device_properties_proto_init() { + if File_tensorflow_core_protobuf_device_properties_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_device_properties_proto_rawDesc), len(file_tensorflow_core_protobuf_device_properties_proto_rawDesc)), + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_device_properties_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_device_properties_proto_depIdxs, + MessageInfos: file_tensorflow_core_protobuf_device_properties_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_device_properties_proto = out.File + file_tensorflow_core_protobuf_device_properties_proto_goTypes = nil + file_tensorflow_core_protobuf_device_properties_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/eager_service.pb.go b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/eager_service.pb.go new file mode 100644 index 0000000..024e019 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/eager_service.pb.go @@ -0,0 +1,1920 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/eager_service.proto + +package for_core_protos_go_proto + +import ( + attr_value_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/attr_value_go_proto" + device_attributes_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/device_attributes_go_proto" + function_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/function_go_proto" + tensor_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_go_proto" + tensor_shape_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_shape_go_proto" + versions_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/versions_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// A proto representation of an eager operation. +type Operation struct { + state protoimpl.MessageState `protogen:"open.v1"` + // A unique identifier for the operation. Set by the client so that the client + // can uniquely identify the outputs of the scheduled operation. + // + // In the initial implementation, sending duplicate IDs has undefined + // behaviour, but additional constraints may be placed upon this in the + // future. + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + OpInputs []*Operation_Input `protobuf:"bytes,10,rep,name=op_inputs,json=opInputs,proto3" json:"op_inputs,omitempty"` + // Control Operation IDs that will be respected when ops are re-ordered by + // async execution. If async execution (+ op re-ordering) is not enabled, this + // should have no effect. + ControlOpIds []int64 `protobuf:"varint,4,rep,packed,name=control_op_ids,json=controlOpIds,proto3" json:"control_op_ids,omitempty"` + Attrs map[string]*attr_value_go_proto.AttrValue `protobuf:"bytes,5,rep,name=attrs,proto3" json:"attrs,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + Device string `protobuf:"bytes,6,opt,name=device,proto3" json:"device,omitempty"` + // Indicates whether the op is a component of a multi-device function. + IsComponentFunction bool `protobuf:"varint,7,opt,name=is_component_function,json=isComponentFunction,proto3" json:"is_component_function,omitempty"` + // Set when is_component_function is true. It's initially generated + // when we create an FunctionLibraryRuntime::Options (negative value) and used + // to create Rendezvous for function execution. All components of a + // multi-device function should use the same step id to make sure that they + // can communicate through Send/Recv ops. + FuncStepId int64 `protobuf:"varint,8,opt,name=func_step_id,json=funcStepId,proto3" json:"func_step_id,omitempty"` + // Indicates whether the op is a function. + IsFunction bool `protobuf:"varint,9,opt,name=is_function,json=isFunction,proto3" json:"is_function,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Operation) Reset() { + *x = Operation{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Operation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Operation) ProtoMessage() {} + +func (x *Operation) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Operation.ProtoReflect.Descriptor instead. +func (*Operation) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{0} +} + +func (x *Operation) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *Operation) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Operation) GetOpInputs() []*Operation_Input { + if x != nil { + return x.OpInputs + } + return nil +} + +func (x *Operation) GetControlOpIds() []int64 { + if x != nil { + return x.ControlOpIds + } + return nil +} + +func (x *Operation) GetAttrs() map[string]*attr_value_go_proto.AttrValue { + if x != nil { + return x.Attrs + } + return nil +} + +func (x *Operation) GetDevice() string { + if x != nil { + return x.Device + } + return "" +} + +func (x *Operation) GetIsComponentFunction() bool { + if x != nil { + return x.IsComponentFunction + } + return false +} + +func (x *Operation) GetFuncStepId() int64 { + if x != nil { + return x.FuncStepId + } + return 0 +} + +func (x *Operation) GetIsFunction() bool { + if x != nil { + return x.IsFunction + } + return false +} + +type QueueItem struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The remote executor should be able to handle either executing ops directly, + // or releasing any unused tensor handles, since the tensor lifetime is + // maintained by the client. + // + // Types that are valid to be assigned to Item: + // + // *QueueItem_HandleToDecref + // *QueueItem_Operation + // *QueueItem_SendTensor + // *QueueItem_RegisterFunction + // *QueueItem_CleanupFunction + // *QueueItem_SyncRemoteExecutorForStream + // *QueueItem_SendPackedHandle + Item isQueueItem_Item `protobuf_oneof:"item"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *QueueItem) Reset() { + *x = QueueItem{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *QueueItem) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueueItem) ProtoMessage() {} + +func (x *QueueItem) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use QueueItem.ProtoReflect.Descriptor instead. +func (*QueueItem) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{1} +} + +func (x *QueueItem) GetItem() isQueueItem_Item { + if x != nil { + return x.Item + } + return nil +} + +func (x *QueueItem) GetHandleToDecref() *RemoteTensorHandle { + if x != nil { + if x, ok := x.Item.(*QueueItem_HandleToDecref); ok { + return x.HandleToDecref + } + } + return nil +} + +func (x *QueueItem) GetOperation() *Operation { + if x != nil { + if x, ok := x.Item.(*QueueItem_Operation); ok { + return x.Operation + } + } + return nil +} + +func (x *QueueItem) GetSendTensor() *SendTensorOp { + if x != nil { + if x, ok := x.Item.(*QueueItem_SendTensor); ok { + return x.SendTensor + } + } + return nil +} + +func (x *QueueItem) GetRegisterFunction() *RegisterFunctionOp { + if x != nil { + if x, ok := x.Item.(*QueueItem_RegisterFunction); ok { + return x.RegisterFunction + } + } + return nil +} + +func (x *QueueItem) GetCleanupFunction() *CleanupFunctionOp { + if x != nil { + if x, ok := x.Item.(*QueueItem_CleanupFunction); ok { + return x.CleanupFunction + } + } + return nil +} + +func (x *QueueItem) GetSyncRemoteExecutorForStream() *SyncRemoteExecutorForStream { + if x != nil { + if x, ok := x.Item.(*QueueItem_SyncRemoteExecutorForStream); ok { + return x.SyncRemoteExecutorForStream + } + } + return nil +} + +func (x *QueueItem) GetSendPackedHandle() *SendPackedHandleOp { + if x != nil { + if x, ok := x.Item.(*QueueItem_SendPackedHandle); ok { + return x.SendPackedHandle + } + } + return nil +} + +type isQueueItem_Item interface { + isQueueItem_Item() +} + +type QueueItem_HandleToDecref struct { + HandleToDecref *RemoteTensorHandle `protobuf:"bytes,1,opt,name=handle_to_decref,json=handleToDecref,proto3,oneof"` +} + +type QueueItem_Operation struct { + Operation *Operation `protobuf:"bytes,2,opt,name=operation,proto3,oneof"` +} + +type QueueItem_SendTensor struct { + SendTensor *SendTensorOp `protobuf:"bytes,3,opt,name=send_tensor,json=sendTensor,proto3,oneof"` +} + +type QueueItem_RegisterFunction struct { + // Takes a FunctionDef and makes it enqueable on the remote worker. + RegisterFunction *RegisterFunctionOp `protobuf:"bytes,4,opt,name=register_function,json=registerFunction,proto3,oneof"` +} + +type QueueItem_CleanupFunction struct { + CleanupFunction *CleanupFunctionOp `protobuf:"bytes,5,opt,name=cleanup_function,json=cleanupFunction,proto3,oneof"` +} + +type QueueItem_SyncRemoteExecutorForStream struct { + // A remote executor is created to execute ops/functions asynchronously + // enqueued in streaming call. Request with this item type waits for pending + // nodes to finish on the remote executor and report status. + SyncRemoteExecutorForStream *SyncRemoteExecutorForStream `protobuf:"bytes,6,opt,name=sync_remote_executor_for_stream,json=syncRemoteExecutorForStream,proto3,oneof"` +} + +type QueueItem_SendPackedHandle struct { + SendPackedHandle *SendPackedHandleOp `protobuf:"bytes,7,opt,name=send_packed_handle,json=sendPackedHandle,proto3,oneof"` +} + +func (*QueueItem_HandleToDecref) isQueueItem_Item() {} + +func (*QueueItem_Operation) isQueueItem_Item() {} + +func (*QueueItem_SendTensor) isQueueItem_Item() {} + +func (*QueueItem_RegisterFunction) isQueueItem_Item() {} + +func (*QueueItem_CleanupFunction) isQueueItem_Item() {} + +func (*QueueItem_SyncRemoteExecutorForStream) isQueueItem_Item() {} + +func (*QueueItem_SendPackedHandle) isQueueItem_Item() {} + +type QueueResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // `shape` and `tensor` cannot be set in the same response. + // Shapes of output tensors for creating remote TensorHandles. + Shape []*tensor_shape_go_proto.TensorShapeProto `protobuf:"bytes,1,rep,name=shape,proto3" json:"shape,omitempty"` + // Optional. If set, represents the output devices of a function. + Device []string `protobuf:"bytes,3,rep,name=device,proto3" json:"device,omitempty"` + // Output tensors of a remote function. Set when Operation.id is invalid. + Tensor []*tensor_go_proto.TensorProto `protobuf:"bytes,2,rep,name=tensor,proto3" json:"tensor,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *QueueResponse) Reset() { + *x = QueueResponse{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *QueueResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueueResponse) ProtoMessage() {} + +func (x *QueueResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use QueueResponse.ProtoReflect.Descriptor instead. +func (*QueueResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{2} +} + +func (x *QueueResponse) GetShape() []*tensor_shape_go_proto.TensorShapeProto { + if x != nil { + return x.Shape + } + return nil +} + +func (x *QueueResponse) GetDevice() []string { + if x != nil { + return x.Device + } + return nil +} + +func (x *QueueResponse) GetTensor() []*tensor_go_proto.TensorProto { + if x != nil { + return x.Tensor + } + return nil +} + +type CreateContextRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Identifies the full cluster, and this particular worker's position within. + ServerDef *ServerDef `protobuf:"bytes,1,opt,name=server_def,json=serverDef,proto3" json:"server_def,omitempty"` + // Whether the ops on the worker should be executed synchronously or + // asynchronously. By default, ops are executed synchronously. + Async bool `protobuf:"varint,2,opt,name=async,proto3" json:"async,omitempty"` + // Number of seconds to keep the context alive. If more than keep_alive_secs + // has passed since a particular context has been communicated with, it will + // be garbage collected. + KeepAliveSecs int64 `protobuf:"varint,3,opt,name=keep_alive_secs,json=keepAliveSecs,proto3" json:"keep_alive_secs,omitempty"` + // This is the version for all the ops that will be enqueued by the client. + VersionDef *versions_go_proto.VersionDef `protobuf:"bytes,4,opt,name=version_def,json=versionDef,proto3" json:"version_def,omitempty"` + // Device attributes in the cluster + ClusterDeviceAttributes []*device_attributes_go_proto.DeviceAttributes `protobuf:"bytes,6,rep,name=cluster_device_attributes,json=clusterDeviceAttributes,proto3" json:"cluster_device_attributes,omitempty"` + // The ID of the created context. This is usually a randomly generated number, + // that will be used to identify the context in future requests to the + // service. Contexts are not persisted through server restarts. + // This ID will be used for all future communications as well. It is essential + // that both ends use this ID for selecting a rendezvous to get everything to + // match. + ContextId uint64 `protobuf:"fixed64,7,opt,name=context_id,json=contextId,proto3" json:"context_id,omitempty"` + // The view ID of the context. + ContextViewId uint64 `protobuf:"fixed64,8,opt,name=context_view_id,json=contextViewId,proto3" json:"context_view_id,omitempty"` + // For a multi device function, if false, eagerly copy all remote inputs to + // the default function device; if true, lazily copy remote inputs to their + // target devices after function instantiation to avoid redundant copies. + LazyCopyRemoteFunctionInputs bool `protobuf:"varint,9,opt,name=lazy_copy_remote_function_inputs,json=lazyCopyRemoteFunctionInputs,proto3" json:"lazy_copy_remote_function_inputs,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateContextRequest) Reset() { + *x = CreateContextRequest{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateContextRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateContextRequest) ProtoMessage() {} + +func (x *CreateContextRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateContextRequest.ProtoReflect.Descriptor instead. +func (*CreateContextRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{3} +} + +func (x *CreateContextRequest) GetServerDef() *ServerDef { + if x != nil { + return x.ServerDef + } + return nil +} + +func (x *CreateContextRequest) GetAsync() bool { + if x != nil { + return x.Async + } + return false +} + +func (x *CreateContextRequest) GetKeepAliveSecs() int64 { + if x != nil { + return x.KeepAliveSecs + } + return 0 +} + +func (x *CreateContextRequest) GetVersionDef() *versions_go_proto.VersionDef { + if x != nil { + return x.VersionDef + } + return nil +} + +func (x *CreateContextRequest) GetClusterDeviceAttributes() []*device_attributes_go_proto.DeviceAttributes { + if x != nil { + return x.ClusterDeviceAttributes + } + return nil +} + +func (x *CreateContextRequest) GetContextId() uint64 { + if x != nil { + return x.ContextId + } + return 0 +} + +func (x *CreateContextRequest) GetContextViewId() uint64 { + if x != nil { + return x.ContextViewId + } + return 0 +} + +func (x *CreateContextRequest) GetLazyCopyRemoteFunctionInputs() bool { + if x != nil { + return x.LazyCopyRemoteFunctionInputs + } + return false +} + +type CreateContextResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // List of devices that are locally accessible to the worker. + DeviceAttributes []*device_attributes_go_proto.DeviceAttributes `protobuf:"bytes,2,rep,name=device_attributes,json=deviceAttributes,proto3" json:"device_attributes,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateContextResponse) Reset() { + *x = CreateContextResponse{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateContextResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateContextResponse) ProtoMessage() {} + +func (x *CreateContextResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateContextResponse.ProtoReflect.Descriptor instead. +func (*CreateContextResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{4} +} + +func (x *CreateContextResponse) GetDeviceAttributes() []*device_attributes_go_proto.DeviceAttributes { + if x != nil { + return x.DeviceAttributes + } + return nil +} + +type UpdateContextRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Identifies the full cluster, and this particular worker's position within. + ServerDef *ServerDef `protobuf:"bytes,1,opt,name=server_def,json=serverDef,proto3" json:"server_def,omitempty"` + // Device attributes in the cluster. + // If this field is empty, it indicates that this is a simple update request + // that only increments the cluster view ID and does not require changes to + // the workers it connects to. + ClusterDeviceAttributes []*device_attributes_go_proto.DeviceAttributes `protobuf:"bytes,2,rep,name=cluster_device_attributes,json=clusterDeviceAttributes,proto3" json:"cluster_device_attributes,omitempty"` + // The ID of the context to be updated. A context with the specified ID must + // already exist on the recepient server of this request. + ContextId uint64 `protobuf:"fixed64,3,opt,name=context_id,json=contextId,proto3" json:"context_id,omitempty"` + // The view ID of the context, which should be contiguously incremented when + // updating the same context. + ContextViewId uint64 `protobuf:"fixed64,4,opt,name=context_view_id,json=contextViewId,proto3" json:"context_view_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateContextRequest) Reset() { + *x = UpdateContextRequest{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateContextRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateContextRequest) ProtoMessage() {} + +func (x *UpdateContextRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateContextRequest.ProtoReflect.Descriptor instead. +func (*UpdateContextRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{5} +} + +func (x *UpdateContextRequest) GetServerDef() *ServerDef { + if x != nil { + return x.ServerDef + } + return nil +} + +func (x *UpdateContextRequest) GetClusterDeviceAttributes() []*device_attributes_go_proto.DeviceAttributes { + if x != nil { + return x.ClusterDeviceAttributes + } + return nil +} + +func (x *UpdateContextRequest) GetContextId() uint64 { + if x != nil { + return x.ContextId + } + return 0 +} + +func (x *UpdateContextRequest) GetContextViewId() uint64 { + if x != nil { + return x.ContextViewId + } + return 0 +} + +type UpdateContextResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // List of devices that are locally accessible to the worker. + DeviceAttributes []*device_attributes_go_proto.DeviceAttributes `protobuf:"bytes,1,rep,name=device_attributes,json=deviceAttributes,proto3" json:"device_attributes,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateContextResponse) Reset() { + *x = UpdateContextResponse{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateContextResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateContextResponse) ProtoMessage() {} + +func (x *UpdateContextResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateContextResponse.ProtoReflect.Descriptor instead. +func (*UpdateContextResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{6} +} + +func (x *UpdateContextResponse) GetDeviceAttributes() []*device_attributes_go_proto.DeviceAttributes { + if x != nil { + return x.DeviceAttributes + } + return nil +} + +type EnqueueRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ContextId uint64 `protobuf:"fixed64,1,opt,name=context_id,json=contextId,proto3" json:"context_id,omitempty"` + Queue []*QueueItem `protobuf:"bytes,3,rep,name=queue,proto3" json:"queue,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *EnqueueRequest) Reset() { + *x = EnqueueRequest{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *EnqueueRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EnqueueRequest) ProtoMessage() {} + +func (x *EnqueueRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EnqueueRequest.ProtoReflect.Descriptor instead. +func (*EnqueueRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{7} +} + +func (x *EnqueueRequest) GetContextId() uint64 { + if x != nil { + return x.ContextId + } + return 0 +} + +func (x *EnqueueRequest) GetQueue() []*QueueItem { + if x != nil { + return x.Queue + } + return nil +} + +type EnqueueResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // A single operation response for every item in the request. + QueueResponse []*QueueResponse `protobuf:"bytes,1,rep,name=queue_response,json=queueResponse,proto3" json:"queue_response,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *EnqueueResponse) Reset() { + *x = EnqueueResponse{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *EnqueueResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EnqueueResponse) ProtoMessage() {} + +func (x *EnqueueResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EnqueueResponse.ProtoReflect.Descriptor instead. +func (*EnqueueResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{8} +} + +func (x *EnqueueResponse) GetQueueResponse() []*QueueResponse { + if x != nil { + return x.QueueResponse + } + return nil +} + +type WaitQueueDoneRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ContextId uint64 `protobuf:"fixed64,1,opt,name=context_id,json=contextId,proto3" json:"context_id,omitempty"` + // Ids to wait on. If empty, wait on everything currently pending. + OpId []int64 `protobuf:"varint,2,rep,packed,name=op_id,json=opId,proto3" json:"op_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *WaitQueueDoneRequest) Reset() { + *x = WaitQueueDoneRequest{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *WaitQueueDoneRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WaitQueueDoneRequest) ProtoMessage() {} + +func (x *WaitQueueDoneRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WaitQueueDoneRequest.ProtoReflect.Descriptor instead. +func (*WaitQueueDoneRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{9} +} + +func (x *WaitQueueDoneRequest) GetContextId() uint64 { + if x != nil { + return x.ContextId + } + return 0 +} + +func (x *WaitQueueDoneRequest) GetOpId() []int64 { + if x != nil { + return x.OpId + } + return nil +} + +type WaitQueueDoneResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *WaitQueueDoneResponse) Reset() { + *x = WaitQueueDoneResponse{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *WaitQueueDoneResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WaitQueueDoneResponse) ProtoMessage() {} + +func (x *WaitQueueDoneResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WaitQueueDoneResponse.ProtoReflect.Descriptor instead. +func (*WaitQueueDoneResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{10} +} + +type RunComponentFunctionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ContextId uint64 `protobuf:"fixed64,1,opt,name=context_id,json=contextId,proto3" json:"context_id,omitempty"` + Operation *Operation `protobuf:"bytes,2,opt,name=operation,proto3" json:"operation,omitempty"` + // The output indices of its parent function. + OutputNum []int32 `protobuf:"varint,3,rep,packed,name=output_num,json=outputNum,proto3" json:"output_num,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RunComponentFunctionRequest) Reset() { + *x = RunComponentFunctionRequest{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RunComponentFunctionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RunComponentFunctionRequest) ProtoMessage() {} + +func (x *RunComponentFunctionRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RunComponentFunctionRequest.ProtoReflect.Descriptor instead. +func (*RunComponentFunctionRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{11} +} + +func (x *RunComponentFunctionRequest) GetContextId() uint64 { + if x != nil { + return x.ContextId + } + return 0 +} + +func (x *RunComponentFunctionRequest) GetOperation() *Operation { + if x != nil { + return x.Operation + } + return nil +} + +func (x *RunComponentFunctionRequest) GetOutputNum() []int32 { + if x != nil { + return x.OutputNum + } + return nil +} + +type RunComponentFunctionResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Shape []*tensor_shape_go_proto.TensorShapeProto `protobuf:"bytes,1,rep,name=shape,proto3" json:"shape,omitempty"` + Tensor []*tensor_go_proto.TensorProto `protobuf:"bytes,2,rep,name=tensor,proto3" json:"tensor,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RunComponentFunctionResponse) Reset() { + *x = RunComponentFunctionResponse{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RunComponentFunctionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RunComponentFunctionResponse) ProtoMessage() {} + +func (x *RunComponentFunctionResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RunComponentFunctionResponse.ProtoReflect.Descriptor instead. +func (*RunComponentFunctionResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{12} +} + +func (x *RunComponentFunctionResponse) GetShape() []*tensor_shape_go_proto.TensorShapeProto { + if x != nil { + return x.Shape + } + return nil +} + +func (x *RunComponentFunctionResponse) GetTensor() []*tensor_go_proto.TensorProto { + if x != nil { + return x.Tensor + } + return nil +} + +type KeepAliveRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ContextId uint64 `protobuf:"fixed64,1,opt,name=context_id,json=contextId,proto3" json:"context_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KeepAliveRequest) Reset() { + *x = KeepAliveRequest{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KeepAliveRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KeepAliveRequest) ProtoMessage() {} + +func (x *KeepAliveRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[13] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KeepAliveRequest.ProtoReflect.Descriptor instead. +func (*KeepAliveRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{13} +} + +func (x *KeepAliveRequest) GetContextId() uint64 { + if x != nil { + return x.ContextId + } + return 0 +} + +type KeepAliveResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // If the requested context_id is on the remote host, set the context view ID. + ContextViewId uint64 `protobuf:"fixed64,1,opt,name=context_view_id,json=contextViewId,proto3" json:"context_view_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KeepAliveResponse) Reset() { + *x = KeepAliveResponse{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KeepAliveResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KeepAliveResponse) ProtoMessage() {} + +func (x *KeepAliveResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[14] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KeepAliveResponse.ProtoReflect.Descriptor instead. +func (*KeepAliveResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{14} +} + +func (x *KeepAliveResponse) GetContextViewId() uint64 { + if x != nil { + return x.ContextViewId + } + return 0 +} + +type CloseContextRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ContextId uint64 `protobuf:"fixed64,1,opt,name=context_id,json=contextId,proto3" json:"context_id,omitempty"` + ContextViewId uint64 `protobuf:"fixed64,2,opt,name=context_view_id,json=contextViewId,proto3" json:"context_view_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CloseContextRequest) Reset() { + *x = CloseContextRequest{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CloseContextRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CloseContextRequest) ProtoMessage() {} + +func (x *CloseContextRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[15] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CloseContextRequest.ProtoReflect.Descriptor instead. +func (*CloseContextRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{15} +} + +func (x *CloseContextRequest) GetContextId() uint64 { + if x != nil { + return x.ContextId + } + return 0 +} + +func (x *CloseContextRequest) GetContextViewId() uint64 { + if x != nil { + return x.ContextViewId + } + return 0 +} + +type CloseContextResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CloseContextResponse) Reset() { + *x = CloseContextResponse{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CloseContextResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CloseContextResponse) ProtoMessage() {} + +func (x *CloseContextResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[16] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CloseContextResponse.ProtoReflect.Descriptor instead. +func (*CloseContextResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{16} +} + +type RegisterFunctionOp struct { + state protoimpl.MessageState `protogen:"open.v1"` + FunctionDef *function_go_proto.FunctionDef `protobuf:"bytes,1,opt,name=function_def,json=functionDef,proto3" json:"function_def,omitempty"` + // If true, it means that function_def is produced by graph partition during + // multi-device function instantiation. + IsComponentFunction bool `protobuf:"varint,2,opt,name=is_component_function,json=isComponentFunction,proto3" json:"is_component_function,omitempty"` + // All necessary FunctionDefs and GradientDefs to expand `function_def`. + // When is_component_function is true, `function_def` could be a nested + // function, since some nodes in its parent's function body could be + // replaced with a new function by the graph optimization passes. No need to + // add FunctionDefs here to the function cache in EagerContext since they + // won't be executed as KernelAndDevices. + Library *function_go_proto.FunctionDefLibrary `protobuf:"bytes,3,opt,name=library,proto3" json:"library,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RegisterFunctionOp) Reset() { + *x = RegisterFunctionOp{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RegisterFunctionOp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RegisterFunctionOp) ProtoMessage() {} + +func (x *RegisterFunctionOp) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[17] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RegisterFunctionOp.ProtoReflect.Descriptor instead. +func (*RegisterFunctionOp) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{17} +} + +func (x *RegisterFunctionOp) GetFunctionDef() *function_go_proto.FunctionDef { + if x != nil { + return x.FunctionDef + } + return nil +} + +func (x *RegisterFunctionOp) GetIsComponentFunction() bool { + if x != nil { + return x.IsComponentFunction + } + return false +} + +func (x *RegisterFunctionOp) GetLibrary() *function_go_proto.FunctionDefLibrary { + if x != nil { + return x.Library + } + return nil +} + +// Cleanup the step state of a multi-device function (e.g. tensors buffered by +// a `Send` op but not picked up by its corresponding `Recv` op). +type CleanupFunctionOp struct { + state protoimpl.MessageState `protogen:"open.v1"` + StepId int64 `protobuf:"varint,1,opt,name=step_id,json=stepId,proto3" json:"step_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CleanupFunctionOp) Reset() { + *x = CleanupFunctionOp{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CleanupFunctionOp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CleanupFunctionOp) ProtoMessage() {} + +func (x *CleanupFunctionOp) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[18] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CleanupFunctionOp.ProtoReflect.Descriptor instead. +func (*CleanupFunctionOp) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{18} +} + +func (x *CleanupFunctionOp) GetStepId() int64 { + if x != nil { + return x.StepId + } + return 0 +} + +type SyncRemoteExecutorForStream struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SyncRemoteExecutorForStream) Reset() { + *x = SyncRemoteExecutorForStream{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SyncRemoteExecutorForStream) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SyncRemoteExecutorForStream) ProtoMessage() {} + +func (x *SyncRemoteExecutorForStream) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[19] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SyncRemoteExecutorForStream.ProtoReflect.Descriptor instead. +func (*SyncRemoteExecutorForStream) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{19} +} + +type SendTensorOp struct { + state protoimpl.MessageState `protogen:"open.v1"` + // All remote tensors are identified by . To mimic this + // situation when directly sending tensors, we include an "artificial" op ID + // (which would have corresponded to the _Recv op when not using SendTensor). + OpId int64 `protobuf:"varint,1,opt,name=op_id,json=opId,proto3" json:"op_id,omitempty"` + // The index within the repeated field is the output number that will help + // uniquely identify (along with the above op_id) the particular tensor. + Tensors []*tensor_go_proto.TensorProto `protobuf:"bytes,2,rep,name=tensors,proto3" json:"tensors,omitempty"` + // The device on which the tensors should be resident. + DeviceName string `protobuf:"bytes,3,opt,name=device_name,json=deviceName,proto3" json:"device_name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SendTensorOp) Reset() { + *x = SendTensorOp{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SendTensorOp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SendTensorOp) ProtoMessage() {} + +func (x *SendTensorOp) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[20] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SendTensorOp.ProtoReflect.Descriptor instead. +func (*SendTensorOp) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{20} +} + +func (x *SendTensorOp) GetOpId() int64 { + if x != nil { + return x.OpId + } + return 0 +} + +func (x *SendTensorOp) GetTensors() []*tensor_go_proto.TensorProto { + if x != nil { + return x.Tensors + } + return nil +} + +func (x *SendTensorOp) GetDeviceName() string { + if x != nil { + return x.DeviceName + } + return "" +} + +// Send a packed TensorHandle to a remote worker. +type SendPackedHandleOp struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Op id of the remote packed TensorHandle. + OpId int64 `protobuf:"varint,1,opt,name=op_id,json=opId,proto3" json:"op_id,omitempty"` + Handles []*SendPackedHandleOp_Handle `protobuf:"bytes,2,rep,name=handles,proto3" json:"handles,omitempty"` + DeviceName string `protobuf:"bytes,3,opt,name=device_name,json=deviceName,proto3" json:"device_name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SendPackedHandleOp) Reset() { + *x = SendPackedHandleOp{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SendPackedHandleOp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SendPackedHandleOp) ProtoMessage() {} + +func (x *SendPackedHandleOp) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[21] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SendPackedHandleOp.ProtoReflect.Descriptor instead. +func (*SendPackedHandleOp) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{21} +} + +func (x *SendPackedHandleOp) GetOpId() int64 { + if x != nil { + return x.OpId + } + return 0 +} + +func (x *SendPackedHandleOp) GetHandles() []*SendPackedHandleOp_Handle { + if x != nil { + return x.Handles + } + return nil +} + +func (x *SendPackedHandleOp) GetDeviceName() string { + if x != nil { + return x.DeviceName + } + return "" +} + +type Operation_Input struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Item: + // + // *Operation_Input_RemoteHandle + // *Operation_Input_Tensor + Item isOperation_Input_Item `protobuf_oneof:"item"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Operation_Input) Reset() { + *x = Operation_Input{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Operation_Input) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Operation_Input) ProtoMessage() {} + +func (x *Operation_Input) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[22] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Operation_Input.ProtoReflect.Descriptor instead. +func (*Operation_Input) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *Operation_Input) GetItem() isOperation_Input_Item { + if x != nil { + return x.Item + } + return nil +} + +func (x *Operation_Input) GetRemoteHandle() *RemoteTensorHandle { + if x != nil { + if x, ok := x.Item.(*Operation_Input_RemoteHandle); ok { + return x.RemoteHandle + } + } + return nil +} + +func (x *Operation_Input) GetTensor() *tensor_go_proto.TensorProto { + if x != nil { + if x, ok := x.Item.(*Operation_Input_Tensor); ok { + return x.Tensor + } + } + return nil +} + +type isOperation_Input_Item interface { + isOperation_Input_Item() +} + +type Operation_Input_RemoteHandle struct { + RemoteHandle *RemoteTensorHandle `protobuf:"bytes,1,opt,name=remote_handle,json=remoteHandle,proto3,oneof"` +} + +type Operation_Input_Tensor struct { + Tensor *tensor_go_proto.TensorProto `protobuf:"bytes,2,opt,name=tensor,proto3,oneof"` +} + +func (*Operation_Input_RemoteHandle) isOperation_Input_Item() {} + +func (*Operation_Input_Tensor) isOperation_Input_Item() {} + +type SendPackedHandleOp_LocalTensorHandle struct { + state protoimpl.MessageState `protogen:"open.v1"` + Tensor *tensor_go_proto.TensorProto `protobuf:"bytes,1,opt,name=tensor,proto3" json:"tensor,omitempty"` + // Device where the tensor is produced. + Device string `protobuf:"bytes,2,opt,name=device,proto3" json:"device,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SendPackedHandleOp_LocalTensorHandle) Reset() { + *x = SendPackedHandleOp_LocalTensorHandle{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SendPackedHandleOp_LocalTensorHandle) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SendPackedHandleOp_LocalTensorHandle) ProtoMessage() {} + +func (x *SendPackedHandleOp_LocalTensorHandle) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[24] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SendPackedHandleOp_LocalTensorHandle.ProtoReflect.Descriptor instead. +func (*SendPackedHandleOp_LocalTensorHandle) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{21, 0} +} + +func (x *SendPackedHandleOp_LocalTensorHandle) GetTensor() *tensor_go_proto.TensorProto { + if x != nil { + return x.Tensor + } + return nil +} + +func (x *SendPackedHandleOp_LocalTensorHandle) GetDevice() string { + if x != nil { + return x.Device + } + return "" +} + +type SendPackedHandleOp_Handle struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Item: + // + // *SendPackedHandleOp_Handle_LocalHandle + // *SendPackedHandleOp_Handle_RemoteHandle + Item isSendPackedHandleOp_Handle_Item `protobuf_oneof:"item"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SendPackedHandleOp_Handle) Reset() { + *x = SendPackedHandleOp_Handle{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SendPackedHandleOp_Handle) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SendPackedHandleOp_Handle) ProtoMessage() {} + +func (x *SendPackedHandleOp_Handle) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[25] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SendPackedHandleOp_Handle.ProtoReflect.Descriptor instead. +func (*SendPackedHandleOp_Handle) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{21, 1} +} + +func (x *SendPackedHandleOp_Handle) GetItem() isSendPackedHandleOp_Handle_Item { + if x != nil { + return x.Item + } + return nil +} + +func (x *SendPackedHandleOp_Handle) GetLocalHandle() *SendPackedHandleOp_LocalTensorHandle { + if x != nil { + if x, ok := x.Item.(*SendPackedHandleOp_Handle_LocalHandle); ok { + return x.LocalHandle + } + } + return nil +} + +func (x *SendPackedHandleOp_Handle) GetRemoteHandle() *RemoteTensorHandle { + if x != nil { + if x, ok := x.Item.(*SendPackedHandleOp_Handle_RemoteHandle); ok { + return x.RemoteHandle + } + } + return nil +} + +type isSendPackedHandleOp_Handle_Item interface { + isSendPackedHandleOp_Handle_Item() +} + +type SendPackedHandleOp_Handle_LocalHandle struct { + LocalHandle *SendPackedHandleOp_LocalTensorHandle `protobuf:"bytes,1,opt,name=local_handle,json=localHandle,proto3,oneof"` +} + +type SendPackedHandleOp_Handle_RemoteHandle struct { + RemoteHandle *RemoteTensorHandle `protobuf:"bytes,2,opt,name=remote_handle,json=remoteHandle,proto3,oneof"` +} + +func (*SendPackedHandleOp_Handle_LocalHandle) isSendPackedHandleOp_Handle_Item() {} + +func (*SendPackedHandleOp_Handle_RemoteHandle) isSendPackedHandleOp_Handle_Item() {} + +var File_tensorflow_core_protobuf_eager_service_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_eager_service_proto_rawDesc = "" + + "\n" + + ",tensorflow/core/protobuf/eager_service.proto\x12\x10tensorflow.eager\x1a*tensorflow/core/framework/attr_value.proto\x1a1tensorflow/core/framework/device_attributes.proto\x1a(tensorflow/core/framework/function.proto\x1a&tensorflow/core/framework/tensor.proto\x1a,tensorflow/core/framework/tensor_shape.proto\x1a(tensorflow/core/framework/versions.proto\x1a3tensorflow/core/protobuf/remote_tensor_handle.proto\x1a0tensorflow/core/protobuf/tensorflow_server.proto\"\xcb\x04\n" + + "\tOperation\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x03R\x02id\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x12>\n" + + "\top_inputs\x18\n" + + " \x03(\v2!.tensorflow.eager.Operation.InputR\bopInputs\x12$\n" + + "\x0econtrol_op_ids\x18\x04 \x03(\x03R\fcontrolOpIds\x12<\n" + + "\x05attrs\x18\x05 \x03(\v2&.tensorflow.eager.Operation.AttrsEntryR\x05attrs\x12\x16\n" + + "\x06device\x18\x06 \x01(\tR\x06device\x122\n" + + "\x15is_component_function\x18\a \x01(\bR\x13isComponentFunction\x12 \n" + + "\ffunc_step_id\x18\b \x01(\x03R\n" + + "funcStepId\x12\x1f\n" + + "\vis_function\x18\t \x01(\bR\n" + + "isFunction\x1a\x8f\x01\n" + + "\x05Input\x12K\n" + + "\rremote_handle\x18\x01 \x01(\v2$.tensorflow.eager.RemoteTensorHandleH\x00R\fremoteHandle\x121\n" + + "\x06tensor\x18\x02 \x01(\v2\x17.tensorflow.TensorProtoH\x00R\x06tensorB\x06\n" + + "\x04item\x1aO\n" + + "\n" + + "AttrsEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12+\n" + + "\x05value\x18\x02 \x01(\v2\x15.tensorflow.AttrValueR\x05value:\x028\x01J\x04\b\x03\x10\x04\"\xd9\x04\n" + + "\tQueueItem\x12P\n" + + "\x10handle_to_decref\x18\x01 \x01(\v2$.tensorflow.eager.RemoteTensorHandleH\x00R\x0ehandleToDecref\x12;\n" + + "\toperation\x18\x02 \x01(\v2\x1b.tensorflow.eager.OperationH\x00R\toperation\x12A\n" + + "\vsend_tensor\x18\x03 \x01(\v2\x1e.tensorflow.eager.SendTensorOpH\x00R\n" + + "sendTensor\x12S\n" + + "\x11register_function\x18\x04 \x01(\v2$.tensorflow.eager.RegisterFunctionOpH\x00R\x10registerFunction\x12P\n" + + "\x10cleanup_function\x18\x05 \x01(\v2#.tensorflow.eager.CleanupFunctionOpH\x00R\x0fcleanupFunction\x12u\n" + + "\x1fsync_remote_executor_for_stream\x18\x06 \x01(\v2-.tensorflow.eager.SyncRemoteExecutorForStreamH\x00R\x1bsyncRemoteExecutorForStream\x12T\n" + + "\x12send_packed_handle\x18\a \x01(\v2$.tensorflow.eager.SendPackedHandleOpH\x00R\x10sendPackedHandleB\x06\n" + + "\x04item\"\x8c\x01\n" + + "\rQueueResponse\x122\n" + + "\x05shape\x18\x01 \x03(\v2\x1c.tensorflow.TensorShapeProtoR\x05shape\x12\x16\n" + + "\x06device\x18\x03 \x03(\tR\x06device\x12/\n" + + "\x06tensor\x18\x02 \x03(\v2\x17.tensorflow.TensorProtoR\x06tensor\"\xb2\x03\n" + + "\x14CreateContextRequest\x124\n" + + "\n" + + "server_def\x18\x01 \x01(\v2\x15.tensorflow.ServerDefR\tserverDef\x12\x14\n" + + "\x05async\x18\x02 \x01(\bR\x05async\x12&\n" + + "\x0fkeep_alive_secs\x18\x03 \x01(\x03R\rkeepAliveSecs\x127\n" + + "\vversion_def\x18\x04 \x01(\v2\x16.tensorflow.VersionDefR\n" + + "versionDef\x12X\n" + + "\x19cluster_device_attributes\x18\x06 \x03(\v2\x1c.tensorflow.DeviceAttributesR\x17clusterDeviceAttributes\x12\x1d\n" + + "\n" + + "context_id\x18\a \x01(\x06R\tcontextId\x12&\n" + + "\x0fcontext_view_id\x18\b \x01(\x06R\rcontextViewId\x12F\n" + + " lazy_copy_remote_function_inputs\x18\t \x01(\bR\x1clazyCopyRemoteFunctionInputsJ\x04\b\x05\x10\x06\"h\n" + + "\x15CreateContextResponse\x12I\n" + + "\x11device_attributes\x18\x02 \x03(\v2\x1c.tensorflow.DeviceAttributesR\x10deviceAttributesJ\x04\b\x01\x10\x02\"\xed\x01\n" + + "\x14UpdateContextRequest\x124\n" + + "\n" + + "server_def\x18\x01 \x01(\v2\x15.tensorflow.ServerDefR\tserverDef\x12X\n" + + "\x19cluster_device_attributes\x18\x02 \x03(\v2\x1c.tensorflow.DeviceAttributesR\x17clusterDeviceAttributes\x12\x1d\n" + + "\n" + + "context_id\x18\x03 \x01(\x06R\tcontextId\x12&\n" + + "\x0fcontext_view_id\x18\x04 \x01(\x06R\rcontextViewId\"b\n" + + "\x15UpdateContextResponse\x12I\n" + + "\x11device_attributes\x18\x01 \x03(\v2\x1c.tensorflow.DeviceAttributesR\x10deviceAttributes\"b\n" + + "\x0eEnqueueRequest\x12\x1d\n" + + "\n" + + "context_id\x18\x01 \x01(\x06R\tcontextId\x121\n" + + "\x05queue\x18\x03 \x03(\v2\x1b.tensorflow.eager.QueueItemR\x05queue\"Y\n" + + "\x0fEnqueueResponse\x12F\n" + + "\x0equeue_response\x18\x01 \x03(\v2\x1f.tensorflow.eager.QueueResponseR\rqueueResponse\"J\n" + + "\x14WaitQueueDoneRequest\x12\x1d\n" + + "\n" + + "context_id\x18\x01 \x01(\x06R\tcontextId\x12\x13\n" + + "\x05op_id\x18\x02 \x03(\x03R\x04opId\"\x17\n" + + "\x15WaitQueueDoneResponse\"\x96\x01\n" + + "\x1bRunComponentFunctionRequest\x12\x1d\n" + + "\n" + + "context_id\x18\x01 \x01(\x06R\tcontextId\x129\n" + + "\toperation\x18\x02 \x01(\v2\x1b.tensorflow.eager.OperationR\toperation\x12\x1d\n" + + "\n" + + "output_num\x18\x03 \x03(\x05R\toutputNum\"\x83\x01\n" + + "\x1cRunComponentFunctionResponse\x122\n" + + "\x05shape\x18\x01 \x03(\v2\x1c.tensorflow.TensorShapeProtoR\x05shape\x12/\n" + + "\x06tensor\x18\x02 \x03(\v2\x17.tensorflow.TensorProtoR\x06tensor\"1\n" + + "\x10KeepAliveRequest\x12\x1d\n" + + "\n" + + "context_id\x18\x01 \x01(\x06R\tcontextId\";\n" + + "\x11KeepAliveResponse\x12&\n" + + "\x0fcontext_view_id\x18\x01 \x01(\x06R\rcontextViewId\"\\\n" + + "\x13CloseContextRequest\x12\x1d\n" + + "\n" + + "context_id\x18\x01 \x01(\x06R\tcontextId\x12&\n" + + "\x0fcontext_view_id\x18\x02 \x01(\x06R\rcontextViewId\"\x16\n" + + "\x14CloseContextResponse\"\xbe\x01\n" + + "\x12RegisterFunctionOp\x12:\n" + + "\ffunction_def\x18\x01 \x01(\v2\x17.tensorflow.FunctionDefR\vfunctionDef\x122\n" + + "\x15is_component_function\x18\x02 \x01(\bR\x13isComponentFunction\x128\n" + + "\alibrary\x18\x03 \x01(\v2\x1e.tensorflow.FunctionDefLibraryR\alibrary\",\n" + + "\x11CleanupFunctionOp\x12\x17\n" + + "\astep_id\x18\x01 \x01(\x03R\x06stepId\"\x1d\n" + + "\x1bSyncRemoteExecutorForStream\"w\n" + + "\fSendTensorOp\x12\x13\n" + + "\x05op_id\x18\x01 \x01(\x03R\x04opId\x121\n" + + "\atensors\x18\x02 \x03(\v2\x17.tensorflow.TensorProtoR\atensors\x12\x1f\n" + + "\vdevice_name\x18\x03 \x01(\tR\n" + + "deviceName\"\xac\x03\n" + + "\x12SendPackedHandleOp\x12\x13\n" + + "\x05op_id\x18\x01 \x01(\x03R\x04opId\x12E\n" + + "\ahandles\x18\x02 \x03(\v2+.tensorflow.eager.SendPackedHandleOp.HandleR\ahandles\x12\x1f\n" + + "\vdevice_name\x18\x03 \x01(\tR\n" + + "deviceName\x1a\\\n" + + "\x11LocalTensorHandle\x12/\n" + + "\x06tensor\x18\x01 \x01(\v2\x17.tensorflow.TensorProtoR\x06tensor\x12\x16\n" + + "\x06device\x18\x02 \x01(\tR\x06device\x1a\xba\x01\n" + + "\x06Handle\x12[\n" + + "\flocal_handle\x18\x01 \x01(\v26.tensorflow.eager.SendPackedHandleOp.LocalTensorHandleH\x00R\vlocalHandle\x12K\n" + + "\rremote_handle\x18\x02 \x01(\v2$.tensorflow.eager.RemoteTensorHandleH\x00R\fremoteHandleB\x06\n" + + "\x04item2\x8d\x06\n" + + "\fEagerService\x12`\n" + + "\rCreateContext\x12&.tensorflow.eager.CreateContextRequest\x1a'.tensorflow.eager.CreateContextResponse\x12`\n" + + "\rUpdateContext\x12&.tensorflow.eager.UpdateContextRequest\x1a'.tensorflow.eager.UpdateContextResponse\x12N\n" + + "\aEnqueue\x12 .tensorflow.eager.EnqueueRequest\x1a!.tensorflow.eager.EnqueueResponse\x12[\n" + + "\x10StreamingEnqueue\x12 .tensorflow.eager.EnqueueRequest\x1a!.tensorflow.eager.EnqueueResponse(\x010\x01\x12`\n" + + "\rWaitQueueDone\x12&.tensorflow.eager.WaitQueueDoneRequest\x1a'.tensorflow.eager.WaitQueueDoneResponse\x12u\n" + + "\x14RunComponentFunction\x12-.tensorflow.eager.RunComponentFunctionRequest\x1a..tensorflow.eager.RunComponentFunctionResponse\x12T\n" + + "\tKeepAlive\x12\".tensorflow.eager.KeepAliveRequest\x1a#.tensorflow.eager.KeepAliveResponse\x12]\n" + + "\fCloseContext\x12%.tensorflow.eager.CloseContextRequest\x1a&.tensorflow.eager.CloseContextResponseBWZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_protob\x06proto3" + +var ( + file_tensorflow_core_protobuf_eager_service_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_eager_service_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_eager_service_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_eager_service_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_eager_service_proto_rawDesc), len(file_tensorflow_core_protobuf_eager_service_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_eager_service_proto_rawDescData +} + +var file_tensorflow_core_protobuf_eager_service_proto_msgTypes = make([]protoimpl.MessageInfo, 26) +var file_tensorflow_core_protobuf_eager_service_proto_goTypes = []any{ + (*Operation)(nil), // 0: tensorflow.eager.Operation + (*QueueItem)(nil), // 1: tensorflow.eager.QueueItem + (*QueueResponse)(nil), // 2: tensorflow.eager.QueueResponse + (*CreateContextRequest)(nil), // 3: tensorflow.eager.CreateContextRequest + (*CreateContextResponse)(nil), // 4: tensorflow.eager.CreateContextResponse + (*UpdateContextRequest)(nil), // 5: tensorflow.eager.UpdateContextRequest + (*UpdateContextResponse)(nil), // 6: tensorflow.eager.UpdateContextResponse + (*EnqueueRequest)(nil), // 7: tensorflow.eager.EnqueueRequest + (*EnqueueResponse)(nil), // 8: tensorflow.eager.EnqueueResponse + (*WaitQueueDoneRequest)(nil), // 9: tensorflow.eager.WaitQueueDoneRequest + (*WaitQueueDoneResponse)(nil), // 10: tensorflow.eager.WaitQueueDoneResponse + (*RunComponentFunctionRequest)(nil), // 11: tensorflow.eager.RunComponentFunctionRequest + (*RunComponentFunctionResponse)(nil), // 12: tensorflow.eager.RunComponentFunctionResponse + (*KeepAliveRequest)(nil), // 13: tensorflow.eager.KeepAliveRequest + (*KeepAliveResponse)(nil), // 14: tensorflow.eager.KeepAliveResponse + (*CloseContextRequest)(nil), // 15: tensorflow.eager.CloseContextRequest + (*CloseContextResponse)(nil), // 16: tensorflow.eager.CloseContextResponse + (*RegisterFunctionOp)(nil), // 17: tensorflow.eager.RegisterFunctionOp + (*CleanupFunctionOp)(nil), // 18: tensorflow.eager.CleanupFunctionOp + (*SyncRemoteExecutorForStream)(nil), // 19: tensorflow.eager.SyncRemoteExecutorForStream + (*SendTensorOp)(nil), // 20: tensorflow.eager.SendTensorOp + (*SendPackedHandleOp)(nil), // 21: tensorflow.eager.SendPackedHandleOp + (*Operation_Input)(nil), // 22: tensorflow.eager.Operation.Input + nil, // 23: tensorflow.eager.Operation.AttrsEntry + (*SendPackedHandleOp_LocalTensorHandle)(nil), // 24: tensorflow.eager.SendPackedHandleOp.LocalTensorHandle + (*SendPackedHandleOp_Handle)(nil), // 25: tensorflow.eager.SendPackedHandleOp.Handle + (*RemoteTensorHandle)(nil), // 26: tensorflow.eager.RemoteTensorHandle + (*tensor_shape_go_proto.TensorShapeProto)(nil), // 27: tensorflow.TensorShapeProto + (*tensor_go_proto.TensorProto)(nil), // 28: tensorflow.TensorProto + (*ServerDef)(nil), // 29: tensorflow.ServerDef + (*versions_go_proto.VersionDef)(nil), // 30: tensorflow.VersionDef + (*device_attributes_go_proto.DeviceAttributes)(nil), // 31: tensorflow.DeviceAttributes + (*function_go_proto.FunctionDef)(nil), // 32: tensorflow.FunctionDef + (*function_go_proto.FunctionDefLibrary)(nil), // 33: tensorflow.FunctionDefLibrary + (*attr_value_go_proto.AttrValue)(nil), // 34: tensorflow.AttrValue +} +var file_tensorflow_core_protobuf_eager_service_proto_depIdxs = []int32{ + 22, // 0: tensorflow.eager.Operation.op_inputs:type_name -> tensorflow.eager.Operation.Input + 23, // 1: tensorflow.eager.Operation.attrs:type_name -> tensorflow.eager.Operation.AttrsEntry + 26, // 2: tensorflow.eager.QueueItem.handle_to_decref:type_name -> tensorflow.eager.RemoteTensorHandle + 0, // 3: tensorflow.eager.QueueItem.operation:type_name -> tensorflow.eager.Operation + 20, // 4: tensorflow.eager.QueueItem.send_tensor:type_name -> tensorflow.eager.SendTensorOp + 17, // 5: tensorflow.eager.QueueItem.register_function:type_name -> tensorflow.eager.RegisterFunctionOp + 18, // 6: tensorflow.eager.QueueItem.cleanup_function:type_name -> tensorflow.eager.CleanupFunctionOp + 19, // 7: tensorflow.eager.QueueItem.sync_remote_executor_for_stream:type_name -> tensorflow.eager.SyncRemoteExecutorForStream + 21, // 8: tensorflow.eager.QueueItem.send_packed_handle:type_name -> tensorflow.eager.SendPackedHandleOp + 27, // 9: tensorflow.eager.QueueResponse.shape:type_name -> tensorflow.TensorShapeProto + 28, // 10: tensorflow.eager.QueueResponse.tensor:type_name -> tensorflow.TensorProto + 29, // 11: tensorflow.eager.CreateContextRequest.server_def:type_name -> tensorflow.ServerDef + 30, // 12: tensorflow.eager.CreateContextRequest.version_def:type_name -> tensorflow.VersionDef + 31, // 13: tensorflow.eager.CreateContextRequest.cluster_device_attributes:type_name -> tensorflow.DeviceAttributes + 31, // 14: tensorflow.eager.CreateContextResponse.device_attributes:type_name -> tensorflow.DeviceAttributes + 29, // 15: tensorflow.eager.UpdateContextRequest.server_def:type_name -> tensorflow.ServerDef + 31, // 16: tensorflow.eager.UpdateContextRequest.cluster_device_attributes:type_name -> tensorflow.DeviceAttributes + 31, // 17: tensorflow.eager.UpdateContextResponse.device_attributes:type_name -> tensorflow.DeviceAttributes + 1, // 18: tensorflow.eager.EnqueueRequest.queue:type_name -> tensorflow.eager.QueueItem + 2, // 19: tensorflow.eager.EnqueueResponse.queue_response:type_name -> tensorflow.eager.QueueResponse + 0, // 20: tensorflow.eager.RunComponentFunctionRequest.operation:type_name -> tensorflow.eager.Operation + 27, // 21: tensorflow.eager.RunComponentFunctionResponse.shape:type_name -> tensorflow.TensorShapeProto + 28, // 22: tensorflow.eager.RunComponentFunctionResponse.tensor:type_name -> tensorflow.TensorProto + 32, // 23: tensorflow.eager.RegisterFunctionOp.function_def:type_name -> tensorflow.FunctionDef + 33, // 24: tensorflow.eager.RegisterFunctionOp.library:type_name -> tensorflow.FunctionDefLibrary + 28, // 25: tensorflow.eager.SendTensorOp.tensors:type_name -> tensorflow.TensorProto + 25, // 26: tensorflow.eager.SendPackedHandleOp.handles:type_name -> tensorflow.eager.SendPackedHandleOp.Handle + 26, // 27: tensorflow.eager.Operation.Input.remote_handle:type_name -> tensorflow.eager.RemoteTensorHandle + 28, // 28: tensorflow.eager.Operation.Input.tensor:type_name -> tensorflow.TensorProto + 34, // 29: tensorflow.eager.Operation.AttrsEntry.value:type_name -> tensorflow.AttrValue + 28, // 30: tensorflow.eager.SendPackedHandleOp.LocalTensorHandle.tensor:type_name -> tensorflow.TensorProto + 24, // 31: tensorflow.eager.SendPackedHandleOp.Handle.local_handle:type_name -> tensorflow.eager.SendPackedHandleOp.LocalTensorHandle + 26, // 32: tensorflow.eager.SendPackedHandleOp.Handle.remote_handle:type_name -> tensorflow.eager.RemoteTensorHandle + 3, // 33: tensorflow.eager.EagerService.CreateContext:input_type -> tensorflow.eager.CreateContextRequest + 5, // 34: tensorflow.eager.EagerService.UpdateContext:input_type -> tensorflow.eager.UpdateContextRequest + 7, // 35: tensorflow.eager.EagerService.Enqueue:input_type -> tensorflow.eager.EnqueueRequest + 7, // 36: tensorflow.eager.EagerService.StreamingEnqueue:input_type -> tensorflow.eager.EnqueueRequest + 9, // 37: tensorflow.eager.EagerService.WaitQueueDone:input_type -> tensorflow.eager.WaitQueueDoneRequest + 11, // 38: tensorflow.eager.EagerService.RunComponentFunction:input_type -> tensorflow.eager.RunComponentFunctionRequest + 13, // 39: tensorflow.eager.EagerService.KeepAlive:input_type -> tensorflow.eager.KeepAliveRequest + 15, // 40: tensorflow.eager.EagerService.CloseContext:input_type -> tensorflow.eager.CloseContextRequest + 4, // 41: tensorflow.eager.EagerService.CreateContext:output_type -> tensorflow.eager.CreateContextResponse + 6, // 42: tensorflow.eager.EagerService.UpdateContext:output_type -> tensorflow.eager.UpdateContextResponse + 8, // 43: tensorflow.eager.EagerService.Enqueue:output_type -> tensorflow.eager.EnqueueResponse + 8, // 44: tensorflow.eager.EagerService.StreamingEnqueue:output_type -> tensorflow.eager.EnqueueResponse + 10, // 45: tensorflow.eager.EagerService.WaitQueueDone:output_type -> tensorflow.eager.WaitQueueDoneResponse + 12, // 46: tensorflow.eager.EagerService.RunComponentFunction:output_type -> tensorflow.eager.RunComponentFunctionResponse + 14, // 47: tensorflow.eager.EagerService.KeepAlive:output_type -> tensorflow.eager.KeepAliveResponse + 16, // 48: tensorflow.eager.EagerService.CloseContext:output_type -> tensorflow.eager.CloseContextResponse + 41, // [41:49] is the sub-list for method output_type + 33, // [33:41] is the sub-list for method input_type + 33, // [33:33] is the sub-list for extension type_name + 33, // [33:33] is the sub-list for extension extendee + 0, // [0:33] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_eager_service_proto_init() } +func file_tensorflow_core_protobuf_eager_service_proto_init() { + if File_tensorflow_core_protobuf_eager_service_proto != nil { + return + } + file_tensorflow_core_protobuf_remote_tensor_handle_proto_init() + file_tensorflow_core_protobuf_tensorflow_server_proto_init() + file_tensorflow_core_protobuf_eager_service_proto_msgTypes[1].OneofWrappers = []any{ + (*QueueItem_HandleToDecref)(nil), + (*QueueItem_Operation)(nil), + (*QueueItem_SendTensor)(nil), + (*QueueItem_RegisterFunction)(nil), + (*QueueItem_CleanupFunction)(nil), + (*QueueItem_SyncRemoteExecutorForStream)(nil), + (*QueueItem_SendPackedHandle)(nil), + } + file_tensorflow_core_protobuf_eager_service_proto_msgTypes[22].OneofWrappers = []any{ + (*Operation_Input_RemoteHandle)(nil), + (*Operation_Input_Tensor)(nil), + } + file_tensorflow_core_protobuf_eager_service_proto_msgTypes[25].OneofWrappers = []any{ + (*SendPackedHandleOp_Handle_LocalHandle)(nil), + (*SendPackedHandleOp_Handle_RemoteHandle)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_eager_service_proto_rawDesc), len(file_tensorflow_core_protobuf_eager_service_proto_rawDesc)), + NumEnums: 0, + NumMessages: 26, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_tensorflow_core_protobuf_eager_service_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_eager_service_proto_depIdxs, + MessageInfos: file_tensorflow_core_protobuf_eager_service_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_eager_service_proto = out.File + file_tensorflow_core_protobuf_eager_service_proto_goTypes = nil + file_tensorflow_core_protobuf_eager_service_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/error_codes.pb.go b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/error_codes.pb.go new file mode 100644 index 0000000..5b85053 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/error_codes.pb.go @@ -0,0 +1,297 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/error_codes.proto + +package for_core_protos_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// The canonical error codes for TensorFlow APIs. +// +// Warnings: +// +// - Do not change any numeric assignments. +// - Changes to this list should only be made if there is a compelling +// need that can't be satisfied in another way. Such changes +// must be approved by at least two OWNERS. +// - These error codes must match gRPC and protobuf error codes (except for +// DO_NOT_USE_RESERVED_FOR_FUTURE_EXPANSION_USE_DEFAULT_IN_SWITCH_INSTEAD_). +// +// Sometimes multiple error codes may apply. Services should return +// the most specific error code that applies. For example, prefer +// OUT_OF_RANGE over FAILED_PRECONDITION if both codes apply. +// Similarly prefer NOT_FOUND or ALREADY_EXISTS over FAILED_PRECONDITION. +type Code int32 + +const ( + // Not an error; returned on success + Code_OK Code = 0 + // The operation was cancelled (typically by the caller). + Code_CANCELLED Code = 1 + // Unknown error. An example of where this error may be returned is + // if a Status value received from another address space belongs to + // an error-space that is not known in this address space. Also + // errors raised by APIs that do not return enough error information + // may be converted to this error. + Code_UNKNOWN Code = 2 + // Client specified an invalid argument. Note that this differs + // from FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments + // that are problematic regardless of the state of the system + // (e.g., a malformed file name). + Code_INVALID_ARGUMENT Code = 3 + // Deadline expired before operation could complete. For operations + // that change the state of the system, this error may be returned + // even if the operation has completed successfully. For example, a + // successful response from a server could have been delayed long + // enough for the deadline to expire. + Code_DEADLINE_EXCEEDED Code = 4 + // Some requested entity (e.g., file or directory) was not found. + // For privacy reasons, this code *may* be returned when the client + // does not have the access right to the entity. + Code_NOT_FOUND Code = 5 + // Some entity that we attempted to create (e.g., file or directory) + // already exists. + Code_ALREADY_EXISTS Code = 6 + // The caller does not have permission to execute the specified + // operation. PERMISSION_DENIED must not be used for rejections + // caused by exhausting some resource (use RESOURCE_EXHAUSTED + // instead for those errors). PERMISSION_DENIED must not be + // used if the caller can not be identified (use UNAUTHENTICATED + // instead for those errors). + Code_PERMISSION_DENIED Code = 7 + // The request does not have valid authentication credentials for the + // operation. + Code_UNAUTHENTICATED Code = 16 + // Some resource has been exhausted, perhaps a per-user quota, or + // perhaps the entire file system is out of space. + Code_RESOURCE_EXHAUSTED Code = 8 + // Operation was rejected because the system is not in a state + // required for the operation's execution. For example, directory + // to be deleted may be non-empty, an rmdir operation is applied to + // a non-directory, etc. + // + // A litmus test that may help a service implementor in deciding + // between FAILED_PRECONDITION, ABORTED, and UNAVAILABLE: + // + // (a) Use UNAVAILABLE if the client can retry just the failing call. + // (b) Use ABORTED if the client should retry at a higher-level + // (e.g., restarting a read-modify-write sequence). + // (c) Use FAILED_PRECONDITION if the client should not retry until + // the system state has been explicitly fixed. E.g., if an "rmdir" + // fails because the directory is non-empty, FAILED_PRECONDITION + // should be returned since the client should not retry unless + // they have first fixed up the directory by deleting files from it. + // (d) Use FAILED_PRECONDITION if the client performs conditional + // REST Get/Update/Delete on a resource and the resource on the + // server does not match the condition. E.g., conflicting + // read-modify-write on the same resource. + Code_FAILED_PRECONDITION Code = 9 + // The operation was aborted, typically due to a concurrency issue + // like sequencer check failures, transaction aborts, etc. + // + // See litmus test above for deciding between FAILED_PRECONDITION, + // ABORTED, and UNAVAILABLE. + Code_ABORTED Code = 10 + // Operation tried to iterate past the valid input range. E.g., seeking or + // reading past end of file. + // + // Unlike INVALID_ARGUMENT, this error indicates a problem that may + // be fixed if the system state changes. For example, a 32-bit file + // system will generate INVALID_ARGUMENT if asked to read at an + // offset that is not in the range [0,2^32-1], but it will generate + // OUT_OF_RANGE if asked to read from an offset past the current + // file size. + // + // There is a fair bit of overlap between FAILED_PRECONDITION and + // OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific + // error) when it applies so that callers who are iterating through + // a space can easily look for an OUT_OF_RANGE error to detect when + // they are done. + Code_OUT_OF_RANGE Code = 11 + // Operation is not implemented or not supported/enabled in this service. + Code_UNIMPLEMENTED Code = 12 + // Internal errors. Means some invariant expected by the underlying + // system has been broken. If you see one of these errors, + // something is very broken. + Code_INTERNAL Code = 13 + // The service is currently unavailable. This is a most likely a + // transient condition and may be corrected by retrying with + // a backoff. + // + // See litmus test above for deciding between FAILED_PRECONDITION, + // ABORTED, and UNAVAILABLE. + Code_UNAVAILABLE Code = 14 + // Unrecoverable data loss or corruption. + Code_DATA_LOSS Code = 15 + // An extra enum entry to prevent people from writing code that + // fails to compile when a new code is added. + // + // Nobody should ever reference this enumeration entry. In particular, + // if you write C++ code that switches on this enumeration, add a default: + // case instead of a case that mentions this enumeration entry. + // + // Nobody should rely on the value (currently 20) listed here. It + // may change in the future. + Code_DO_NOT_USE_RESERVED_FOR_FUTURE_EXPANSION_USE_DEFAULT_IN_SWITCH_INSTEAD_ Code = 20 +) + +// Enum value maps for Code. +var ( + Code_name = map[int32]string{ + 0: "OK", + 1: "CANCELLED", + 2: "UNKNOWN", + 3: "INVALID_ARGUMENT", + 4: "DEADLINE_EXCEEDED", + 5: "NOT_FOUND", + 6: "ALREADY_EXISTS", + 7: "PERMISSION_DENIED", + 16: "UNAUTHENTICATED", + 8: "RESOURCE_EXHAUSTED", + 9: "FAILED_PRECONDITION", + 10: "ABORTED", + 11: "OUT_OF_RANGE", + 12: "UNIMPLEMENTED", + 13: "INTERNAL", + 14: "UNAVAILABLE", + 15: "DATA_LOSS", + 20: "DO_NOT_USE_RESERVED_FOR_FUTURE_EXPANSION_USE_DEFAULT_IN_SWITCH_INSTEAD_", + } + Code_value = map[string]int32{ + "OK": 0, + "CANCELLED": 1, + "UNKNOWN": 2, + "INVALID_ARGUMENT": 3, + "DEADLINE_EXCEEDED": 4, + "NOT_FOUND": 5, + "ALREADY_EXISTS": 6, + "PERMISSION_DENIED": 7, + "UNAUTHENTICATED": 16, + "RESOURCE_EXHAUSTED": 8, + "FAILED_PRECONDITION": 9, + "ABORTED": 10, + "OUT_OF_RANGE": 11, + "UNIMPLEMENTED": 12, + "INTERNAL": 13, + "UNAVAILABLE": 14, + "DATA_LOSS": 15, + "DO_NOT_USE_RESERVED_FOR_FUTURE_EXPANSION_USE_DEFAULT_IN_SWITCH_INSTEAD_": 20, + } +) + +func (x Code) Enum() *Code { + p := new(Code) + *p = x + return p +} + +func (x Code) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Code) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_protobuf_error_codes_proto_enumTypes[0].Descriptor() +} + +func (Code) Type() protoreflect.EnumType { + return &file_tensorflow_core_protobuf_error_codes_proto_enumTypes[0] +} + +func (x Code) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Code.Descriptor instead. +func (Code) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_error_codes_proto_rawDescGZIP(), []int{0} +} + +var File_tensorflow_core_protobuf_error_codes_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_error_codes_proto_rawDesc = "" + + "\n" + + "*tensorflow/core/protobuf/error_codes.proto\x12\x10tensorflow.error*\x84\x03\n" + + "\x04Code\x12\x06\n" + + "\x02OK\x10\x00\x12\r\n" + + "\tCANCELLED\x10\x01\x12\v\n" + + "\aUNKNOWN\x10\x02\x12\x14\n" + + "\x10INVALID_ARGUMENT\x10\x03\x12\x15\n" + + "\x11DEADLINE_EXCEEDED\x10\x04\x12\r\n" + + "\tNOT_FOUND\x10\x05\x12\x12\n" + + "\x0eALREADY_EXISTS\x10\x06\x12\x15\n" + + "\x11PERMISSION_DENIED\x10\a\x12\x13\n" + + "\x0fUNAUTHENTICATED\x10\x10\x12\x16\n" + + "\x12RESOURCE_EXHAUSTED\x10\b\x12\x17\n" + + "\x13FAILED_PRECONDITION\x10\t\x12\v\n" + + "\aABORTED\x10\n" + + "\x12\x10\n" + + "\fOUT_OF_RANGE\x10\v\x12\x11\n" + + "\rUNIMPLEMENTED\x10\f\x12\f\n" + + "\bINTERNAL\x10\r\x12\x0f\n" + + "\vUNAVAILABLE\x10\x0e\x12\r\n" + + "\tDATA_LOSS\x10\x0f\x12K\n" + + "GDO_NOT_USE_RESERVED_FOR_FUTURE_EXPANSION_USE_DEFAULT_IN_SWITCH_INSTEAD_\x10\x14B\x88\x01\n" + + "\x18org.tensorflow.frameworkB\x10ErrorCodesProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_error_codes_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_error_codes_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_error_codes_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_error_codes_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_error_codes_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_error_codes_proto_rawDesc), len(file_tensorflow_core_protobuf_error_codes_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_error_codes_proto_rawDescData +} + +var file_tensorflow_core_protobuf_error_codes_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_tensorflow_core_protobuf_error_codes_proto_goTypes = []any{ + (Code)(0), // 0: tensorflow.error.Code +} +var file_tensorflow_core_protobuf_error_codes_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_error_codes_proto_init() } +func file_tensorflow_core_protobuf_error_codes_proto_init() { + if File_tensorflow_core_protobuf_error_codes_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_error_codes_proto_rawDesc), len(file_tensorflow_core_protobuf_error_codes_proto_rawDesc)), + NumEnums: 1, + NumMessages: 0, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_error_codes_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_error_codes_proto_depIdxs, + EnumInfos: file_tensorflow_core_protobuf_error_codes_proto_enumTypes, + }.Build() + File_tensorflow_core_protobuf_error_codes_proto = out.File + file_tensorflow_core_protobuf_error_codes_proto_goTypes = nil + file_tensorflow_core_protobuf_error_codes_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/graph_debug_info.pb.go b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/graph_debug_info.pb.go new file mode 100644 index 0000000..c856012 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/graph_debug_info.pb.go @@ -0,0 +1,295 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/graph_debug_info.proto + +package for_core_protos_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type GraphDebugInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + // This stores all the source code file names and can be indexed by the + // `file_index`. + Files []string `protobuf:"bytes,1,rep,name=files,proto3" json:"files,omitempty"` + // This maps a node name to a stack trace in the source code. + // The map key is a mangling of the containing function and op name with + // syntax: + // + // op.name '@' func_name + // + // For ops in the top-level graph, the func_name is the empty string. + // Note that op names are restricted to a small number of characters which + // exclude '@', making it impossible to collide keys of this form. Function + // names accept a much wider set of characters. + // It would be preferable to avoid mangling and use a tuple key of (op.name, + // func_name), but this is not supported with protocol buffers. + Traces map[string]*GraphDebugInfo_StackTrace `protobuf:"bytes,2,rep,name=traces,proto3" json:"traces,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GraphDebugInfo) Reset() { + *x = GraphDebugInfo{} + mi := &file_tensorflow_core_protobuf_graph_debug_info_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GraphDebugInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GraphDebugInfo) ProtoMessage() {} + +func (x *GraphDebugInfo) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_graph_debug_info_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GraphDebugInfo.ProtoReflect.Descriptor instead. +func (*GraphDebugInfo) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_graph_debug_info_proto_rawDescGZIP(), []int{0} +} + +func (x *GraphDebugInfo) GetFiles() []string { + if x != nil { + return x.Files + } + return nil +} + +func (x *GraphDebugInfo) GetTraces() map[string]*GraphDebugInfo_StackTrace { + if x != nil { + return x.Traces + } + return nil +} + +// This represents a file/line location in the source code. +type GraphDebugInfo_FileLineCol struct { + state protoimpl.MessageState `protogen:"open.v1"` + // File name index, which can be used to retrieve the file name string from + // `files`. The value should be between 0 and (len(files)-1) + FileIndex int32 `protobuf:"varint,1,opt,name=file_index,json=fileIndex,proto3" json:"file_index,omitempty"` + // Line number in the file. + Line int32 `protobuf:"varint,2,opt,name=line,proto3" json:"line,omitempty"` + // Col number in the file line. + Col int32 `protobuf:"varint,3,opt,name=col,proto3" json:"col,omitempty"` + // Name of function contains the file line. + Func string `protobuf:"bytes,4,opt,name=func,proto3" json:"func,omitempty"` + // Source code contained in this file line. + Code string `protobuf:"bytes,5,opt,name=code,proto3" json:"code,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GraphDebugInfo_FileLineCol) Reset() { + *x = GraphDebugInfo_FileLineCol{} + mi := &file_tensorflow_core_protobuf_graph_debug_info_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GraphDebugInfo_FileLineCol) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GraphDebugInfo_FileLineCol) ProtoMessage() {} + +func (x *GraphDebugInfo_FileLineCol) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_graph_debug_info_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GraphDebugInfo_FileLineCol.ProtoReflect.Descriptor instead. +func (*GraphDebugInfo_FileLineCol) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_graph_debug_info_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *GraphDebugInfo_FileLineCol) GetFileIndex() int32 { + if x != nil { + return x.FileIndex + } + return 0 +} + +func (x *GraphDebugInfo_FileLineCol) GetLine() int32 { + if x != nil { + return x.Line + } + return 0 +} + +func (x *GraphDebugInfo_FileLineCol) GetCol() int32 { + if x != nil { + return x.Col + } + return 0 +} + +func (x *GraphDebugInfo_FileLineCol) GetFunc() string { + if x != nil { + return x.Func + } + return "" +} + +func (x *GraphDebugInfo_FileLineCol) GetCode() string { + if x != nil { + return x.Code + } + return "" +} + +// This represents a stack trace which is a ordered list of `FileLineCol`. +type GraphDebugInfo_StackTrace struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Each line in the stack trace. + FileLineCols []*GraphDebugInfo_FileLineCol `protobuf:"bytes,1,rep,name=file_line_cols,json=fileLineCols,proto3" json:"file_line_cols,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GraphDebugInfo_StackTrace) Reset() { + *x = GraphDebugInfo_StackTrace{} + mi := &file_tensorflow_core_protobuf_graph_debug_info_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GraphDebugInfo_StackTrace) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GraphDebugInfo_StackTrace) ProtoMessage() {} + +func (x *GraphDebugInfo_StackTrace) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_graph_debug_info_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GraphDebugInfo_StackTrace.ProtoReflect.Descriptor instead. +func (*GraphDebugInfo_StackTrace) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_graph_debug_info_proto_rawDescGZIP(), []int{0, 1} +} + +func (x *GraphDebugInfo_StackTrace) GetFileLineCols() []*GraphDebugInfo_FileLineCol { + if x != nil { + return x.FileLineCols + } + return nil +} + +var File_tensorflow_core_protobuf_graph_debug_info_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_graph_debug_info_proto_rawDesc = "" + + "\n" + + "/tensorflow/core/protobuf/graph_debug_info.proto\x12\n" + + "tensorflow\"\xa0\x03\n" + + "\x0eGraphDebugInfo\x12\x14\n" + + "\x05files\x18\x01 \x03(\tR\x05files\x12>\n" + + "\x06traces\x18\x02 \x03(\v2&.tensorflow.GraphDebugInfo.TracesEntryR\x06traces\x1az\n" + + "\vFileLineCol\x12\x1d\n" + + "\n" + + "file_index\x18\x01 \x01(\x05R\tfileIndex\x12\x12\n" + + "\x04line\x18\x02 \x01(\x05R\x04line\x12\x10\n" + + "\x03col\x18\x03 \x01(\x05R\x03col\x12\x12\n" + + "\x04func\x18\x04 \x01(\tR\x04func\x12\x12\n" + + "\x04code\x18\x05 \x01(\tR\x04code\x1aZ\n" + + "\n" + + "StackTrace\x12L\n" + + "\x0efile_line_cols\x18\x01 \x03(\v2&.tensorflow.GraphDebugInfo.FileLineColR\ffileLineCols\x1a`\n" + + "\vTracesEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12;\n" + + "\x05value\x18\x02 \x01(\v2%.tensorflow.GraphDebugInfo.StackTraceR\x05value:\x028\x01B\x8c\x01\n" + + "\x18org.tensorflow.frameworkB\x14GraphDebugInfoProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_graph_debug_info_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_graph_debug_info_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_graph_debug_info_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_graph_debug_info_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_graph_debug_info_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_graph_debug_info_proto_rawDesc), len(file_tensorflow_core_protobuf_graph_debug_info_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_graph_debug_info_proto_rawDescData +} + +var file_tensorflow_core_protobuf_graph_debug_info_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_tensorflow_core_protobuf_graph_debug_info_proto_goTypes = []any{ + (*GraphDebugInfo)(nil), // 0: tensorflow.GraphDebugInfo + (*GraphDebugInfo_FileLineCol)(nil), // 1: tensorflow.GraphDebugInfo.FileLineCol + (*GraphDebugInfo_StackTrace)(nil), // 2: tensorflow.GraphDebugInfo.StackTrace + nil, // 3: tensorflow.GraphDebugInfo.TracesEntry +} +var file_tensorflow_core_protobuf_graph_debug_info_proto_depIdxs = []int32{ + 3, // 0: tensorflow.GraphDebugInfo.traces:type_name -> tensorflow.GraphDebugInfo.TracesEntry + 1, // 1: tensorflow.GraphDebugInfo.StackTrace.file_line_cols:type_name -> tensorflow.GraphDebugInfo.FileLineCol + 2, // 2: tensorflow.GraphDebugInfo.TracesEntry.value:type_name -> tensorflow.GraphDebugInfo.StackTrace + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_graph_debug_info_proto_init() } +func file_tensorflow_core_protobuf_graph_debug_info_proto_init() { + if File_tensorflow_core_protobuf_graph_debug_info_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_graph_debug_info_proto_rawDesc), len(file_tensorflow_core_protobuf_graph_debug_info_proto_rawDesc)), + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_graph_debug_info_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_graph_debug_info_proto_depIdxs, + MessageInfos: file_tensorflow_core_protobuf_graph_debug_info_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_graph_debug_info_proto = out.File + file_tensorflow_core_protobuf_graph_debug_info_proto_goTypes = nil + file_tensorflow_core_protobuf_graph_debug_info_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/master.pb.go b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/master.pb.go new file mode 100644 index 0000000..7e7c94b --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/master.pb.go @@ -0,0 +1,1408 @@ +// Copyright 2016 The TensorFlow Authors. All Rights Reserved. +// +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +//============================================================================== + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/master.proto + +package for_core_protos_go_proto + +import ( + device_attributes_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/device_attributes_go_proto" + graph_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/graph_go_proto" + tensor_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type CreateSessionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The initial graph definition. + GraphDef *graph_go_proto.GraphDef `protobuf:"bytes,1,opt,name=graph_def,json=graphDef,proto3" json:"graph_def,omitempty"` + // Configuration options. + Config *ConfigProto `protobuf:"bytes,2,opt,name=config,proto3" json:"config,omitempty"` + // The target string used from the client's perspective. + Target string `protobuf:"bytes,3,opt,name=target,proto3" json:"target,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateSessionRequest) Reset() { + *x = CreateSessionRequest{} + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateSessionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateSessionRequest) ProtoMessage() {} + +func (x *CreateSessionRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateSessionRequest.ProtoReflect.Descriptor instead. +func (*CreateSessionRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_master_proto_rawDescGZIP(), []int{0} +} + +func (x *CreateSessionRequest) GetGraphDef() *graph_go_proto.GraphDef { + if x != nil { + return x.GraphDef + } + return nil +} + +func (x *CreateSessionRequest) GetConfig() *ConfigProto { + if x != nil { + return x.Config + } + return nil +} + +func (x *CreateSessionRequest) GetTarget() string { + if x != nil { + return x.Target + } + return "" +} + +type CreateSessionResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The session handle to be used in subsequent calls for the created session. + // + // The client must arrange to call CloseSession with this returned + // session handle to close the session. + SessionHandle string `protobuf:"bytes,1,opt,name=session_handle,json=sessionHandle,proto3" json:"session_handle,omitempty"` + // The initial version number for the graph, to be used in the next call + // to ExtendSession. + GraphVersion int64 `protobuf:"varint,2,opt,name=graph_version,json=graphVersion,proto3" json:"graph_version,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateSessionResponse) Reset() { + *x = CreateSessionResponse{} + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateSessionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateSessionResponse) ProtoMessage() {} + +func (x *CreateSessionResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateSessionResponse.ProtoReflect.Descriptor instead. +func (*CreateSessionResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_master_proto_rawDescGZIP(), []int{1} +} + +func (x *CreateSessionResponse) GetSessionHandle() string { + if x != nil { + return x.SessionHandle + } + return "" +} + +func (x *CreateSessionResponse) GetGraphVersion() int64 { + if x != nil { + return x.GraphVersion + } + return 0 +} + +type ExtendSessionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // REQUIRED: session_handle must be returned by a CreateSession call + // to the same master service. + SessionHandle string `protobuf:"bytes,1,opt,name=session_handle,json=sessionHandle,proto3" json:"session_handle,omitempty"` + // REQUIRED: The nodes to be added to the session's graph. If any node has + // the same name as an existing node, the operation will fail with + // ILLEGAL_ARGUMENT. + GraphDef *graph_go_proto.GraphDef `protobuf:"bytes,2,opt,name=graph_def,json=graphDef,proto3" json:"graph_def,omitempty"` + // REQUIRED: The version number of the graph to be extended. This will be + // tested against the current server-side version number, and the operation + // will fail with FAILED_PRECONDITION if they do not match. + CurrentGraphVersion int64 `protobuf:"varint,3,opt,name=current_graph_version,json=currentGraphVersion,proto3" json:"current_graph_version,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ExtendSessionRequest) Reset() { + *x = ExtendSessionRequest{} + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ExtendSessionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExtendSessionRequest) ProtoMessage() {} + +func (x *ExtendSessionRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ExtendSessionRequest.ProtoReflect.Descriptor instead. +func (*ExtendSessionRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_master_proto_rawDescGZIP(), []int{2} +} + +func (x *ExtendSessionRequest) GetSessionHandle() string { + if x != nil { + return x.SessionHandle + } + return "" +} + +func (x *ExtendSessionRequest) GetGraphDef() *graph_go_proto.GraphDef { + if x != nil { + return x.GraphDef + } + return nil +} + +func (x *ExtendSessionRequest) GetCurrentGraphVersion() int64 { + if x != nil { + return x.CurrentGraphVersion + } + return 0 +} + +type ExtendSessionResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The new version number for the extended graph, to be used in the next call + // to ExtendSession. + NewGraphVersion int64 `protobuf:"varint,4,opt,name=new_graph_version,json=newGraphVersion,proto3" json:"new_graph_version,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ExtendSessionResponse) Reset() { + *x = ExtendSessionResponse{} + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ExtendSessionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExtendSessionResponse) ProtoMessage() {} + +func (x *ExtendSessionResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ExtendSessionResponse.ProtoReflect.Descriptor instead. +func (*ExtendSessionResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_master_proto_rawDescGZIP(), []int{3} +} + +func (x *ExtendSessionResponse) GetNewGraphVersion() int64 { + if x != nil { + return x.NewGraphVersion + } + return 0 +} + +type RunStepRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // REQUIRED: session_handle must be returned by a CreateSession call + // to the same master service. + SessionHandle string `protobuf:"bytes,1,opt,name=session_handle,json=sessionHandle,proto3" json:"session_handle,omitempty"` + // Tensors to be fed in the step. Each feed is a named tensor. + Feed []*NamedTensorProto `protobuf:"bytes,2,rep,name=feed,proto3" json:"feed,omitempty"` + // Fetches. A list of tensor names. The caller expects a tensor to + // be returned for each fetch[i] (see RunStepResponse.tensor). The + // order of specified fetches does not change the execution order. + Fetch []string `protobuf:"bytes,3,rep,name=fetch,proto3" json:"fetch,omitempty"` + // Target Nodes. A list of node names. The named nodes will be run + // to but their outputs will not be fetched. + Target []string `protobuf:"bytes,4,rep,name=target,proto3" json:"target,omitempty"` + // Options for the run call. + Options *RunOptions `protobuf:"bytes,5,opt,name=options,proto3" json:"options,omitempty"` + // Partial run handle (optional). If specified, this will be a partial run + // execution, run up to the specified fetches. + PartialRunHandle string `protobuf:"bytes,6,opt,name=partial_run_handle,json=partialRunHandle,proto3" json:"partial_run_handle,omitempty"` + // If true then some errors, e.g., execution errors that have long + // error messages, may return an OK RunStepResponse with the actual + // error saved in the status_code/status_error_message fields of the + // response body. This is a workaround since the RPC subsystem may + // truncate long metadata messages. + StoreErrorsInResponseBody bool `protobuf:"varint,7,opt,name=store_errors_in_response_body,json=storeErrorsInResponseBody,proto3" json:"store_errors_in_response_body,omitempty"` + // Unique identifier for this request. Every RunStepRequest must + // have a unique request_id, and retried RunStepRequest must have + // the same request_id. If request_id is zero, retry detection is disabled. + RequestId int64 `protobuf:"varint,8,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RunStepRequest) Reset() { + *x = RunStepRequest{} + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RunStepRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RunStepRequest) ProtoMessage() {} + +func (x *RunStepRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RunStepRequest.ProtoReflect.Descriptor instead. +func (*RunStepRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_master_proto_rawDescGZIP(), []int{4} +} + +func (x *RunStepRequest) GetSessionHandle() string { + if x != nil { + return x.SessionHandle + } + return "" +} + +func (x *RunStepRequest) GetFeed() []*NamedTensorProto { + if x != nil { + return x.Feed + } + return nil +} + +func (x *RunStepRequest) GetFetch() []string { + if x != nil { + return x.Fetch + } + return nil +} + +func (x *RunStepRequest) GetTarget() []string { + if x != nil { + return x.Target + } + return nil +} + +func (x *RunStepRequest) GetOptions() *RunOptions { + if x != nil { + return x.Options + } + return nil +} + +func (x *RunStepRequest) GetPartialRunHandle() string { + if x != nil { + return x.PartialRunHandle + } + return "" +} + +func (x *RunStepRequest) GetStoreErrorsInResponseBody() bool { + if x != nil { + return x.StoreErrorsInResponseBody + } + return false +} + +func (x *RunStepRequest) GetRequestId() int64 { + if x != nil { + return x.RequestId + } + return 0 +} + +type RunStepResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // NOTE: The order of the returned tensors may or may not match + // the fetch order specified in RunStepRequest. + Tensor []*NamedTensorProto `protobuf:"bytes,1,rep,name=tensor,proto3" json:"tensor,omitempty"` + // Returned metadata if requested in the options. + Metadata *RunMetadata `protobuf:"bytes,2,opt,name=metadata,proto3" json:"metadata,omitempty"` + // If store_errors_in_response_body is true in the request, then + // optionally the server may return an OK status for the RPC and + // fill the true status into the fields below, to allow for messages + // that are too long to fit in metadata. + StatusCode Code `protobuf:"varint,3,opt,name=status_code,json=statusCode,proto3,enum=tensorflow.error.Code" json:"status_code,omitempty"` + StatusErrorMessage string `protobuf:"bytes,4,opt,name=status_error_message,json=statusErrorMessage,proto3" json:"status_error_message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RunStepResponse) Reset() { + *x = RunStepResponse{} + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RunStepResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RunStepResponse) ProtoMessage() {} + +func (x *RunStepResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RunStepResponse.ProtoReflect.Descriptor instead. +func (*RunStepResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_master_proto_rawDescGZIP(), []int{5} +} + +func (x *RunStepResponse) GetTensor() []*NamedTensorProto { + if x != nil { + return x.Tensor + } + return nil +} + +func (x *RunStepResponse) GetMetadata() *RunMetadata { + if x != nil { + return x.Metadata + } + return nil +} + +func (x *RunStepResponse) GetStatusCode() Code { + if x != nil { + return x.StatusCode + } + return Code_OK +} + +func (x *RunStepResponse) GetStatusErrorMessage() string { + if x != nil { + return x.StatusErrorMessage + } + return "" +} + +type PartialRunSetupRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // REQUIRED: session_handle must be returned by a CreateSession call + // to the same master service. + SessionHandle string `protobuf:"bytes,1,opt,name=session_handle,json=sessionHandle,proto3" json:"session_handle,omitempty"` + // Tensors to be fed in future steps. + Feed []string `protobuf:"bytes,2,rep,name=feed,proto3" json:"feed,omitempty"` + // Fetches. A list of tensor names. The caller expects a tensor to be returned + // for each fetch[i] (see RunStepResponse.tensor), for corresponding partial + // RunStepRequests. The order of specified fetches does not change the + // execution order. + Fetch []string `protobuf:"bytes,3,rep,name=fetch,proto3" json:"fetch,omitempty"` + // Target Nodes. A list of node names. The named nodes will be run in future + // steps, but their outputs will not be fetched. + Target []string `protobuf:"bytes,4,rep,name=target,proto3" json:"target,omitempty"` + // Unique identifier for this request. Every PartialRunSetupRequest must + // have a unique request_id, and retried PartialRunSetupRequest must have + // the same request_id. If request_id is zero, retry detection is disabled. + RequestId int64 `protobuf:"varint,5,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PartialRunSetupRequest) Reset() { + *x = PartialRunSetupRequest{} + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PartialRunSetupRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PartialRunSetupRequest) ProtoMessage() {} + +func (x *PartialRunSetupRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PartialRunSetupRequest.ProtoReflect.Descriptor instead. +func (*PartialRunSetupRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_master_proto_rawDescGZIP(), []int{6} +} + +func (x *PartialRunSetupRequest) GetSessionHandle() string { + if x != nil { + return x.SessionHandle + } + return "" +} + +func (x *PartialRunSetupRequest) GetFeed() []string { + if x != nil { + return x.Feed + } + return nil +} + +func (x *PartialRunSetupRequest) GetFetch() []string { + if x != nil { + return x.Fetch + } + return nil +} + +func (x *PartialRunSetupRequest) GetTarget() []string { + if x != nil { + return x.Target + } + return nil +} + +func (x *PartialRunSetupRequest) GetRequestId() int64 { + if x != nil { + return x.RequestId + } + return 0 +} + +type PartialRunSetupResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The unique handle corresponding to the ongoing partial run call setup by + // the invocation to PartialRunSetup. This handle may be passed to + // RunStepRequest to send and receive tensors for this partial run. + PartialRunHandle string `protobuf:"bytes,1,opt,name=partial_run_handle,json=partialRunHandle,proto3" json:"partial_run_handle,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PartialRunSetupResponse) Reset() { + *x = PartialRunSetupResponse{} + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PartialRunSetupResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PartialRunSetupResponse) ProtoMessage() {} + +func (x *PartialRunSetupResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PartialRunSetupResponse.ProtoReflect.Descriptor instead. +func (*PartialRunSetupResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_master_proto_rawDescGZIP(), []int{7} +} + +func (x *PartialRunSetupResponse) GetPartialRunHandle() string { + if x != nil { + return x.PartialRunHandle + } + return "" +} + +type CloseSessionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // REQUIRED: session_handle must be returned by a CreateSession call + // to the same master service. + SessionHandle string `protobuf:"bytes,1,opt,name=session_handle,json=sessionHandle,proto3" json:"session_handle,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CloseSessionRequest) Reset() { + *x = CloseSessionRequest{} + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CloseSessionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CloseSessionRequest) ProtoMessage() {} + +func (x *CloseSessionRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CloseSessionRequest.ProtoReflect.Descriptor instead. +func (*CloseSessionRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_master_proto_rawDescGZIP(), []int{8} +} + +func (x *CloseSessionRequest) GetSessionHandle() string { + if x != nil { + return x.SessionHandle + } + return "" +} + +type CloseSessionResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CloseSessionResponse) Reset() { + *x = CloseSessionResponse{} + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CloseSessionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CloseSessionResponse) ProtoMessage() {} + +func (x *CloseSessionResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CloseSessionResponse.ProtoReflect.Descriptor instead. +func (*CloseSessionResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_master_proto_rawDescGZIP(), []int{9} +} + +// Reset() allows misbehaving or slow sessions to be aborted and closed, and +// causes their resources eventually to be released. Reset() does not wait +// for the computations in old sessions to cease; it merely starts the +// process of tearing them down. However, if a new session is started after +// a Reset(), the new session is isolated from changes that old sessions +// (started prior to the Reset()) may continue to make to resources, provided +// all those resources are in containers listed in "containers". +// +// Old sessions may continue to have side-effects on resources not in +// containers listed in "containers", and thus may affect future +// sessions' results in ways that are hard to predict. Thus, if well-defined +// behavior is desired, is it recommended that all containers be listed in +// "containers". Similarly, if a device_filter is specified, results may be +// hard to predict. +type ResetRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // A list of container names, which may be empty. + // + // If 'container' is not empty, releases resources in the given + // containers in all devices. + // + // If 'container' is empty, releases resources in the default + // container in all devices. + Container []string `protobuf:"bytes,1,rep,name=container,proto3" json:"container,omitempty"` + // When any filters are present, only devices that match the filters + // will be reset. Each filter can be partially specified, + // e.g. "/job:ps" "/job:worker/replica:3", etc. + DeviceFilters []string `protobuf:"bytes,2,rep,name=device_filters,json=deviceFilters,proto3" json:"device_filters,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ResetRequest) Reset() { + *x = ResetRequest{} + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ResetRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResetRequest) ProtoMessage() {} + +func (x *ResetRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ResetRequest.ProtoReflect.Descriptor instead. +func (*ResetRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_master_proto_rawDescGZIP(), []int{10} +} + +func (x *ResetRequest) GetContainer() []string { + if x != nil { + return x.Container + } + return nil +} + +func (x *ResetRequest) GetDeviceFilters() []string { + if x != nil { + return x.DeviceFilters + } + return nil +} + +type ResetResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ResetResponse) Reset() { + *x = ResetResponse{} + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ResetResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResetResponse) ProtoMessage() {} + +func (x *ResetResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ResetResponse.ProtoReflect.Descriptor instead. +func (*ResetResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_master_proto_rawDescGZIP(), []int{11} +} + +type ListDevicesRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Optional: session_handle must be returned by a CreateSession call to the + // same master service. + // + // When session_handle is empty, the ClusterSpec provided when the master was + // started is used to compute the available devices. If the session_handle is + // provided but not recognized, an error is returned. Finally, if a valid + // session_handle is provided, the cluster configuration for that session is + // used when computing the response. + SessionHandle string `protobuf:"bytes,1,opt,name=session_handle,json=sessionHandle,proto3" json:"session_handle,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListDevicesRequest) Reset() { + *x = ListDevicesRequest{} + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListDevicesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListDevicesRequest) ProtoMessage() {} + +func (x *ListDevicesRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListDevicesRequest.ProtoReflect.Descriptor instead. +func (*ListDevicesRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_master_proto_rawDescGZIP(), []int{12} +} + +func (x *ListDevicesRequest) GetSessionHandle() string { + if x != nil { + return x.SessionHandle + } + return "" +} + +type ListDevicesResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + LocalDevice []*device_attributes_go_proto.DeviceAttributes `protobuf:"bytes,1,rep,name=local_device,json=localDevice,proto3" json:"local_device,omitempty"` + RemoteDevice []*device_attributes_go_proto.DeviceAttributes `protobuf:"bytes,2,rep,name=remote_device,json=remoteDevice,proto3" json:"remote_device,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListDevicesResponse) Reset() { + *x = ListDevicesResponse{} + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListDevicesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListDevicesResponse) ProtoMessage() {} + +func (x *ListDevicesResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[13] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListDevicesResponse.ProtoReflect.Descriptor instead. +func (*ListDevicesResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_master_proto_rawDescGZIP(), []int{13} +} + +func (x *ListDevicesResponse) GetLocalDevice() []*device_attributes_go_proto.DeviceAttributes { + if x != nil { + return x.LocalDevice + } + return nil +} + +func (x *ListDevicesResponse) GetRemoteDevice() []*device_attributes_go_proto.DeviceAttributes { + if x != nil { + return x.RemoteDevice + } + return nil +} + +type MakeCallableRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // REQUIRED: session_handle must be returned by a CreateSession call + // to the same master service. + SessionHandle string `protobuf:"bytes,1,opt,name=session_handle,json=sessionHandle,proto3" json:"session_handle,omitempty"` + // Options that define the behavior of the created callable. + Options *CallableOptions `protobuf:"bytes,2,opt,name=options,proto3" json:"options,omitempty"` + // Unique identifier for this request. Every MakeCallableRequest must + // have a unique request_id, and retried MakeCallableRequest must have + // the same request_id. If request_id is zero, retry detection is disabled. + RequestId int64 `protobuf:"varint,3,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MakeCallableRequest) Reset() { + *x = MakeCallableRequest{} + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MakeCallableRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MakeCallableRequest) ProtoMessage() {} + +func (x *MakeCallableRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[14] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MakeCallableRequest.ProtoReflect.Descriptor instead. +func (*MakeCallableRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_master_proto_rawDescGZIP(), []int{14} +} + +func (x *MakeCallableRequest) GetSessionHandle() string { + if x != nil { + return x.SessionHandle + } + return "" +} + +func (x *MakeCallableRequest) GetOptions() *CallableOptions { + if x != nil { + return x.Options + } + return nil +} + +func (x *MakeCallableRequest) GetRequestId() int64 { + if x != nil { + return x.RequestId + } + return 0 +} + +type MakeCallableResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // A handle to the created callable. + Handle int64 `protobuf:"varint,1,opt,name=handle,proto3" json:"handle,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MakeCallableResponse) Reset() { + *x = MakeCallableResponse{} + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MakeCallableResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MakeCallableResponse) ProtoMessage() {} + +func (x *MakeCallableResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[15] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MakeCallableResponse.ProtoReflect.Descriptor instead. +func (*MakeCallableResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_master_proto_rawDescGZIP(), []int{15} +} + +func (x *MakeCallableResponse) GetHandle() int64 { + if x != nil { + return x.Handle + } + return 0 +} + +type RunCallableRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // REQUIRED: session_handle must be returned by a CreateSession call + // to the same master service. + SessionHandle string `protobuf:"bytes,1,opt,name=session_handle,json=sessionHandle,proto3" json:"session_handle,omitempty"` + // REQUIRED: handle must be returned by a MakeCallable call to the same + // master service. + Handle int64 `protobuf:"varint,2,opt,name=handle,proto3" json:"handle,omitempty"` + // Values of the tensors passed as arguments to the callable, in the order + // defined in the CallableOptions.feed field passed to MakeCallable. + Feed []*tensor_go_proto.TensorProto `protobuf:"bytes,3,rep,name=feed,proto3" json:"feed,omitempty"` + // Unique identifier for this request. Every RunCallableRequest must + // have a unique request_id, and retried RunCallableRequest must have + // the same request_id. If request_id is zero, retry detection is disabled. + RequestId int64 `protobuf:"varint,4,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RunCallableRequest) Reset() { + *x = RunCallableRequest{} + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RunCallableRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RunCallableRequest) ProtoMessage() {} + +func (x *RunCallableRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[16] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RunCallableRequest.ProtoReflect.Descriptor instead. +func (*RunCallableRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_master_proto_rawDescGZIP(), []int{16} +} + +func (x *RunCallableRequest) GetSessionHandle() string { + if x != nil { + return x.SessionHandle + } + return "" +} + +func (x *RunCallableRequest) GetHandle() int64 { + if x != nil { + return x.Handle + } + return 0 +} + +func (x *RunCallableRequest) GetFeed() []*tensor_go_proto.TensorProto { + if x != nil { + return x.Feed + } + return nil +} + +func (x *RunCallableRequest) GetRequestId() int64 { + if x != nil { + return x.RequestId + } + return 0 +} + +type RunCallableResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Values of the tensors returned by the callable, in the order defined in the + // CallableOptions.fetch field passed to MakeCallable. + Fetch []*tensor_go_proto.TensorProto `protobuf:"bytes,1,rep,name=fetch,proto3" json:"fetch,omitempty"` + // Returned metadata if requested in the options. + Metadata *RunMetadata `protobuf:"bytes,2,opt,name=metadata,proto3" json:"metadata,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RunCallableResponse) Reset() { + *x = RunCallableResponse{} + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RunCallableResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RunCallableResponse) ProtoMessage() {} + +func (x *RunCallableResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[17] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RunCallableResponse.ProtoReflect.Descriptor instead. +func (*RunCallableResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_master_proto_rawDescGZIP(), []int{17} +} + +func (x *RunCallableResponse) GetFetch() []*tensor_go_proto.TensorProto { + if x != nil { + return x.Fetch + } + return nil +} + +func (x *RunCallableResponse) GetMetadata() *RunMetadata { + if x != nil { + return x.Metadata + } + return nil +} + +type ReleaseCallableRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // REQUIRED: session_handle must be returned by a CreateSession call + // to the same master service. + SessionHandle string `protobuf:"bytes,1,opt,name=session_handle,json=sessionHandle,proto3" json:"session_handle,omitempty"` + // REQUIRED: handle must be returned by a MakeCallable call to the same + // master service. + Handle int64 `protobuf:"varint,2,opt,name=handle,proto3" json:"handle,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ReleaseCallableRequest) Reset() { + *x = ReleaseCallableRequest{} + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ReleaseCallableRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReleaseCallableRequest) ProtoMessage() {} + +func (x *ReleaseCallableRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[18] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReleaseCallableRequest.ProtoReflect.Descriptor instead. +func (*ReleaseCallableRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_master_proto_rawDescGZIP(), []int{18} +} + +func (x *ReleaseCallableRequest) GetSessionHandle() string { + if x != nil { + return x.SessionHandle + } + return "" +} + +func (x *ReleaseCallableRequest) GetHandle() int64 { + if x != nil { + return x.Handle + } + return 0 +} + +type ReleaseCallableResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ReleaseCallableResponse) Reset() { + *x = ReleaseCallableResponse{} + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ReleaseCallableResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReleaseCallableResponse) ProtoMessage() {} + +func (x *ReleaseCallableResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[19] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReleaseCallableResponse.ProtoReflect.Descriptor instead. +func (*ReleaseCallableResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_master_proto_rawDescGZIP(), []int{19} +} + +var File_tensorflow_core_protobuf_master_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_master_proto_rawDesc = "" + + "\n" + + "%tensorflow/core/protobuf/master.proto\x12\n" + + "tensorflow\x1a1tensorflow/core/framework/device_attributes.proto\x1a%tensorflow/core/framework/graph.proto\x1a&tensorflow/core/framework/tensor.proto\x1a%tensorflow/core/protobuf/config.proto\x1a*tensorflow/core/protobuf/error_codes.proto\x1a+tensorflow/core/protobuf/named_tensor.proto\"\x92\x01\n" + + "\x14CreateSessionRequest\x121\n" + + "\tgraph_def\x18\x01 \x01(\v2\x14.tensorflow.GraphDefR\bgraphDef\x12/\n" + + "\x06config\x18\x02 \x01(\v2\x17.tensorflow.ConfigProtoR\x06config\x12\x16\n" + + "\x06target\x18\x03 \x01(\tR\x06target\"c\n" + + "\x15CreateSessionResponse\x12%\n" + + "\x0esession_handle\x18\x01 \x01(\tR\rsessionHandle\x12#\n" + + "\rgraph_version\x18\x02 \x01(\x03R\fgraphVersion\"\xa4\x01\n" + + "\x14ExtendSessionRequest\x12%\n" + + "\x0esession_handle\x18\x01 \x01(\tR\rsessionHandle\x121\n" + + "\tgraph_def\x18\x02 \x01(\v2\x14.tensorflow.GraphDefR\bgraphDef\x122\n" + + "\x15current_graph_version\x18\x03 \x01(\x03R\x13currentGraphVersion\"C\n" + + "\x15ExtendSessionResponse\x12*\n" + + "\x11new_graph_version\x18\x04 \x01(\x03R\x0fnewGraphVersion\"\xd8\x02\n" + + "\x0eRunStepRequest\x12%\n" + + "\x0esession_handle\x18\x01 \x01(\tR\rsessionHandle\x120\n" + + "\x04feed\x18\x02 \x03(\v2\x1c.tensorflow.NamedTensorProtoR\x04feed\x12\x14\n" + + "\x05fetch\x18\x03 \x03(\tR\x05fetch\x12\x16\n" + + "\x06target\x18\x04 \x03(\tR\x06target\x120\n" + + "\aoptions\x18\x05 \x01(\v2\x16.tensorflow.RunOptionsR\aoptions\x12,\n" + + "\x12partial_run_handle\x18\x06 \x01(\tR\x10partialRunHandle\x12@\n" + + "\x1dstore_errors_in_response_body\x18\a \x01(\bR\x19storeErrorsInResponseBody\x12\x1d\n" + + "\n" + + "request_id\x18\b \x01(\x03R\trequestId\"\xe7\x01\n" + + "\x0fRunStepResponse\x124\n" + + "\x06tensor\x18\x01 \x03(\v2\x1c.tensorflow.NamedTensorProtoR\x06tensor\x123\n" + + "\bmetadata\x18\x02 \x01(\v2\x17.tensorflow.RunMetadataR\bmetadata\x127\n" + + "\vstatus_code\x18\x03 \x01(\x0e2\x16.tensorflow.error.CodeR\n" + + "statusCode\x120\n" + + "\x14status_error_message\x18\x04 \x01(\tR\x12statusErrorMessage\"\xa0\x01\n" + + "\x16PartialRunSetupRequest\x12%\n" + + "\x0esession_handle\x18\x01 \x01(\tR\rsessionHandle\x12\x12\n" + + "\x04feed\x18\x02 \x03(\tR\x04feed\x12\x14\n" + + "\x05fetch\x18\x03 \x03(\tR\x05fetch\x12\x16\n" + + "\x06target\x18\x04 \x03(\tR\x06target\x12\x1d\n" + + "\n" + + "request_id\x18\x05 \x01(\x03R\trequestId\"G\n" + + "\x17PartialRunSetupResponse\x12,\n" + + "\x12partial_run_handle\x18\x01 \x01(\tR\x10partialRunHandle\"<\n" + + "\x13CloseSessionRequest\x12%\n" + + "\x0esession_handle\x18\x01 \x01(\tR\rsessionHandle\"\x16\n" + + "\x14CloseSessionResponse\"S\n" + + "\fResetRequest\x12\x1c\n" + + "\tcontainer\x18\x01 \x03(\tR\tcontainer\x12%\n" + + "\x0edevice_filters\x18\x02 \x03(\tR\rdeviceFilters\"\x0f\n" + + "\rResetResponse\";\n" + + "\x12ListDevicesRequest\x12%\n" + + "\x0esession_handle\x18\x01 \x01(\tR\rsessionHandle\"\x99\x01\n" + + "\x13ListDevicesResponse\x12?\n" + + "\flocal_device\x18\x01 \x03(\v2\x1c.tensorflow.DeviceAttributesR\vlocalDevice\x12A\n" + + "\rremote_device\x18\x02 \x03(\v2\x1c.tensorflow.DeviceAttributesR\fremoteDevice\"\x92\x01\n" + + "\x13MakeCallableRequest\x12%\n" + + "\x0esession_handle\x18\x01 \x01(\tR\rsessionHandle\x125\n" + + "\aoptions\x18\x02 \x01(\v2\x1b.tensorflow.CallableOptionsR\aoptions\x12\x1d\n" + + "\n" + + "request_id\x18\x03 \x01(\x03R\trequestId\".\n" + + "\x14MakeCallableResponse\x12\x16\n" + + "\x06handle\x18\x01 \x01(\x03R\x06handle\"\x9f\x01\n" + + "\x12RunCallableRequest\x12%\n" + + "\x0esession_handle\x18\x01 \x01(\tR\rsessionHandle\x12\x16\n" + + "\x06handle\x18\x02 \x01(\x03R\x06handle\x12+\n" + + "\x04feed\x18\x03 \x03(\v2\x17.tensorflow.TensorProtoR\x04feed\x12\x1d\n" + + "\n" + + "request_id\x18\x04 \x01(\x03R\trequestId\"y\n" + + "\x13RunCallableResponse\x12-\n" + + "\x05fetch\x18\x01 \x03(\v2\x17.tensorflow.TensorProtoR\x05fetch\x123\n" + + "\bmetadata\x18\x02 \x01(\v2\x17.tensorflow.RunMetadataR\bmetadata\"W\n" + + "\x16ReleaseCallableRequest\x12%\n" + + "\x0esession_handle\x18\x01 \x01(\tR\rsessionHandle\x12\x16\n" + + "\x06handle\x18\x02 \x01(\x03R\x06handle\"\x19\n" + + "\x17ReleaseCallableResponseB\x92\x01\n" + + "\x1aorg.tensorflow.distruntimeB\x18DistributedRuntimeProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_master_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_master_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_master_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_master_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_master_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_master_proto_rawDesc), len(file_tensorflow_core_protobuf_master_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_master_proto_rawDescData +} + +var file_tensorflow_core_protobuf_master_proto_msgTypes = make([]protoimpl.MessageInfo, 20) +var file_tensorflow_core_protobuf_master_proto_goTypes = []any{ + (*CreateSessionRequest)(nil), // 0: tensorflow.CreateSessionRequest + (*CreateSessionResponse)(nil), // 1: tensorflow.CreateSessionResponse + (*ExtendSessionRequest)(nil), // 2: tensorflow.ExtendSessionRequest + (*ExtendSessionResponse)(nil), // 3: tensorflow.ExtendSessionResponse + (*RunStepRequest)(nil), // 4: tensorflow.RunStepRequest + (*RunStepResponse)(nil), // 5: tensorflow.RunStepResponse + (*PartialRunSetupRequest)(nil), // 6: tensorflow.PartialRunSetupRequest + (*PartialRunSetupResponse)(nil), // 7: tensorflow.PartialRunSetupResponse + (*CloseSessionRequest)(nil), // 8: tensorflow.CloseSessionRequest + (*CloseSessionResponse)(nil), // 9: tensorflow.CloseSessionResponse + (*ResetRequest)(nil), // 10: tensorflow.ResetRequest + (*ResetResponse)(nil), // 11: tensorflow.ResetResponse + (*ListDevicesRequest)(nil), // 12: tensorflow.ListDevicesRequest + (*ListDevicesResponse)(nil), // 13: tensorflow.ListDevicesResponse + (*MakeCallableRequest)(nil), // 14: tensorflow.MakeCallableRequest + (*MakeCallableResponse)(nil), // 15: tensorflow.MakeCallableResponse + (*RunCallableRequest)(nil), // 16: tensorflow.RunCallableRequest + (*RunCallableResponse)(nil), // 17: tensorflow.RunCallableResponse + (*ReleaseCallableRequest)(nil), // 18: tensorflow.ReleaseCallableRequest + (*ReleaseCallableResponse)(nil), // 19: tensorflow.ReleaseCallableResponse + (*graph_go_proto.GraphDef)(nil), // 20: tensorflow.GraphDef + (*ConfigProto)(nil), // 21: tensorflow.ConfigProto + (*NamedTensorProto)(nil), // 22: tensorflow.NamedTensorProto + (*RunOptions)(nil), // 23: tensorflow.RunOptions + (*RunMetadata)(nil), // 24: tensorflow.RunMetadata + (Code)(0), // 25: tensorflow.error.Code + (*device_attributes_go_proto.DeviceAttributes)(nil), // 26: tensorflow.DeviceAttributes + (*CallableOptions)(nil), // 27: tensorflow.CallableOptions + (*tensor_go_proto.TensorProto)(nil), // 28: tensorflow.TensorProto +} +var file_tensorflow_core_protobuf_master_proto_depIdxs = []int32{ + 20, // 0: tensorflow.CreateSessionRequest.graph_def:type_name -> tensorflow.GraphDef + 21, // 1: tensorflow.CreateSessionRequest.config:type_name -> tensorflow.ConfigProto + 20, // 2: tensorflow.ExtendSessionRequest.graph_def:type_name -> tensorflow.GraphDef + 22, // 3: tensorflow.RunStepRequest.feed:type_name -> tensorflow.NamedTensorProto + 23, // 4: tensorflow.RunStepRequest.options:type_name -> tensorflow.RunOptions + 22, // 5: tensorflow.RunStepResponse.tensor:type_name -> tensorflow.NamedTensorProto + 24, // 6: tensorflow.RunStepResponse.metadata:type_name -> tensorflow.RunMetadata + 25, // 7: tensorflow.RunStepResponse.status_code:type_name -> tensorflow.error.Code + 26, // 8: tensorflow.ListDevicesResponse.local_device:type_name -> tensorflow.DeviceAttributes + 26, // 9: tensorflow.ListDevicesResponse.remote_device:type_name -> tensorflow.DeviceAttributes + 27, // 10: tensorflow.MakeCallableRequest.options:type_name -> tensorflow.CallableOptions + 28, // 11: tensorflow.RunCallableRequest.feed:type_name -> tensorflow.TensorProto + 28, // 12: tensorflow.RunCallableResponse.fetch:type_name -> tensorflow.TensorProto + 24, // 13: tensorflow.RunCallableResponse.metadata:type_name -> tensorflow.RunMetadata + 14, // [14:14] is the sub-list for method output_type + 14, // [14:14] is the sub-list for method input_type + 14, // [14:14] is the sub-list for extension type_name + 14, // [14:14] is the sub-list for extension extendee + 0, // [0:14] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_master_proto_init() } +func file_tensorflow_core_protobuf_master_proto_init() { + if File_tensorflow_core_protobuf_master_proto != nil { + return + } + file_tensorflow_core_protobuf_config_proto_init() + file_tensorflow_core_protobuf_error_codes_proto_init() + file_tensorflow_core_protobuf_named_tensor_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_master_proto_rawDesc), len(file_tensorflow_core_protobuf_master_proto_rawDesc)), + NumEnums: 0, + NumMessages: 20, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_master_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_master_proto_depIdxs, + MessageInfos: file_tensorflow_core_protobuf_master_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_master_proto = out.File + file_tensorflow_core_protobuf_master_proto_goTypes = nil + file_tensorflow_core_protobuf_master_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/master_service.pb.go b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/master_service.pb.go new file mode 100644 index 0000000..57d778d --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/master_service.pb.go @@ -0,0 +1,128 @@ +// Copyright 2016 The TensorFlow Authors. All Rights Reserved. +// +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +//============================================================================== + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/master_service.proto + +package for_core_protos_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +var File_tensorflow_core_protobuf_master_service_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_master_service_proto_rawDesc = "" + + "\n" + + "-tensorflow/core/protobuf/master_service.proto\x12\x0ftensorflow.grpc\x1a%tensorflow/core/protobuf/master.proto2\xbb\x06\n" + + "\rMasterService\x12T\n" + + "\rCreateSession\x12 .tensorflow.CreateSessionRequest\x1a!.tensorflow.CreateSessionResponse\x12T\n" + + "\rExtendSession\x12 .tensorflow.ExtendSessionRequest\x1a!.tensorflow.ExtendSessionResponse\x12Z\n" + + "\x0fPartialRunSetup\x12\".tensorflow.PartialRunSetupRequest\x1a#.tensorflow.PartialRunSetupResponse\x12B\n" + + "\aRunStep\x12\x1a.tensorflow.RunStepRequest\x1a\x1b.tensorflow.RunStepResponse\x12Q\n" + + "\fCloseSession\x12\x1f.tensorflow.CloseSessionRequest\x1a .tensorflow.CloseSessionResponse\x12N\n" + + "\vListDevices\x12\x1e.tensorflow.ListDevicesRequest\x1a\x1f.tensorflow.ListDevicesResponse\x12<\n" + + "\x05Reset\x12\x18.tensorflow.ResetRequest\x1a\x19.tensorflow.ResetResponse\x12Q\n" + + "\fMakeCallable\x12\x1f.tensorflow.MakeCallableRequest\x1a .tensorflow.MakeCallableResponse\x12N\n" + + "\vRunCallable\x12\x1e.tensorflow.RunCallableRequest\x1a\x1f.tensorflow.RunCallableResponse\x12Z\n" + + "\x0fReleaseCallable\x12\".tensorflow.ReleaseCallableRequest\x1a#.tensorflow.ReleaseCallableResponseB\x8a\x01\n" + + "\x1aorg.tensorflow.distruntimeB\x13MasterServiceProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_protob\x06proto3" + +var file_tensorflow_core_protobuf_master_service_proto_goTypes = []any{ + (*CreateSessionRequest)(nil), // 0: tensorflow.CreateSessionRequest + (*ExtendSessionRequest)(nil), // 1: tensorflow.ExtendSessionRequest + (*PartialRunSetupRequest)(nil), // 2: tensorflow.PartialRunSetupRequest + (*RunStepRequest)(nil), // 3: tensorflow.RunStepRequest + (*CloseSessionRequest)(nil), // 4: tensorflow.CloseSessionRequest + (*ListDevicesRequest)(nil), // 5: tensorflow.ListDevicesRequest + (*ResetRequest)(nil), // 6: tensorflow.ResetRequest + (*MakeCallableRequest)(nil), // 7: tensorflow.MakeCallableRequest + (*RunCallableRequest)(nil), // 8: tensorflow.RunCallableRequest + (*ReleaseCallableRequest)(nil), // 9: tensorflow.ReleaseCallableRequest + (*CreateSessionResponse)(nil), // 10: tensorflow.CreateSessionResponse + (*ExtendSessionResponse)(nil), // 11: tensorflow.ExtendSessionResponse + (*PartialRunSetupResponse)(nil), // 12: tensorflow.PartialRunSetupResponse + (*RunStepResponse)(nil), // 13: tensorflow.RunStepResponse + (*CloseSessionResponse)(nil), // 14: tensorflow.CloseSessionResponse + (*ListDevicesResponse)(nil), // 15: tensorflow.ListDevicesResponse + (*ResetResponse)(nil), // 16: tensorflow.ResetResponse + (*MakeCallableResponse)(nil), // 17: tensorflow.MakeCallableResponse + (*RunCallableResponse)(nil), // 18: tensorflow.RunCallableResponse + (*ReleaseCallableResponse)(nil), // 19: tensorflow.ReleaseCallableResponse +} +var file_tensorflow_core_protobuf_master_service_proto_depIdxs = []int32{ + 0, // 0: tensorflow.grpc.MasterService.CreateSession:input_type -> tensorflow.CreateSessionRequest + 1, // 1: tensorflow.grpc.MasterService.ExtendSession:input_type -> tensorflow.ExtendSessionRequest + 2, // 2: tensorflow.grpc.MasterService.PartialRunSetup:input_type -> tensorflow.PartialRunSetupRequest + 3, // 3: tensorflow.grpc.MasterService.RunStep:input_type -> tensorflow.RunStepRequest + 4, // 4: tensorflow.grpc.MasterService.CloseSession:input_type -> tensorflow.CloseSessionRequest + 5, // 5: tensorflow.grpc.MasterService.ListDevices:input_type -> tensorflow.ListDevicesRequest + 6, // 6: tensorflow.grpc.MasterService.Reset:input_type -> tensorflow.ResetRequest + 7, // 7: tensorflow.grpc.MasterService.MakeCallable:input_type -> tensorflow.MakeCallableRequest + 8, // 8: tensorflow.grpc.MasterService.RunCallable:input_type -> tensorflow.RunCallableRequest + 9, // 9: tensorflow.grpc.MasterService.ReleaseCallable:input_type -> tensorflow.ReleaseCallableRequest + 10, // 10: tensorflow.grpc.MasterService.CreateSession:output_type -> tensorflow.CreateSessionResponse + 11, // 11: tensorflow.grpc.MasterService.ExtendSession:output_type -> tensorflow.ExtendSessionResponse + 12, // 12: tensorflow.grpc.MasterService.PartialRunSetup:output_type -> tensorflow.PartialRunSetupResponse + 13, // 13: tensorflow.grpc.MasterService.RunStep:output_type -> tensorflow.RunStepResponse + 14, // 14: tensorflow.grpc.MasterService.CloseSession:output_type -> tensorflow.CloseSessionResponse + 15, // 15: tensorflow.grpc.MasterService.ListDevices:output_type -> tensorflow.ListDevicesResponse + 16, // 16: tensorflow.grpc.MasterService.Reset:output_type -> tensorflow.ResetResponse + 17, // 17: tensorflow.grpc.MasterService.MakeCallable:output_type -> tensorflow.MakeCallableResponse + 18, // 18: tensorflow.grpc.MasterService.RunCallable:output_type -> tensorflow.RunCallableResponse + 19, // 19: tensorflow.grpc.MasterService.ReleaseCallable:output_type -> tensorflow.ReleaseCallableResponse + 10, // [10:20] is the sub-list for method output_type + 0, // [0:10] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_master_service_proto_init() } +func file_tensorflow_core_protobuf_master_service_proto_init() { + if File_tensorflow_core_protobuf_master_service_proto != nil { + return + } + file_tensorflow_core_protobuf_master_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_master_service_proto_rawDesc), len(file_tensorflow_core_protobuf_master_service_proto_rawDesc)), + NumEnums: 0, + NumMessages: 0, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_tensorflow_core_protobuf_master_service_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_master_service_proto_depIdxs, + }.Build() + File_tensorflow_core_protobuf_master_service_proto = out.File + file_tensorflow_core_protobuf_master_service_proto_goTypes = nil + file_tensorflow_core_protobuf_master_service_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/meta_graph.pb.go b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/meta_graph.pb.go new file mode 100644 index 0000000..86ba2b7 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/meta_graph.pb.go @@ -0,0 +1,1343 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/meta_graph.proto + +package for_core_protos_go_proto + +import ( + graph_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/graph_go_proto" + op_def_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/op_def_go_proto" + tensor_shape_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_shape_go_proto" + types_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/types_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + anypb "google.golang.org/protobuf/types/known/anypb" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// 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 +// process boundary. It can be used for long term storage of graphs, +// cross-language execution of graphs, etc. +// +// MetaInfoDef +// GraphDef +// SaverDef +// CollectionDef +// TensorInfo +// SignatureDef +type MetaGraphDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + MetaInfoDef *MetaGraphDef_MetaInfoDef `protobuf:"bytes,1,opt,name=meta_info_def,json=metaInfoDef,proto3" json:"meta_info_def,omitempty"` + // GraphDef. + GraphDef *graph_go_proto.GraphDef `protobuf:"bytes,2,opt,name=graph_def,json=graphDef,proto3" json:"graph_def,omitempty"` + // SaverDef. + SaverDef *SaverDef `protobuf:"bytes,3,opt,name=saver_def,json=saverDef,proto3" json:"saver_def,omitempty"` + // collection_def: Map from collection name to collections. + // See CollectionDef section for details. + CollectionDef map[string]*CollectionDef `protobuf:"bytes,4,rep,name=collection_def,json=collectionDef,proto3" json:"collection_def,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // signature_def: Map from user supplied key for a signature to a single + // SignatureDef. + SignatureDef map[string]*SignatureDef `protobuf:"bytes,5,rep,name=signature_def,json=signatureDef,proto3" json:"signature_def,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // Asset file def to be used with the defined graph. + AssetFileDef []*AssetFileDef `protobuf:"bytes,6,rep,name=asset_file_def,json=assetFileDef,proto3" json:"asset_file_def,omitempty"` + // Extra information about the structure of functions and stateful objects. + ObjectGraphDef *SavedObjectGraph `protobuf:"bytes,7,opt,name=object_graph_def,json=objectGraphDef,proto3" json:"object_graph_def,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MetaGraphDef) Reset() { + *x = MetaGraphDef{} + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MetaGraphDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MetaGraphDef) ProtoMessage() {} + +func (x *MetaGraphDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MetaGraphDef.ProtoReflect.Descriptor instead. +func (*MetaGraphDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_meta_graph_proto_rawDescGZIP(), []int{0} +} + +func (x *MetaGraphDef) GetMetaInfoDef() *MetaGraphDef_MetaInfoDef { + if x != nil { + return x.MetaInfoDef + } + return nil +} + +func (x *MetaGraphDef) GetGraphDef() *graph_go_proto.GraphDef { + if x != nil { + return x.GraphDef + } + return nil +} + +func (x *MetaGraphDef) GetSaverDef() *SaverDef { + if x != nil { + return x.SaverDef + } + return nil +} + +func (x *MetaGraphDef) GetCollectionDef() map[string]*CollectionDef { + if x != nil { + return x.CollectionDef + } + return nil +} + +func (x *MetaGraphDef) GetSignatureDef() map[string]*SignatureDef { + if x != nil { + return x.SignatureDef + } + return nil +} + +func (x *MetaGraphDef) GetAssetFileDef() []*AssetFileDef { + if x != nil { + return x.AssetFileDef + } + return nil +} + +func (x *MetaGraphDef) GetObjectGraphDef() *SavedObjectGraph { + if x != nil { + return x.ObjectGraphDef + } + return nil +} + +// CollectionDef should cover most collections. +// To add a user-defined collection, do one of the following: +// 1. For simple data types, such as string, int, float: +// tf.add_to_collection("your_collection_name", your_simple_value) +// strings will be stored as bytes_list. +// +// 2. For Protobuf types, there are three ways to add them: +// +// 1. tf.add_to_collection("your_collection_name", +// your_proto.SerializeToString()) +// +// collection_def { +// key: "user_defined_bytes_collection" +// value { +// bytes_list { +// value: "queue_name: \"test_queue\"\n" +// } +// } +// } +// +// or +// +// 2. tf.add_to_collection("your_collection_name", str(your_proto)) +// +// collection_def { +// key: "user_defined_string_collection" +// value { +// bytes_list { +// value: "\n\ntest_queue" +// } +// } +// } +// +// or +// +// 3. any_buf = any_pb2.Any() +// tf.add_to_collection("your_collection_name", +// any_buf.Pack(your_proto)) +// +// collection_def { +// key: "user_defined_any_collection" +// value { +// any_list { +// value { +// type_url: "type.googleapis.com/tensorflow.QueueRunnerDef" +// value: "\n\ntest_queue" +// } +// } +// } +// } +// +// 3. For Python objects, implement to_proto() and from_proto(), and register +// them in the following manner: +// ops.register_proto_function("your_collection_name", +// proto_type, +// to_proto=YourPythonObject.to_proto, +// from_proto=YourPythonObject.from_proto) +// These functions will be invoked to serialize and de-serialize the +// collection. For example, +// ops.register_proto_function(ops.GraphKeys.GLOBAL_VARIABLES, +// proto_type=variable_pb2.VariableDef, +// to_proto=Variable.to_proto, +// from_proto=Variable.from_proto) +type CollectionDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Kind: + // + // *CollectionDef_NodeList_ + // *CollectionDef_BytesList_ + // *CollectionDef_Int64List_ + // *CollectionDef_FloatList_ + // *CollectionDef_AnyList_ + Kind isCollectionDef_Kind `protobuf_oneof:"kind"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CollectionDef) Reset() { + *x = CollectionDef{} + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CollectionDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CollectionDef) ProtoMessage() {} + +func (x *CollectionDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CollectionDef.ProtoReflect.Descriptor instead. +func (*CollectionDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_meta_graph_proto_rawDescGZIP(), []int{1} +} + +func (x *CollectionDef) GetKind() isCollectionDef_Kind { + if x != nil { + return x.Kind + } + return nil +} + +func (x *CollectionDef) GetNodeList() *CollectionDef_NodeList { + if x != nil { + if x, ok := x.Kind.(*CollectionDef_NodeList_); ok { + return x.NodeList + } + } + return nil +} + +func (x *CollectionDef) GetBytesList() *CollectionDef_BytesList { + if x != nil { + if x, ok := x.Kind.(*CollectionDef_BytesList_); ok { + return x.BytesList + } + } + return nil +} + +func (x *CollectionDef) GetInt64List() *CollectionDef_Int64List { + if x != nil { + if x, ok := x.Kind.(*CollectionDef_Int64List_); ok { + return x.Int64List + } + } + return nil +} + +func (x *CollectionDef) GetFloatList() *CollectionDef_FloatList { + if x != nil { + if x, ok := x.Kind.(*CollectionDef_FloatList_); ok { + return x.FloatList + } + } + return nil +} + +func (x *CollectionDef) GetAnyList() *CollectionDef_AnyList { + if x != nil { + if x, ok := x.Kind.(*CollectionDef_AnyList_); ok { + return x.AnyList + } + } + return nil +} + +type isCollectionDef_Kind interface { + isCollectionDef_Kind() +} + +type CollectionDef_NodeList_ struct { + NodeList *CollectionDef_NodeList `protobuf:"bytes,1,opt,name=node_list,json=nodeList,proto3,oneof"` +} + +type CollectionDef_BytesList_ struct { + BytesList *CollectionDef_BytesList `protobuf:"bytes,2,opt,name=bytes_list,json=bytesList,proto3,oneof"` +} + +type CollectionDef_Int64List_ struct { + Int64List *CollectionDef_Int64List `protobuf:"bytes,3,opt,name=int64_list,json=int64List,proto3,oneof"` +} + +type CollectionDef_FloatList_ struct { + FloatList *CollectionDef_FloatList `protobuf:"bytes,4,opt,name=float_list,json=floatList,proto3,oneof"` +} + +type CollectionDef_AnyList_ struct { + AnyList *CollectionDef_AnyList `protobuf:"bytes,5,opt,name=any_list,json=anyList,proto3,oneof"` +} + +func (*CollectionDef_NodeList_) isCollectionDef_Kind() {} + +func (*CollectionDef_BytesList_) isCollectionDef_Kind() {} + +func (*CollectionDef_Int64List_) isCollectionDef_Kind() {} + +func (*CollectionDef_FloatList_) isCollectionDef_Kind() {} + +func (*CollectionDef_AnyList_) isCollectionDef_Kind() {} + +// Information about a Tensor necessary for feeding or retrieval. +type TensorInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Encoding: + // + // *TensorInfo_Name + // *TensorInfo_CooSparse_ + // *TensorInfo_CompositeTensor_ + Encoding isTensorInfo_Encoding `protobuf_oneof:"encoding"` + Dtype types_go_proto.DataType `protobuf:"varint,2,opt,name=dtype,proto3,enum=tensorflow.DataType" json:"dtype,omitempty"` + // The static shape should be recorded here, to the extent that it can + // be known in advance. In the case of a SparseTensor, this field describes + // the logical shape of the represented tensor (aka dense_shape). + TensorShape *tensor_shape_go_proto.TensorShapeProto `protobuf:"bytes,3,opt,name=tensor_shape,json=tensorShape,proto3" json:"tensor_shape,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TensorInfo) Reset() { + *x = TensorInfo{} + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TensorInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TensorInfo) ProtoMessage() {} + +func (x *TensorInfo) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TensorInfo.ProtoReflect.Descriptor instead. +func (*TensorInfo) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_meta_graph_proto_rawDescGZIP(), []int{2} +} + +func (x *TensorInfo) GetEncoding() isTensorInfo_Encoding { + if x != nil { + return x.Encoding + } + return nil +} + +func (x *TensorInfo) GetName() string { + if x != nil { + if x, ok := x.Encoding.(*TensorInfo_Name); ok { + return x.Name + } + } + return "" +} + +func (x *TensorInfo) GetCooSparse() *TensorInfo_CooSparse { + if x != nil { + if x, ok := x.Encoding.(*TensorInfo_CooSparse_); ok { + return x.CooSparse + } + } + return nil +} + +func (x *TensorInfo) GetCompositeTensor() *TensorInfo_CompositeTensor { + if x != nil { + if x, ok := x.Encoding.(*TensorInfo_CompositeTensor_); ok { + return x.CompositeTensor + } + } + return nil +} + +func (x *TensorInfo) GetDtype() types_go_proto.DataType { + if x != nil { + return x.Dtype + } + return types_go_proto.DataType(0) +} + +func (x *TensorInfo) GetTensorShape() *tensor_shape_go_proto.TensorShapeProto { + if x != nil { + return x.TensorShape + } + return nil +} + +type isTensorInfo_Encoding interface { + isTensorInfo_Encoding() +} + +type TensorInfo_Name struct { + // For dense `Tensor`s, the name of the tensor in the graph. + Name string `protobuf:"bytes,1,opt,name=name,proto3,oneof"` +} + +type TensorInfo_CooSparse_ struct { + // There are many possible encodings of sparse matrices + // (https://en.wikipedia.org/wiki/Sparse_matrix). Currently, TensorFlow + // uses only the COO encoding. This is supported and documented in the + // SparseTensor Python class. + CooSparse *TensorInfo_CooSparse `protobuf:"bytes,4,opt,name=coo_sparse,json=cooSparse,proto3,oneof"` +} + +type TensorInfo_CompositeTensor_ struct { + // Generic encoding for CompositeTensors. + CompositeTensor *TensorInfo_CompositeTensor `protobuf:"bytes,5,opt,name=composite_tensor,json=compositeTensor,proto3,oneof"` +} + +func (*TensorInfo_Name) isTensorInfo_Encoding() {} + +func (*TensorInfo_CooSparse_) isTensorInfo_Encoding() {} + +func (*TensorInfo_CompositeTensor_) isTensorInfo_Encoding() {} + +// SignatureDef defines the signature of a computation supported by a TensorFlow +// graph. +// +// For example, a model with two loss computations, sharing a single input, +// might have the following signature_def map. +// +// Note that across the two SignatureDefs "loss_A" and "loss_B", the input key, +// output key, and method_name are identical, and will be used by system(s) that +// implement or rely upon this particular loss method. The output tensor names +// differ, demonstrating how different outputs can exist for the same method. +// +// signature_def { +// key: "loss_A" +// value { +// inputs { +// key: "input" +// value { +// name: "input:0" +// dtype: DT_STRING +// tensor_shape: ... +// } +// } +// outputs { +// key: "loss_output" +// value { +// name: "loss_output_A:0" +// dtype: DT_FLOAT +// tensor_shape: ... +// } +// } +// } +// ... +// method_name: "some/package/compute_loss" +// } +// +// signature_def { +// key: "loss_B" +// value { +// inputs { +// key: "input" +// value { +// name: "input:0" +// dtype: DT_STRING +// tensor_shape: ... +// } +// } +// outputs { +// key: "loss_output" +// value { +// name: "loss_output_B:0" +// dtype: DT_FLOAT +// tensor_shape: ... +// } +// } +// } +// ... +// method_name: "some/package/compute_loss" +// } +type SignatureDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Named input parameters. + Inputs map[string]*TensorInfo `protobuf:"bytes,1,rep,name=inputs,proto3" json:"inputs,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // Named output parameters. + Outputs map[string]*TensorInfo `protobuf:"bytes,2,rep,name=outputs,proto3" json:"outputs,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // Extensible method_name information enabling third-party users to mark a + // SignatureDef as supporting a particular method. This enables producers and + // consumers of SignatureDefs, e.g. a model definition library and a serving + // library to have a clear hand-off regarding the semantics of a computation. + // + // Note that multiple SignatureDefs in a single MetaGraphDef may have the same + // method_name. This is commonly used to support multi-headed computation, + // where a single graph computation may return multiple results. + MethodName string `protobuf:"bytes,3,opt,name=method_name,json=methodName,proto3" json:"method_name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SignatureDef) Reset() { + *x = SignatureDef{} + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SignatureDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SignatureDef) ProtoMessage() {} + +func (x *SignatureDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SignatureDef.ProtoReflect.Descriptor instead. +func (*SignatureDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_meta_graph_proto_rawDescGZIP(), []int{3} +} + +func (x *SignatureDef) GetInputs() map[string]*TensorInfo { + if x != nil { + return x.Inputs + } + return nil +} + +func (x *SignatureDef) GetOutputs() map[string]*TensorInfo { + if x != nil { + return x.Outputs + } + return nil +} + +func (x *SignatureDef) GetMethodName() string { + if x != nil { + return x.MethodName + } + return "" +} + +// An asset file def for a single file or a set of sharded files with the same +// name. +type AssetFileDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The tensor to bind the asset filename to. + TensorInfo *TensorInfo `protobuf:"bytes,1,opt,name=tensor_info,json=tensorInfo,proto3" json:"tensor_info,omitempty"` + // The filename within an assets directory. Note: does not include the path + // prefix, i.e. directories. For an asset at /tmp/path/vocab.txt, the filename + // would be "vocab.txt". + Filename string `protobuf:"bytes,2,opt,name=filename,proto3" json:"filename,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AssetFileDef) Reset() { + *x = AssetFileDef{} + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AssetFileDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AssetFileDef) ProtoMessage() {} + +func (x *AssetFileDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AssetFileDef.ProtoReflect.Descriptor instead. +func (*AssetFileDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_meta_graph_proto_rawDescGZIP(), []int{4} +} + +func (x *AssetFileDef) GetTensorInfo() *TensorInfo { + if x != nil { + return x.TensorInfo + } + return nil +} + +func (x *AssetFileDef) GetFilename() string { + if x != nil { + return x.Filename + } + return "" +} + +// Meta information regarding the graph to be exported. To be used by users +// of this protocol buffer to encode information regarding their meta graph. +type MetaGraphDef_MetaInfoDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // User specified Version string. Can be the name of the model and revision, + // steps this model has been trained to, etc. + MetaGraphVersion string `protobuf:"bytes,1,opt,name=meta_graph_version,json=metaGraphVersion,proto3" json:"meta_graph_version,omitempty"` + // A copy of the OpDefs used by the producer of this graph_def. + // Descriptions and Ops not used in graph_def are stripped out. + StrippedOpList *op_def_go_proto.OpList `protobuf:"bytes,2,opt,name=stripped_op_list,json=strippedOpList,proto3" json:"stripped_op_list,omitempty"` + // A serialized protobuf. Can be the time this meta graph is created, or + // modified, or name of the model. + AnyInfo *anypb.Any `protobuf:"bytes,3,opt,name=any_info,json=anyInfo,proto3" json:"any_info,omitempty"` + // User supplied tag(s) on the meta_graph and included graph_def. + // + // MetaGraphDefs should be tagged with their capabilities or use-cases. + // Examples: "train", "serve", "gpu", "tpu", etc. + // These tags enable loaders to access the MetaGraph(s) appropriate for a + // specific use-case or runtime environment. + Tags []string `protobuf:"bytes,4,rep,name=tags,proto3" json:"tags,omitempty"` + // The __version__ string of the tensorflow build used to write this graph. + // This will be populated by the framework, which will overwrite any user + // supplied value. + TensorflowVersion string `protobuf:"bytes,5,opt,name=tensorflow_version,json=tensorflowVersion,proto3" json:"tensorflow_version,omitempty"` + // The __git_version__ string of the tensorflow build used to write this + // graph. This will be populated by the framework, which will overwrite any + // user supplied value. + TensorflowGitVersion string `protobuf:"bytes,6,opt,name=tensorflow_git_version,json=tensorflowGitVersion,proto3" json:"tensorflow_git_version,omitempty"` + // A flag to denote whether default-valued attrs have been stripped from + // the nodes in this graph_def. + StrippedDefaultAttrs bool `protobuf:"varint,7,opt,name=stripped_default_attrs,json=strippedDefaultAttrs,proto3" json:"stripped_default_attrs,omitempty"` + // FunctionDef name to aliases mapping. + FunctionAliases map[string]string `protobuf:"bytes,8,rep,name=function_aliases,json=functionAliases,proto3" json:"function_aliases,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MetaGraphDef_MetaInfoDef) Reset() { + *x = MetaGraphDef_MetaInfoDef{} + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MetaGraphDef_MetaInfoDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MetaGraphDef_MetaInfoDef) ProtoMessage() {} + +func (x *MetaGraphDef_MetaInfoDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MetaGraphDef_MetaInfoDef.ProtoReflect.Descriptor instead. +func (*MetaGraphDef_MetaInfoDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_meta_graph_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *MetaGraphDef_MetaInfoDef) GetMetaGraphVersion() string { + if x != nil { + return x.MetaGraphVersion + } + return "" +} + +func (x *MetaGraphDef_MetaInfoDef) GetStrippedOpList() *op_def_go_proto.OpList { + if x != nil { + return x.StrippedOpList + } + return nil +} + +func (x *MetaGraphDef_MetaInfoDef) GetAnyInfo() *anypb.Any { + if x != nil { + return x.AnyInfo + } + return nil +} + +func (x *MetaGraphDef_MetaInfoDef) GetTags() []string { + if x != nil { + return x.Tags + } + return nil +} + +func (x *MetaGraphDef_MetaInfoDef) GetTensorflowVersion() string { + if x != nil { + return x.TensorflowVersion + } + return "" +} + +func (x *MetaGraphDef_MetaInfoDef) GetTensorflowGitVersion() string { + if x != nil { + return x.TensorflowGitVersion + } + return "" +} + +func (x *MetaGraphDef_MetaInfoDef) GetStrippedDefaultAttrs() bool { + if x != nil { + return x.StrippedDefaultAttrs + } + return false +} + +func (x *MetaGraphDef_MetaInfoDef) GetFunctionAliases() map[string]string { + if x != nil { + return x.FunctionAliases + } + return nil +} + +// NodeList is used for collecting nodes in graph. For example +// +// collection_def { +// key: "summaries" +// value { +// node_list { +// value: "input_producer/ScalarSummary:0" +// value: "shuffle_batch/ScalarSummary:0" +// value: "ImageSummary:0" +// } +// } +type CollectionDef_NodeList struct { + state protoimpl.MessageState `protogen:"open.v1"` + Value []string `protobuf:"bytes,1,rep,name=value,proto3" json:"value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CollectionDef_NodeList) Reset() { + *x = CollectionDef_NodeList{} + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CollectionDef_NodeList) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CollectionDef_NodeList) ProtoMessage() {} + +func (x *CollectionDef_NodeList) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CollectionDef_NodeList.ProtoReflect.Descriptor instead. +func (*CollectionDef_NodeList) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_meta_graph_proto_rawDescGZIP(), []int{1, 0} +} + +func (x *CollectionDef_NodeList) GetValue() []string { + if x != nil { + return x.Value + } + return nil +} + +// BytesList is used for collecting strings and serialized protobufs. For +// example: +// +// collection_def { +// key: "trainable_variables" +// value { +// bytes_list { +// value: "\n\017conv1/weights:0\022\024conv1/weights/Assign +// \032\024conv1/weights/read:0" +// value: "\n\016conv1/biases:0\022\023conv1/biases/Assign\032 +// \023conv1/biases/read:0" +// } +// } +// } +type CollectionDef_BytesList struct { + state protoimpl.MessageState `protogen:"open.v1"` + Value [][]byte `protobuf:"bytes,1,rep,name=value,proto3" json:"value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CollectionDef_BytesList) Reset() { + *x = CollectionDef_BytesList{} + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CollectionDef_BytesList) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CollectionDef_BytesList) ProtoMessage() {} + +func (x *CollectionDef_BytesList) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CollectionDef_BytesList.ProtoReflect.Descriptor instead. +func (*CollectionDef_BytesList) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_meta_graph_proto_rawDescGZIP(), []int{1, 1} +} + +func (x *CollectionDef_BytesList) GetValue() [][]byte { + if x != nil { + return x.Value + } + return nil +} + +// Int64List is used for collecting int, int64 and long values. +type CollectionDef_Int64List struct { + state protoimpl.MessageState `protogen:"open.v1"` + Value []int64 `protobuf:"varint,1,rep,packed,name=value,proto3" json:"value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CollectionDef_Int64List) Reset() { + *x = CollectionDef_Int64List{} + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CollectionDef_Int64List) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CollectionDef_Int64List) ProtoMessage() {} + +func (x *CollectionDef_Int64List) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CollectionDef_Int64List.ProtoReflect.Descriptor instead. +func (*CollectionDef_Int64List) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_meta_graph_proto_rawDescGZIP(), []int{1, 2} +} + +func (x *CollectionDef_Int64List) GetValue() []int64 { + if x != nil { + return x.Value + } + return nil +} + +// FloatList is used for collecting float values. +type CollectionDef_FloatList struct { + state protoimpl.MessageState `protogen:"open.v1"` + Value []float32 `protobuf:"fixed32,1,rep,packed,name=value,proto3" json:"value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CollectionDef_FloatList) Reset() { + *x = CollectionDef_FloatList{} + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CollectionDef_FloatList) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CollectionDef_FloatList) ProtoMessage() {} + +func (x *CollectionDef_FloatList) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CollectionDef_FloatList.ProtoReflect.Descriptor instead. +func (*CollectionDef_FloatList) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_meta_graph_proto_rawDescGZIP(), []int{1, 3} +} + +func (x *CollectionDef_FloatList) GetValue() []float32 { + if x != nil { + return x.Value + } + return nil +} + +// AnyList is used for collecting Any protos. +type CollectionDef_AnyList struct { + state protoimpl.MessageState `protogen:"open.v1"` + Value []*anypb.Any `protobuf:"bytes,1,rep,name=value,proto3" json:"value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CollectionDef_AnyList) Reset() { + *x = CollectionDef_AnyList{} + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CollectionDef_AnyList) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CollectionDef_AnyList) ProtoMessage() {} + +func (x *CollectionDef_AnyList) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[13] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CollectionDef_AnyList.ProtoReflect.Descriptor instead. +func (*CollectionDef_AnyList) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_meta_graph_proto_rawDescGZIP(), []int{1, 4} +} + +func (x *CollectionDef_AnyList) GetValue() []*anypb.Any { + if x != nil { + return x.Value + } + return nil +} + +// For sparse tensors, The COO encoding stores a triple of values, indices, +// and shape. +type TensorInfo_CooSparse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The shape of the values Tensor is [?]. Its dtype must be the dtype of + // the SparseTensor as a whole, given in the enclosing TensorInfo. + ValuesTensorName string `protobuf:"bytes,1,opt,name=values_tensor_name,json=valuesTensorName,proto3" json:"values_tensor_name,omitempty"` + // The indices Tensor must have dtype int64 and shape [?, ?]. + IndicesTensorName string `protobuf:"bytes,2,opt,name=indices_tensor_name,json=indicesTensorName,proto3" json:"indices_tensor_name,omitempty"` + // The dynamic logical shape represented by the SparseTensor is recorded in + // the Tensor referenced here. It must have dtype int64 and shape [?]. + DenseShapeTensorName string `protobuf:"bytes,3,opt,name=dense_shape_tensor_name,json=denseShapeTensorName,proto3" json:"dense_shape_tensor_name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TensorInfo_CooSparse) Reset() { + *x = TensorInfo_CooSparse{} + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TensorInfo_CooSparse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TensorInfo_CooSparse) ProtoMessage() {} + +func (x *TensorInfo_CooSparse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[14] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TensorInfo_CooSparse.ProtoReflect.Descriptor instead. +func (*TensorInfo_CooSparse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_meta_graph_proto_rawDescGZIP(), []int{2, 0} +} + +func (x *TensorInfo_CooSparse) GetValuesTensorName() string { + if x != nil { + return x.ValuesTensorName + } + return "" +} + +func (x *TensorInfo_CooSparse) GetIndicesTensorName() string { + if x != nil { + return x.IndicesTensorName + } + return "" +} + +func (x *TensorInfo_CooSparse) GetDenseShapeTensorName() string { + if x != nil { + return x.DenseShapeTensorName + } + return "" +} + +// Generic encoding for composite tensors. +type TensorInfo_CompositeTensor struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The serialized TypeSpec for the composite tensor. + TypeSpec *TypeSpecProto `protobuf:"bytes,1,opt,name=type_spec,json=typeSpec,proto3" json:"type_spec,omitempty"` + // A TensorInfo for each flattened component tensor. + Components []*TensorInfo `protobuf:"bytes,2,rep,name=components,proto3" json:"components,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TensorInfo_CompositeTensor) Reset() { + *x = TensorInfo_CompositeTensor{} + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TensorInfo_CompositeTensor) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TensorInfo_CompositeTensor) ProtoMessage() {} + +func (x *TensorInfo_CompositeTensor) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[15] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TensorInfo_CompositeTensor.ProtoReflect.Descriptor instead. +func (*TensorInfo_CompositeTensor) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_meta_graph_proto_rawDescGZIP(), []int{2, 1} +} + +func (x *TensorInfo_CompositeTensor) GetTypeSpec() *TypeSpecProto { + if x != nil { + return x.TypeSpec + } + return nil +} + +func (x *TensorInfo_CompositeTensor) GetComponents() []*TensorInfo { + if x != nil { + return x.Components + } + return nil +} + +var File_tensorflow_core_protobuf_meta_graph_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_meta_graph_proto_rawDesc = "" + + "\n" + + ")tensorflow/core/protobuf/meta_graph.proto\x12\n" + + "tensorflow\x1a\x19google/protobuf/any.proto\x1a%tensorflow/core/framework/graph.proto\x1a&tensorflow/core/framework/op_def.proto\x1a,tensorflow/core/framework/tensor_shape.proto\x1a%tensorflow/core/framework/types.proto\x1a1tensorflow/core/protobuf/saved_object_graph.proto\x1a$tensorflow/core/protobuf/saver.proto\x1a%tensorflow/core/protobuf/struct.proto\"\xa9\t\n" + + "\fMetaGraphDef\x12H\n" + + "\rmeta_info_def\x18\x01 \x01(\v2$.tensorflow.MetaGraphDef.MetaInfoDefR\vmetaInfoDef\x121\n" + + "\tgraph_def\x18\x02 \x01(\v2\x14.tensorflow.GraphDefR\bgraphDef\x121\n" + + "\tsaver_def\x18\x03 \x01(\v2\x14.tensorflow.SaverDefR\bsaverDef\x12R\n" + + "\x0ecollection_def\x18\x04 \x03(\v2+.tensorflow.MetaGraphDef.CollectionDefEntryR\rcollectionDef\x12O\n" + + "\rsignature_def\x18\x05 \x03(\v2*.tensorflow.MetaGraphDef.SignatureDefEntryR\fsignatureDef\x12>\n" + + "\x0easset_file_def\x18\x06 \x03(\v2\x18.tensorflow.AssetFileDefR\fassetFileDef\x12F\n" + + "\x10object_graph_def\x18\a \x01(\v2\x1c.tensorflow.SavedObjectGraphR\x0eobjectGraphDef\x1a\x83\x04\n" + + "\vMetaInfoDef\x12,\n" + + "\x12meta_graph_version\x18\x01 \x01(\tR\x10metaGraphVersion\x12<\n" + + "\x10stripped_op_list\x18\x02 \x01(\v2\x12.tensorflow.OpListR\x0estrippedOpList\x12/\n" + + "\bany_info\x18\x03 \x01(\v2\x14.google.protobuf.AnyR\aanyInfo\x12\x12\n" + + "\x04tags\x18\x04 \x03(\tR\x04tags\x12-\n" + + "\x12tensorflow_version\x18\x05 \x01(\tR\x11tensorflowVersion\x124\n" + + "\x16tensorflow_git_version\x18\x06 \x01(\tR\x14tensorflowGitVersion\x124\n" + + "\x16stripped_default_attrs\x18\a \x01(\bR\x14strippedDefaultAttrs\x12d\n" + + "\x10function_aliases\x18\b \x03(\v29.tensorflow.MetaGraphDef.MetaInfoDef.FunctionAliasesEntryR\x0ffunctionAliases\x1aB\n" + + "\x14FunctionAliasesEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\x1a[\n" + + "\x12CollectionDefEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12/\n" + + "\x05value\x18\x02 \x01(\v2\x19.tensorflow.CollectionDefR\x05value:\x028\x01\x1aY\n" + + "\x11SignatureDefEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12.\n" + + "\x05value\x18\x02 \x01(\v2\x18.tensorflow.SignatureDefR\x05value:\x028\x01\"\xb6\x04\n" + + "\rCollectionDef\x12A\n" + + "\tnode_list\x18\x01 \x01(\v2\".tensorflow.CollectionDef.NodeListH\x00R\bnodeList\x12D\n" + + "\n" + + "bytes_list\x18\x02 \x01(\v2#.tensorflow.CollectionDef.BytesListH\x00R\tbytesList\x12D\n" + + "\n" + + "int64_list\x18\x03 \x01(\v2#.tensorflow.CollectionDef.Int64ListH\x00R\tint64List\x12D\n" + + "\n" + + "float_list\x18\x04 \x01(\v2#.tensorflow.CollectionDef.FloatListH\x00R\tfloatList\x12>\n" + + "\bany_list\x18\x05 \x01(\v2!.tensorflow.CollectionDef.AnyListH\x00R\aanyList\x1a \n" + + "\bNodeList\x12\x14\n" + + "\x05value\x18\x01 \x03(\tR\x05value\x1a!\n" + + "\tBytesList\x12\x14\n" + + "\x05value\x18\x01 \x03(\fR\x05value\x1a%\n" + + "\tInt64List\x12\x18\n" + + "\x05value\x18\x01 \x03(\x03B\x02\x10\x01R\x05value\x1a%\n" + + "\tFloatList\x12\x18\n" + + "\x05value\x18\x01 \x03(\x02B\x02\x10\x01R\x05value\x1a5\n" + + "\aAnyList\x12*\n" + + "\x05value\x18\x01 \x03(\v2\x14.google.protobuf.AnyR\x05valueB\x06\n" + + "\x04kind\"\xda\x04\n" + + "\n" + + "TensorInfo\x12\x14\n" + + "\x04name\x18\x01 \x01(\tH\x00R\x04name\x12A\n" + + "\n" + + "coo_sparse\x18\x04 \x01(\v2 .tensorflow.TensorInfo.CooSparseH\x00R\tcooSparse\x12S\n" + + "\x10composite_tensor\x18\x05 \x01(\v2&.tensorflow.TensorInfo.CompositeTensorH\x00R\x0fcompositeTensor\x12*\n" + + "\x05dtype\x18\x02 \x01(\x0e2\x14.tensorflow.DataTypeR\x05dtype\x12?\n" + + "\ftensor_shape\x18\x03 \x01(\v2\x1c.tensorflow.TensorShapeProtoR\vtensorShape\x1a\xa0\x01\n" + + "\tCooSparse\x12,\n" + + "\x12values_tensor_name\x18\x01 \x01(\tR\x10valuesTensorName\x12.\n" + + "\x13indices_tensor_name\x18\x02 \x01(\tR\x11indicesTensorName\x125\n" + + "\x17dense_shape_tensor_name\x18\x03 \x01(\tR\x14denseShapeTensorName\x1a\x81\x01\n" + + "\x0fCompositeTensor\x126\n" + + "\ttype_spec\x18\x01 \x01(\v2\x19.tensorflow.TypeSpecProtoR\btypeSpec\x126\n" + + "\n" + + "components\x18\x02 \x03(\v2\x16.tensorflow.TensorInfoR\n" + + "componentsB\n" + + "\n" + + "\bencoding\"\xd5\x02\n" + + "\fSignatureDef\x12<\n" + + "\x06inputs\x18\x01 \x03(\v2$.tensorflow.SignatureDef.InputsEntryR\x06inputs\x12?\n" + + "\aoutputs\x18\x02 \x03(\v2%.tensorflow.SignatureDef.OutputsEntryR\aoutputs\x12\x1f\n" + + "\vmethod_name\x18\x03 \x01(\tR\n" + + "methodName\x1aQ\n" + + "\vInputsEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12,\n" + + "\x05value\x18\x02 \x01(\v2\x16.tensorflow.TensorInfoR\x05value:\x028\x01\x1aR\n" + + "\fOutputsEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12,\n" + + "\x05value\x18\x02 \x01(\v2\x16.tensorflow.TensorInfoR\x05value:\x028\x01\"c\n" + + "\fAssetFileDef\x127\n" + + "\vtensor_info\x18\x01 \x01(\v2\x16.tensorflow.TensorInfoR\n" + + "tensorInfo\x12\x1a\n" + + "\bfilename\x18\x02 \x01(\tR\bfilenameB\x87\x01\n" + + "\x18org.tensorflow.frameworkB\x0fMetaGraphProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_meta_graph_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_meta_graph_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_meta_graph_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_meta_graph_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_meta_graph_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_meta_graph_proto_rawDesc), len(file_tensorflow_core_protobuf_meta_graph_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_meta_graph_proto_rawDescData +} + +var file_tensorflow_core_protobuf_meta_graph_proto_msgTypes = make([]protoimpl.MessageInfo, 18) +var file_tensorflow_core_protobuf_meta_graph_proto_goTypes = []any{ + (*MetaGraphDef)(nil), // 0: tensorflow.MetaGraphDef + (*CollectionDef)(nil), // 1: tensorflow.CollectionDef + (*TensorInfo)(nil), // 2: tensorflow.TensorInfo + (*SignatureDef)(nil), // 3: tensorflow.SignatureDef + (*AssetFileDef)(nil), // 4: tensorflow.AssetFileDef + (*MetaGraphDef_MetaInfoDef)(nil), // 5: tensorflow.MetaGraphDef.MetaInfoDef + nil, // 6: tensorflow.MetaGraphDef.CollectionDefEntry + nil, // 7: tensorflow.MetaGraphDef.SignatureDefEntry + nil, // 8: tensorflow.MetaGraphDef.MetaInfoDef.FunctionAliasesEntry + (*CollectionDef_NodeList)(nil), // 9: tensorflow.CollectionDef.NodeList + (*CollectionDef_BytesList)(nil), // 10: tensorflow.CollectionDef.BytesList + (*CollectionDef_Int64List)(nil), // 11: tensorflow.CollectionDef.Int64List + (*CollectionDef_FloatList)(nil), // 12: tensorflow.CollectionDef.FloatList + (*CollectionDef_AnyList)(nil), // 13: tensorflow.CollectionDef.AnyList + (*TensorInfo_CooSparse)(nil), // 14: tensorflow.TensorInfo.CooSparse + (*TensorInfo_CompositeTensor)(nil), // 15: tensorflow.TensorInfo.CompositeTensor + nil, // 16: tensorflow.SignatureDef.InputsEntry + nil, // 17: tensorflow.SignatureDef.OutputsEntry + (*graph_go_proto.GraphDef)(nil), // 18: tensorflow.GraphDef + (*SaverDef)(nil), // 19: tensorflow.SaverDef + (*SavedObjectGraph)(nil), // 20: tensorflow.SavedObjectGraph + (types_go_proto.DataType)(0), // 21: tensorflow.DataType + (*tensor_shape_go_proto.TensorShapeProto)(nil), // 22: tensorflow.TensorShapeProto + (*op_def_go_proto.OpList)(nil), // 23: tensorflow.OpList + (*anypb.Any)(nil), // 24: google.protobuf.Any + (*TypeSpecProto)(nil), // 25: tensorflow.TypeSpecProto +} +var file_tensorflow_core_protobuf_meta_graph_proto_depIdxs = []int32{ + 5, // 0: tensorflow.MetaGraphDef.meta_info_def:type_name -> tensorflow.MetaGraphDef.MetaInfoDef + 18, // 1: tensorflow.MetaGraphDef.graph_def:type_name -> tensorflow.GraphDef + 19, // 2: tensorflow.MetaGraphDef.saver_def:type_name -> tensorflow.SaverDef + 6, // 3: tensorflow.MetaGraphDef.collection_def:type_name -> tensorflow.MetaGraphDef.CollectionDefEntry + 7, // 4: tensorflow.MetaGraphDef.signature_def:type_name -> tensorflow.MetaGraphDef.SignatureDefEntry + 4, // 5: tensorflow.MetaGraphDef.asset_file_def:type_name -> tensorflow.AssetFileDef + 20, // 6: tensorflow.MetaGraphDef.object_graph_def:type_name -> tensorflow.SavedObjectGraph + 9, // 7: tensorflow.CollectionDef.node_list:type_name -> tensorflow.CollectionDef.NodeList + 10, // 8: tensorflow.CollectionDef.bytes_list:type_name -> tensorflow.CollectionDef.BytesList + 11, // 9: tensorflow.CollectionDef.int64_list:type_name -> tensorflow.CollectionDef.Int64List + 12, // 10: tensorflow.CollectionDef.float_list:type_name -> tensorflow.CollectionDef.FloatList + 13, // 11: tensorflow.CollectionDef.any_list:type_name -> tensorflow.CollectionDef.AnyList + 14, // 12: tensorflow.TensorInfo.coo_sparse:type_name -> tensorflow.TensorInfo.CooSparse + 15, // 13: tensorflow.TensorInfo.composite_tensor:type_name -> tensorflow.TensorInfo.CompositeTensor + 21, // 14: tensorflow.TensorInfo.dtype:type_name -> tensorflow.DataType + 22, // 15: tensorflow.TensorInfo.tensor_shape:type_name -> tensorflow.TensorShapeProto + 16, // 16: tensorflow.SignatureDef.inputs:type_name -> tensorflow.SignatureDef.InputsEntry + 17, // 17: tensorflow.SignatureDef.outputs:type_name -> tensorflow.SignatureDef.OutputsEntry + 2, // 18: tensorflow.AssetFileDef.tensor_info:type_name -> tensorflow.TensorInfo + 23, // 19: tensorflow.MetaGraphDef.MetaInfoDef.stripped_op_list:type_name -> tensorflow.OpList + 24, // 20: tensorflow.MetaGraphDef.MetaInfoDef.any_info:type_name -> google.protobuf.Any + 8, // 21: tensorflow.MetaGraphDef.MetaInfoDef.function_aliases:type_name -> tensorflow.MetaGraphDef.MetaInfoDef.FunctionAliasesEntry + 1, // 22: tensorflow.MetaGraphDef.CollectionDefEntry.value:type_name -> tensorflow.CollectionDef + 3, // 23: tensorflow.MetaGraphDef.SignatureDefEntry.value:type_name -> tensorflow.SignatureDef + 24, // 24: tensorflow.CollectionDef.AnyList.value:type_name -> google.protobuf.Any + 25, // 25: tensorflow.TensorInfo.CompositeTensor.type_spec:type_name -> tensorflow.TypeSpecProto + 2, // 26: tensorflow.TensorInfo.CompositeTensor.components:type_name -> tensorflow.TensorInfo + 2, // 27: tensorflow.SignatureDef.InputsEntry.value:type_name -> tensorflow.TensorInfo + 2, // 28: tensorflow.SignatureDef.OutputsEntry.value:type_name -> tensorflow.TensorInfo + 29, // [29:29] is the sub-list for method output_type + 29, // [29:29] is the sub-list for method input_type + 29, // [29:29] is the sub-list for extension type_name + 29, // [29:29] is the sub-list for extension extendee + 0, // [0:29] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_meta_graph_proto_init() } +func file_tensorflow_core_protobuf_meta_graph_proto_init() { + if File_tensorflow_core_protobuf_meta_graph_proto != nil { + return + } + file_tensorflow_core_protobuf_saved_object_graph_proto_init() + file_tensorflow_core_protobuf_saver_proto_init() + file_tensorflow_core_protobuf_struct_proto_init() + file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[1].OneofWrappers = []any{ + (*CollectionDef_NodeList_)(nil), + (*CollectionDef_BytesList_)(nil), + (*CollectionDef_Int64List_)(nil), + (*CollectionDef_FloatList_)(nil), + (*CollectionDef_AnyList_)(nil), + } + file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[2].OneofWrappers = []any{ + (*TensorInfo_Name)(nil), + (*TensorInfo_CooSparse_)(nil), + (*TensorInfo_CompositeTensor_)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_meta_graph_proto_rawDesc), len(file_tensorflow_core_protobuf_meta_graph_proto_rawDesc)), + NumEnums: 0, + NumMessages: 18, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_meta_graph_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_meta_graph_proto_depIdxs, + MessageInfos: file_tensorflow_core_protobuf_meta_graph_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_meta_graph_proto = out.File + file_tensorflow_core_protobuf_meta_graph_proto_goTypes = nil + file_tensorflow_core_protobuf_meta_graph_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/named_tensor.pb.go b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/named_tensor.pb.go new file mode 100644 index 0000000..6a95198 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/named_tensor.pb.go @@ -0,0 +1,144 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/named_tensor.proto + +package for_core_protos_go_proto + +import ( + tensor_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// A pair of tensor name and tensor values. +type NamedTensorProto struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Name of the tensor. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // The client can populate a TensorProto using a tensorflow::Tensor`, or + // directly using the protobuf field accessors. + // + // The client specifies whether the returned tensor values should be + // filled tensor fields (float_val, int_val, etc.) or encoded in a + // compact form in tensor.tensor_content. + Tensor *tensor_go_proto.TensorProto `protobuf:"bytes,2,opt,name=tensor,proto3" json:"tensor,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NamedTensorProto) Reset() { + *x = NamedTensorProto{} + mi := &file_tensorflow_core_protobuf_named_tensor_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NamedTensorProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NamedTensorProto) ProtoMessage() {} + +func (x *NamedTensorProto) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_named_tensor_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NamedTensorProto.ProtoReflect.Descriptor instead. +func (*NamedTensorProto) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_named_tensor_proto_rawDescGZIP(), []int{0} +} + +func (x *NamedTensorProto) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *NamedTensorProto) GetTensor() *tensor_go_proto.TensorProto { + if x != nil { + return x.Tensor + } + return nil +} + +var File_tensorflow_core_protobuf_named_tensor_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_named_tensor_proto_rawDesc = "" + + "\n" + + "+tensorflow/core/protobuf/named_tensor.proto\x12\n" + + "tensorflow\x1a&tensorflow/core/framework/tensor.proto\"W\n" + + "\x10NamedTensorProto\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12/\n" + + "\x06tensor\x18\x02 \x01(\v2\x17.tensorflow.TensorProtoR\x06tensorB\x89\x01\n" + + "\x18org.tensorflow.frameworkB\x11NamedTensorProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_named_tensor_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_named_tensor_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_named_tensor_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_named_tensor_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_named_tensor_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_named_tensor_proto_rawDesc), len(file_tensorflow_core_protobuf_named_tensor_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_named_tensor_proto_rawDescData +} + +var file_tensorflow_core_protobuf_named_tensor_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_tensorflow_core_protobuf_named_tensor_proto_goTypes = []any{ + (*NamedTensorProto)(nil), // 0: tensorflow.NamedTensorProto + (*tensor_go_proto.TensorProto)(nil), // 1: tensorflow.TensorProto +} +var file_tensorflow_core_protobuf_named_tensor_proto_depIdxs = []int32{ + 1, // 0: tensorflow.NamedTensorProto.tensor:type_name -> tensorflow.TensorProto + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_named_tensor_proto_init() } +func file_tensorflow_core_protobuf_named_tensor_proto_init() { + if File_tensorflow_core_protobuf_named_tensor_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_named_tensor_proto_rawDesc), len(file_tensorflow_core_protobuf_named_tensor_proto_rawDesc)), + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_named_tensor_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_named_tensor_proto_depIdxs, + MessageInfos: file_tensorflow_core_protobuf_named_tensor_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_named_tensor_proto = out.File + file_tensorflow_core_protobuf_named_tensor_proto_goTypes = nil + file_tensorflow_core_protobuf_named_tensor_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/queue_runner.pb.go b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/queue_runner.pb.go new file mode 100644 index 0000000..2a0bef4 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/queue_runner.pb.go @@ -0,0 +1,171 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/queue_runner.proto + +package for_core_protos_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Protocol buffer representing a QueueRunner. +type QueueRunnerDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Queue name. + QueueName string `protobuf:"bytes,1,opt,name=queue_name,json=queueName,proto3" json:"queue_name,omitempty"` + // A list of enqueue operations. + EnqueueOpName []string `protobuf:"bytes,2,rep,name=enqueue_op_name,json=enqueueOpName,proto3" json:"enqueue_op_name,omitempty"` + // The operation to run to close the queue. + CloseOpName string `protobuf:"bytes,3,opt,name=close_op_name,json=closeOpName,proto3" json:"close_op_name,omitempty"` + // The operation to run to cancel the queue. + CancelOpName string `protobuf:"bytes,4,opt,name=cancel_op_name,json=cancelOpName,proto3" json:"cancel_op_name,omitempty"` + // A list of exception types considered to signal a safely closed queue + // if raised during enqueue operations. + QueueClosedExceptionTypes []Code `protobuf:"varint,5,rep,packed,name=queue_closed_exception_types,json=queueClosedExceptionTypes,proto3,enum=tensorflow.error.Code" json:"queue_closed_exception_types,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *QueueRunnerDef) Reset() { + *x = QueueRunnerDef{} + mi := &file_tensorflow_core_protobuf_queue_runner_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *QueueRunnerDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueueRunnerDef) ProtoMessage() {} + +func (x *QueueRunnerDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_queue_runner_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use QueueRunnerDef.ProtoReflect.Descriptor instead. +func (*QueueRunnerDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_queue_runner_proto_rawDescGZIP(), []int{0} +} + +func (x *QueueRunnerDef) GetQueueName() string { + if x != nil { + return x.QueueName + } + return "" +} + +func (x *QueueRunnerDef) GetEnqueueOpName() []string { + if x != nil { + return x.EnqueueOpName + } + return nil +} + +func (x *QueueRunnerDef) GetCloseOpName() string { + if x != nil { + return x.CloseOpName + } + return "" +} + +func (x *QueueRunnerDef) GetCancelOpName() string { + if x != nil { + return x.CancelOpName + } + return "" +} + +func (x *QueueRunnerDef) GetQueueClosedExceptionTypes() []Code { + if x != nil { + return x.QueueClosedExceptionTypes + } + return nil +} + +var File_tensorflow_core_protobuf_queue_runner_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_queue_runner_proto_rawDesc = "" + + "\n" + + "+tensorflow/core/protobuf/queue_runner.proto\x12\n" + + "tensorflow\x1a*tensorflow/core/protobuf/error_codes.proto\"\xfa\x01\n" + + "\x0eQueueRunnerDef\x12\x1d\n" + + "\n" + + "queue_name\x18\x01 \x01(\tR\tqueueName\x12&\n" + + "\x0fenqueue_op_name\x18\x02 \x03(\tR\renqueueOpName\x12\"\n" + + "\rclose_op_name\x18\x03 \x01(\tR\vcloseOpName\x12$\n" + + "\x0ecancel_op_name\x18\x04 \x01(\tR\fcancelOpName\x12W\n" + + "\x1cqueue_closed_exception_types\x18\x05 \x03(\x0e2\x16.tensorflow.error.CodeR\x19queueClosedExceptionTypesB\x89\x01\n" + + "\x18org.tensorflow.frameworkB\x11QueueRunnerProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_queue_runner_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_queue_runner_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_queue_runner_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_queue_runner_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_queue_runner_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_queue_runner_proto_rawDesc), len(file_tensorflow_core_protobuf_queue_runner_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_queue_runner_proto_rawDescData +} + +var file_tensorflow_core_protobuf_queue_runner_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_tensorflow_core_protobuf_queue_runner_proto_goTypes = []any{ + (*QueueRunnerDef)(nil), // 0: tensorflow.QueueRunnerDef + (Code)(0), // 1: tensorflow.error.Code +} +var file_tensorflow_core_protobuf_queue_runner_proto_depIdxs = []int32{ + 1, // 0: tensorflow.QueueRunnerDef.queue_closed_exception_types:type_name -> tensorflow.error.Code + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_queue_runner_proto_init() } +func file_tensorflow_core_protobuf_queue_runner_proto_init() { + if File_tensorflow_core_protobuf_queue_runner_proto != nil { + return + } + file_tensorflow_core_protobuf_error_codes_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_queue_runner_proto_rawDesc), len(file_tensorflow_core_protobuf_queue_runner_proto_rawDesc)), + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_queue_runner_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_queue_runner_proto_depIdxs, + MessageInfos: file_tensorflow_core_protobuf_queue_runner_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_queue_runner_proto = out.File + file_tensorflow_core_protobuf_queue_runner_proto_goTypes = nil + file_tensorflow_core_protobuf_queue_runner_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/remote_tensor_handle.pb.go b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/remote_tensor_handle.pb.go new file mode 100644 index 0000000..014eca9 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/remote_tensor_handle.pb.go @@ -0,0 +1,241 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/remote_tensor_handle.proto + +package for_core_protos_go_proto + +import ( + tensor_shape_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_shape_go_proto" + types_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/types_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type ResourceDtypeAndShape struct { + state protoimpl.MessageState `protogen:"open.v1"` + Dtype types_go_proto.DataType `protobuf:"varint,1,opt,name=dtype,proto3,enum=tensorflow.DataType" json:"dtype,omitempty"` + Shape *tensor_shape_go_proto.TensorShapeProto `protobuf:"bytes,2,opt,name=shape,proto3" json:"shape,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ResourceDtypeAndShape) Reset() { + *x = ResourceDtypeAndShape{} + mi := &file_tensorflow_core_protobuf_remote_tensor_handle_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ResourceDtypeAndShape) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResourceDtypeAndShape) ProtoMessage() {} + +func (x *ResourceDtypeAndShape) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_remote_tensor_handle_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ResourceDtypeAndShape.ProtoReflect.Descriptor instead. +func (*ResourceDtypeAndShape) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_remote_tensor_handle_proto_rawDescGZIP(), []int{0} +} + +func (x *ResourceDtypeAndShape) GetDtype() types_go_proto.DataType { + if x != nil { + return x.Dtype + } + return types_go_proto.DataType(0) +} + +func (x *ResourceDtypeAndShape) GetShape() *tensor_shape_go_proto.TensorShapeProto { + if x != nil { + return x.Shape + } + return nil +} + +type RemoteTensorHandle struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The ID of the operation that produced this tensor. + OpId int64 `protobuf:"varint,1,opt,name=op_id,json=opId,proto3" json:"op_id,omitempty"` + // The index into the outputs of the operation that produced this tensor. + OutputNum int32 `protobuf:"varint,2,opt,name=output_num,json=outputNum,proto3" json:"output_num,omitempty"` + // Device where the tensor is located. Cannot be empty. + // For multi-device functions, it's the default device passed to placer. + Device string `protobuf:"bytes,3,opt,name=device,proto3" json:"device,omitempty"` + // Device of the operation producing this tensor. Can be empty if the + // operation producing this tensor is a multi-device function. + OpDevice string `protobuf:"bytes,4,opt,name=op_device,json=opDevice,proto3" json:"op_device,omitempty"` + // Tensor type. + Dtype types_go_proto.DataType `protobuf:"varint,5,opt,name=dtype,proto3,enum=tensorflow.DataType" json:"dtype,omitempty"` + // Optional data types and shapes of a remote resource variable. + ResourceDtypesAndShapes []*ResourceDtypeAndShape `protobuf:"bytes,6,rep,name=resource_dtypes_and_shapes,json=resourceDtypesAndShapes,proto3" json:"resource_dtypes_and_shapes,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RemoteTensorHandle) Reset() { + *x = RemoteTensorHandle{} + mi := &file_tensorflow_core_protobuf_remote_tensor_handle_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RemoteTensorHandle) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoteTensorHandle) ProtoMessage() {} + +func (x *RemoteTensorHandle) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_remote_tensor_handle_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RemoteTensorHandle.ProtoReflect.Descriptor instead. +func (*RemoteTensorHandle) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_remote_tensor_handle_proto_rawDescGZIP(), []int{1} +} + +func (x *RemoteTensorHandle) GetOpId() int64 { + if x != nil { + return x.OpId + } + return 0 +} + +func (x *RemoteTensorHandle) GetOutputNum() int32 { + if x != nil { + return x.OutputNum + } + return 0 +} + +func (x *RemoteTensorHandle) GetDevice() string { + if x != nil { + return x.Device + } + return "" +} + +func (x *RemoteTensorHandle) GetOpDevice() string { + if x != nil { + return x.OpDevice + } + return "" +} + +func (x *RemoteTensorHandle) GetDtype() types_go_proto.DataType { + if x != nil { + return x.Dtype + } + return types_go_proto.DataType(0) +} + +func (x *RemoteTensorHandle) GetResourceDtypesAndShapes() []*ResourceDtypeAndShape { + if x != nil { + return x.ResourceDtypesAndShapes + } + return nil +} + +var File_tensorflow_core_protobuf_remote_tensor_handle_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_remote_tensor_handle_proto_rawDesc = "" + + "\n" + + "3tensorflow/core/protobuf/remote_tensor_handle.proto\x12\x10tensorflow.eager\x1a,tensorflow/core/framework/tensor_shape.proto\x1a%tensorflow/core/framework/types.proto\"w\n" + + "\x15ResourceDtypeAndShape\x12*\n" + + "\x05dtype\x18\x01 \x01(\x0e2\x14.tensorflow.DataTypeR\x05dtype\x122\n" + + "\x05shape\x18\x02 \x01(\v2\x1c.tensorflow.TensorShapeProtoR\x05shape\"\x8f\x02\n" + + "\x12RemoteTensorHandle\x12\x13\n" + + "\x05op_id\x18\x01 \x01(\x03R\x04opId\x12\x1d\n" + + "\n" + + "output_num\x18\x02 \x01(\x05R\toutputNum\x12\x16\n" + + "\x06device\x18\x03 \x01(\tR\x06device\x12\x1b\n" + + "\top_device\x18\x04 \x01(\tR\bopDevice\x12*\n" + + "\x05dtype\x18\x05 \x01(\x0e2\x14.tensorflow.DataTypeR\x05dtype\x12d\n" + + "\x1aresource_dtypes_and_shapes\x18\x06 \x03(\v2'.tensorflow.eager.ResourceDtypeAndShapeR\x17resourceDtypesAndShapesB\x90\x01\n" + + "\x18org.tensorflow.frameworkB\x18RemoteTensorHandleProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_remote_tensor_handle_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_remote_tensor_handle_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_remote_tensor_handle_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_remote_tensor_handle_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_remote_tensor_handle_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_remote_tensor_handle_proto_rawDesc), len(file_tensorflow_core_protobuf_remote_tensor_handle_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_remote_tensor_handle_proto_rawDescData +} + +var file_tensorflow_core_protobuf_remote_tensor_handle_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_tensorflow_core_protobuf_remote_tensor_handle_proto_goTypes = []any{ + (*ResourceDtypeAndShape)(nil), // 0: tensorflow.eager.ResourceDtypeAndShape + (*RemoteTensorHandle)(nil), // 1: tensorflow.eager.RemoteTensorHandle + (types_go_proto.DataType)(0), // 2: tensorflow.DataType + (*tensor_shape_go_proto.TensorShapeProto)(nil), // 3: tensorflow.TensorShapeProto +} +var file_tensorflow_core_protobuf_remote_tensor_handle_proto_depIdxs = []int32{ + 2, // 0: tensorflow.eager.ResourceDtypeAndShape.dtype:type_name -> tensorflow.DataType + 3, // 1: tensorflow.eager.ResourceDtypeAndShape.shape:type_name -> tensorflow.TensorShapeProto + 2, // 2: tensorflow.eager.RemoteTensorHandle.dtype:type_name -> tensorflow.DataType + 0, // 3: tensorflow.eager.RemoteTensorHandle.resource_dtypes_and_shapes:type_name -> tensorflow.eager.ResourceDtypeAndShape + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_remote_tensor_handle_proto_init() } +func file_tensorflow_core_protobuf_remote_tensor_handle_proto_init() { + if File_tensorflow_core_protobuf_remote_tensor_handle_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_remote_tensor_handle_proto_rawDesc), len(file_tensorflow_core_protobuf_remote_tensor_handle_proto_rawDesc)), + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_remote_tensor_handle_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_remote_tensor_handle_proto_depIdxs, + MessageInfos: file_tensorflow_core_protobuf_remote_tensor_handle_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_remote_tensor_handle_proto = out.File + file_tensorflow_core_protobuf_remote_tensor_handle_proto_goTypes = nil + file_tensorflow_core_protobuf_remote_tensor_handle_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/replay_log.pb.go b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/replay_log.pb.go new file mode 100644 index 0000000..cfcb03b --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/replay_log.pb.go @@ -0,0 +1,645 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/replay_log.proto + +package for_core_protos_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Records the creation of a new replay session. We record the device listing +// here to capture the state of the cluster. +type NewReplaySession struct { + state protoimpl.MessageState `protogen:"open.v1"` + Devices *ListDevicesResponse `protobuf:"bytes,1,opt,name=devices,proto3" json:"devices,omitempty"` + SessionHandle string `protobuf:"bytes,2,opt,name=session_handle,json=sessionHandle,proto3" json:"session_handle,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NewReplaySession) Reset() { + *x = NewReplaySession{} + mi := &file_tensorflow_core_protobuf_replay_log_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NewReplaySession) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NewReplaySession) ProtoMessage() {} + +func (x *NewReplaySession) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_replay_log_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NewReplaySession.ProtoReflect.Descriptor instead. +func (*NewReplaySession) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_replay_log_proto_rawDescGZIP(), []int{0} +} + +func (x *NewReplaySession) GetDevices() *ListDevicesResponse { + if x != nil { + return x.Devices + } + return nil +} + +func (x *NewReplaySession) GetSessionHandle() string { + if x != nil { + return x.SessionHandle + } + return "" +} + +type ReplayOp struct { + state protoimpl.MessageState `protogen:"open.v1"` + StartTimeUs float64 `protobuf:"fixed64,31,opt,name=start_time_us,json=startTimeUs,proto3" json:"start_time_us,omitempty"` + EndTimeUs float64 `protobuf:"fixed64,32,opt,name=end_time_us,json=endTimeUs,proto3" json:"end_time_us,omitempty"` + // Types that are valid to be assigned to Op: + // + // *ReplayOp_CreateSession + // *ReplayOp_ExtendSession + // *ReplayOp_PartialRunSetup + // *ReplayOp_RunStep + // *ReplayOp_CloseSession + // *ReplayOp_ListDevices + // *ReplayOp_ResetRequest + // *ReplayOp_MakeCallable + // *ReplayOp_RunCallable + // *ReplayOp_ReleaseCallable + // *ReplayOp_NewReplaySession + Op isReplayOp_Op `protobuf_oneof:"op"` + // Types that are valid to be assigned to Response: + // + // *ReplayOp_CreateSessionResponse + // *ReplayOp_ExtendSessionResponse + // *ReplayOp_PartialRunSetupResponse + // *ReplayOp_RunStepResponse + // *ReplayOp_CloseSessionResponse + // *ReplayOp_ListDevicesResponse + // *ReplayOp_ResetRequestResponse + // *ReplayOp_MakeCallableResponse + // *ReplayOp_RunCallableResponse + // *ReplayOp_ReleaseCallableResponse + Response isReplayOp_Response `protobuf_oneof:"response"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ReplayOp) Reset() { + *x = ReplayOp{} + mi := &file_tensorflow_core_protobuf_replay_log_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ReplayOp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReplayOp) ProtoMessage() {} + +func (x *ReplayOp) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_replay_log_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReplayOp.ProtoReflect.Descriptor instead. +func (*ReplayOp) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_replay_log_proto_rawDescGZIP(), []int{1} +} + +func (x *ReplayOp) GetStartTimeUs() float64 { + if x != nil { + return x.StartTimeUs + } + return 0 +} + +func (x *ReplayOp) GetEndTimeUs() float64 { + if x != nil { + return x.EndTimeUs + } + return 0 +} + +func (x *ReplayOp) GetOp() isReplayOp_Op { + if x != nil { + return x.Op + } + return nil +} + +func (x *ReplayOp) GetCreateSession() *CreateSessionRequest { + if x != nil { + if x, ok := x.Op.(*ReplayOp_CreateSession); ok { + return x.CreateSession + } + } + return nil +} + +func (x *ReplayOp) GetExtendSession() *ExtendSessionRequest { + if x != nil { + if x, ok := x.Op.(*ReplayOp_ExtendSession); ok { + return x.ExtendSession + } + } + return nil +} + +func (x *ReplayOp) GetPartialRunSetup() *PartialRunSetupRequest { + if x != nil { + if x, ok := x.Op.(*ReplayOp_PartialRunSetup); ok { + return x.PartialRunSetup + } + } + return nil +} + +func (x *ReplayOp) GetRunStep() *RunStepRequest { + if x != nil { + if x, ok := x.Op.(*ReplayOp_RunStep); ok { + return x.RunStep + } + } + return nil +} + +func (x *ReplayOp) GetCloseSession() *CloseSessionRequest { + if x != nil { + if x, ok := x.Op.(*ReplayOp_CloseSession); ok { + return x.CloseSession + } + } + return nil +} + +func (x *ReplayOp) GetListDevices() *ListDevicesRequest { + if x != nil { + if x, ok := x.Op.(*ReplayOp_ListDevices); ok { + return x.ListDevices + } + } + return nil +} + +func (x *ReplayOp) GetResetRequest() *ResetRequest { + if x != nil { + if x, ok := x.Op.(*ReplayOp_ResetRequest); ok { + return x.ResetRequest + } + } + return nil +} + +func (x *ReplayOp) GetMakeCallable() *MakeCallableRequest { + if x != nil { + if x, ok := x.Op.(*ReplayOp_MakeCallable); ok { + return x.MakeCallable + } + } + return nil +} + +func (x *ReplayOp) GetRunCallable() *RunCallableRequest { + if x != nil { + if x, ok := x.Op.(*ReplayOp_RunCallable); ok { + return x.RunCallable + } + } + return nil +} + +func (x *ReplayOp) GetReleaseCallable() *ReleaseCallableRequest { + if x != nil { + if x, ok := x.Op.(*ReplayOp_ReleaseCallable); ok { + return x.ReleaseCallable + } + } + return nil +} + +func (x *ReplayOp) GetNewReplaySession() *NewReplaySession { + if x != nil { + if x, ok := x.Op.(*ReplayOp_NewReplaySession); ok { + return x.NewReplaySession + } + } + return nil +} + +func (x *ReplayOp) GetResponse() isReplayOp_Response { + if x != nil { + return x.Response + } + return nil +} + +func (x *ReplayOp) GetCreateSessionResponse() *CreateSessionResponse { + if x != nil { + if x, ok := x.Response.(*ReplayOp_CreateSessionResponse); ok { + return x.CreateSessionResponse + } + } + return nil +} + +func (x *ReplayOp) GetExtendSessionResponse() *ExtendSessionResponse { + if x != nil { + if x, ok := x.Response.(*ReplayOp_ExtendSessionResponse); ok { + return x.ExtendSessionResponse + } + } + return nil +} + +func (x *ReplayOp) GetPartialRunSetupResponse() *PartialRunSetupResponse { + if x != nil { + if x, ok := x.Response.(*ReplayOp_PartialRunSetupResponse); ok { + return x.PartialRunSetupResponse + } + } + return nil +} + +func (x *ReplayOp) GetRunStepResponse() *RunStepResponse { + if x != nil { + if x, ok := x.Response.(*ReplayOp_RunStepResponse); ok { + return x.RunStepResponse + } + } + return nil +} + +func (x *ReplayOp) GetCloseSessionResponse() *CloseSessionResponse { + if x != nil { + if x, ok := x.Response.(*ReplayOp_CloseSessionResponse); ok { + return x.CloseSessionResponse + } + } + return nil +} + +func (x *ReplayOp) GetListDevicesResponse() *ListDevicesResponse { + if x != nil { + if x, ok := x.Response.(*ReplayOp_ListDevicesResponse); ok { + return x.ListDevicesResponse + } + } + return nil +} + +func (x *ReplayOp) GetResetRequestResponse() *ResetResponse { + if x != nil { + if x, ok := x.Response.(*ReplayOp_ResetRequestResponse); ok { + return x.ResetRequestResponse + } + } + return nil +} + +func (x *ReplayOp) GetMakeCallableResponse() *MakeCallableResponse { + if x != nil { + if x, ok := x.Response.(*ReplayOp_MakeCallableResponse); ok { + return x.MakeCallableResponse + } + } + return nil +} + +func (x *ReplayOp) GetRunCallableResponse() *RunCallableResponse { + if x != nil { + if x, ok := x.Response.(*ReplayOp_RunCallableResponse); ok { + return x.RunCallableResponse + } + } + return nil +} + +func (x *ReplayOp) GetReleaseCallableResponse() *ReleaseCallableResponse { + if x != nil { + if x, ok := x.Response.(*ReplayOp_ReleaseCallableResponse); ok { + return x.ReleaseCallableResponse + } + } + return nil +} + +type isReplayOp_Op interface { + isReplayOp_Op() +} + +type ReplayOp_CreateSession struct { + CreateSession *CreateSessionRequest `protobuf:"bytes,1,opt,name=create_session,json=createSession,proto3,oneof"` +} + +type ReplayOp_ExtendSession struct { + ExtendSession *ExtendSessionRequest `protobuf:"bytes,2,opt,name=extend_session,json=extendSession,proto3,oneof"` +} + +type ReplayOp_PartialRunSetup struct { + PartialRunSetup *PartialRunSetupRequest `protobuf:"bytes,3,opt,name=partial_run_setup,json=partialRunSetup,proto3,oneof"` +} + +type ReplayOp_RunStep struct { + RunStep *RunStepRequest `protobuf:"bytes,4,opt,name=run_step,json=runStep,proto3,oneof"` +} + +type ReplayOp_CloseSession struct { + CloseSession *CloseSessionRequest `protobuf:"bytes,5,opt,name=close_session,json=closeSession,proto3,oneof"` +} + +type ReplayOp_ListDevices struct { + ListDevices *ListDevicesRequest `protobuf:"bytes,6,opt,name=list_devices,json=listDevices,proto3,oneof"` +} + +type ReplayOp_ResetRequest struct { + ResetRequest *ResetRequest `protobuf:"bytes,7,opt,name=reset_request,json=resetRequest,proto3,oneof"` +} + +type ReplayOp_MakeCallable struct { + MakeCallable *MakeCallableRequest `protobuf:"bytes,8,opt,name=make_callable,json=makeCallable,proto3,oneof"` +} + +type ReplayOp_RunCallable struct { + RunCallable *RunCallableRequest `protobuf:"bytes,9,opt,name=run_callable,json=runCallable,proto3,oneof"` +} + +type ReplayOp_ReleaseCallable struct { + ReleaseCallable *ReleaseCallableRequest `protobuf:"bytes,10,opt,name=release_callable,json=releaseCallable,proto3,oneof"` +} + +type ReplayOp_NewReplaySession struct { + NewReplaySession *NewReplaySession `protobuf:"bytes,11,opt,name=new_replay_session,json=newReplaySession,proto3,oneof"` +} + +func (*ReplayOp_CreateSession) isReplayOp_Op() {} + +func (*ReplayOp_ExtendSession) isReplayOp_Op() {} + +func (*ReplayOp_PartialRunSetup) isReplayOp_Op() {} + +func (*ReplayOp_RunStep) isReplayOp_Op() {} + +func (*ReplayOp_CloseSession) isReplayOp_Op() {} + +func (*ReplayOp_ListDevices) isReplayOp_Op() {} + +func (*ReplayOp_ResetRequest) isReplayOp_Op() {} + +func (*ReplayOp_MakeCallable) isReplayOp_Op() {} + +func (*ReplayOp_RunCallable) isReplayOp_Op() {} + +func (*ReplayOp_ReleaseCallable) isReplayOp_Op() {} + +func (*ReplayOp_NewReplaySession) isReplayOp_Op() {} + +type isReplayOp_Response interface { + isReplayOp_Response() +} + +type ReplayOp_CreateSessionResponse struct { + CreateSessionResponse *CreateSessionResponse `protobuf:"bytes,21,opt,name=create_session_response,json=createSessionResponse,proto3,oneof"` +} + +type ReplayOp_ExtendSessionResponse struct { + ExtendSessionResponse *ExtendSessionResponse `protobuf:"bytes,22,opt,name=extend_session_response,json=extendSessionResponse,proto3,oneof"` +} + +type ReplayOp_PartialRunSetupResponse struct { + PartialRunSetupResponse *PartialRunSetupResponse `protobuf:"bytes,23,opt,name=partial_run_setup_response,json=partialRunSetupResponse,proto3,oneof"` +} + +type ReplayOp_RunStepResponse struct { + RunStepResponse *RunStepResponse `protobuf:"bytes,24,opt,name=run_step_response,json=runStepResponse,proto3,oneof"` +} + +type ReplayOp_CloseSessionResponse struct { + CloseSessionResponse *CloseSessionResponse `protobuf:"bytes,25,opt,name=close_session_response,json=closeSessionResponse,proto3,oneof"` +} + +type ReplayOp_ListDevicesResponse struct { + ListDevicesResponse *ListDevicesResponse `protobuf:"bytes,26,opt,name=list_devices_response,json=listDevicesResponse,proto3,oneof"` +} + +type ReplayOp_ResetRequestResponse struct { + ResetRequestResponse *ResetResponse `protobuf:"bytes,27,opt,name=reset_request_response,json=resetRequestResponse,proto3,oneof"` +} + +type ReplayOp_MakeCallableResponse struct { + MakeCallableResponse *MakeCallableResponse `protobuf:"bytes,28,opt,name=make_callable_response,json=makeCallableResponse,proto3,oneof"` +} + +type ReplayOp_RunCallableResponse struct { + RunCallableResponse *RunCallableResponse `protobuf:"bytes,29,opt,name=run_callable_response,json=runCallableResponse,proto3,oneof"` +} + +type ReplayOp_ReleaseCallableResponse struct { + ReleaseCallableResponse *ReleaseCallableResponse `protobuf:"bytes,30,opt,name=release_callable_response,json=releaseCallableResponse,proto3,oneof"` +} + +func (*ReplayOp_CreateSessionResponse) isReplayOp_Response() {} + +func (*ReplayOp_ExtendSessionResponse) isReplayOp_Response() {} + +func (*ReplayOp_PartialRunSetupResponse) isReplayOp_Response() {} + +func (*ReplayOp_RunStepResponse) isReplayOp_Response() {} + +func (*ReplayOp_CloseSessionResponse) isReplayOp_Response() {} + +func (*ReplayOp_ListDevicesResponse) isReplayOp_Response() {} + +func (*ReplayOp_ResetRequestResponse) isReplayOp_Response() {} + +func (*ReplayOp_MakeCallableResponse) isReplayOp_Response() {} + +func (*ReplayOp_RunCallableResponse) isReplayOp_Response() {} + +func (*ReplayOp_ReleaseCallableResponse) isReplayOp_Response() {} + +var File_tensorflow_core_protobuf_replay_log_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_replay_log_proto_rawDesc = "" + + "\n" + + ")tensorflow/core/protobuf/replay_log.proto\x12\n" + + "tensorflow\x1a%tensorflow/core/protobuf/master.proto\"t\n" + + "\x10NewReplaySession\x129\n" + + "\adevices\x18\x01 \x01(\v2\x1f.tensorflow.ListDevicesResponseR\adevices\x12%\n" + + "\x0esession_handle\x18\x02 \x01(\tR\rsessionHandle\"\xfc\r\n" + + "\bReplayOp\x12\"\n" + + "\rstart_time_us\x18\x1f \x01(\x01R\vstartTimeUs\x12\x1e\n" + + "\vend_time_us\x18 \x01(\x01R\tendTimeUs\x12I\n" + + "\x0ecreate_session\x18\x01 \x01(\v2 .tensorflow.CreateSessionRequestH\x00R\rcreateSession\x12I\n" + + "\x0eextend_session\x18\x02 \x01(\v2 .tensorflow.ExtendSessionRequestH\x00R\rextendSession\x12P\n" + + "\x11partial_run_setup\x18\x03 \x01(\v2\".tensorflow.PartialRunSetupRequestH\x00R\x0fpartialRunSetup\x127\n" + + "\brun_step\x18\x04 \x01(\v2\x1a.tensorflow.RunStepRequestH\x00R\arunStep\x12F\n" + + "\rclose_session\x18\x05 \x01(\v2\x1f.tensorflow.CloseSessionRequestH\x00R\fcloseSession\x12C\n" + + "\flist_devices\x18\x06 \x01(\v2\x1e.tensorflow.ListDevicesRequestH\x00R\vlistDevices\x12?\n" + + "\rreset_request\x18\a \x01(\v2\x18.tensorflow.ResetRequestH\x00R\fresetRequest\x12F\n" + + "\rmake_callable\x18\b \x01(\v2\x1f.tensorflow.MakeCallableRequestH\x00R\fmakeCallable\x12C\n" + + "\frun_callable\x18\t \x01(\v2\x1e.tensorflow.RunCallableRequestH\x00R\vrunCallable\x12O\n" + + "\x10release_callable\x18\n" + + " \x01(\v2\".tensorflow.ReleaseCallableRequestH\x00R\x0freleaseCallable\x12L\n" + + "\x12new_replay_session\x18\v \x01(\v2\x1c.tensorflow.NewReplaySessionH\x00R\x10newReplaySession\x12[\n" + + "\x17create_session_response\x18\x15 \x01(\v2!.tensorflow.CreateSessionResponseH\x01R\x15createSessionResponse\x12[\n" + + "\x17extend_session_response\x18\x16 \x01(\v2!.tensorflow.ExtendSessionResponseH\x01R\x15extendSessionResponse\x12b\n" + + "\x1apartial_run_setup_response\x18\x17 \x01(\v2#.tensorflow.PartialRunSetupResponseH\x01R\x17partialRunSetupResponse\x12I\n" + + "\x11run_step_response\x18\x18 \x01(\v2\x1b.tensorflow.RunStepResponseH\x01R\x0frunStepResponse\x12X\n" + + "\x16close_session_response\x18\x19 \x01(\v2 .tensorflow.CloseSessionResponseH\x01R\x14closeSessionResponse\x12U\n" + + "\x15list_devices_response\x18\x1a \x01(\v2\x1f.tensorflow.ListDevicesResponseH\x01R\x13listDevicesResponse\x12Q\n" + + "\x16reset_request_response\x18\x1b \x01(\v2\x19.tensorflow.ResetResponseH\x01R\x14resetRequestResponse\x12X\n" + + "\x16make_callable_response\x18\x1c \x01(\v2 .tensorflow.MakeCallableResponseH\x01R\x14makeCallableResponse\x12U\n" + + "\x15run_callable_response\x18\x1d \x01(\v2\x1f.tensorflow.RunCallableResponseH\x01R\x13runCallableResponse\x12a\n" + + "\x19release_callable_response\x18\x1e \x01(\v2#.tensorflow.ReleaseCallableResponseH\x01R\x17releaseCallableResponseB\x04\n" + + "\x02opB\n" + + "\n" + + "\bresponseBZZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_replay_log_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_replay_log_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_replay_log_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_replay_log_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_replay_log_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_replay_log_proto_rawDesc), len(file_tensorflow_core_protobuf_replay_log_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_replay_log_proto_rawDescData +} + +var file_tensorflow_core_protobuf_replay_log_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_tensorflow_core_protobuf_replay_log_proto_goTypes = []any{ + (*NewReplaySession)(nil), // 0: tensorflow.NewReplaySession + (*ReplayOp)(nil), // 1: tensorflow.ReplayOp + (*ListDevicesResponse)(nil), // 2: tensorflow.ListDevicesResponse + (*CreateSessionRequest)(nil), // 3: tensorflow.CreateSessionRequest + (*ExtendSessionRequest)(nil), // 4: tensorflow.ExtendSessionRequest + (*PartialRunSetupRequest)(nil), // 5: tensorflow.PartialRunSetupRequest + (*RunStepRequest)(nil), // 6: tensorflow.RunStepRequest + (*CloseSessionRequest)(nil), // 7: tensorflow.CloseSessionRequest + (*ListDevicesRequest)(nil), // 8: tensorflow.ListDevicesRequest + (*ResetRequest)(nil), // 9: tensorflow.ResetRequest + (*MakeCallableRequest)(nil), // 10: tensorflow.MakeCallableRequest + (*RunCallableRequest)(nil), // 11: tensorflow.RunCallableRequest + (*ReleaseCallableRequest)(nil), // 12: tensorflow.ReleaseCallableRequest + (*CreateSessionResponse)(nil), // 13: tensorflow.CreateSessionResponse + (*ExtendSessionResponse)(nil), // 14: tensorflow.ExtendSessionResponse + (*PartialRunSetupResponse)(nil), // 15: tensorflow.PartialRunSetupResponse + (*RunStepResponse)(nil), // 16: tensorflow.RunStepResponse + (*CloseSessionResponse)(nil), // 17: tensorflow.CloseSessionResponse + (*ResetResponse)(nil), // 18: tensorflow.ResetResponse + (*MakeCallableResponse)(nil), // 19: tensorflow.MakeCallableResponse + (*RunCallableResponse)(nil), // 20: tensorflow.RunCallableResponse + (*ReleaseCallableResponse)(nil), // 21: tensorflow.ReleaseCallableResponse +} +var file_tensorflow_core_protobuf_replay_log_proto_depIdxs = []int32{ + 2, // 0: tensorflow.NewReplaySession.devices:type_name -> tensorflow.ListDevicesResponse + 3, // 1: tensorflow.ReplayOp.create_session:type_name -> tensorflow.CreateSessionRequest + 4, // 2: tensorflow.ReplayOp.extend_session:type_name -> tensorflow.ExtendSessionRequest + 5, // 3: tensorflow.ReplayOp.partial_run_setup:type_name -> tensorflow.PartialRunSetupRequest + 6, // 4: tensorflow.ReplayOp.run_step:type_name -> tensorflow.RunStepRequest + 7, // 5: tensorflow.ReplayOp.close_session:type_name -> tensorflow.CloseSessionRequest + 8, // 6: tensorflow.ReplayOp.list_devices:type_name -> tensorflow.ListDevicesRequest + 9, // 7: tensorflow.ReplayOp.reset_request:type_name -> tensorflow.ResetRequest + 10, // 8: tensorflow.ReplayOp.make_callable:type_name -> tensorflow.MakeCallableRequest + 11, // 9: tensorflow.ReplayOp.run_callable:type_name -> tensorflow.RunCallableRequest + 12, // 10: tensorflow.ReplayOp.release_callable:type_name -> tensorflow.ReleaseCallableRequest + 0, // 11: tensorflow.ReplayOp.new_replay_session:type_name -> tensorflow.NewReplaySession + 13, // 12: tensorflow.ReplayOp.create_session_response:type_name -> tensorflow.CreateSessionResponse + 14, // 13: tensorflow.ReplayOp.extend_session_response:type_name -> tensorflow.ExtendSessionResponse + 15, // 14: tensorflow.ReplayOp.partial_run_setup_response:type_name -> tensorflow.PartialRunSetupResponse + 16, // 15: tensorflow.ReplayOp.run_step_response:type_name -> tensorflow.RunStepResponse + 17, // 16: tensorflow.ReplayOp.close_session_response:type_name -> tensorflow.CloseSessionResponse + 2, // 17: tensorflow.ReplayOp.list_devices_response:type_name -> tensorflow.ListDevicesResponse + 18, // 18: tensorflow.ReplayOp.reset_request_response:type_name -> tensorflow.ResetResponse + 19, // 19: tensorflow.ReplayOp.make_callable_response:type_name -> tensorflow.MakeCallableResponse + 20, // 20: tensorflow.ReplayOp.run_callable_response:type_name -> tensorflow.RunCallableResponse + 21, // 21: tensorflow.ReplayOp.release_callable_response:type_name -> tensorflow.ReleaseCallableResponse + 22, // [22:22] is the sub-list for method output_type + 22, // [22:22] is the sub-list for method input_type + 22, // [22:22] is the sub-list for extension type_name + 22, // [22:22] is the sub-list for extension extendee + 0, // [0:22] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_replay_log_proto_init() } +func file_tensorflow_core_protobuf_replay_log_proto_init() { + if File_tensorflow_core_protobuf_replay_log_proto != nil { + return + } + file_tensorflow_core_protobuf_master_proto_init() + file_tensorflow_core_protobuf_replay_log_proto_msgTypes[1].OneofWrappers = []any{ + (*ReplayOp_CreateSession)(nil), + (*ReplayOp_ExtendSession)(nil), + (*ReplayOp_PartialRunSetup)(nil), + (*ReplayOp_RunStep)(nil), + (*ReplayOp_CloseSession)(nil), + (*ReplayOp_ListDevices)(nil), + (*ReplayOp_ResetRequest)(nil), + (*ReplayOp_MakeCallable)(nil), + (*ReplayOp_RunCallable)(nil), + (*ReplayOp_ReleaseCallable)(nil), + (*ReplayOp_NewReplaySession)(nil), + (*ReplayOp_CreateSessionResponse)(nil), + (*ReplayOp_ExtendSessionResponse)(nil), + (*ReplayOp_PartialRunSetupResponse)(nil), + (*ReplayOp_RunStepResponse)(nil), + (*ReplayOp_CloseSessionResponse)(nil), + (*ReplayOp_ListDevicesResponse)(nil), + (*ReplayOp_ResetRequestResponse)(nil), + (*ReplayOp_MakeCallableResponse)(nil), + (*ReplayOp_RunCallableResponse)(nil), + (*ReplayOp_ReleaseCallableResponse)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_replay_log_proto_rawDesc), len(file_tensorflow_core_protobuf_replay_log_proto_rawDesc)), + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_replay_log_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_replay_log_proto_depIdxs, + MessageInfos: file_tensorflow_core_protobuf_replay_log_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_replay_log_proto = out.File + file_tensorflow_core_protobuf_replay_log_proto_goTypes = nil + file_tensorflow_core_protobuf_replay_log_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/rewriter_config.pb.go b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/rewriter_config.pb.go new file mode 100644 index 0000000..e2a4f14 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/rewriter_config.pb.go @@ -0,0 +1,926 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/rewriter_config.proto + +package for_core_protos_go_proto + +import ( + attr_value_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/attr_value_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type RewriterConfig_Toggle int32 + +const ( + RewriterConfig_DEFAULT RewriterConfig_Toggle = 0 + RewriterConfig_ON RewriterConfig_Toggle = 1 + RewriterConfig_OFF RewriterConfig_Toggle = 2 + // Enable some aggressive optimizations that use assumptions that TF graphs + // may break. For example, assume the shape of a placeholder matches its + // actual feed. + RewriterConfig_AGGRESSIVE RewriterConfig_Toggle = 3 +) + +// Enum value maps for RewriterConfig_Toggle. +var ( + RewriterConfig_Toggle_name = map[int32]string{ + 0: "DEFAULT", + 1: "ON", + 2: "OFF", + 3: "AGGRESSIVE", + } + RewriterConfig_Toggle_value = map[string]int32{ + "DEFAULT": 0, + "ON": 1, + "OFF": 2, + "AGGRESSIVE": 3, + } +) + +func (x RewriterConfig_Toggle) Enum() *RewriterConfig_Toggle { + p := new(RewriterConfig_Toggle) + *p = x + return p +} + +func (x RewriterConfig_Toggle) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (RewriterConfig_Toggle) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_protobuf_rewriter_config_proto_enumTypes[0].Descriptor() +} + +func (RewriterConfig_Toggle) Type() protoreflect.EnumType { + return &file_tensorflow_core_protobuf_rewriter_config_proto_enumTypes[0] +} + +func (x RewriterConfig_Toggle) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use RewriterConfig_Toggle.Descriptor instead. +func (RewriterConfig_Toggle) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_rewriter_config_proto_rawDescGZIP(), []int{2, 0} +} + +// Enum for layout conversion between NCHW and NHWC on CPU. Default is OFF. +type RewriterConfig_CpuLayout int32 + +const ( + RewriterConfig_NO_CONVERSION_ON_CPU RewriterConfig_CpuLayout = 0 + RewriterConfig_NCHW_TO_NHWC RewriterConfig_CpuLayout = 1 + RewriterConfig_NHWC_TO_NCHW RewriterConfig_CpuLayout = 2 +) + +// Enum value maps for RewriterConfig_CpuLayout. +var ( + RewriterConfig_CpuLayout_name = map[int32]string{ + 0: "NO_CONVERSION_ON_CPU", + 1: "NCHW_TO_NHWC", + 2: "NHWC_TO_NCHW", + } + RewriterConfig_CpuLayout_value = map[string]int32{ + "NO_CONVERSION_ON_CPU": 0, + "NCHW_TO_NHWC": 1, + "NHWC_TO_NCHW": 2, + } +) + +func (x RewriterConfig_CpuLayout) Enum() *RewriterConfig_CpuLayout { + p := new(RewriterConfig_CpuLayout) + *p = x + return p +} + +func (x RewriterConfig_CpuLayout) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (RewriterConfig_CpuLayout) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_protobuf_rewriter_config_proto_enumTypes[1].Descriptor() +} + +func (RewriterConfig_CpuLayout) Type() protoreflect.EnumType { + return &file_tensorflow_core_protobuf_rewriter_config_proto_enumTypes[1] +} + +func (x RewriterConfig_CpuLayout) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use RewriterConfig_CpuLayout.Descriptor instead. +func (RewriterConfig_CpuLayout) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_rewriter_config_proto_rawDescGZIP(), []int{2, 1} +} + +// Enum controlling the number of times to run optimizers. The default is to +// run them twice. +type RewriterConfig_NumIterationsType int32 + +const ( + RewriterConfig_DEFAULT_NUM_ITERS RewriterConfig_NumIterationsType = 0 + RewriterConfig_ONE RewriterConfig_NumIterationsType = 1 + RewriterConfig_TWO RewriterConfig_NumIterationsType = 2 +) + +// Enum value maps for RewriterConfig_NumIterationsType. +var ( + RewriterConfig_NumIterationsType_name = map[int32]string{ + 0: "DEFAULT_NUM_ITERS", + 1: "ONE", + 2: "TWO", + } + RewriterConfig_NumIterationsType_value = map[string]int32{ + "DEFAULT_NUM_ITERS": 0, + "ONE": 1, + "TWO": 2, + } +) + +func (x RewriterConfig_NumIterationsType) Enum() *RewriterConfig_NumIterationsType { + p := new(RewriterConfig_NumIterationsType) + *p = x + return p +} + +func (x RewriterConfig_NumIterationsType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (RewriterConfig_NumIterationsType) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_protobuf_rewriter_config_proto_enumTypes[2].Descriptor() +} + +func (RewriterConfig_NumIterationsType) Type() protoreflect.EnumType { + return &file_tensorflow_core_protobuf_rewriter_config_proto_enumTypes[2] +} + +func (x RewriterConfig_NumIterationsType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use RewriterConfig_NumIterationsType.Descriptor instead. +func (RewriterConfig_NumIterationsType) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_rewriter_config_proto_rawDescGZIP(), []int{2, 2} +} + +type RewriterConfig_MemOptType int32 + +const ( + // The default setting (SCHEDULING and SWAPPING HEURISTICS only) + RewriterConfig_DEFAULT_MEM_OPT RewriterConfig_MemOptType = 0 + // Disabled in the meta-optimizer. + RewriterConfig_NO_MEM_OPT RewriterConfig_MemOptType = 1 + // Driven by manual op-level annotations. + RewriterConfig_MANUAL RewriterConfig_MemOptType = 2 + // Swapping heuristic will move a tensor from the GPU to the CPU and move + // it back when needed to reduce peak memory usage. + RewriterConfig_SWAPPING_HEURISTICS RewriterConfig_MemOptType = 4 + // Recomputation heuristics will recompute ops (such as Relu activation) + // during backprop instead of storing them, reducing peak memory usage. + RewriterConfig_RECOMPUTATION_HEURISTICS RewriterConfig_MemOptType = 5 + // Scheduling will split big ops such as AddN and try to enforce a schedule + // of the new computations that decreases peak memory usage. + RewriterConfig_SCHEDULING_HEURISTICS RewriterConfig_MemOptType = 6 + // Use any combination of swapping and recomputation heuristics. + RewriterConfig_HEURISTICS RewriterConfig_MemOptType = 3 +) + +// Enum value maps for RewriterConfig_MemOptType. +var ( + RewriterConfig_MemOptType_name = map[int32]string{ + 0: "DEFAULT_MEM_OPT", + 1: "NO_MEM_OPT", + 2: "MANUAL", + 4: "SWAPPING_HEURISTICS", + 5: "RECOMPUTATION_HEURISTICS", + 6: "SCHEDULING_HEURISTICS", + 3: "HEURISTICS", + } + RewriterConfig_MemOptType_value = map[string]int32{ + "DEFAULT_MEM_OPT": 0, + "NO_MEM_OPT": 1, + "MANUAL": 2, + "SWAPPING_HEURISTICS": 4, + "RECOMPUTATION_HEURISTICS": 5, + "SCHEDULING_HEURISTICS": 6, + "HEURISTICS": 3, + } +) + +func (x RewriterConfig_MemOptType) Enum() *RewriterConfig_MemOptType { + p := new(RewriterConfig_MemOptType) + *p = x + return p +} + +func (x RewriterConfig_MemOptType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (RewriterConfig_MemOptType) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_protobuf_rewriter_config_proto_enumTypes[3].Descriptor() +} + +func (RewriterConfig_MemOptType) Type() protoreflect.EnumType { + return &file_tensorflow_core_protobuf_rewriter_config_proto_enumTypes[3] +} + +func (x RewriterConfig_MemOptType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use RewriterConfig_MemOptType.Descriptor instead. +func (RewriterConfig_MemOptType) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_rewriter_config_proto_rawDescGZIP(), []int{2, 3} +} + +type AutoParallelOptions struct { + state protoimpl.MessageState `protogen:"open.v1"` + Enable bool `protobuf:"varint,1,opt,name=enable,proto3" json:"enable,omitempty"` + NumReplicas int32 `protobuf:"varint,2,opt,name=num_replicas,json=numReplicas,proto3" json:"num_replicas,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AutoParallelOptions) Reset() { + *x = AutoParallelOptions{} + mi := &file_tensorflow_core_protobuf_rewriter_config_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AutoParallelOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AutoParallelOptions) ProtoMessage() {} + +func (x *AutoParallelOptions) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_rewriter_config_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AutoParallelOptions.ProtoReflect.Descriptor instead. +func (*AutoParallelOptions) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_rewriter_config_proto_rawDescGZIP(), []int{0} +} + +func (x *AutoParallelOptions) GetEnable() bool { + if x != nil { + return x.Enable + } + return false +} + +func (x *AutoParallelOptions) GetNumReplicas() int32 { + if x != nil { + return x.NumReplicas + } + return 0 +} + +type ScopedAllocatorOptions struct { + state protoimpl.MessageState `protogen:"open.v1"` + // If present, only perform optimization for these ops. + EnableOp []string `protobuf:"bytes,1,rep,name=enable_op,json=enableOp,proto3" json:"enable_op,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ScopedAllocatorOptions) Reset() { + *x = ScopedAllocatorOptions{} + mi := &file_tensorflow_core_protobuf_rewriter_config_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ScopedAllocatorOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ScopedAllocatorOptions) ProtoMessage() {} + +func (x *ScopedAllocatorOptions) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_rewriter_config_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ScopedAllocatorOptions.ProtoReflect.Descriptor instead. +func (*ScopedAllocatorOptions) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_rewriter_config_proto_rawDescGZIP(), []int{1} +} + +func (x *ScopedAllocatorOptions) GetEnableOp() []string { + if x != nil { + return x.EnableOp + } + return nil +} + +type RewriterConfig struct { + state protoimpl.MessageState `protogen:"open.v1"` + // CPU Conversion settings between NHCW and NCHW. + CpuLayoutConversion RewriterConfig_CpuLayout `protobuf:"varint,50,opt,name=cpu_layout_conversion,json=cpuLayoutConversion,proto3,enum=tensorflow.RewriterConfig_CpuLayout" json:"cpu_layout_conversion,omitempty"` + // Optimize tensor layouts (default is ON) + // e.g. This will try to use NCHW layout on GPU which is faster. + LayoutOptimizer RewriterConfig_Toggle `protobuf:"varint,1,opt,name=layout_optimizer,json=layoutOptimizer,proto3,enum=tensorflow.RewriterConfig_Toggle" json:"layout_optimizer,omitempty"` + // Fold constants (default is ON) + // Statically infer the value of tensors when possible, and materialize the + // result using constants. + ConstantFolding RewriterConfig_Toggle `protobuf:"varint,3,opt,name=constant_folding,json=constantFolding,proto3,enum=tensorflow.RewriterConfig_Toggle" json:"constant_folding,omitempty"` + // Shape optimizations (default is ON) + // Simplify computations made on shapes. + ShapeOptimization RewriterConfig_Toggle `protobuf:"varint,13,opt,name=shape_optimization,json=shapeOptimization,proto3,enum=tensorflow.RewriterConfig_Toggle" json:"shape_optimization,omitempty"` + // Remapping (default is ON) + // Remap subgraphs onto more efficient implementations. + Remapping RewriterConfig_Toggle `protobuf:"varint,14,opt,name=remapping,proto3,enum=tensorflow.RewriterConfig_Toggle" json:"remapping,omitempty"` + // Common subgraph elimination (default is ON) + // e.g. Simplify arithmetic ops; merge ops with same value (like constants). + CommonSubgraphElimination RewriterConfig_Toggle `protobuf:"varint,24,opt,name=common_subgraph_elimination,json=commonSubgraphElimination,proto3,enum=tensorflow.RewriterConfig_Toggle" json:"common_subgraph_elimination,omitempty"` + // Arithmetic optimizations (default is ON) + // e.g. Simplify arithmetic ops; merge ops with same value (like constants). + ArithmeticOptimization RewriterConfig_Toggle `protobuf:"varint,7,opt,name=arithmetic_optimization,json=arithmeticOptimization,proto3,enum=tensorflow.RewriterConfig_Toggle" json:"arithmetic_optimization,omitempty"` + // Control dependency optimizations (default is ON). + // Remove redundant control dependencies, which may enable other optimization. + DependencyOptimization RewriterConfig_Toggle `protobuf:"varint,8,opt,name=dependency_optimization,json=dependencyOptimization,proto3,enum=tensorflow.RewriterConfig_Toggle" json:"dependency_optimization,omitempty"` + // Loop optimizations (default is ON). + LoopOptimization RewriterConfig_Toggle `protobuf:"varint,9,opt,name=loop_optimization,json=loopOptimization,proto3,enum=tensorflow.RewriterConfig_Toggle" json:"loop_optimization,omitempty"` + // Function optimizations (default is ON). + FunctionOptimization RewriterConfig_Toggle `protobuf:"varint,10,opt,name=function_optimization,json=functionOptimization,proto3,enum=tensorflow.RewriterConfig_Toggle" json:"function_optimization,omitempty"` + // Strips debug-related nodes from the graph (off by default). + DebugStripper RewriterConfig_Toggle `protobuf:"varint,11,opt,name=debug_stripper,json=debugStripper,proto3,enum=tensorflow.RewriterConfig_Toggle" json:"debug_stripper,omitempty"` + // If true, don't remove unnecessary ops from the graph + DisableModelPruning bool `protobuf:"varint,2,opt,name=disable_model_pruning,json=disableModelPruning,proto3" json:"disable_model_pruning,omitempty"` + // Try to allocate some independent Op outputs contiguously in order to + // merge or eliminate downstream Ops (off by default). + ScopedAllocatorOptimization RewriterConfig_Toggle `protobuf:"varint,15,opt,name=scoped_allocator_optimization,json=scopedAllocatorOptimization,proto3,enum=tensorflow.RewriterConfig_Toggle" json:"scoped_allocator_optimization,omitempty"` + // Force small ops onto the CPU (default is OFF). + PinToHostOptimization RewriterConfig_Toggle `protobuf:"varint,18,opt,name=pin_to_host_optimization,json=pinToHostOptimization,proto3,enum=tensorflow.RewriterConfig_Toggle" json:"pin_to_host_optimization,omitempty"` + // Enable the swap of kernel implementations based on the device placement + // (default is ON). + ImplementationSelector RewriterConfig_Toggle `protobuf:"varint,22,opt,name=implementation_selector,json=implementationSelector,proto3,enum=tensorflow.RewriterConfig_Toggle" json:"implementation_selector,omitempty"` + // Optimize data types for CUDA (default is OFF). + // This will try to use float16 on GPU which is faster. + // Note that this can change the numerical stability of the graph and may + // require the use of loss scaling to maintain model convergence. + AutoMixedPrecision RewriterConfig_Toggle `protobuf:"varint,23,opt,name=auto_mixed_precision,json=autoMixedPrecision,proto3,enum=tensorflow.RewriterConfig_Toggle" json:"auto_mixed_precision,omitempty"` + // Optimize data types for MKL (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. + AutoMixedPrecisionMkl RewriterConfig_Toggle `protobuf:"varint,25,opt,name=auto_mixed_precision_mkl,json=autoMixedPrecisionMkl,proto3,enum=tensorflow.RewriterConfig_Toggle" json:"auto_mixed_precision_mkl,omitempty"` + // Disable the entire meta optimizer (off by default). + DisableMetaOptimizer bool `protobuf:"varint,19,opt,name=disable_meta_optimizer,json=disableMetaOptimizer,proto3" json:"disable_meta_optimizer,omitempty"` + // Controls how many times we run the optimizers in meta optimizer (default + // is once). + MetaOptimizerIterations RewriterConfig_NumIterationsType `protobuf:"varint,12,opt,name=meta_optimizer_iterations,json=metaOptimizerIterations,proto3,enum=tensorflow.RewriterConfig_NumIterationsType" json:"meta_optimizer_iterations,omitempty"` + // The minimum number of nodes in a graph to optimizer. For smaller graphs, + // optimization is skipped. + // 0 means the system picks an appropriate number. + // < 0 means do not skip optimization. + MinGraphNodes int32 `protobuf:"varint,17,opt,name=min_graph_nodes,json=minGraphNodes,proto3" json:"min_graph_nodes,omitempty"` + // Disable optimizations that assume compressed tensors. Note that this flag + // is experimental and may be removed in the future. + ExperimentalDisableCompressedTensorOptimization bool `protobuf:"varint,26,opt,name=experimental_disable_compressed_tensor_optimization,json=experimentalDisableCompressedTensorOptimization,proto3" json:"experimental_disable_compressed_tensor_optimization,omitempty"` + // Configures memory optimization passes through the meta-optimizer. Has no + // effect on manually requested memory optimization passes in the optimizers + // field. + MemoryOptimization RewriterConfig_MemOptType `protobuf:"varint,4,opt,name=memory_optimization,json=memoryOptimization,proto3,enum=tensorflow.RewriterConfig_MemOptType" json:"memory_optimization,omitempty"` + // A node name scope for node names which are valid outputs of recomputations. + // Inputs to nodes that match this scope may be recomputed (subject either to + // manual annotation of those input nodes or to manual annotation and + // heuristics depending on memory_optimization), but the nodes themselves will + // not be recomputed. This matches any sub-scopes as well, meaning the scope + // can appear not just as a top-level scope. For example, if the value is + // "gradients/", the default, it will match node name "gradients/foo", + // "foo/gradients/bar", but not "foo_gradients/" + MemoryOptimizerTargetNodeNameScope string `protobuf:"bytes,6,opt,name=memory_optimizer_target_node_name_scope,json=memoryOptimizerTargetNodeNameScope,proto3" json:"memory_optimizer_target_node_name_scope,omitempty"` + // Maximum number of milliseconds to spend optimizing a single graph before + // timing out. If equal to 0 the system picks a default (currently 5 minutes). + // If less than 0 the optimizer will never time out. + MetaOptimizerTimeoutMs int64 `protobuf:"varint,20,opt,name=meta_optimizer_timeout_ms,json=metaOptimizerTimeoutMs,proto3" json:"meta_optimizer_timeout_ms,omitempty"` + // Configures AutoParallel optimization passes either through the + // meta-optimizer or when manually specified through the optimizers field. + AutoParallel *AutoParallelOptions `protobuf:"bytes,5,opt,name=auto_parallel,json=autoParallel,proto3" json:"auto_parallel,omitempty"` + // If true, any optimization pass failing will cause the MetaOptimizer to + // stop with an error. By default - or when set to false, failing passes are + // skipped silently. + FailOnOptimizerErrors bool `protobuf:"varint,21,opt,name=fail_on_optimizer_errors,json=failOnOptimizerErrors,proto3" json:"fail_on_optimizer_errors,omitempty"` + ScopedAllocatorOpts *ScopedAllocatorOptions `protobuf:"bytes,16,opt,name=scoped_allocator_opts,json=scopedAllocatorOpts,proto3" json:"scoped_allocator_opts,omitempty"` + // If non-empty, will use this as an alternative way to specify a list of + // optimizations to turn on and the order of the optimizations (replacing the + // meta-optimizer). + // + // Of the RewriterConfig options, only the AutoParallel configuration options + // (the auto_parallel field) apply to manually requested optimization passes + // ("autoparallel"). Memory optimization passes ("memory") invoked here are + // not configurable (in contrast to memory optimization passes through the + // meta-optimizer) and act only on manual op annotations. + // + // Custom optimizers (see custom_optimizers) that are not part of this + // schedule will be run after - in the order that they were specified. + Optimizers []string `protobuf:"bytes,100,rep,name=optimizers,proto3" json:"optimizers,omitempty"` + // list of CustomGraphOptimizers to apply. + CustomOptimizers []*RewriterConfig_CustomGraphOptimizer `protobuf:"bytes,200,rep,name=custom_optimizers,json=customOptimizers,proto3" json:"custom_optimizers,omitempty"` + // VerifierConfig specifying the verifiers to be run after every optimizer. + InterOptimizerVerifierConfig *VerifierConfig `protobuf:"bytes,300,opt,name=inter_optimizer_verifier_config,json=interOptimizerVerifierConfig,proto3" json:"inter_optimizer_verifier_config,omitempty"` + // VerifierConfig specifying the verifiers to be run at the end, after all + // optimizers have run. + PostOptimizationVerifierConfig *VerifierConfig `protobuf:"bytes,301,opt,name=post_optimization_verifier_config,json=postOptimizationVerifierConfig,proto3" json:"post_optimization_verifier_config,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RewriterConfig) Reset() { + *x = RewriterConfig{} + mi := &file_tensorflow_core_protobuf_rewriter_config_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RewriterConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RewriterConfig) ProtoMessage() {} + +func (x *RewriterConfig) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_rewriter_config_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RewriterConfig.ProtoReflect.Descriptor instead. +func (*RewriterConfig) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_rewriter_config_proto_rawDescGZIP(), []int{2} +} + +func (x *RewriterConfig) GetCpuLayoutConversion() RewriterConfig_CpuLayout { + if x != nil { + return x.CpuLayoutConversion + } + return RewriterConfig_NO_CONVERSION_ON_CPU +} + +func (x *RewriterConfig) GetLayoutOptimizer() RewriterConfig_Toggle { + if x != nil { + return x.LayoutOptimizer + } + return RewriterConfig_DEFAULT +} + +func (x *RewriterConfig) GetConstantFolding() RewriterConfig_Toggle { + if x != nil { + return x.ConstantFolding + } + return RewriterConfig_DEFAULT +} + +func (x *RewriterConfig) GetShapeOptimization() RewriterConfig_Toggle { + if x != nil { + return x.ShapeOptimization + } + return RewriterConfig_DEFAULT +} + +func (x *RewriterConfig) GetRemapping() RewriterConfig_Toggle { + if x != nil { + return x.Remapping + } + return RewriterConfig_DEFAULT +} + +func (x *RewriterConfig) GetCommonSubgraphElimination() RewriterConfig_Toggle { + if x != nil { + return x.CommonSubgraphElimination + } + return RewriterConfig_DEFAULT +} + +func (x *RewriterConfig) GetArithmeticOptimization() RewriterConfig_Toggle { + if x != nil { + return x.ArithmeticOptimization + } + return RewriterConfig_DEFAULT +} + +func (x *RewriterConfig) GetDependencyOptimization() RewriterConfig_Toggle { + if x != nil { + return x.DependencyOptimization + } + return RewriterConfig_DEFAULT +} + +func (x *RewriterConfig) GetLoopOptimization() RewriterConfig_Toggle { + if x != nil { + return x.LoopOptimization + } + return RewriterConfig_DEFAULT +} + +func (x *RewriterConfig) GetFunctionOptimization() RewriterConfig_Toggle { + if x != nil { + return x.FunctionOptimization + } + return RewriterConfig_DEFAULT +} + +func (x *RewriterConfig) GetDebugStripper() RewriterConfig_Toggle { + if x != nil { + return x.DebugStripper + } + return RewriterConfig_DEFAULT +} + +func (x *RewriterConfig) GetDisableModelPruning() bool { + if x != nil { + return x.DisableModelPruning + } + return false +} + +func (x *RewriterConfig) GetScopedAllocatorOptimization() RewriterConfig_Toggle { + if x != nil { + return x.ScopedAllocatorOptimization + } + return RewriterConfig_DEFAULT +} + +func (x *RewriterConfig) GetPinToHostOptimization() RewriterConfig_Toggle { + if x != nil { + return x.PinToHostOptimization + } + return RewriterConfig_DEFAULT +} + +func (x *RewriterConfig) GetImplementationSelector() RewriterConfig_Toggle { + if x != nil { + return x.ImplementationSelector + } + return RewriterConfig_DEFAULT +} + +func (x *RewriterConfig) GetAutoMixedPrecision() RewriterConfig_Toggle { + if x != nil { + return x.AutoMixedPrecision + } + return RewriterConfig_DEFAULT +} + +func (x *RewriterConfig) GetAutoMixedPrecisionMkl() RewriterConfig_Toggle { + if x != nil { + return x.AutoMixedPrecisionMkl + } + return RewriterConfig_DEFAULT +} + +func (x *RewriterConfig) GetDisableMetaOptimizer() bool { + if x != nil { + return x.DisableMetaOptimizer + } + return false +} + +func (x *RewriterConfig) GetMetaOptimizerIterations() RewriterConfig_NumIterationsType { + if x != nil { + return x.MetaOptimizerIterations + } + return RewriterConfig_DEFAULT_NUM_ITERS +} + +func (x *RewriterConfig) GetMinGraphNodes() int32 { + if x != nil { + return x.MinGraphNodes + } + return 0 +} + +func (x *RewriterConfig) GetExperimentalDisableCompressedTensorOptimization() bool { + if x != nil { + return x.ExperimentalDisableCompressedTensorOptimization + } + return false +} + +func (x *RewriterConfig) GetMemoryOptimization() RewriterConfig_MemOptType { + if x != nil { + return x.MemoryOptimization + } + return RewriterConfig_DEFAULT_MEM_OPT +} + +func (x *RewriterConfig) GetMemoryOptimizerTargetNodeNameScope() string { + if x != nil { + return x.MemoryOptimizerTargetNodeNameScope + } + return "" +} + +func (x *RewriterConfig) GetMetaOptimizerTimeoutMs() int64 { + if x != nil { + return x.MetaOptimizerTimeoutMs + } + return 0 +} + +func (x *RewriterConfig) GetAutoParallel() *AutoParallelOptions { + if x != nil { + return x.AutoParallel + } + return nil +} + +func (x *RewriterConfig) GetFailOnOptimizerErrors() bool { + if x != nil { + return x.FailOnOptimizerErrors + } + return false +} + +func (x *RewriterConfig) GetScopedAllocatorOpts() *ScopedAllocatorOptions { + if x != nil { + return x.ScopedAllocatorOpts + } + return nil +} + +func (x *RewriterConfig) GetOptimizers() []string { + if x != nil { + return x.Optimizers + } + return nil +} + +func (x *RewriterConfig) GetCustomOptimizers() []*RewriterConfig_CustomGraphOptimizer { + if x != nil { + return x.CustomOptimizers + } + return nil +} + +func (x *RewriterConfig) GetInterOptimizerVerifierConfig() *VerifierConfig { + if x != nil { + return x.InterOptimizerVerifierConfig + } + return nil +} + +func (x *RewriterConfig) GetPostOptimizationVerifierConfig() *VerifierConfig { + if x != nil { + return x.PostOptimizationVerifierConfig + } + return nil +} + +// Message to describe custom graph optimizer and its parameters +type RewriterConfig_CustomGraphOptimizer struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + ParameterMap map[string]*attr_value_go_proto.AttrValue `protobuf:"bytes,2,rep,name=parameter_map,json=parameterMap,proto3" json:"parameter_map,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RewriterConfig_CustomGraphOptimizer) Reset() { + *x = RewriterConfig_CustomGraphOptimizer{} + mi := &file_tensorflow_core_protobuf_rewriter_config_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RewriterConfig_CustomGraphOptimizer) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RewriterConfig_CustomGraphOptimizer) ProtoMessage() {} + +func (x *RewriterConfig_CustomGraphOptimizer) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_rewriter_config_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RewriterConfig_CustomGraphOptimizer.ProtoReflect.Descriptor instead. +func (*RewriterConfig_CustomGraphOptimizer) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_rewriter_config_proto_rawDescGZIP(), []int{2, 0} +} + +func (x *RewriterConfig_CustomGraphOptimizer) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *RewriterConfig_CustomGraphOptimizer) GetParameterMap() map[string]*attr_value_go_proto.AttrValue { + if x != nil { + return x.ParameterMap + } + return nil +} + +var File_tensorflow_core_protobuf_rewriter_config_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_rewriter_config_proto_rawDesc = "" + + "\n" + + ".tensorflow/core/protobuf/rewriter_config.proto\x12\n" + + "tensorflow\x1a*tensorflow/core/framework/attr_value.proto\x1a.tensorflow/core/protobuf/verifier_config.proto\"P\n" + + "\x13AutoParallelOptions\x12\x16\n" + + "\x06enable\x18\x01 \x01(\bR\x06enable\x12!\n" + + "\fnum_replicas\x18\x02 \x01(\x05R\vnumReplicas\"5\n" + + "\x16ScopedAllocatorOptions\x12\x1b\n" + + "\tenable_op\x18\x01 \x03(\tR\benableOp\"\xba\x18\n" + + "\x0eRewriterConfig\x12X\n" + + "\x15cpu_layout_conversion\x182 \x01(\x0e2$.tensorflow.RewriterConfig.CpuLayoutR\x13cpuLayoutConversion\x12L\n" + + "\x10layout_optimizer\x18\x01 \x01(\x0e2!.tensorflow.RewriterConfig.ToggleR\x0flayoutOptimizer\x12L\n" + + "\x10constant_folding\x18\x03 \x01(\x0e2!.tensorflow.RewriterConfig.ToggleR\x0fconstantFolding\x12P\n" + + "\x12shape_optimization\x18\r \x01(\x0e2!.tensorflow.RewriterConfig.ToggleR\x11shapeOptimization\x12?\n" + + "\tremapping\x18\x0e \x01(\x0e2!.tensorflow.RewriterConfig.ToggleR\tremapping\x12a\n" + + "\x1bcommon_subgraph_elimination\x18\x18 \x01(\x0e2!.tensorflow.RewriterConfig.ToggleR\x19commonSubgraphElimination\x12Z\n" + + "\x17arithmetic_optimization\x18\a \x01(\x0e2!.tensorflow.RewriterConfig.ToggleR\x16arithmeticOptimization\x12Z\n" + + "\x17dependency_optimization\x18\b \x01(\x0e2!.tensorflow.RewriterConfig.ToggleR\x16dependencyOptimization\x12N\n" + + "\x11loop_optimization\x18\t \x01(\x0e2!.tensorflow.RewriterConfig.ToggleR\x10loopOptimization\x12V\n" + + "\x15function_optimization\x18\n" + + " \x01(\x0e2!.tensorflow.RewriterConfig.ToggleR\x14functionOptimization\x12H\n" + + "\x0edebug_stripper\x18\v \x01(\x0e2!.tensorflow.RewriterConfig.ToggleR\rdebugStripper\x122\n" + + "\x15disable_model_pruning\x18\x02 \x01(\bR\x13disableModelPruning\x12e\n" + + "\x1dscoped_allocator_optimization\x18\x0f \x01(\x0e2!.tensorflow.RewriterConfig.ToggleR\x1bscopedAllocatorOptimization\x12Z\n" + + "\x18pin_to_host_optimization\x18\x12 \x01(\x0e2!.tensorflow.RewriterConfig.ToggleR\x15pinToHostOptimization\x12Z\n" + + "\x17implementation_selector\x18\x16 \x01(\x0e2!.tensorflow.RewriterConfig.ToggleR\x16implementationSelector\x12S\n" + + "\x14auto_mixed_precision\x18\x17 \x01(\x0e2!.tensorflow.RewriterConfig.ToggleR\x12autoMixedPrecision\x12Z\n" + + "\x18auto_mixed_precision_mkl\x18\x19 \x01(\x0e2!.tensorflow.RewriterConfig.ToggleR\x15autoMixedPrecisionMkl\x124\n" + + "\x16disable_meta_optimizer\x18\x13 \x01(\bR\x14disableMetaOptimizer\x12h\n" + + "\x19meta_optimizer_iterations\x18\f \x01(\x0e2,.tensorflow.RewriterConfig.NumIterationsTypeR\x17metaOptimizerIterations\x12&\n" + + "\x0fmin_graph_nodes\x18\x11 \x01(\x05R\rminGraphNodes\x12l\n" + + "3experimental_disable_compressed_tensor_optimization\x18\x1a \x01(\bR/experimentalDisableCompressedTensorOptimization\x12V\n" + + "\x13memory_optimization\x18\x04 \x01(\x0e2%.tensorflow.RewriterConfig.MemOptTypeR\x12memoryOptimization\x12S\n" + + "'memory_optimizer_target_node_name_scope\x18\x06 \x01(\tR\"memoryOptimizerTargetNodeNameScope\x129\n" + + "\x19meta_optimizer_timeout_ms\x18\x14 \x01(\x03R\x16metaOptimizerTimeoutMs\x12D\n" + + "\rauto_parallel\x18\x05 \x01(\v2\x1f.tensorflow.AutoParallelOptionsR\fautoParallel\x127\n" + + "\x18fail_on_optimizer_errors\x18\x15 \x01(\bR\x15failOnOptimizerErrors\x12V\n" + + "\x15scoped_allocator_opts\x18\x10 \x01(\v2\".tensorflow.ScopedAllocatorOptionsR\x13scopedAllocatorOpts\x12\x1e\n" + + "\n" + + "optimizers\x18d \x03(\tR\n" + + "optimizers\x12]\n" + + "\x11custom_optimizers\x18\xc8\x01 \x03(\v2/.tensorflow.RewriterConfig.CustomGraphOptimizerR\x10customOptimizers\x12b\n" + + "\x1finter_optimizer_verifier_config\x18\xac\x02 \x01(\v2\x1a.tensorflow.VerifierConfigR\x1cinterOptimizerVerifierConfig\x12f\n" + + "!post_optimization_verifier_config\x18\xad\x02 \x01(\v2\x1a.tensorflow.VerifierConfigR\x1epostOptimizationVerifierConfig\x1a\xea\x01\n" + + "\x14CustomGraphOptimizer\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12f\n" + + "\rparameter_map\x18\x02 \x03(\v2A.tensorflow.RewriterConfig.CustomGraphOptimizer.ParameterMapEntryR\fparameterMap\x1aV\n" + + "\x11ParameterMapEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12+\n" + + "\x05value\x18\x02 \x01(\v2\x15.tensorflow.AttrValueR\x05value:\x028\x01\"6\n" + + "\x06Toggle\x12\v\n" + + "\aDEFAULT\x10\x00\x12\x06\n" + + "\x02ON\x10\x01\x12\a\n" + + "\x03OFF\x10\x02\x12\x0e\n" + + "\n" + + "AGGRESSIVE\x10\x03\"I\n" + + "\tCpuLayout\x12\x18\n" + + "\x14NO_CONVERSION_ON_CPU\x10\x00\x12\x10\n" + + "\fNCHW_TO_NHWC\x10\x01\x12\x10\n" + + "\fNHWC_TO_NCHW\x10\x02\"<\n" + + "\x11NumIterationsType\x12\x15\n" + + "\x11DEFAULT_NUM_ITERS\x10\x00\x12\a\n" + + "\x03ONE\x10\x01\x12\a\n" + + "\x03TWO\x10\x02\"\x9f\x01\n" + + "\n" + + "MemOptType\x12\x13\n" + + "\x0fDEFAULT_MEM_OPT\x10\x00\x12\x0e\n" + + "\n" + + "NO_MEM_OPT\x10\x01\x12\n" + + "\n" + + "\x06MANUAL\x10\x02\x12\x17\n" + + "\x13SWAPPING_HEURISTICS\x10\x04\x12\x1c\n" + + "\x18RECOMPUTATION_HEURISTICS\x10\x05\x12\x19\n" + + "\x15SCHEDULING_HEURISTICS\x10\x06\x12\x0e\n" + + "\n" + + "HEURISTICS\x10\x03B\x8c\x01\n" + + "\x18org.tensorflow.frameworkB\x14RewriterConfigProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_rewriter_config_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_rewriter_config_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_rewriter_config_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_rewriter_config_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_rewriter_config_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_rewriter_config_proto_rawDesc), len(file_tensorflow_core_protobuf_rewriter_config_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_rewriter_config_proto_rawDescData +} + +var file_tensorflow_core_protobuf_rewriter_config_proto_enumTypes = make([]protoimpl.EnumInfo, 4) +var file_tensorflow_core_protobuf_rewriter_config_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_tensorflow_core_protobuf_rewriter_config_proto_goTypes = []any{ + (RewriterConfig_Toggle)(0), // 0: tensorflow.RewriterConfig.Toggle + (RewriterConfig_CpuLayout)(0), // 1: tensorflow.RewriterConfig.CpuLayout + (RewriterConfig_NumIterationsType)(0), // 2: tensorflow.RewriterConfig.NumIterationsType + (RewriterConfig_MemOptType)(0), // 3: tensorflow.RewriterConfig.MemOptType + (*AutoParallelOptions)(nil), // 4: tensorflow.AutoParallelOptions + (*ScopedAllocatorOptions)(nil), // 5: tensorflow.ScopedAllocatorOptions + (*RewriterConfig)(nil), // 6: tensorflow.RewriterConfig + (*RewriterConfig_CustomGraphOptimizer)(nil), // 7: tensorflow.RewriterConfig.CustomGraphOptimizer + nil, // 8: tensorflow.RewriterConfig.CustomGraphOptimizer.ParameterMapEntry + (*VerifierConfig)(nil), // 9: tensorflow.VerifierConfig + (*attr_value_go_proto.AttrValue)(nil), // 10: tensorflow.AttrValue +} +var file_tensorflow_core_protobuf_rewriter_config_proto_depIdxs = []int32{ + 1, // 0: tensorflow.RewriterConfig.cpu_layout_conversion:type_name -> tensorflow.RewriterConfig.CpuLayout + 0, // 1: tensorflow.RewriterConfig.layout_optimizer:type_name -> tensorflow.RewriterConfig.Toggle + 0, // 2: tensorflow.RewriterConfig.constant_folding:type_name -> tensorflow.RewriterConfig.Toggle + 0, // 3: tensorflow.RewriterConfig.shape_optimization:type_name -> tensorflow.RewriterConfig.Toggle + 0, // 4: tensorflow.RewriterConfig.remapping:type_name -> tensorflow.RewriterConfig.Toggle + 0, // 5: tensorflow.RewriterConfig.common_subgraph_elimination:type_name -> tensorflow.RewriterConfig.Toggle + 0, // 6: tensorflow.RewriterConfig.arithmetic_optimization:type_name -> tensorflow.RewriterConfig.Toggle + 0, // 7: tensorflow.RewriterConfig.dependency_optimization:type_name -> tensorflow.RewriterConfig.Toggle + 0, // 8: tensorflow.RewriterConfig.loop_optimization:type_name -> tensorflow.RewriterConfig.Toggle + 0, // 9: tensorflow.RewriterConfig.function_optimization:type_name -> tensorflow.RewriterConfig.Toggle + 0, // 10: tensorflow.RewriterConfig.debug_stripper:type_name -> tensorflow.RewriterConfig.Toggle + 0, // 11: tensorflow.RewriterConfig.scoped_allocator_optimization:type_name -> tensorflow.RewriterConfig.Toggle + 0, // 12: tensorflow.RewriterConfig.pin_to_host_optimization:type_name -> tensorflow.RewriterConfig.Toggle + 0, // 13: tensorflow.RewriterConfig.implementation_selector:type_name -> tensorflow.RewriterConfig.Toggle + 0, // 14: tensorflow.RewriterConfig.auto_mixed_precision:type_name -> tensorflow.RewriterConfig.Toggle + 0, // 15: tensorflow.RewriterConfig.auto_mixed_precision_mkl:type_name -> tensorflow.RewriterConfig.Toggle + 2, // 16: tensorflow.RewriterConfig.meta_optimizer_iterations:type_name -> tensorflow.RewriterConfig.NumIterationsType + 3, // 17: tensorflow.RewriterConfig.memory_optimization:type_name -> tensorflow.RewriterConfig.MemOptType + 4, // 18: tensorflow.RewriterConfig.auto_parallel:type_name -> tensorflow.AutoParallelOptions + 5, // 19: tensorflow.RewriterConfig.scoped_allocator_opts:type_name -> tensorflow.ScopedAllocatorOptions + 7, // 20: tensorflow.RewriterConfig.custom_optimizers:type_name -> tensorflow.RewriterConfig.CustomGraphOptimizer + 9, // 21: tensorflow.RewriterConfig.inter_optimizer_verifier_config:type_name -> tensorflow.VerifierConfig + 9, // 22: tensorflow.RewriterConfig.post_optimization_verifier_config:type_name -> tensorflow.VerifierConfig + 8, // 23: tensorflow.RewriterConfig.CustomGraphOptimizer.parameter_map:type_name -> tensorflow.RewriterConfig.CustomGraphOptimizer.ParameterMapEntry + 10, // 24: tensorflow.RewriterConfig.CustomGraphOptimizer.ParameterMapEntry.value:type_name -> tensorflow.AttrValue + 25, // [25:25] is the sub-list for method output_type + 25, // [25:25] is the sub-list for method input_type + 25, // [25:25] is the sub-list for extension type_name + 25, // [25:25] is the sub-list for extension extendee + 0, // [0:25] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_rewriter_config_proto_init() } +func file_tensorflow_core_protobuf_rewriter_config_proto_init() { + if File_tensorflow_core_protobuf_rewriter_config_proto != nil { + return + } + file_tensorflow_core_protobuf_verifier_config_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_rewriter_config_proto_rawDesc), len(file_tensorflow_core_protobuf_rewriter_config_proto_rawDesc)), + NumEnums: 4, + NumMessages: 5, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_rewriter_config_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_rewriter_config_proto_depIdxs, + EnumInfos: file_tensorflow_core_protobuf_rewriter_config_proto_enumTypes, + MessageInfos: file_tensorflow_core_protobuf_rewriter_config_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_rewriter_config_proto = out.File + file_tensorflow_core_protobuf_rewriter_config_proto_goTypes = nil + file_tensorflow_core_protobuf_rewriter_config_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/saved_model.pb.go b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/saved_model.pb.go new file mode 100644 index 0000000..3383361 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/saved_model.pb.go @@ -0,0 +1,144 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/saved_model.proto + +package for_core_protos_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// SavedModel is the high level serialization format for TensorFlow Models. +// See [todo: doc links, similar to session_bundle] for more information. +type SavedModel struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The schema version of the SavedModel instance. Used for versioning when + // making future changes to the specification/implementation. Initial value + // at release will be 1. + SavedModelSchemaVersion int64 `protobuf:"varint,1,opt,name=saved_model_schema_version,json=savedModelSchemaVersion,proto3" json:"saved_model_schema_version,omitempty"` + // One or more MetaGraphs. + MetaGraphs []*MetaGraphDef `protobuf:"bytes,2,rep,name=meta_graphs,json=metaGraphs,proto3" json:"meta_graphs,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SavedModel) Reset() { + *x = SavedModel{} + mi := &file_tensorflow_core_protobuf_saved_model_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SavedModel) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SavedModel) ProtoMessage() {} + +func (x *SavedModel) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_saved_model_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SavedModel.ProtoReflect.Descriptor instead. +func (*SavedModel) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_saved_model_proto_rawDescGZIP(), []int{0} +} + +func (x *SavedModel) GetSavedModelSchemaVersion() int64 { + if x != nil { + return x.SavedModelSchemaVersion + } + return 0 +} + +func (x *SavedModel) GetMetaGraphs() []*MetaGraphDef { + if x != nil { + return x.MetaGraphs + } + return nil +} + +var File_tensorflow_core_protobuf_saved_model_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_saved_model_proto_rawDesc = "" + + "\n" + + "*tensorflow/core/protobuf/saved_model.proto\x12\n" + + "tensorflow\x1a)tensorflow/core/protobuf/meta_graph.proto\"\x84\x01\n" + + "\n" + + "SavedModel\x12;\n" + + "\x1asaved_model_schema_version\x18\x01 \x01(\x03R\x17savedModelSchemaVersion\x129\n" + + "\vmeta_graphs\x18\x02 \x03(\v2\x18.tensorflow.MetaGraphDefR\n" + + "metaGraphsB\x88\x01\n" + + "\x18org.tensorflow.frameworkB\x10SavedModelProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_saved_model_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_saved_model_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_saved_model_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_saved_model_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_saved_model_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_saved_model_proto_rawDesc), len(file_tensorflow_core_protobuf_saved_model_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_saved_model_proto_rawDescData +} + +var file_tensorflow_core_protobuf_saved_model_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_tensorflow_core_protobuf_saved_model_proto_goTypes = []any{ + (*SavedModel)(nil), // 0: tensorflow.SavedModel + (*MetaGraphDef)(nil), // 1: tensorflow.MetaGraphDef +} +var file_tensorflow_core_protobuf_saved_model_proto_depIdxs = []int32{ + 1, // 0: tensorflow.SavedModel.meta_graphs:type_name -> tensorflow.MetaGraphDef + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_saved_model_proto_init() } +func file_tensorflow_core_protobuf_saved_model_proto_init() { + if File_tensorflow_core_protobuf_saved_model_proto != nil { + return + } + file_tensorflow_core_protobuf_meta_graph_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_saved_model_proto_rawDesc), len(file_tensorflow_core_protobuf_saved_model_proto_rawDesc)), + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_saved_model_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_saved_model_proto_depIdxs, + MessageInfos: file_tensorflow_core_protobuf_saved_model_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_saved_model_proto = out.File + file_tensorflow_core_protobuf_saved_model_proto_goTypes = nil + file_tensorflow_core_protobuf_saved_model_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/saved_object_graph.pb.go b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/saved_object_graph.pb.go new file mode 100644 index 0000000..5364e52 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/saved_object_graph.pb.go @@ -0,0 +1,1175 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/saved_object_graph.proto + +package for_core_protos_go_proto + +import ( + tensor_shape_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_shape_go_proto" + types_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/types_go_proto" + variable_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/variable_go_proto" + versions_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/versions_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Whether the function should be compiled by XLA. +// +// The public interface to `tf.function` uses an optional boolean to +// represent three distinct states for this field. Unfortunately, proto3 +// removes the ability to explicitly check for the presence or absence of a +// field, so we instead map to an enum. +// +// See `tf.function` for details. +type FunctionSpec_ExperimentalCompile int32 + +const ( + FunctionSpec_DEFAULT FunctionSpec_ExperimentalCompile = 0 + FunctionSpec_ON FunctionSpec_ExperimentalCompile = 1 + FunctionSpec_OFF FunctionSpec_ExperimentalCompile = 2 +) + +// Enum value maps for FunctionSpec_ExperimentalCompile. +var ( + FunctionSpec_ExperimentalCompile_name = map[int32]string{ + 0: "DEFAULT", + 1: "ON", + 2: "OFF", + } + FunctionSpec_ExperimentalCompile_value = map[string]int32{ + "DEFAULT": 0, + "ON": 1, + "OFF": 2, + } +) + +func (x FunctionSpec_ExperimentalCompile) Enum() *FunctionSpec_ExperimentalCompile { + p := new(FunctionSpec_ExperimentalCompile) + *p = x + return p +} + +func (x FunctionSpec_ExperimentalCompile) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (FunctionSpec_ExperimentalCompile) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_protobuf_saved_object_graph_proto_enumTypes[0].Descriptor() +} + +func (FunctionSpec_ExperimentalCompile) Type() protoreflect.EnumType { + return &file_tensorflow_core_protobuf_saved_object_graph_proto_enumTypes[0] +} + +func (x FunctionSpec_ExperimentalCompile) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use FunctionSpec_ExperimentalCompile.Descriptor instead. +func (FunctionSpec_ExperimentalCompile) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_saved_object_graph_proto_rawDescGZIP(), []int{9, 0} +} + +type SavedObjectGraph struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Flattened list of objects in the object graph. + // + // The position of the object in this list indicates its id. + // Nodes[0] is considered the root node. + Nodes []*SavedObject `protobuf:"bytes,1,rep,name=nodes,proto3" json:"nodes,omitempty"` + // Information about captures and output structures in concrete functions. + // Referenced from SavedBareConcreteFunction and SavedFunction. + ConcreteFunctions map[string]*SavedConcreteFunction `protobuf:"bytes,2,rep,name=concrete_functions,json=concreteFunctions,proto3" json:"concrete_functions,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SavedObjectGraph) Reset() { + *x = SavedObjectGraph{} + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SavedObjectGraph) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SavedObjectGraph) ProtoMessage() {} + +func (x *SavedObjectGraph) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SavedObjectGraph.ProtoReflect.Descriptor instead. +func (*SavedObjectGraph) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_saved_object_graph_proto_rawDescGZIP(), []int{0} +} + +func (x *SavedObjectGraph) GetNodes() []*SavedObject { + if x != nil { + return x.Nodes + } + return nil +} + +func (x *SavedObjectGraph) GetConcreteFunctions() map[string]*SavedConcreteFunction { + if x != nil { + return x.ConcreteFunctions + } + return nil +} + +type SavedObject struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Objects which this object depends on: named edges in the dependency + // graph. + // + // Note: currently only valid if kind == "user_object". + Children []*TrackableObjectGraph_TrackableObject_ObjectReference `protobuf:"bytes,1,rep,name=children,proto3" json:"children,omitempty"` + // Slot variables owned by this object. This describes the three-way + // (optimizer, variable, slot variable) relationship; none of the three + // depend on the others directly. + // + // Note: currently only valid if kind == "user_object". + SlotVariables []*TrackableObjectGraph_TrackableObject_SlotVariableReference `protobuf:"bytes,3,rep,name=slot_variables,json=slotVariables,proto3" json:"slot_variables,omitempty"` + // Types that are valid to be assigned to Kind: + // + // *SavedObject_UserObject + // *SavedObject_Asset + // *SavedObject_Function + // *SavedObject_Variable + // *SavedObject_BareConcreteFunction + // *SavedObject_Constant + // *SavedObject_Resource + Kind isSavedObject_Kind `protobuf_oneof:"kind"` + SaveableObjects map[string]*SaveableObject `protobuf:"bytes,11,rep,name=saveable_objects,json=saveableObjects,proto3" json:"saveable_objects,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SavedObject) Reset() { + *x = SavedObject{} + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SavedObject) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SavedObject) ProtoMessage() {} + +func (x *SavedObject) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SavedObject.ProtoReflect.Descriptor instead. +func (*SavedObject) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_saved_object_graph_proto_rawDescGZIP(), []int{1} +} + +func (x *SavedObject) GetChildren() []*TrackableObjectGraph_TrackableObject_ObjectReference { + if x != nil { + return x.Children + } + return nil +} + +func (x *SavedObject) GetSlotVariables() []*TrackableObjectGraph_TrackableObject_SlotVariableReference { + if x != nil { + return x.SlotVariables + } + return nil +} + +func (x *SavedObject) GetKind() isSavedObject_Kind { + if x != nil { + return x.Kind + } + return nil +} + +func (x *SavedObject) GetUserObject() *SavedUserObject { + if x != nil { + if x, ok := x.Kind.(*SavedObject_UserObject); ok { + return x.UserObject + } + } + return nil +} + +func (x *SavedObject) GetAsset() *SavedAsset { + if x != nil { + if x, ok := x.Kind.(*SavedObject_Asset); ok { + return x.Asset + } + } + return nil +} + +func (x *SavedObject) GetFunction() *SavedFunction { + if x != nil { + if x, ok := x.Kind.(*SavedObject_Function); ok { + return x.Function + } + } + return nil +} + +func (x *SavedObject) GetVariable() *SavedVariable { + if x != nil { + if x, ok := x.Kind.(*SavedObject_Variable); ok { + return x.Variable + } + } + return nil +} + +func (x *SavedObject) GetBareConcreteFunction() *SavedBareConcreteFunction { + if x != nil { + if x, ok := x.Kind.(*SavedObject_BareConcreteFunction); ok { + return x.BareConcreteFunction + } + } + return nil +} + +func (x *SavedObject) GetConstant() *SavedConstant { + if x != nil { + if x, ok := x.Kind.(*SavedObject_Constant); ok { + return x.Constant + } + } + return nil +} + +func (x *SavedObject) GetResource() *SavedResource { + if x != nil { + if x, ok := x.Kind.(*SavedObject_Resource); ok { + return x.Resource + } + } + return nil +} + +func (x *SavedObject) GetSaveableObjects() map[string]*SaveableObject { + if x != nil { + return x.SaveableObjects + } + return nil +} + +type isSavedObject_Kind interface { + isSavedObject_Kind() +} + +type SavedObject_UserObject struct { + UserObject *SavedUserObject `protobuf:"bytes,4,opt,name=user_object,json=userObject,proto3,oneof"` +} + +type SavedObject_Asset struct { + Asset *SavedAsset `protobuf:"bytes,5,opt,name=asset,proto3,oneof"` +} + +type SavedObject_Function struct { + Function *SavedFunction `protobuf:"bytes,6,opt,name=function,proto3,oneof"` +} + +type SavedObject_Variable struct { + Variable *SavedVariable `protobuf:"bytes,7,opt,name=variable,proto3,oneof"` +} + +type SavedObject_BareConcreteFunction struct { + BareConcreteFunction *SavedBareConcreteFunction `protobuf:"bytes,8,opt,name=bare_concrete_function,json=bareConcreteFunction,proto3,oneof"` +} + +type SavedObject_Constant struct { + Constant *SavedConstant `protobuf:"bytes,9,opt,name=constant,proto3,oneof"` +} + +type SavedObject_Resource struct { + Resource *SavedResource `protobuf:"bytes,10,opt,name=resource,proto3,oneof"` +} + +func (*SavedObject_UserObject) isSavedObject_Kind() {} + +func (*SavedObject_Asset) isSavedObject_Kind() {} + +func (*SavedObject_Function) isSavedObject_Kind() {} + +func (*SavedObject_Variable) isSavedObject_Kind() {} + +func (*SavedObject_BareConcreteFunction) isSavedObject_Kind() {} + +func (*SavedObject_Constant) isSavedObject_Kind() {} + +func (*SavedObject_Resource) isSavedObject_Kind() {} + +// A SavedUserObject is an object (in the object-oriented language of the +// TensorFlow program) of some user- or framework-defined class other than +// those handled specifically by the other kinds of SavedObjects. +// +// This object cannot be evaluated as a tensor, and therefore cannot be bound +// to an input of a function. +type SavedUserObject struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Corresponds to a registration of the type to use in the loading program. + Identifier string `protobuf:"bytes,1,opt,name=identifier,proto3" json:"identifier,omitempty"` + // Version information from the producer of this SavedUserObject. + Version *versions_go_proto.VersionDef `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` + // Initialization-related metadata. + Metadata string `protobuf:"bytes,3,opt,name=metadata,proto3" json:"metadata,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SavedUserObject) Reset() { + *x = SavedUserObject{} + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SavedUserObject) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SavedUserObject) ProtoMessage() {} + +func (x *SavedUserObject) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SavedUserObject.ProtoReflect.Descriptor instead. +func (*SavedUserObject) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_saved_object_graph_proto_rawDescGZIP(), []int{2} +} + +func (x *SavedUserObject) GetIdentifier() string { + if x != nil { + return x.Identifier + } + return "" +} + +func (x *SavedUserObject) GetVersion() *versions_go_proto.VersionDef { + if x != nil { + return x.Version + } + return nil +} + +func (x *SavedUserObject) GetMetadata() string { + if x != nil { + return x.Metadata + } + return "" +} + +// A SavedAsset points to an asset in the MetaGraph. +// +// When bound to a function this object evaluates to a tensor with the absolute +// filename. Users should not depend on a particular part of the filename to +// remain stable (e.g. basename could be changed). +type SavedAsset struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Index into `MetaGraphDef.asset_file_def[]` that describes the Asset. + // + // Only the field `AssetFileDef.filename` is used. Other fields, such as + // `AssetFileDef.tensor_info`, MUST be ignored. + AssetFileDefIndex int32 `protobuf:"varint,1,opt,name=asset_file_def_index,json=assetFileDefIndex,proto3" json:"asset_file_def_index,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SavedAsset) Reset() { + *x = SavedAsset{} + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SavedAsset) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SavedAsset) ProtoMessage() {} + +func (x *SavedAsset) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SavedAsset.ProtoReflect.Descriptor instead. +func (*SavedAsset) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_saved_object_graph_proto_rawDescGZIP(), []int{3} +} + +func (x *SavedAsset) GetAssetFileDefIndex() int32 { + if x != nil { + return x.AssetFileDefIndex + } + return 0 +} + +// A function with multiple signatures, possibly with non-Tensor arguments. +type SavedFunction struct { + state protoimpl.MessageState `protogen:"open.v1"` + ConcreteFunctions []string `protobuf:"bytes,1,rep,name=concrete_functions,json=concreteFunctions,proto3" json:"concrete_functions,omitempty"` + FunctionSpec *FunctionSpec `protobuf:"bytes,2,opt,name=function_spec,json=functionSpec,proto3" json:"function_spec,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SavedFunction) Reset() { + *x = SavedFunction{} + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SavedFunction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SavedFunction) ProtoMessage() {} + +func (x *SavedFunction) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SavedFunction.ProtoReflect.Descriptor instead. +func (*SavedFunction) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_saved_object_graph_proto_rawDescGZIP(), []int{4} +} + +func (x *SavedFunction) GetConcreteFunctions() []string { + if x != nil { + return x.ConcreteFunctions + } + return nil +} + +func (x *SavedFunction) GetFunctionSpec() *FunctionSpec { + if x != nil { + return x.FunctionSpec + } + return nil +} + +// Stores low-level information about a concrete function. Referenced in either +// a SavedFunction or a SavedBareConcreteFunction. +type SavedConcreteFunction struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Bound inputs to the function. The SavedObjects identified by the node ids + // given here are appended as extra inputs to the caller-supplied inputs. + // The only types of SavedObjects valid here are SavedVariable, SavedResource + // and SavedAsset. + BoundInputs []int32 `protobuf:"varint,2,rep,packed,name=bound_inputs,json=boundInputs,proto3" json:"bound_inputs,omitempty"` + // Input in canonicalized form that was received to create this concrete + // function. + CanonicalizedInputSignature *StructuredValue `protobuf:"bytes,3,opt,name=canonicalized_input_signature,json=canonicalizedInputSignature,proto3" json:"canonicalized_input_signature,omitempty"` + // Output that was the return value of this function after replacing all + // Tensors with TensorSpecs. This can be an arbitrary nested function and will + // be used to reconstruct the full structure from pure tensors. + OutputSignature *StructuredValue `protobuf:"bytes,4,opt,name=output_signature,json=outputSignature,proto3" json:"output_signature,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SavedConcreteFunction) Reset() { + *x = SavedConcreteFunction{} + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SavedConcreteFunction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SavedConcreteFunction) ProtoMessage() {} + +func (x *SavedConcreteFunction) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SavedConcreteFunction.ProtoReflect.Descriptor instead. +func (*SavedConcreteFunction) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_saved_object_graph_proto_rawDescGZIP(), []int{5} +} + +func (x *SavedConcreteFunction) GetBoundInputs() []int32 { + if x != nil { + return x.BoundInputs + } + return nil +} + +func (x *SavedConcreteFunction) GetCanonicalizedInputSignature() *StructuredValue { + if x != nil { + return x.CanonicalizedInputSignature + } + return nil +} + +func (x *SavedConcreteFunction) GetOutputSignature() *StructuredValue { + if x != nil { + return x.OutputSignature + } + return nil +} + +type SavedBareConcreteFunction struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Identifies a SavedConcreteFunction. + ConcreteFunctionName string `protobuf:"bytes,1,opt,name=concrete_function_name,json=concreteFunctionName,proto3" json:"concrete_function_name,omitempty"` + // A sequence of unique strings, one per Tensor argument. + ArgumentKeywords []string `protobuf:"bytes,2,rep,name=argument_keywords,json=argumentKeywords,proto3" json:"argument_keywords,omitempty"` + // The prefix of `argument_keywords` which may be identified by position. + AllowedPositionalArguments int64 `protobuf:"varint,3,opt,name=allowed_positional_arguments,json=allowedPositionalArguments,proto3" json:"allowed_positional_arguments,omitempty"` + // The spec of the function that this ConcreteFunction is traced from. This + // allows the ConcreteFunction to be called with nest structure inputs. This + // field may not be populated. If this field is absent, the concrete function + // can only be called with flat inputs. + // TODO(b/169361281): support calling saved ConcreteFunction with structured + // inputs in C++ SavedModel API. + FunctionSpec *FunctionSpec `protobuf:"bytes,4,opt,name=function_spec,json=functionSpec,proto3" json:"function_spec,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SavedBareConcreteFunction) Reset() { + *x = SavedBareConcreteFunction{} + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SavedBareConcreteFunction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SavedBareConcreteFunction) ProtoMessage() {} + +func (x *SavedBareConcreteFunction) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SavedBareConcreteFunction.ProtoReflect.Descriptor instead. +func (*SavedBareConcreteFunction) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_saved_object_graph_proto_rawDescGZIP(), []int{6} +} + +func (x *SavedBareConcreteFunction) GetConcreteFunctionName() string { + if x != nil { + return x.ConcreteFunctionName + } + return "" +} + +func (x *SavedBareConcreteFunction) GetArgumentKeywords() []string { + if x != nil { + return x.ArgumentKeywords + } + return nil +} + +func (x *SavedBareConcreteFunction) GetAllowedPositionalArguments() int64 { + if x != nil { + return x.AllowedPositionalArguments + } + return 0 +} + +func (x *SavedBareConcreteFunction) GetFunctionSpec() *FunctionSpec { + if x != nil { + return x.FunctionSpec + } + return nil +} + +type SavedConstant struct { + state protoimpl.MessageState `protogen:"open.v1"` + // An Operation name for a ConstantOp in this SavedObjectGraph's MetaGraph. + Operation string `protobuf:"bytes,1,opt,name=operation,proto3" json:"operation,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SavedConstant) Reset() { + *x = SavedConstant{} + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SavedConstant) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SavedConstant) ProtoMessage() {} + +func (x *SavedConstant) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SavedConstant.ProtoReflect.Descriptor instead. +func (*SavedConstant) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_saved_object_graph_proto_rawDescGZIP(), []int{7} +} + +func (x *SavedConstant) GetOperation() string { + if x != nil { + return x.Operation + } + return "" +} + +// Represents a Variable that is initialized by loading the contents from the +// checkpoint. +type SavedVariable struct { + state protoimpl.MessageState `protogen:"open.v1"` + Dtype types_go_proto.DataType `protobuf:"varint,1,opt,name=dtype,proto3,enum=tensorflow.DataType" json:"dtype,omitempty"` + Shape *tensor_shape_go_proto.TensorShapeProto `protobuf:"bytes,2,opt,name=shape,proto3" json:"shape,omitempty"` + Trainable bool `protobuf:"varint,3,opt,name=trainable,proto3" json:"trainable,omitempty"` + Synchronization variable_go_proto.VariableSynchronization `protobuf:"varint,4,opt,name=synchronization,proto3,enum=tensorflow.VariableSynchronization" json:"synchronization,omitempty"` + Aggregation variable_go_proto.VariableAggregation `protobuf:"varint,5,opt,name=aggregation,proto3,enum=tensorflow.VariableAggregation" json:"aggregation,omitempty"` + Name string `protobuf:"bytes,6,opt,name=name,proto3" json:"name,omitempty"` + Device string `protobuf:"bytes,7,opt,name=device,proto3" json:"device,omitempty"` + // List of component variables for a distributed variable. + // + // When this field is non-empty, the SavedVariable will be assumed + // to be a distributed variable defined by the components listed here. + // + // This is only supported by experimental loaders at the moment. + ExperimentalDistributedVariableComponents []*SavedVariable `protobuf:"bytes,8,rep,name=experimental_distributed_variable_components,json=experimentalDistributedVariableComponents,proto3" json:"experimental_distributed_variable_components,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SavedVariable) Reset() { + *x = SavedVariable{} + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SavedVariable) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SavedVariable) ProtoMessage() {} + +func (x *SavedVariable) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SavedVariable.ProtoReflect.Descriptor instead. +func (*SavedVariable) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_saved_object_graph_proto_rawDescGZIP(), []int{8} +} + +func (x *SavedVariable) GetDtype() types_go_proto.DataType { + if x != nil { + return x.Dtype + } + return types_go_proto.DataType(0) +} + +func (x *SavedVariable) GetShape() *tensor_shape_go_proto.TensorShapeProto { + if x != nil { + return x.Shape + } + return nil +} + +func (x *SavedVariable) GetTrainable() bool { + if x != nil { + return x.Trainable + } + return false +} + +func (x *SavedVariable) GetSynchronization() variable_go_proto.VariableSynchronization { + if x != nil { + return x.Synchronization + } + return variable_go_proto.VariableSynchronization(0) +} + +func (x *SavedVariable) GetAggregation() variable_go_proto.VariableAggregation { + if x != nil { + return x.Aggregation + } + return variable_go_proto.VariableAggregation(0) +} + +func (x *SavedVariable) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *SavedVariable) GetDevice() string { + if x != nil { + return x.Device + } + return "" +} + +func (x *SavedVariable) GetExperimentalDistributedVariableComponents() []*SavedVariable { + if x != nil { + return x.ExperimentalDistributedVariableComponents + } + return nil +} + +// Represents `FunctionSpec` used in `Function`. This represents a +// function that has been wrapped as a TensorFlow `Function`. +type FunctionSpec struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Full arg spec from inspect.getfullargspec(). + Fullargspec *StructuredValue `protobuf:"bytes,1,opt,name=fullargspec,proto3" json:"fullargspec,omitempty"` + // Whether this represents a class method. + IsMethod bool `protobuf:"varint,2,opt,name=is_method,json=isMethod,proto3" json:"is_method,omitempty"` + // The input signature, if specified. + InputSignature *StructuredValue `protobuf:"bytes,5,opt,name=input_signature,json=inputSignature,proto3" json:"input_signature,omitempty"` + ExperimentalCompile FunctionSpec_ExperimentalCompile `protobuf:"varint,6,opt,name=experimental_compile,json=experimentalCompile,proto3,enum=tensorflow.FunctionSpec_ExperimentalCompile" json:"experimental_compile,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *FunctionSpec) Reset() { + *x = FunctionSpec{} + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *FunctionSpec) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FunctionSpec) ProtoMessage() {} + +func (x *FunctionSpec) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FunctionSpec.ProtoReflect.Descriptor instead. +func (*FunctionSpec) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_saved_object_graph_proto_rawDescGZIP(), []int{9} +} + +func (x *FunctionSpec) GetFullargspec() *StructuredValue { + if x != nil { + return x.Fullargspec + } + return nil +} + +func (x *FunctionSpec) GetIsMethod() bool { + if x != nil { + return x.IsMethod + } + return false +} + +func (x *FunctionSpec) GetInputSignature() *StructuredValue { + if x != nil { + return x.InputSignature + } + return nil +} + +func (x *FunctionSpec) GetExperimentalCompile() FunctionSpec_ExperimentalCompile { + if x != nil { + return x.ExperimentalCompile + } + return FunctionSpec_DEFAULT +} + +// A SavedResource represents a TF object that holds state during its lifetime. +// An object of this type can have a reference to a: +// create_resource() and an initialize() function. +type SavedResource struct { + state protoimpl.MessageState `protogen:"open.v1"` + // A device specification indicating a required placement for the resource + // creation function, e.g. "CPU". An empty string allows the user to select a + // device. + Device string `protobuf:"bytes,1,opt,name=device,proto3" json:"device,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SavedResource) Reset() { + *x = SavedResource{} + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SavedResource) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SavedResource) ProtoMessage() {} + +func (x *SavedResource) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SavedResource.ProtoReflect.Descriptor instead. +func (*SavedResource) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_saved_object_graph_proto_rawDescGZIP(), []int{10} +} + +func (x *SavedResource) GetDevice() string { + if x != nil { + return x.Device + } + return "" +} + +type SaveableObject struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Node ids of concrete functions for saving and loading from a checkpoint. + SaveFunction int32 `protobuf:"varint,2,opt,name=save_function,json=saveFunction,proto3" json:"save_function,omitempty"` + RestoreFunction int32 `protobuf:"varint,3,opt,name=restore_function,json=restoreFunction,proto3" json:"restore_function,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SaveableObject) Reset() { + *x = SaveableObject{} + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SaveableObject) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SaveableObject) ProtoMessage() {} + +func (x *SaveableObject) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SaveableObject.ProtoReflect.Descriptor instead. +func (*SaveableObject) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_saved_object_graph_proto_rawDescGZIP(), []int{11} +} + +func (x *SaveableObject) GetSaveFunction() int32 { + if x != nil { + return x.SaveFunction + } + return 0 +} + +func (x *SaveableObject) GetRestoreFunction() int32 { + if x != nil { + return x.RestoreFunction + } + return 0 +} + +var File_tensorflow_core_protobuf_saved_object_graph_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_saved_object_graph_proto_rawDesc = "" + + "\n" + + "1tensorflow/core/protobuf/saved_object_graph.proto\x12\n" + + "tensorflow\x1a,tensorflow/core/framework/tensor_shape.proto\x1a%tensorflow/core/framework/types.proto\x1a(tensorflow/core/framework/variable.proto\x1a(tensorflow/core/framework/versions.proto\x1a%tensorflow/core/protobuf/struct.proto\x1a5tensorflow/core/protobuf/trackable_object_graph.proto\"\x8e\x02\n" + + "\x10SavedObjectGraph\x12-\n" + + "\x05nodes\x18\x01 \x03(\v2\x17.tensorflow.SavedObjectR\x05nodes\x12b\n" + + "\x12concrete_functions\x18\x02 \x03(\v23.tensorflow.SavedObjectGraph.ConcreteFunctionsEntryR\x11concreteFunctions\x1ag\n" + + "\x16ConcreteFunctionsEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x127\n" + + "\x05value\x18\x02 \x01(\v2!.tensorflow.SavedConcreteFunctionR\x05value:\x028\x01\"\xe0\x06\n" + + "\vSavedObject\x12\\\n" + + "\bchildren\x18\x01 \x03(\v2@.tensorflow.TrackableObjectGraph.TrackableObject.ObjectReferenceR\bchildren\x12m\n" + + "\x0eslot_variables\x18\x03 \x03(\v2F.tensorflow.TrackableObjectGraph.TrackableObject.SlotVariableReferenceR\rslotVariables\x12>\n" + + "\vuser_object\x18\x04 \x01(\v2\x1b.tensorflow.SavedUserObjectH\x00R\n" + + "userObject\x12.\n" + + "\x05asset\x18\x05 \x01(\v2\x16.tensorflow.SavedAssetH\x00R\x05asset\x127\n" + + "\bfunction\x18\x06 \x01(\v2\x19.tensorflow.SavedFunctionH\x00R\bfunction\x127\n" + + "\bvariable\x18\a \x01(\v2\x19.tensorflow.SavedVariableH\x00R\bvariable\x12]\n" + + "\x16bare_concrete_function\x18\b \x01(\v2%.tensorflow.SavedBareConcreteFunctionH\x00R\x14bareConcreteFunction\x127\n" + + "\bconstant\x18\t \x01(\v2\x19.tensorflow.SavedConstantH\x00R\bconstant\x127\n" + + "\bresource\x18\n" + + " \x01(\v2\x19.tensorflow.SavedResourceH\x00R\bresource\x12W\n" + + "\x10saveable_objects\x18\v \x03(\v2,.tensorflow.SavedObject.SaveableObjectsEntryR\x0fsaveableObjects\x1a^\n" + + "\x14SaveableObjectsEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x120\n" + + "\x05value\x18\x02 \x01(\v2\x1a.tensorflow.SaveableObjectR\x05value:\x028\x01B\x06\n" + + "\x04kindJ\x04\b\x02\x10\x03R\n" + + "attributes\"\x7f\n" + + "\x0fSavedUserObject\x12\x1e\n" + + "\n" + + "identifier\x18\x01 \x01(\tR\n" + + "identifier\x120\n" + + "\aversion\x18\x02 \x01(\v2\x16.tensorflow.VersionDefR\aversion\x12\x1a\n" + + "\bmetadata\x18\x03 \x01(\tR\bmetadata\"=\n" + + "\n" + + "SavedAsset\x12/\n" + + "\x14asset_file_def_index\x18\x01 \x01(\x05R\x11assetFileDefIndex\"}\n" + + "\rSavedFunction\x12-\n" + + "\x12concrete_functions\x18\x01 \x03(\tR\x11concreteFunctions\x12=\n" + + "\rfunction_spec\x18\x02 \x01(\v2\x18.tensorflow.FunctionSpecR\ffunctionSpec\"\xe3\x01\n" + + "\x15SavedConcreteFunction\x12!\n" + + "\fbound_inputs\x18\x02 \x03(\x05R\vboundInputs\x12_\n" + + "\x1dcanonicalized_input_signature\x18\x03 \x01(\v2\x1b.tensorflow.StructuredValueR\x1bcanonicalizedInputSignature\x12F\n" + + "\x10output_signature\x18\x04 \x01(\v2\x1b.tensorflow.StructuredValueR\x0foutputSignature\"\xff\x01\n" + + "\x19SavedBareConcreteFunction\x124\n" + + "\x16concrete_function_name\x18\x01 \x01(\tR\x14concreteFunctionName\x12+\n" + + "\x11argument_keywords\x18\x02 \x03(\tR\x10argumentKeywords\x12@\n" + + "\x1callowed_positional_arguments\x18\x03 \x01(\x03R\x1aallowedPositionalArguments\x12=\n" + + "\rfunction_spec\x18\x04 \x01(\v2\x18.tensorflow.FunctionSpecR\ffunctionSpec\"-\n" + + "\rSavedConstant\x12\x1c\n" + + "\toperation\x18\x01 \x01(\tR\toperation\"\xc7\x03\n" + + "\rSavedVariable\x12*\n" + + "\x05dtype\x18\x01 \x01(\x0e2\x14.tensorflow.DataTypeR\x05dtype\x122\n" + + "\x05shape\x18\x02 \x01(\v2\x1c.tensorflow.TensorShapeProtoR\x05shape\x12\x1c\n" + + "\ttrainable\x18\x03 \x01(\bR\ttrainable\x12M\n" + + "\x0fsynchronization\x18\x04 \x01(\x0e2#.tensorflow.VariableSynchronizationR\x0fsynchronization\x12A\n" + + "\vaggregation\x18\x05 \x01(\x0e2\x1f.tensorflow.VariableAggregationR\vaggregation\x12\x12\n" + + "\x04name\x18\x06 \x01(\tR\x04name\x12\x16\n" + + "\x06device\x18\a \x01(\tR\x06device\x12z\n" + + ",experimental_distributed_variable_components\x18\b \x03(\v2\x19.tensorflow.SavedVariableR)experimentalDistributedVariableComponents\"\xd2\x02\n" + + "\fFunctionSpec\x12=\n" + + "\vfullargspec\x18\x01 \x01(\v2\x1b.tensorflow.StructuredValueR\vfullargspec\x12\x1b\n" + + "\tis_method\x18\x02 \x01(\bR\bisMethod\x12D\n" + + "\x0finput_signature\x18\x05 \x01(\v2\x1b.tensorflow.StructuredValueR\x0einputSignature\x12_\n" + + "\x14experimental_compile\x18\x06 \x01(\x0e2,.tensorflow.FunctionSpec.ExperimentalCompileR\x13experimentalCompile\"3\n" + + "\x13ExperimentalCompile\x12\v\n" + + "\aDEFAULT\x10\x00\x12\x06\n" + + "\x02ON\x10\x01\x12\a\n" + + "\x03OFF\x10\x02J\x04\b\x03\x10\x04J\x04\b\x04\x10\x05\"'\n" + + "\rSavedResource\x12\x16\n" + + "\x06device\x18\x01 \x01(\tR\x06device\"`\n" + + "\x0eSaveableObject\x12#\n" + + "\rsave_function\x18\x02 \x01(\x05R\fsaveFunction\x12)\n" + + "\x10restore_function\x18\x03 \x01(\x05R\x0frestoreFunctionBZZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_saved_object_graph_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_saved_object_graph_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_saved_object_graph_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_saved_object_graph_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_saved_object_graph_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_saved_object_graph_proto_rawDesc), len(file_tensorflow_core_protobuf_saved_object_graph_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_saved_object_graph_proto_rawDescData +} + +var file_tensorflow_core_protobuf_saved_object_graph_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes = make([]protoimpl.MessageInfo, 14) +var file_tensorflow_core_protobuf_saved_object_graph_proto_goTypes = []any{ + (FunctionSpec_ExperimentalCompile)(0), // 0: tensorflow.FunctionSpec.ExperimentalCompile + (*SavedObjectGraph)(nil), // 1: tensorflow.SavedObjectGraph + (*SavedObject)(nil), // 2: tensorflow.SavedObject + (*SavedUserObject)(nil), // 3: tensorflow.SavedUserObject + (*SavedAsset)(nil), // 4: tensorflow.SavedAsset + (*SavedFunction)(nil), // 5: tensorflow.SavedFunction + (*SavedConcreteFunction)(nil), // 6: tensorflow.SavedConcreteFunction + (*SavedBareConcreteFunction)(nil), // 7: tensorflow.SavedBareConcreteFunction + (*SavedConstant)(nil), // 8: tensorflow.SavedConstant + (*SavedVariable)(nil), // 9: tensorflow.SavedVariable + (*FunctionSpec)(nil), // 10: tensorflow.FunctionSpec + (*SavedResource)(nil), // 11: tensorflow.SavedResource + (*SaveableObject)(nil), // 12: tensorflow.SaveableObject + nil, // 13: tensorflow.SavedObjectGraph.ConcreteFunctionsEntry + nil, // 14: tensorflow.SavedObject.SaveableObjectsEntry + (*TrackableObjectGraph_TrackableObject_ObjectReference)(nil), // 15: tensorflow.TrackableObjectGraph.TrackableObject.ObjectReference + (*TrackableObjectGraph_TrackableObject_SlotVariableReference)(nil), // 16: tensorflow.TrackableObjectGraph.TrackableObject.SlotVariableReference + (*versions_go_proto.VersionDef)(nil), // 17: tensorflow.VersionDef + (*StructuredValue)(nil), // 18: tensorflow.StructuredValue + (types_go_proto.DataType)(0), // 19: tensorflow.DataType + (*tensor_shape_go_proto.TensorShapeProto)(nil), // 20: tensorflow.TensorShapeProto + (variable_go_proto.VariableSynchronization)(0), // 21: tensorflow.VariableSynchronization + (variable_go_proto.VariableAggregation)(0), // 22: tensorflow.VariableAggregation +} +var file_tensorflow_core_protobuf_saved_object_graph_proto_depIdxs = []int32{ + 2, // 0: tensorflow.SavedObjectGraph.nodes:type_name -> tensorflow.SavedObject + 13, // 1: tensorflow.SavedObjectGraph.concrete_functions:type_name -> tensorflow.SavedObjectGraph.ConcreteFunctionsEntry + 15, // 2: tensorflow.SavedObject.children:type_name -> tensorflow.TrackableObjectGraph.TrackableObject.ObjectReference + 16, // 3: tensorflow.SavedObject.slot_variables:type_name -> tensorflow.TrackableObjectGraph.TrackableObject.SlotVariableReference + 3, // 4: tensorflow.SavedObject.user_object:type_name -> tensorflow.SavedUserObject + 4, // 5: tensorflow.SavedObject.asset:type_name -> tensorflow.SavedAsset + 5, // 6: tensorflow.SavedObject.function:type_name -> tensorflow.SavedFunction + 9, // 7: tensorflow.SavedObject.variable:type_name -> tensorflow.SavedVariable + 7, // 8: tensorflow.SavedObject.bare_concrete_function:type_name -> tensorflow.SavedBareConcreteFunction + 8, // 9: tensorflow.SavedObject.constant:type_name -> tensorflow.SavedConstant + 11, // 10: tensorflow.SavedObject.resource:type_name -> tensorflow.SavedResource + 14, // 11: tensorflow.SavedObject.saveable_objects:type_name -> tensorflow.SavedObject.SaveableObjectsEntry + 17, // 12: tensorflow.SavedUserObject.version:type_name -> tensorflow.VersionDef + 10, // 13: tensorflow.SavedFunction.function_spec:type_name -> tensorflow.FunctionSpec + 18, // 14: tensorflow.SavedConcreteFunction.canonicalized_input_signature:type_name -> tensorflow.StructuredValue + 18, // 15: tensorflow.SavedConcreteFunction.output_signature:type_name -> tensorflow.StructuredValue + 10, // 16: tensorflow.SavedBareConcreteFunction.function_spec:type_name -> tensorflow.FunctionSpec + 19, // 17: tensorflow.SavedVariable.dtype:type_name -> tensorflow.DataType + 20, // 18: tensorflow.SavedVariable.shape:type_name -> tensorflow.TensorShapeProto + 21, // 19: tensorflow.SavedVariable.synchronization:type_name -> tensorflow.VariableSynchronization + 22, // 20: tensorflow.SavedVariable.aggregation:type_name -> tensorflow.VariableAggregation + 9, // 21: tensorflow.SavedVariable.experimental_distributed_variable_components:type_name -> tensorflow.SavedVariable + 18, // 22: tensorflow.FunctionSpec.fullargspec:type_name -> tensorflow.StructuredValue + 18, // 23: tensorflow.FunctionSpec.input_signature:type_name -> tensorflow.StructuredValue + 0, // 24: tensorflow.FunctionSpec.experimental_compile:type_name -> tensorflow.FunctionSpec.ExperimentalCompile + 6, // 25: tensorflow.SavedObjectGraph.ConcreteFunctionsEntry.value:type_name -> tensorflow.SavedConcreteFunction + 12, // 26: tensorflow.SavedObject.SaveableObjectsEntry.value:type_name -> tensorflow.SaveableObject + 27, // [27:27] is the sub-list for method output_type + 27, // [27:27] is the sub-list for method input_type + 27, // [27:27] is the sub-list for extension type_name + 27, // [27:27] is the sub-list for extension extendee + 0, // [0:27] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_saved_object_graph_proto_init() } +func file_tensorflow_core_protobuf_saved_object_graph_proto_init() { + if File_tensorflow_core_protobuf_saved_object_graph_proto != nil { + return + } + file_tensorflow_core_protobuf_struct_proto_init() + file_tensorflow_core_protobuf_trackable_object_graph_proto_init() + file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[1].OneofWrappers = []any{ + (*SavedObject_UserObject)(nil), + (*SavedObject_Asset)(nil), + (*SavedObject_Function)(nil), + (*SavedObject_Variable)(nil), + (*SavedObject_BareConcreteFunction)(nil), + (*SavedObject_Constant)(nil), + (*SavedObject_Resource)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_saved_object_graph_proto_rawDesc), len(file_tensorflow_core_protobuf_saved_object_graph_proto_rawDesc)), + NumEnums: 1, + NumMessages: 14, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_saved_object_graph_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_saved_object_graph_proto_depIdxs, + EnumInfos: file_tensorflow_core_protobuf_saved_object_graph_proto_enumTypes, + MessageInfos: file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_saved_object_graph_proto = out.File + file_tensorflow_core_protobuf_saved_object_graph_proto_goTypes = nil + file_tensorflow_core_protobuf_saved_object_graph_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/saver.pb.go b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/saver.pb.go new file mode 100644 index 0000000..82c6b2a --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/saver.pb.go @@ -0,0 +1,254 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/saver.proto + +package for_core_protos_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// A version number that identifies a different on-disk checkpoint format. +// Usually, each subclass of BaseSaverBuilder works with a particular +// version/format. However, it is possible that the same builder may be +// upgraded to support a newer checkpoint format in the future. +type SaverDef_CheckpointFormatVersion int32 + +const ( + // Internal legacy format. + SaverDef_LEGACY SaverDef_CheckpointFormatVersion = 0 + // Deprecated format: tf.Saver() which works with tensorflow::table::Table. + SaverDef_V1 SaverDef_CheckpointFormatVersion = 1 + // Current format: more efficient. + SaverDef_V2 SaverDef_CheckpointFormatVersion = 2 +) + +// Enum value maps for SaverDef_CheckpointFormatVersion. +var ( + SaverDef_CheckpointFormatVersion_name = map[int32]string{ + 0: "LEGACY", + 1: "V1", + 2: "V2", + } + SaverDef_CheckpointFormatVersion_value = map[string]int32{ + "LEGACY": 0, + "V1": 1, + "V2": 2, + } +) + +func (x SaverDef_CheckpointFormatVersion) Enum() *SaverDef_CheckpointFormatVersion { + p := new(SaverDef_CheckpointFormatVersion) + *p = x + return p +} + +func (x SaverDef_CheckpointFormatVersion) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (SaverDef_CheckpointFormatVersion) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_protobuf_saver_proto_enumTypes[0].Descriptor() +} + +func (SaverDef_CheckpointFormatVersion) Type() protoreflect.EnumType { + return &file_tensorflow_core_protobuf_saver_proto_enumTypes[0] +} + +func (x SaverDef_CheckpointFormatVersion) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use SaverDef_CheckpointFormatVersion.Descriptor instead. +func (SaverDef_CheckpointFormatVersion) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_saver_proto_rawDescGZIP(), []int{0, 0} +} + +// Protocol buffer representing the configuration of a Saver. +type SaverDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The name of the tensor in which to specify the filename when saving or + // restoring a model checkpoint. + FilenameTensorName string `protobuf:"bytes,1,opt,name=filename_tensor_name,json=filenameTensorName,proto3" json:"filename_tensor_name,omitempty"` + // The operation to run when saving a model checkpoint. + SaveTensorName string `protobuf:"bytes,2,opt,name=save_tensor_name,json=saveTensorName,proto3" json:"save_tensor_name,omitempty"` + // The operation to run when restoring a model checkpoint. + RestoreOpName string `protobuf:"bytes,3,opt,name=restore_op_name,json=restoreOpName,proto3" json:"restore_op_name,omitempty"` + // Maximum number of checkpoints to keep. If 0, no checkpoints are deleted. + MaxToKeep int32 `protobuf:"varint,4,opt,name=max_to_keep,json=maxToKeep,proto3" json:"max_to_keep,omitempty"` + // Shard the save files, one per device that has Variable nodes. + Sharded bool `protobuf:"varint,5,opt,name=sharded,proto3" json:"sharded,omitempty"` + // How often to keep an additional checkpoint. If not specified, only the last + // "max_to_keep" checkpoints are kept; if specified, in addition to keeping + // the last "max_to_keep" checkpoints, an additional checkpoint will be kept + // for every n hours of training. + KeepCheckpointEveryNHours float32 `protobuf:"fixed32,6,opt,name=keep_checkpoint_every_n_hours,json=keepCheckpointEveryNHours,proto3" json:"keep_checkpoint_every_n_hours,omitempty"` + Version SaverDef_CheckpointFormatVersion `protobuf:"varint,7,opt,name=version,proto3,enum=tensorflow.SaverDef_CheckpointFormatVersion" json:"version,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SaverDef) Reset() { + *x = SaverDef{} + mi := &file_tensorflow_core_protobuf_saver_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SaverDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SaverDef) ProtoMessage() {} + +func (x *SaverDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_saver_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SaverDef.ProtoReflect.Descriptor instead. +func (*SaverDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_saver_proto_rawDescGZIP(), []int{0} +} + +func (x *SaverDef) GetFilenameTensorName() string { + if x != nil { + return x.FilenameTensorName + } + return "" +} + +func (x *SaverDef) GetSaveTensorName() string { + if x != nil { + return x.SaveTensorName + } + return "" +} + +func (x *SaverDef) GetRestoreOpName() string { + if x != nil { + return x.RestoreOpName + } + return "" +} + +func (x *SaverDef) GetMaxToKeep() int32 { + if x != nil { + return x.MaxToKeep + } + return 0 +} + +func (x *SaverDef) GetSharded() bool { + if x != nil { + return x.Sharded + } + return false +} + +func (x *SaverDef) GetKeepCheckpointEveryNHours() float32 { + if x != nil { + return x.KeepCheckpointEveryNHours + } + return 0 +} + +func (x *SaverDef) GetVersion() SaverDef_CheckpointFormatVersion { + if x != nil { + return x.Version + } + return SaverDef_LEGACY +} + +var File_tensorflow_core_protobuf_saver_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_saver_proto_rawDesc = "" + + "\n" + + "$tensorflow/core/protobuf/saver.proto\x12\n" + + "tensorflow\"\x89\x03\n" + + "\bSaverDef\x120\n" + + "\x14filename_tensor_name\x18\x01 \x01(\tR\x12filenameTensorName\x12(\n" + + "\x10save_tensor_name\x18\x02 \x01(\tR\x0esaveTensorName\x12&\n" + + "\x0frestore_op_name\x18\x03 \x01(\tR\rrestoreOpName\x12\x1e\n" + + "\vmax_to_keep\x18\x04 \x01(\x05R\tmaxToKeep\x12\x18\n" + + "\asharded\x18\x05 \x01(\bR\asharded\x12@\n" + + "\x1dkeep_checkpoint_every_n_hours\x18\x06 \x01(\x02R\x19keepCheckpointEveryNHours\x12F\n" + + "\aversion\x18\a \x01(\x0e2,.tensorflow.SaverDef.CheckpointFormatVersionR\aversion\"5\n" + + "\x17CheckpointFormatVersion\x12\n" + + "\n" + + "\x06LEGACY\x10\x00\x12\x06\n" + + "\x02V1\x10\x01\x12\x06\n" + + "\x02V2\x10\x02B~\n" + + "\x13org.tensorflow.utilB\vSaverProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_saver_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_saver_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_saver_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_saver_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_saver_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_saver_proto_rawDesc), len(file_tensorflow_core_protobuf_saver_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_saver_proto_rawDescData +} + +var file_tensorflow_core_protobuf_saver_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_tensorflow_core_protobuf_saver_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_tensorflow_core_protobuf_saver_proto_goTypes = []any{ + (SaverDef_CheckpointFormatVersion)(0), // 0: tensorflow.SaverDef.CheckpointFormatVersion + (*SaverDef)(nil), // 1: tensorflow.SaverDef +} +var file_tensorflow_core_protobuf_saver_proto_depIdxs = []int32{ + 0, // 0: tensorflow.SaverDef.version:type_name -> tensorflow.SaverDef.CheckpointFormatVersion + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_saver_proto_init() } +func file_tensorflow_core_protobuf_saver_proto_init() { + if File_tensorflow_core_protobuf_saver_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_saver_proto_rawDesc), len(file_tensorflow_core_protobuf_saver_proto_rawDesc)), + NumEnums: 1, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_saver_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_saver_proto_depIdxs, + EnumInfos: file_tensorflow_core_protobuf_saver_proto_enumTypes, + MessageInfos: file_tensorflow_core_protobuf_saver_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_saver_proto = out.File + file_tensorflow_core_protobuf_saver_proto_goTypes = nil + file_tensorflow_core_protobuf_saver_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/struct.pb.go b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/struct.pb.go new file mode 100644 index 0000000..c823e05 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/struct.pb.go @@ -0,0 +1,1083 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/struct.proto + +package for_core_protos_go_proto + +import ( + tensor_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_go_proto" + tensor_shape_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_shape_go_proto" + types_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/types_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type TypeSpecProto_TypeSpecClass int32 + +const ( + TypeSpecProto_UNKNOWN TypeSpecProto_TypeSpecClass = 0 + TypeSpecProto_SPARSE_TENSOR_SPEC TypeSpecProto_TypeSpecClass = 1 // tf.SparseTensorSpec + TypeSpecProto_INDEXED_SLICES_SPEC TypeSpecProto_TypeSpecClass = 2 // tf.IndexedSlicesSpec + TypeSpecProto_RAGGED_TENSOR_SPEC TypeSpecProto_TypeSpecClass = 3 // tf.RaggedTensorSpec + TypeSpecProto_TENSOR_ARRAY_SPEC TypeSpecProto_TypeSpecClass = 4 // tf.TensorArraySpec + TypeSpecProto_DATA_DATASET_SPEC TypeSpecProto_TypeSpecClass = 5 // tf.data.DatasetSpec + TypeSpecProto_DATA_ITERATOR_SPEC TypeSpecProto_TypeSpecClass = 6 // IteratorSpec from data/ops/iterator_ops.py + TypeSpecProto_OPTIONAL_SPEC TypeSpecProto_TypeSpecClass = 7 // tf.OptionalSpec + TypeSpecProto_PER_REPLICA_SPEC TypeSpecProto_TypeSpecClass = 8 // PerReplicaSpec from distribute/values.py + TypeSpecProto_VARIABLE_SPEC TypeSpecProto_TypeSpecClass = 9 // tf.VariableSpec + TypeSpecProto_ROW_PARTITION_SPEC TypeSpecProto_TypeSpecClass = 10 // RowPartitionSpec from ragged/row_partition.py + TypeSpecProto_NDARRAY_SPEC TypeSpecProto_TypeSpecClass = 11 // TF Numpy NDarray spec +) + +// Enum value maps for TypeSpecProto_TypeSpecClass. +var ( + TypeSpecProto_TypeSpecClass_name = map[int32]string{ + 0: "UNKNOWN", + 1: "SPARSE_TENSOR_SPEC", + 2: "INDEXED_SLICES_SPEC", + 3: "RAGGED_TENSOR_SPEC", + 4: "TENSOR_ARRAY_SPEC", + 5: "DATA_DATASET_SPEC", + 6: "DATA_ITERATOR_SPEC", + 7: "OPTIONAL_SPEC", + 8: "PER_REPLICA_SPEC", + 9: "VARIABLE_SPEC", + 10: "ROW_PARTITION_SPEC", + 11: "NDARRAY_SPEC", + } + TypeSpecProto_TypeSpecClass_value = map[string]int32{ + "UNKNOWN": 0, + "SPARSE_TENSOR_SPEC": 1, + "INDEXED_SLICES_SPEC": 2, + "RAGGED_TENSOR_SPEC": 3, + "TENSOR_ARRAY_SPEC": 4, + "DATA_DATASET_SPEC": 5, + "DATA_ITERATOR_SPEC": 6, + "OPTIONAL_SPEC": 7, + "PER_REPLICA_SPEC": 8, + "VARIABLE_SPEC": 9, + "ROW_PARTITION_SPEC": 10, + "NDARRAY_SPEC": 11, + } +) + +func (x TypeSpecProto_TypeSpecClass) Enum() *TypeSpecProto_TypeSpecClass { + p := new(TypeSpecProto_TypeSpecClass) + *p = x + return p +} + +func (x TypeSpecProto_TypeSpecClass) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (TypeSpecProto_TypeSpecClass) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_protobuf_struct_proto_enumTypes[0].Descriptor() +} + +func (TypeSpecProto_TypeSpecClass) Type() protoreflect.EnumType { + return &file_tensorflow_core_protobuf_struct_proto_enumTypes[0] +} + +func (x TypeSpecProto_TypeSpecClass) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use TypeSpecProto_TypeSpecClass.Descriptor instead. +func (TypeSpecProto_TypeSpecClass) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_struct_proto_rawDescGZIP(), []int{9, 0} +} + +// `StructuredValue` represents a dynamically typed value representing various +// data structures that are inspired by Python data structures typically used in +// TensorFlow functions as inputs and outputs. +// +// For example when saving a Layer there may be a `training` argument. If the +// user passes a boolean True/False, that switches between two concrete +// TensorFlow functions. In order to switch between them in the same way after +// loading the SavedModel, we need to represent "True" and "False". +// +// A more advanced example might be a function which takes a list of +// dictionaries mapping from strings to Tensors. In order to map from +// user-specified arguments `[{"a": tf.constant(1.)}, {"q": tf.constant(3.)}]` +// after load to the right saved TensorFlow function, we need to represent the +// nested structure and the strings, recording that we have a trace for anything +// matching `[{"a": tf.TensorSpec(None, tf.float32)}, {"q": tf.TensorSpec([], +// tf.float64)}]` as an example. +// +// Likewise functions may return nested structures of Tensors, for example +// returning a dictionary mapping from strings to Tensors. In order for the +// loaded function to return the same structure we need to serialize it. +// +// This is an ergonomic aid for working with loaded SavedModels, not a promise +// to serialize all possible function signatures. For example we do not expect +// to pickle generic Python objects, and ideally we'd stay language-agnostic. +type StructuredValue struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The kind of value. + // + // Types that are valid to be assigned to Kind: + // + // *StructuredValue_NoneValue + // *StructuredValue_Float64Value + // *StructuredValue_Int64Value + // *StructuredValue_StringValue + // *StructuredValue_BoolValue + // *StructuredValue_TensorShapeValue + // *StructuredValue_TensorDtypeValue + // *StructuredValue_TensorSpecValue + // *StructuredValue_TypeSpecValue + // *StructuredValue_BoundedTensorSpecValue + // *StructuredValue_ListValue + // *StructuredValue_TupleValue + // *StructuredValue_DictValue + // *StructuredValue_NamedTupleValue + Kind isStructuredValue_Kind `protobuf_oneof:"kind"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *StructuredValue) Reset() { + *x = StructuredValue{} + mi := &file_tensorflow_core_protobuf_struct_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *StructuredValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StructuredValue) ProtoMessage() {} + +func (x *StructuredValue) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_struct_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StructuredValue.ProtoReflect.Descriptor instead. +func (*StructuredValue) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_struct_proto_rawDescGZIP(), []int{0} +} + +func (x *StructuredValue) GetKind() isStructuredValue_Kind { + if x != nil { + return x.Kind + } + return nil +} + +func (x *StructuredValue) GetNoneValue() *NoneValue { + if x != nil { + if x, ok := x.Kind.(*StructuredValue_NoneValue); ok { + return x.NoneValue + } + } + return nil +} + +func (x *StructuredValue) GetFloat64Value() float64 { + if x != nil { + if x, ok := x.Kind.(*StructuredValue_Float64Value); ok { + return x.Float64Value + } + } + return 0 +} + +func (x *StructuredValue) GetInt64Value() int64 { + if x != nil { + if x, ok := x.Kind.(*StructuredValue_Int64Value); ok { + return x.Int64Value + } + } + return 0 +} + +func (x *StructuredValue) GetStringValue() string { + if x != nil { + if x, ok := x.Kind.(*StructuredValue_StringValue); ok { + return x.StringValue + } + } + return "" +} + +func (x *StructuredValue) GetBoolValue() bool { + if x != nil { + if x, ok := x.Kind.(*StructuredValue_BoolValue); ok { + return x.BoolValue + } + } + return false +} + +func (x *StructuredValue) GetTensorShapeValue() *tensor_shape_go_proto.TensorShapeProto { + if x != nil { + if x, ok := x.Kind.(*StructuredValue_TensorShapeValue); ok { + return x.TensorShapeValue + } + } + return nil +} + +func (x *StructuredValue) GetTensorDtypeValue() types_go_proto.DataType { + if x != nil { + if x, ok := x.Kind.(*StructuredValue_TensorDtypeValue); ok { + return x.TensorDtypeValue + } + } + return types_go_proto.DataType(0) +} + +func (x *StructuredValue) GetTensorSpecValue() *TensorSpecProto { + if x != nil { + if x, ok := x.Kind.(*StructuredValue_TensorSpecValue); ok { + return x.TensorSpecValue + } + } + return nil +} + +func (x *StructuredValue) GetTypeSpecValue() *TypeSpecProto { + if x != nil { + if x, ok := x.Kind.(*StructuredValue_TypeSpecValue); ok { + return x.TypeSpecValue + } + } + return nil +} + +func (x *StructuredValue) GetBoundedTensorSpecValue() *BoundedTensorSpecProto { + if x != nil { + if x, ok := x.Kind.(*StructuredValue_BoundedTensorSpecValue); ok { + return x.BoundedTensorSpecValue + } + } + return nil +} + +func (x *StructuredValue) GetListValue() *ListValue { + if x != nil { + if x, ok := x.Kind.(*StructuredValue_ListValue); ok { + return x.ListValue + } + } + return nil +} + +func (x *StructuredValue) GetTupleValue() *TupleValue { + if x != nil { + if x, ok := x.Kind.(*StructuredValue_TupleValue); ok { + return x.TupleValue + } + } + return nil +} + +func (x *StructuredValue) GetDictValue() *DictValue { + if x != nil { + if x, ok := x.Kind.(*StructuredValue_DictValue); ok { + return x.DictValue + } + } + return nil +} + +func (x *StructuredValue) GetNamedTupleValue() *NamedTupleValue { + if x != nil { + if x, ok := x.Kind.(*StructuredValue_NamedTupleValue); ok { + return x.NamedTupleValue + } + } + return nil +} + +type isStructuredValue_Kind interface { + isStructuredValue_Kind() +} + +type StructuredValue_NoneValue struct { + // Represents None. + NoneValue *NoneValue `protobuf:"bytes,1,opt,name=none_value,json=noneValue,proto3,oneof"` +} + +type StructuredValue_Float64Value struct { + // Represents a double-precision floating-point value (a Python `float`). + Float64Value float64 `protobuf:"fixed64,11,opt,name=float64_value,json=float64Value,proto3,oneof"` +} + +type StructuredValue_Int64Value struct { + // Represents a signed integer value, limited to 64 bits. + // Larger values from Python's arbitrary-precision integers are unsupported. + Int64Value int64 `protobuf:"zigzag64,12,opt,name=int64_value,json=int64Value,proto3,oneof"` +} + +type StructuredValue_StringValue struct { + // Represents a string of Unicode characters stored in a Python `str`. + // In Python 3, this is exactly what type `str` is. + // In Python 2, this is the UTF-8 encoding of the characters. + // For strings with ASCII characters only (as often used in TensorFlow code) + // there is effectively no difference between the language versions. + // The obsolescent `unicode` type of Python 2 is not supported here. + StringValue string `protobuf:"bytes,13,opt,name=string_value,json=stringValue,proto3,oneof"` +} + +type StructuredValue_BoolValue struct { + // Represents a boolean value. + BoolValue bool `protobuf:"varint,14,opt,name=bool_value,json=boolValue,proto3,oneof"` +} + +type StructuredValue_TensorShapeValue struct { + // Represents a TensorShape. + TensorShapeValue *tensor_shape_go_proto.TensorShapeProto `protobuf:"bytes,31,opt,name=tensor_shape_value,json=tensorShapeValue,proto3,oneof"` +} + +type StructuredValue_TensorDtypeValue struct { + // Represents an enum value for dtype. + TensorDtypeValue types_go_proto.DataType `protobuf:"varint,32,opt,name=tensor_dtype_value,json=tensorDtypeValue,proto3,enum=tensorflow.DataType,oneof"` +} + +type StructuredValue_TensorSpecValue struct { + // Represents a value for tf.TensorSpec. + TensorSpecValue *TensorSpecProto `protobuf:"bytes,33,opt,name=tensor_spec_value,json=tensorSpecValue,proto3,oneof"` +} + +type StructuredValue_TypeSpecValue struct { + // Represents a value for tf.TypeSpec. + TypeSpecValue *TypeSpecProto `protobuf:"bytes,34,opt,name=type_spec_value,json=typeSpecValue,proto3,oneof"` +} + +type StructuredValue_BoundedTensorSpecValue struct { + // Represents a value for tf.BoundedTensorSpec. + BoundedTensorSpecValue *BoundedTensorSpecProto `protobuf:"bytes,35,opt,name=bounded_tensor_spec_value,json=boundedTensorSpecValue,proto3,oneof"` +} + +type StructuredValue_ListValue struct { + // Represents a list of `Value`. + ListValue *ListValue `protobuf:"bytes,51,opt,name=list_value,json=listValue,proto3,oneof"` +} + +type StructuredValue_TupleValue struct { + // Represents a tuple of `Value`. + TupleValue *TupleValue `protobuf:"bytes,52,opt,name=tuple_value,json=tupleValue,proto3,oneof"` +} + +type StructuredValue_DictValue struct { + // Represents a dict `Value`. + DictValue *DictValue `protobuf:"bytes,53,opt,name=dict_value,json=dictValue,proto3,oneof"` +} + +type StructuredValue_NamedTupleValue struct { + // Represents Python's namedtuple. + NamedTupleValue *NamedTupleValue `protobuf:"bytes,54,opt,name=named_tuple_value,json=namedTupleValue,proto3,oneof"` +} + +func (*StructuredValue_NoneValue) isStructuredValue_Kind() {} + +func (*StructuredValue_Float64Value) isStructuredValue_Kind() {} + +func (*StructuredValue_Int64Value) isStructuredValue_Kind() {} + +func (*StructuredValue_StringValue) isStructuredValue_Kind() {} + +func (*StructuredValue_BoolValue) isStructuredValue_Kind() {} + +func (*StructuredValue_TensorShapeValue) isStructuredValue_Kind() {} + +func (*StructuredValue_TensorDtypeValue) isStructuredValue_Kind() {} + +func (*StructuredValue_TensorSpecValue) isStructuredValue_Kind() {} + +func (*StructuredValue_TypeSpecValue) isStructuredValue_Kind() {} + +func (*StructuredValue_BoundedTensorSpecValue) isStructuredValue_Kind() {} + +func (*StructuredValue_ListValue) isStructuredValue_Kind() {} + +func (*StructuredValue_TupleValue) isStructuredValue_Kind() {} + +func (*StructuredValue_DictValue) isStructuredValue_Kind() {} + +func (*StructuredValue_NamedTupleValue) isStructuredValue_Kind() {} + +// Represents None. +type NoneValue struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NoneValue) Reset() { + *x = NoneValue{} + mi := &file_tensorflow_core_protobuf_struct_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NoneValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NoneValue) ProtoMessage() {} + +func (x *NoneValue) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_struct_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NoneValue.ProtoReflect.Descriptor instead. +func (*NoneValue) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_struct_proto_rawDescGZIP(), []int{1} +} + +// Represents a Python list. +type ListValue struct { + state protoimpl.MessageState `protogen:"open.v1"` + Values []*StructuredValue `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListValue) Reset() { + *x = ListValue{} + mi := &file_tensorflow_core_protobuf_struct_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListValue) ProtoMessage() {} + +func (x *ListValue) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_struct_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListValue.ProtoReflect.Descriptor instead. +func (*ListValue) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_struct_proto_rawDescGZIP(), []int{2} +} + +func (x *ListValue) GetValues() []*StructuredValue { + if x != nil { + return x.Values + } + return nil +} + +// Represents a Python tuple. +type TupleValue struct { + state protoimpl.MessageState `protogen:"open.v1"` + Values []*StructuredValue `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TupleValue) Reset() { + *x = TupleValue{} + mi := &file_tensorflow_core_protobuf_struct_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TupleValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TupleValue) ProtoMessage() {} + +func (x *TupleValue) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_struct_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TupleValue.ProtoReflect.Descriptor instead. +func (*TupleValue) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_struct_proto_rawDescGZIP(), []int{3} +} + +func (x *TupleValue) GetValues() []*StructuredValue { + if x != nil { + return x.Values + } + return nil +} + +// Represents a Python dict keyed by `str`. +// The comment on Unicode from Value.string_value applies analogously. +type DictValue struct { + state protoimpl.MessageState `protogen:"open.v1"` + Fields map[string]*StructuredValue `protobuf:"bytes,1,rep,name=fields,proto3" json:"fields,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DictValue) Reset() { + *x = DictValue{} + mi := &file_tensorflow_core_protobuf_struct_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DictValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DictValue) ProtoMessage() {} + +func (x *DictValue) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_struct_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DictValue.ProtoReflect.Descriptor instead. +func (*DictValue) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_struct_proto_rawDescGZIP(), []int{4} +} + +func (x *DictValue) GetFields() map[string]*StructuredValue { + if x != nil { + return x.Fields + } + return nil +} + +// Represents a (key, value) pair. +type PairValue struct { + state protoimpl.MessageState `protogen:"open.v1"` + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Value *StructuredValue `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PairValue) Reset() { + *x = PairValue{} + mi := &file_tensorflow_core_protobuf_struct_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PairValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PairValue) ProtoMessage() {} + +func (x *PairValue) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_struct_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PairValue.ProtoReflect.Descriptor instead. +func (*PairValue) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_struct_proto_rawDescGZIP(), []int{5} +} + +func (x *PairValue) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *PairValue) GetValue() *StructuredValue { + if x != nil { + return x.Value + } + return nil +} + +// Represents Python's namedtuple. +type NamedTupleValue struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Values []*PairValue `protobuf:"bytes,2,rep,name=values,proto3" json:"values,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NamedTupleValue) Reset() { + *x = NamedTupleValue{} + mi := &file_tensorflow_core_protobuf_struct_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NamedTupleValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NamedTupleValue) ProtoMessage() {} + +func (x *NamedTupleValue) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_struct_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NamedTupleValue.ProtoReflect.Descriptor instead. +func (*NamedTupleValue) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_struct_proto_rawDescGZIP(), []int{6} +} + +func (x *NamedTupleValue) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *NamedTupleValue) GetValues() []*PairValue { + if x != nil { + return x.Values + } + return nil +} + +// A protobuf to represent tf.TensorSpec. +type TensorSpecProto struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Shape *tensor_shape_go_proto.TensorShapeProto `protobuf:"bytes,2,opt,name=shape,proto3" json:"shape,omitempty"` + Dtype types_go_proto.DataType `protobuf:"varint,3,opt,name=dtype,proto3,enum=tensorflow.DataType" json:"dtype,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TensorSpecProto) Reset() { + *x = TensorSpecProto{} + mi := &file_tensorflow_core_protobuf_struct_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TensorSpecProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TensorSpecProto) ProtoMessage() {} + +func (x *TensorSpecProto) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_struct_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TensorSpecProto.ProtoReflect.Descriptor instead. +func (*TensorSpecProto) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_struct_proto_rawDescGZIP(), []int{7} +} + +func (x *TensorSpecProto) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *TensorSpecProto) GetShape() *tensor_shape_go_proto.TensorShapeProto { + if x != nil { + return x.Shape + } + return nil +} + +func (x *TensorSpecProto) GetDtype() types_go_proto.DataType { + if x != nil { + return x.Dtype + } + return types_go_proto.DataType(0) +} + +// A protobuf to represent tf.BoundedTensorSpec. +type BoundedTensorSpecProto struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Shape *tensor_shape_go_proto.TensorShapeProto `protobuf:"bytes,2,opt,name=shape,proto3" json:"shape,omitempty"` + Dtype types_go_proto.DataType `protobuf:"varint,3,opt,name=dtype,proto3,enum=tensorflow.DataType" json:"dtype,omitempty"` + Minimum *tensor_go_proto.TensorProto `protobuf:"bytes,4,opt,name=minimum,proto3" json:"minimum,omitempty"` + Maximum *tensor_go_proto.TensorProto `protobuf:"bytes,5,opt,name=maximum,proto3" json:"maximum,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BoundedTensorSpecProto) Reset() { + *x = BoundedTensorSpecProto{} + mi := &file_tensorflow_core_protobuf_struct_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BoundedTensorSpecProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BoundedTensorSpecProto) ProtoMessage() {} + +func (x *BoundedTensorSpecProto) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_struct_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BoundedTensorSpecProto.ProtoReflect.Descriptor instead. +func (*BoundedTensorSpecProto) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_struct_proto_rawDescGZIP(), []int{8} +} + +func (x *BoundedTensorSpecProto) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *BoundedTensorSpecProto) GetShape() *tensor_shape_go_proto.TensorShapeProto { + if x != nil { + return x.Shape + } + return nil +} + +func (x *BoundedTensorSpecProto) GetDtype() types_go_proto.DataType { + if x != nil { + return x.Dtype + } + return types_go_proto.DataType(0) +} + +func (x *BoundedTensorSpecProto) GetMinimum() *tensor_go_proto.TensorProto { + if x != nil { + return x.Minimum + } + return nil +} + +func (x *BoundedTensorSpecProto) GetMaximum() *tensor_go_proto.TensorProto { + if x != nil { + return x.Maximum + } + return nil +} + +// Represents a tf.TypeSpec +type TypeSpecProto struct { + state protoimpl.MessageState `protogen:"open.v1"` + TypeSpecClass TypeSpecProto_TypeSpecClass `protobuf:"varint,1,opt,name=type_spec_class,json=typeSpecClass,proto3,enum=tensorflow.TypeSpecProto_TypeSpecClass" json:"type_spec_class,omitempty"` + // The value returned by TypeSpec._serialize(). + TypeState *StructuredValue `protobuf:"bytes,2,opt,name=type_state,json=typeState,proto3" json:"type_state,omitempty"` + // This is currently redundant with the type_spec_class enum, and is only + // used for error reporting. In particular, if you use an older binary to + // load a newer model, and the model uses a TypeSpecClass that the older + // binary doesn't support, then this lets us display a useful error message. + TypeSpecClassName string `protobuf:"bytes,3,opt,name=type_spec_class_name,json=typeSpecClassName,proto3" json:"type_spec_class_name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TypeSpecProto) Reset() { + *x = TypeSpecProto{} + mi := &file_tensorflow_core_protobuf_struct_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TypeSpecProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TypeSpecProto) ProtoMessage() {} + +func (x *TypeSpecProto) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_struct_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TypeSpecProto.ProtoReflect.Descriptor instead. +func (*TypeSpecProto) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_struct_proto_rawDescGZIP(), []int{9} +} + +func (x *TypeSpecProto) GetTypeSpecClass() TypeSpecProto_TypeSpecClass { + if x != nil { + return x.TypeSpecClass + } + return TypeSpecProto_UNKNOWN +} + +func (x *TypeSpecProto) GetTypeState() *StructuredValue { + if x != nil { + return x.TypeState + } + return nil +} + +func (x *TypeSpecProto) GetTypeSpecClassName() string { + if x != nil { + return x.TypeSpecClassName + } + return "" +} + +var File_tensorflow_core_protobuf_struct_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_struct_proto_rawDesc = "" + + "\n" + + "%tensorflow/core/protobuf/struct.proto\x12\n" + + "tensorflow\x1a&tensorflow/core/framework/tensor.proto\x1a,tensorflow/core/framework/tensor_shape.proto\x1a%tensorflow/core/framework/types.proto\"\xdc\x06\n" + + "\x0fStructuredValue\x126\n" + + "\n" + + "none_value\x18\x01 \x01(\v2\x15.tensorflow.NoneValueH\x00R\tnoneValue\x12%\n" + + "\rfloat64_value\x18\v \x01(\x01H\x00R\ffloat64Value\x12!\n" + + "\vint64_value\x18\f \x01(\x12H\x00R\n" + + "int64Value\x12#\n" + + "\fstring_value\x18\r \x01(\tH\x00R\vstringValue\x12\x1f\n" + + "\n" + + "bool_value\x18\x0e \x01(\bH\x00R\tboolValue\x12L\n" + + "\x12tensor_shape_value\x18\x1f \x01(\v2\x1c.tensorflow.TensorShapeProtoH\x00R\x10tensorShapeValue\x12D\n" + + "\x12tensor_dtype_value\x18 \x01(\x0e2\x14.tensorflow.DataTypeH\x00R\x10tensorDtypeValue\x12I\n" + + "\x11tensor_spec_value\x18! \x01(\v2\x1b.tensorflow.TensorSpecProtoH\x00R\x0ftensorSpecValue\x12C\n" + + "\x0ftype_spec_value\x18\" \x01(\v2\x19.tensorflow.TypeSpecProtoH\x00R\rtypeSpecValue\x12_\n" + + "\x19bounded_tensor_spec_value\x18# \x01(\v2\".tensorflow.BoundedTensorSpecProtoH\x00R\x16boundedTensorSpecValue\x126\n" + + "\n" + + "list_value\x183 \x01(\v2\x15.tensorflow.ListValueH\x00R\tlistValue\x129\n" + + "\vtuple_value\x184 \x01(\v2\x16.tensorflow.TupleValueH\x00R\n" + + "tupleValue\x126\n" + + "\n" + + "dict_value\x185 \x01(\v2\x15.tensorflow.DictValueH\x00R\tdictValue\x12I\n" + + "\x11named_tuple_value\x186 \x01(\v2\x1b.tensorflow.NamedTupleValueH\x00R\x0fnamedTupleValueB\x06\n" + + "\x04kind\"\v\n" + + "\tNoneValue\"@\n" + + "\tListValue\x123\n" + + "\x06values\x18\x01 \x03(\v2\x1b.tensorflow.StructuredValueR\x06values\"A\n" + + "\n" + + "TupleValue\x123\n" + + "\x06values\x18\x01 \x03(\v2\x1b.tensorflow.StructuredValueR\x06values\"\x9e\x01\n" + + "\tDictValue\x129\n" + + "\x06fields\x18\x01 \x03(\v2!.tensorflow.DictValue.FieldsEntryR\x06fields\x1aV\n" + + "\vFieldsEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x121\n" + + "\x05value\x18\x02 \x01(\v2\x1b.tensorflow.StructuredValueR\x05value:\x028\x01\"P\n" + + "\tPairValue\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x121\n" + + "\x05value\x18\x02 \x01(\v2\x1b.tensorflow.StructuredValueR\x05value\"T\n" + + "\x0fNamedTupleValue\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12-\n" + + "\x06values\x18\x02 \x03(\v2\x15.tensorflow.PairValueR\x06values\"\x85\x01\n" + + "\x0fTensorSpecProto\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x122\n" + + "\x05shape\x18\x02 \x01(\v2\x1c.tensorflow.TensorShapeProtoR\x05shape\x12*\n" + + "\x05dtype\x18\x03 \x01(\x0e2\x14.tensorflow.DataTypeR\x05dtype\"\xf2\x01\n" + + "\x16BoundedTensorSpecProto\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x122\n" + + "\x05shape\x18\x02 \x01(\v2\x1c.tensorflow.TensorShapeProtoR\x05shape\x12*\n" + + "\x05dtype\x18\x03 \x01(\x0e2\x14.tensorflow.DataTypeR\x05dtype\x121\n" + + "\aminimum\x18\x04 \x01(\v2\x17.tensorflow.TensorProtoR\aminimum\x121\n" + + "\amaximum\x18\x05 \x01(\v2\x17.tensorflow.TensorProtoR\amaximum\"\xe1\x03\n" + + "\rTypeSpecProto\x12O\n" + + "\x0ftype_spec_class\x18\x01 \x01(\x0e2'.tensorflow.TypeSpecProto.TypeSpecClassR\rtypeSpecClass\x12:\n" + + "\n" + + "type_state\x18\x02 \x01(\v2\x1b.tensorflow.StructuredValueR\ttypeState\x12/\n" + + "\x14type_spec_class_name\x18\x03 \x01(\tR\x11typeSpecClassName\"\x91\x02\n" + + "\rTypeSpecClass\x12\v\n" + + "\aUNKNOWN\x10\x00\x12\x16\n" + + "\x12SPARSE_TENSOR_SPEC\x10\x01\x12\x17\n" + + "\x13INDEXED_SLICES_SPEC\x10\x02\x12\x16\n" + + "\x12RAGGED_TENSOR_SPEC\x10\x03\x12\x15\n" + + "\x11TENSOR_ARRAY_SPEC\x10\x04\x12\x15\n" + + "\x11DATA_DATASET_SPEC\x10\x05\x12\x16\n" + + "\x12DATA_ITERATOR_SPEC\x10\x06\x12\x11\n" + + "\rOPTIONAL_SPEC\x10\a\x12\x14\n" + + "\x10PER_REPLICA_SPEC\x10\b\x12\x11\n" + + "\rVARIABLE_SPEC\x10\t\x12\x16\n" + + "\x12ROW_PARTITION_SPEC\x10\n" + + "\x12\x10\n" + + "\fNDARRAY_SPEC\x10\vBWZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_protob\x06proto3" + +var ( + file_tensorflow_core_protobuf_struct_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_struct_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_struct_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_struct_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_struct_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_struct_proto_rawDesc), len(file_tensorflow_core_protobuf_struct_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_struct_proto_rawDescData +} + +var file_tensorflow_core_protobuf_struct_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_tensorflow_core_protobuf_struct_proto_msgTypes = make([]protoimpl.MessageInfo, 11) +var file_tensorflow_core_protobuf_struct_proto_goTypes = []any{ + (TypeSpecProto_TypeSpecClass)(0), // 0: tensorflow.TypeSpecProto.TypeSpecClass + (*StructuredValue)(nil), // 1: tensorflow.StructuredValue + (*NoneValue)(nil), // 2: tensorflow.NoneValue + (*ListValue)(nil), // 3: tensorflow.ListValue + (*TupleValue)(nil), // 4: tensorflow.TupleValue + (*DictValue)(nil), // 5: tensorflow.DictValue + (*PairValue)(nil), // 6: tensorflow.PairValue + (*NamedTupleValue)(nil), // 7: tensorflow.NamedTupleValue + (*TensorSpecProto)(nil), // 8: tensorflow.TensorSpecProto + (*BoundedTensorSpecProto)(nil), // 9: tensorflow.BoundedTensorSpecProto + (*TypeSpecProto)(nil), // 10: tensorflow.TypeSpecProto + nil, // 11: tensorflow.DictValue.FieldsEntry + (*tensor_shape_go_proto.TensorShapeProto)(nil), // 12: tensorflow.TensorShapeProto + (types_go_proto.DataType)(0), // 13: tensorflow.DataType + (*tensor_go_proto.TensorProto)(nil), // 14: tensorflow.TensorProto +} +var file_tensorflow_core_protobuf_struct_proto_depIdxs = []int32{ + 2, // 0: tensorflow.StructuredValue.none_value:type_name -> tensorflow.NoneValue + 12, // 1: tensorflow.StructuredValue.tensor_shape_value:type_name -> tensorflow.TensorShapeProto + 13, // 2: tensorflow.StructuredValue.tensor_dtype_value:type_name -> tensorflow.DataType + 8, // 3: tensorflow.StructuredValue.tensor_spec_value:type_name -> tensorflow.TensorSpecProto + 10, // 4: tensorflow.StructuredValue.type_spec_value:type_name -> tensorflow.TypeSpecProto + 9, // 5: tensorflow.StructuredValue.bounded_tensor_spec_value:type_name -> tensorflow.BoundedTensorSpecProto + 3, // 6: tensorflow.StructuredValue.list_value:type_name -> tensorflow.ListValue + 4, // 7: tensorflow.StructuredValue.tuple_value:type_name -> tensorflow.TupleValue + 5, // 8: tensorflow.StructuredValue.dict_value:type_name -> tensorflow.DictValue + 7, // 9: tensorflow.StructuredValue.named_tuple_value:type_name -> tensorflow.NamedTupleValue + 1, // 10: tensorflow.ListValue.values:type_name -> tensorflow.StructuredValue + 1, // 11: tensorflow.TupleValue.values:type_name -> tensorflow.StructuredValue + 11, // 12: tensorflow.DictValue.fields:type_name -> tensorflow.DictValue.FieldsEntry + 1, // 13: tensorflow.PairValue.value:type_name -> tensorflow.StructuredValue + 6, // 14: tensorflow.NamedTupleValue.values:type_name -> tensorflow.PairValue + 12, // 15: tensorflow.TensorSpecProto.shape:type_name -> tensorflow.TensorShapeProto + 13, // 16: tensorflow.TensorSpecProto.dtype:type_name -> tensorflow.DataType + 12, // 17: tensorflow.BoundedTensorSpecProto.shape:type_name -> tensorflow.TensorShapeProto + 13, // 18: tensorflow.BoundedTensorSpecProto.dtype:type_name -> tensorflow.DataType + 14, // 19: tensorflow.BoundedTensorSpecProto.minimum:type_name -> tensorflow.TensorProto + 14, // 20: tensorflow.BoundedTensorSpecProto.maximum:type_name -> tensorflow.TensorProto + 0, // 21: tensorflow.TypeSpecProto.type_spec_class:type_name -> tensorflow.TypeSpecProto.TypeSpecClass + 1, // 22: tensorflow.TypeSpecProto.type_state:type_name -> tensorflow.StructuredValue + 1, // 23: tensorflow.DictValue.FieldsEntry.value:type_name -> tensorflow.StructuredValue + 24, // [24:24] is the sub-list for method output_type + 24, // [24:24] is the sub-list for method input_type + 24, // [24:24] is the sub-list for extension type_name + 24, // [24:24] is the sub-list for extension extendee + 0, // [0:24] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_struct_proto_init() } +func file_tensorflow_core_protobuf_struct_proto_init() { + if File_tensorflow_core_protobuf_struct_proto != nil { + return + } + file_tensorflow_core_protobuf_struct_proto_msgTypes[0].OneofWrappers = []any{ + (*StructuredValue_NoneValue)(nil), + (*StructuredValue_Float64Value)(nil), + (*StructuredValue_Int64Value)(nil), + (*StructuredValue_StringValue)(nil), + (*StructuredValue_BoolValue)(nil), + (*StructuredValue_TensorShapeValue)(nil), + (*StructuredValue_TensorDtypeValue)(nil), + (*StructuredValue_TensorSpecValue)(nil), + (*StructuredValue_TypeSpecValue)(nil), + (*StructuredValue_BoundedTensorSpecValue)(nil), + (*StructuredValue_ListValue)(nil), + (*StructuredValue_TupleValue)(nil), + (*StructuredValue_DictValue)(nil), + (*StructuredValue_NamedTupleValue)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_struct_proto_rawDesc), len(file_tensorflow_core_protobuf_struct_proto_rawDesc)), + NumEnums: 1, + NumMessages: 11, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_struct_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_struct_proto_depIdxs, + EnumInfos: file_tensorflow_core_protobuf_struct_proto_enumTypes, + MessageInfos: file_tensorflow_core_protobuf_struct_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_struct_proto = out.File + file_tensorflow_core_protobuf_struct_proto_goTypes = nil + file_tensorflow_core_protobuf_struct_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/tensor_bundle.pb.go b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/tensor_bundle.pb.go new file mode 100644 index 0000000..3fac279 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/tensor_bundle.pb.go @@ -0,0 +1,340 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/tensor_bundle.proto + +package for_core_protos_go_proto + +import ( + tensor_shape_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_shape_go_proto" + tensor_slice_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_slice_go_proto" + types_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/types_go_proto" + versions_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/versions_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// An enum indicating the endianness of the platform that produced this +// bundle. A bundle can only be read by a platform with matching endianness. +// Defaults to LITTLE, as most modern platforms are little-endian. +// +// Affects the binary tensor data bytes only, not the metadata in protobufs. +type BundleHeaderProto_Endianness int32 + +const ( + BundleHeaderProto_LITTLE BundleHeaderProto_Endianness = 0 + BundleHeaderProto_BIG BundleHeaderProto_Endianness = 1 +) + +// Enum value maps for BundleHeaderProto_Endianness. +var ( + BundleHeaderProto_Endianness_name = map[int32]string{ + 0: "LITTLE", + 1: "BIG", + } + BundleHeaderProto_Endianness_value = map[string]int32{ + "LITTLE": 0, + "BIG": 1, + } +) + +func (x BundleHeaderProto_Endianness) Enum() *BundleHeaderProto_Endianness { + p := new(BundleHeaderProto_Endianness) + *p = x + return p +} + +func (x BundleHeaderProto_Endianness) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (BundleHeaderProto_Endianness) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_protobuf_tensor_bundle_proto_enumTypes[0].Descriptor() +} + +func (BundleHeaderProto_Endianness) Type() protoreflect.EnumType { + return &file_tensorflow_core_protobuf_tensor_bundle_proto_enumTypes[0] +} + +func (x BundleHeaderProto_Endianness) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use BundleHeaderProto_Endianness.Descriptor instead. +func (BundleHeaderProto_Endianness) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_tensor_bundle_proto_rawDescGZIP(), []int{0, 0} +} + +// Special header that is associated with a bundle. +// +// TODO(zongheng,zhifengc): maybe in the future, we can add information about +// which binary produced this checkpoint, timestamp, etc. Sometime, these can be +// valuable debugging information. And if needed, these can be used as defensive +// information ensuring reader (binary version) of the checkpoint and the writer +// (binary version) must match within certain range, etc. +type BundleHeaderProto struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Number of data files in the bundle. + NumShards int32 `protobuf:"varint,1,opt,name=num_shards,json=numShards,proto3" json:"num_shards,omitempty"` + Endianness BundleHeaderProto_Endianness `protobuf:"varint,2,opt,name=endianness,proto3,enum=tensorflow.BundleHeaderProto_Endianness" json:"endianness,omitempty"` + // Versioning of the tensor bundle format. + Version *versions_go_proto.VersionDef `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BundleHeaderProto) Reset() { + *x = BundleHeaderProto{} + mi := &file_tensorflow_core_protobuf_tensor_bundle_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BundleHeaderProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BundleHeaderProto) ProtoMessage() {} + +func (x *BundleHeaderProto) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_tensor_bundle_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BundleHeaderProto.ProtoReflect.Descriptor instead. +func (*BundleHeaderProto) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_tensor_bundle_proto_rawDescGZIP(), []int{0} +} + +func (x *BundleHeaderProto) GetNumShards() int32 { + if x != nil { + return x.NumShards + } + return 0 +} + +func (x *BundleHeaderProto) GetEndianness() BundleHeaderProto_Endianness { + if x != nil { + return x.Endianness + } + return BundleHeaderProto_LITTLE +} + +func (x *BundleHeaderProto) GetVersion() *versions_go_proto.VersionDef { + if x != nil { + return x.Version + } + return nil +} + +// Describes the metadata related to a checkpointed tensor. +type BundleEntryProto struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The tensor dtype and shape. + Dtype types_go_proto.DataType `protobuf:"varint,1,opt,name=dtype,proto3,enum=tensorflow.DataType" json:"dtype,omitempty"` + Shape *tensor_shape_go_proto.TensorShapeProto `protobuf:"bytes,2,opt,name=shape,proto3" json:"shape,omitempty"` + // The binary content of the tensor lies in: + // + // File "shard_id": bytes [offset, offset + size). + ShardId int32 `protobuf:"varint,3,opt,name=shard_id,json=shardId,proto3" json:"shard_id,omitempty"` + Offset int64 `protobuf:"varint,4,opt,name=offset,proto3" json:"offset,omitempty"` + Size int64 `protobuf:"varint,5,opt,name=size,proto3" json:"size,omitempty"` + // The CRC32C checksum of the tensor bytes. + Crc32C uint32 `protobuf:"fixed32,6,opt,name=crc32c,proto3" json:"crc32c,omitempty"` + // Iff present, this entry represents a partitioned tensor. The previous + // fields are interpreted as follows: + // + // "dtype", "shape": describe the full tensor. + // "shard_id", "offset", "size", "crc32c": all IGNORED. + // These information for each slice can be looked up in their own + // BundleEntryProto, keyed by each "slice_name". + Slices []*tensor_slice_go_proto.TensorSliceProto `protobuf:"bytes,7,rep,name=slices,proto3" json:"slices,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BundleEntryProto) Reset() { + *x = BundleEntryProto{} + mi := &file_tensorflow_core_protobuf_tensor_bundle_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BundleEntryProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BundleEntryProto) ProtoMessage() {} + +func (x *BundleEntryProto) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_tensor_bundle_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BundleEntryProto.ProtoReflect.Descriptor instead. +func (*BundleEntryProto) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_tensor_bundle_proto_rawDescGZIP(), []int{1} +} + +func (x *BundleEntryProto) GetDtype() types_go_proto.DataType { + if x != nil { + return x.Dtype + } + return types_go_proto.DataType(0) +} + +func (x *BundleEntryProto) GetShape() *tensor_shape_go_proto.TensorShapeProto { + if x != nil { + return x.Shape + } + return nil +} + +func (x *BundleEntryProto) GetShardId() int32 { + if x != nil { + return x.ShardId + } + return 0 +} + +func (x *BundleEntryProto) GetOffset() int64 { + if x != nil { + return x.Offset + } + return 0 +} + +func (x *BundleEntryProto) GetSize() int64 { + if x != nil { + return x.Size + } + return 0 +} + +func (x *BundleEntryProto) GetCrc32C() uint32 { + if x != nil { + return x.Crc32C + } + return 0 +} + +func (x *BundleEntryProto) GetSlices() []*tensor_slice_go_proto.TensorSliceProto { + if x != nil { + return x.Slices + } + return nil +} + +var File_tensorflow_core_protobuf_tensor_bundle_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_tensor_bundle_proto_rawDesc = "" + + "\n" + + ",tensorflow/core/protobuf/tensor_bundle.proto\x12\n" + + "tensorflow\x1a,tensorflow/core/framework/tensor_shape.proto\x1a,tensorflow/core/framework/tensor_slice.proto\x1a%tensorflow/core/framework/types.proto\x1a(tensorflow/core/framework/versions.proto\"\xd1\x01\n" + + "\x11BundleHeaderProto\x12\x1d\n" + + "\n" + + "num_shards\x18\x01 \x01(\x05R\tnumShards\x12H\n" + + "\n" + + "endianness\x18\x02 \x01(\x0e2(.tensorflow.BundleHeaderProto.EndiannessR\n" + + "endianness\x120\n" + + "\aversion\x18\x03 \x01(\v2\x16.tensorflow.VersionDefR\aversion\"!\n" + + "\n" + + "Endianness\x12\n" + + "\n" + + "\x06LITTLE\x10\x00\x12\a\n" + + "\x03BIG\x10\x01\"\x87\x02\n" + + "\x10BundleEntryProto\x12*\n" + + "\x05dtype\x18\x01 \x01(\x0e2\x14.tensorflow.DataTypeR\x05dtype\x122\n" + + "\x05shape\x18\x02 \x01(\v2\x1c.tensorflow.TensorShapeProtoR\x05shape\x12\x19\n" + + "\bshard_id\x18\x03 \x01(\x05R\ashardId\x12\x16\n" + + "\x06offset\x18\x04 \x01(\x03R\x06offset\x12\x12\n" + + "\x04size\x18\x05 \x01(\x03R\x04size\x12\x16\n" + + "\x06crc32c\x18\x06 \x01(\aR\x06crc32c\x124\n" + + "\x06slices\x18\a \x03(\v2\x1c.tensorflow.TensorSliceProtoR\x06slicesB\x85\x01\n" + + "\x13org.tensorflow.utilB\x12TensorBundleProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_tensor_bundle_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_tensor_bundle_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_tensor_bundle_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_tensor_bundle_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_tensor_bundle_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_tensor_bundle_proto_rawDesc), len(file_tensorflow_core_protobuf_tensor_bundle_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_tensor_bundle_proto_rawDescData +} + +var file_tensorflow_core_protobuf_tensor_bundle_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_tensorflow_core_protobuf_tensor_bundle_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_tensorflow_core_protobuf_tensor_bundle_proto_goTypes = []any{ + (BundleHeaderProto_Endianness)(0), // 0: tensorflow.BundleHeaderProto.Endianness + (*BundleHeaderProto)(nil), // 1: tensorflow.BundleHeaderProto + (*BundleEntryProto)(nil), // 2: tensorflow.BundleEntryProto + (*versions_go_proto.VersionDef)(nil), // 3: tensorflow.VersionDef + (types_go_proto.DataType)(0), // 4: tensorflow.DataType + (*tensor_shape_go_proto.TensorShapeProto)(nil), // 5: tensorflow.TensorShapeProto + (*tensor_slice_go_proto.TensorSliceProto)(nil), // 6: tensorflow.TensorSliceProto +} +var file_tensorflow_core_protobuf_tensor_bundle_proto_depIdxs = []int32{ + 0, // 0: tensorflow.BundleHeaderProto.endianness:type_name -> tensorflow.BundleHeaderProto.Endianness + 3, // 1: tensorflow.BundleHeaderProto.version:type_name -> tensorflow.VersionDef + 4, // 2: tensorflow.BundleEntryProto.dtype:type_name -> tensorflow.DataType + 5, // 3: tensorflow.BundleEntryProto.shape:type_name -> tensorflow.TensorShapeProto + 6, // 4: tensorflow.BundleEntryProto.slices:type_name -> tensorflow.TensorSliceProto + 5, // [5:5] is the sub-list for method output_type + 5, // [5:5] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_tensor_bundle_proto_init() } +func file_tensorflow_core_protobuf_tensor_bundle_proto_init() { + if File_tensorflow_core_protobuf_tensor_bundle_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_tensor_bundle_proto_rawDesc), len(file_tensorflow_core_protobuf_tensor_bundle_proto_rawDesc)), + NumEnums: 1, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_tensor_bundle_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_tensor_bundle_proto_depIdxs, + EnumInfos: file_tensorflow_core_protobuf_tensor_bundle_proto_enumTypes, + MessageInfos: file_tensorflow_core_protobuf_tensor_bundle_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_tensor_bundle_proto = out.File + file_tensorflow_core_protobuf_tensor_bundle_proto_goTypes = nil + file_tensorflow_core_protobuf_tensor_bundle_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/tensorflow_server.pb.go b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/tensorflow_server.pb.go new file mode 100644 index 0000000..f7b1fe3 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/tensorflow_server.pb.go @@ -0,0 +1,220 @@ +// Copyright 2016 The TensorFlow Authors. All Rights Reserved. +// +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +//============================================================================== + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/tensorflow_server.proto + +package for_core_protos_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Defines the configuration of a single TensorFlow server. +type ServerDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The cluster of which this server is a member. + Cluster *ClusterDef `protobuf:"bytes,1,opt,name=cluster,proto3" json:"cluster,omitempty"` + // The name of the job of which this server is a member. + // + // NOTE(mrry): The `cluster` field must contain a `JobDef` with a `name` field + // that matches this name. + JobName string `protobuf:"bytes,2,opt,name=job_name,json=jobName,proto3" json:"job_name,omitempty"` + // The task index of this server in its job. + // + // NOTE: The `cluster` field must contain a `JobDef` with a matching `name` + // and a mapping in its `tasks` field for this index. + TaskIndex int32 `protobuf:"varint,3,opt,name=task_index,json=taskIndex,proto3" json:"task_index,omitempty"` + // The default configuration for sessions that run on this server. + DefaultSessionConfig *ConfigProto `protobuf:"bytes,4,opt,name=default_session_config,json=defaultSessionConfig,proto3" json:"default_session_config,omitempty"` + // The protocol to be used by this server. + // + // Acceptable values include: "grpc", "grpc+verbs". + Protocol string `protobuf:"bytes,5,opt,name=protocol,proto3" json:"protocol,omitempty"` + // The server port. If not set, then we identify the port from the job_name. + Port int32 `protobuf:"varint,6,opt,name=port,proto3" json:"port,omitempty"` + // Device filters for remote tasks in the cluster. + // NOTE: This is an experimental feature and only effective in TensorFlow 2.x. + ClusterDeviceFilters *ClusterDeviceFilters `protobuf:"bytes,7,opt,name=cluster_device_filters,json=clusterDeviceFilters,proto3" json:"cluster_device_filters,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ServerDef) Reset() { + *x = ServerDef{} + mi := &file_tensorflow_core_protobuf_tensorflow_server_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ServerDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ServerDef) ProtoMessage() {} + +func (x *ServerDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_tensorflow_server_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ServerDef.ProtoReflect.Descriptor instead. +func (*ServerDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_tensorflow_server_proto_rawDescGZIP(), []int{0} +} + +func (x *ServerDef) GetCluster() *ClusterDef { + if x != nil { + return x.Cluster + } + return nil +} + +func (x *ServerDef) GetJobName() string { + if x != nil { + return x.JobName + } + return "" +} + +func (x *ServerDef) GetTaskIndex() int32 { + if x != nil { + return x.TaskIndex + } + return 0 +} + +func (x *ServerDef) GetDefaultSessionConfig() *ConfigProto { + if x != nil { + return x.DefaultSessionConfig + } + return nil +} + +func (x *ServerDef) GetProtocol() string { + if x != nil { + return x.Protocol + } + return "" +} + +func (x *ServerDef) GetPort() int32 { + if x != nil { + return x.Port + } + return 0 +} + +func (x *ServerDef) GetClusterDeviceFilters() *ClusterDeviceFilters { + if x != nil { + return x.ClusterDeviceFilters + } + return nil +} + +var File_tensorflow_core_protobuf_tensorflow_server_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_tensorflow_server_proto_rawDesc = "" + + "\n" + + "0tensorflow/core/protobuf/tensorflow_server.proto\x12\n" + + "tensorflow\x1a&tensorflow/core/protobuf/cluster.proto\x1a%tensorflow/core/protobuf/config.proto\x1a-tensorflow/core/protobuf/device_filters.proto\"\xce\x02\n" + + "\tServerDef\x120\n" + + "\acluster\x18\x01 \x01(\v2\x16.tensorflow.ClusterDefR\acluster\x12\x19\n" + + "\bjob_name\x18\x02 \x01(\tR\ajobName\x12\x1d\n" + + "\n" + + "task_index\x18\x03 \x01(\x05R\ttaskIndex\x12M\n" + + "\x16default_session_config\x18\x04 \x01(\v2\x17.tensorflow.ConfigProtoR\x14defaultSessionConfig\x12\x1a\n" + + "\bprotocol\x18\x05 \x01(\tR\bprotocol\x12\x12\n" + + "\x04port\x18\x06 \x01(\x05R\x04port\x12V\n" + + "\x16cluster_device_filters\x18\a \x01(\v2 .tensorflow.ClusterDeviceFiltersR\x14clusterDeviceFiltersB\x86\x01\n" + + "\x1aorg.tensorflow.distruntimeB\fServerProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_tensorflow_server_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_tensorflow_server_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_tensorflow_server_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_tensorflow_server_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_tensorflow_server_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_tensorflow_server_proto_rawDesc), len(file_tensorflow_core_protobuf_tensorflow_server_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_tensorflow_server_proto_rawDescData +} + +var file_tensorflow_core_protobuf_tensorflow_server_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_tensorflow_core_protobuf_tensorflow_server_proto_goTypes = []any{ + (*ServerDef)(nil), // 0: tensorflow.ServerDef + (*ClusterDef)(nil), // 1: tensorflow.ClusterDef + (*ConfigProto)(nil), // 2: tensorflow.ConfigProto + (*ClusterDeviceFilters)(nil), // 3: tensorflow.ClusterDeviceFilters +} +var file_tensorflow_core_protobuf_tensorflow_server_proto_depIdxs = []int32{ + 1, // 0: tensorflow.ServerDef.cluster:type_name -> tensorflow.ClusterDef + 2, // 1: tensorflow.ServerDef.default_session_config:type_name -> tensorflow.ConfigProto + 3, // 2: tensorflow.ServerDef.cluster_device_filters:type_name -> tensorflow.ClusterDeviceFilters + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_tensorflow_server_proto_init() } +func file_tensorflow_core_protobuf_tensorflow_server_proto_init() { + if File_tensorflow_core_protobuf_tensorflow_server_proto != nil { + return + } + file_tensorflow_core_protobuf_cluster_proto_init() + file_tensorflow_core_protobuf_config_proto_init() + file_tensorflow_core_protobuf_device_filters_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_tensorflow_server_proto_rawDesc), len(file_tensorflow_core_protobuf_tensorflow_server_proto_rawDesc)), + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_tensorflow_server_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_tensorflow_server_proto_depIdxs, + MessageInfos: file_tensorflow_core_protobuf_tensorflow_server_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_tensorflow_server_proto = out.File + file_tensorflow_core_protobuf_tensorflow_server_proto_goTypes = nil + file_tensorflow_core_protobuf_tensorflow_server_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/trackable_object_graph.pb.go b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/trackable_object_graph.pb.go new file mode 100644 index 0000000..dfeba54 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/trackable_object_graph.pb.go @@ -0,0 +1,412 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/trackable_object_graph.proto + +package for_core_protos_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type TrackableObjectGraph struct { + state protoimpl.MessageState `protogen:"open.v1"` + Nodes []*TrackableObjectGraph_TrackableObject `protobuf:"bytes,1,rep,name=nodes,proto3" json:"nodes,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TrackableObjectGraph) Reset() { + *x = TrackableObjectGraph{} + mi := &file_tensorflow_core_protobuf_trackable_object_graph_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TrackableObjectGraph) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TrackableObjectGraph) ProtoMessage() {} + +func (x *TrackableObjectGraph) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_trackable_object_graph_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TrackableObjectGraph.ProtoReflect.Descriptor instead. +func (*TrackableObjectGraph) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_trackable_object_graph_proto_rawDescGZIP(), []int{0} +} + +func (x *TrackableObjectGraph) GetNodes() []*TrackableObjectGraph_TrackableObject { + if x != nil { + return x.Nodes + } + return nil +} + +type TrackableObjectGraph_TrackableObject struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Objects which this object depends on. + Children []*TrackableObjectGraph_TrackableObject_ObjectReference `protobuf:"bytes,1,rep,name=children,proto3" json:"children,omitempty"` + // Serialized data specific to this object. + Attributes []*TrackableObjectGraph_TrackableObject_SerializedTensor `protobuf:"bytes,2,rep,name=attributes,proto3" json:"attributes,omitempty"` + // Slot variables owned by this object. + SlotVariables []*TrackableObjectGraph_TrackableObject_SlotVariableReference `protobuf:"bytes,3,rep,name=slot_variables,json=slotVariables,proto3" json:"slot_variables,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TrackableObjectGraph_TrackableObject) Reset() { + *x = TrackableObjectGraph_TrackableObject{} + mi := &file_tensorflow_core_protobuf_trackable_object_graph_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TrackableObjectGraph_TrackableObject) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TrackableObjectGraph_TrackableObject) ProtoMessage() {} + +func (x *TrackableObjectGraph_TrackableObject) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_trackable_object_graph_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TrackableObjectGraph_TrackableObject.ProtoReflect.Descriptor instead. +func (*TrackableObjectGraph_TrackableObject) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_trackable_object_graph_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *TrackableObjectGraph_TrackableObject) GetChildren() []*TrackableObjectGraph_TrackableObject_ObjectReference { + if x != nil { + return x.Children + } + return nil +} + +func (x *TrackableObjectGraph_TrackableObject) GetAttributes() []*TrackableObjectGraph_TrackableObject_SerializedTensor { + if x != nil { + return x.Attributes + } + return nil +} + +func (x *TrackableObjectGraph_TrackableObject) GetSlotVariables() []*TrackableObjectGraph_TrackableObject_SlotVariableReference { + if x != nil { + return x.SlotVariables + } + return nil +} + +type TrackableObjectGraph_TrackableObject_ObjectReference struct { + state protoimpl.MessageState `protogen:"open.v1"` + // An index into `TrackableObjectGraph.nodes`, indicating the object + // being referenced. + NodeId int32 `protobuf:"varint,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` + // A user-provided name for the edge. + LocalName string `protobuf:"bytes,2,opt,name=local_name,json=localName,proto3" json:"local_name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TrackableObjectGraph_TrackableObject_ObjectReference) Reset() { + *x = TrackableObjectGraph_TrackableObject_ObjectReference{} + mi := &file_tensorflow_core_protobuf_trackable_object_graph_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TrackableObjectGraph_TrackableObject_ObjectReference) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TrackableObjectGraph_TrackableObject_ObjectReference) ProtoMessage() {} + +func (x *TrackableObjectGraph_TrackableObject_ObjectReference) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_trackable_object_graph_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TrackableObjectGraph_TrackableObject_ObjectReference.ProtoReflect.Descriptor instead. +func (*TrackableObjectGraph_TrackableObject_ObjectReference) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_trackable_object_graph_proto_rawDescGZIP(), []int{0, 0, 0} +} + +func (x *TrackableObjectGraph_TrackableObject_ObjectReference) GetNodeId() int32 { + if x != nil { + return x.NodeId + } + return 0 +} + +func (x *TrackableObjectGraph_TrackableObject_ObjectReference) GetLocalName() string { + if x != nil { + return x.LocalName + } + return "" +} + +type TrackableObjectGraph_TrackableObject_SerializedTensor struct { + state protoimpl.MessageState `protogen:"open.v1"` + // A name for the Tensor. Simple variables have only one + // `SerializedTensor` named "VARIABLE_VALUE" by convention. This value may + // be restored on object creation as an optimization. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // The full name of the variable/tensor, if applicable. Used to allow + // name-based loading of checkpoints which were saved using an + // object-based API. Should match the checkpoint key which would have been + // assigned by tf.train.Saver. + FullName string `protobuf:"bytes,2,opt,name=full_name,json=fullName,proto3" json:"full_name,omitempty"` + // The generated name of the Tensor in the checkpoint. + CheckpointKey string `protobuf:"bytes,3,opt,name=checkpoint_key,json=checkpointKey,proto3" json:"checkpoint_key,omitempty"` + // 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. + OptionalRestore bool `protobuf:"varint,4,opt,name=optional_restore,json=optionalRestore,proto3" json:"optional_restore,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TrackableObjectGraph_TrackableObject_SerializedTensor) Reset() { + *x = TrackableObjectGraph_TrackableObject_SerializedTensor{} + mi := &file_tensorflow_core_protobuf_trackable_object_graph_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TrackableObjectGraph_TrackableObject_SerializedTensor) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TrackableObjectGraph_TrackableObject_SerializedTensor) ProtoMessage() {} + +func (x *TrackableObjectGraph_TrackableObject_SerializedTensor) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_trackable_object_graph_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TrackableObjectGraph_TrackableObject_SerializedTensor.ProtoReflect.Descriptor instead. +func (*TrackableObjectGraph_TrackableObject_SerializedTensor) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_trackable_object_graph_proto_rawDescGZIP(), []int{0, 0, 1} +} + +func (x *TrackableObjectGraph_TrackableObject_SerializedTensor) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *TrackableObjectGraph_TrackableObject_SerializedTensor) GetFullName() string { + if x != nil { + return x.FullName + } + return "" +} + +func (x *TrackableObjectGraph_TrackableObject_SerializedTensor) GetCheckpointKey() string { + if x != nil { + return x.CheckpointKey + } + return "" +} + +func (x *TrackableObjectGraph_TrackableObject_SerializedTensor) GetOptionalRestore() bool { + if x != nil { + return x.OptionalRestore + } + return false +} + +type TrackableObjectGraph_TrackableObject_SlotVariableReference struct { + state protoimpl.MessageState `protogen:"open.v1"` + // An index into `TrackableObjectGraph.nodes`, indicating the + // variable object this slot was created for. + OriginalVariableNodeId int32 `protobuf:"varint,1,opt,name=original_variable_node_id,json=originalVariableNodeId,proto3" json:"original_variable_node_id,omitempty"` + // The name of the slot (e.g. "m"/"v"). + SlotName string `protobuf:"bytes,2,opt,name=slot_name,json=slotName,proto3" json:"slot_name,omitempty"` + // An index into `TrackableObjectGraph.nodes`, indicating the + // `Object` with the value of the slot variable. + SlotVariableNodeId int32 `protobuf:"varint,3,opt,name=slot_variable_node_id,json=slotVariableNodeId,proto3" json:"slot_variable_node_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TrackableObjectGraph_TrackableObject_SlotVariableReference) Reset() { + *x = TrackableObjectGraph_TrackableObject_SlotVariableReference{} + mi := &file_tensorflow_core_protobuf_trackable_object_graph_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TrackableObjectGraph_TrackableObject_SlotVariableReference) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TrackableObjectGraph_TrackableObject_SlotVariableReference) ProtoMessage() {} + +func (x *TrackableObjectGraph_TrackableObject_SlotVariableReference) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_trackable_object_graph_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TrackableObjectGraph_TrackableObject_SlotVariableReference.ProtoReflect.Descriptor instead. +func (*TrackableObjectGraph_TrackableObject_SlotVariableReference) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_trackable_object_graph_proto_rawDescGZIP(), []int{0, 0, 2} +} + +func (x *TrackableObjectGraph_TrackableObject_SlotVariableReference) GetOriginalVariableNodeId() int32 { + if x != nil { + return x.OriginalVariableNodeId + } + return 0 +} + +func (x *TrackableObjectGraph_TrackableObject_SlotVariableReference) GetSlotName() string { + if x != nil { + return x.SlotName + } + return "" +} + +func (x *TrackableObjectGraph_TrackableObject_SlotVariableReference) GetSlotVariableNodeId() int32 { + if x != nil { + return x.SlotVariableNodeId + } + return 0 +} + +var File_tensorflow_core_protobuf_trackable_object_graph_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_trackable_object_graph_proto_rawDesc = "" + + "\n" + + "5tensorflow/core/protobuf/trackable_object_graph.proto\x12\n" + + "tensorflow\"\xaa\x06\n" + + "\x14TrackableObjectGraph\x12F\n" + + "\x05nodes\x18\x01 \x03(\v20.tensorflow.TrackableObjectGraph.TrackableObjectR\x05nodes\x1a\xc9\x05\n" + + "\x0fTrackableObject\x12\\\n" + + "\bchildren\x18\x01 \x03(\v2@.tensorflow.TrackableObjectGraph.TrackableObject.ObjectReferenceR\bchildren\x12a\n" + + "\n" + + "attributes\x18\x02 \x03(\v2A.tensorflow.TrackableObjectGraph.TrackableObject.SerializedTensorR\n" + + "attributes\x12m\n" + + "\x0eslot_variables\x18\x03 \x03(\v2F.tensorflow.TrackableObjectGraph.TrackableObject.SlotVariableReferenceR\rslotVariables\x1aI\n" + + "\x0fObjectReference\x12\x17\n" + + "\anode_id\x18\x01 \x01(\x05R\x06nodeId\x12\x1d\n" + + "\n" + + "local_name\x18\x02 \x01(\tR\tlocalName\x1a\x95\x01\n" + + "\x10SerializedTensor\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x1b\n" + + "\tfull_name\x18\x02 \x01(\tR\bfullName\x12%\n" + + "\x0echeckpoint_key\x18\x03 \x01(\tR\rcheckpointKey\x12)\n" + + "\x10optional_restore\x18\x04 \x01(\bR\x0foptionalRestore\x1a\xa2\x01\n" + + "\x15SlotVariableReference\x129\n" + + "\x19original_variable_node_id\x18\x01 \x01(\x05R\x16originalVariableNodeId\x12\x1b\n" + + "\tslot_name\x18\x02 \x01(\tR\bslotName\x121\n" + + "\x15slot_variable_node_id\x18\x03 \x01(\x05R\x12slotVariableNodeIdBZZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_trackable_object_graph_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_trackable_object_graph_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_trackable_object_graph_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_trackable_object_graph_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_trackable_object_graph_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_trackable_object_graph_proto_rawDesc), len(file_tensorflow_core_protobuf_trackable_object_graph_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_trackable_object_graph_proto_rawDescData +} + +var file_tensorflow_core_protobuf_trackable_object_graph_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_tensorflow_core_protobuf_trackable_object_graph_proto_goTypes = []any{ + (*TrackableObjectGraph)(nil), // 0: tensorflow.TrackableObjectGraph + (*TrackableObjectGraph_TrackableObject)(nil), // 1: tensorflow.TrackableObjectGraph.TrackableObject + (*TrackableObjectGraph_TrackableObject_ObjectReference)(nil), // 2: tensorflow.TrackableObjectGraph.TrackableObject.ObjectReference + (*TrackableObjectGraph_TrackableObject_SerializedTensor)(nil), // 3: tensorflow.TrackableObjectGraph.TrackableObject.SerializedTensor + (*TrackableObjectGraph_TrackableObject_SlotVariableReference)(nil), // 4: tensorflow.TrackableObjectGraph.TrackableObject.SlotVariableReference +} +var file_tensorflow_core_protobuf_trackable_object_graph_proto_depIdxs = []int32{ + 1, // 0: tensorflow.TrackableObjectGraph.nodes:type_name -> tensorflow.TrackableObjectGraph.TrackableObject + 2, // 1: tensorflow.TrackableObjectGraph.TrackableObject.children:type_name -> tensorflow.TrackableObjectGraph.TrackableObject.ObjectReference + 3, // 2: tensorflow.TrackableObjectGraph.TrackableObject.attributes:type_name -> tensorflow.TrackableObjectGraph.TrackableObject.SerializedTensor + 4, // 3: tensorflow.TrackableObjectGraph.TrackableObject.slot_variables:type_name -> tensorflow.TrackableObjectGraph.TrackableObject.SlotVariableReference + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_trackable_object_graph_proto_init() } +func file_tensorflow_core_protobuf_trackable_object_graph_proto_init() { + if File_tensorflow_core_protobuf_trackable_object_graph_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_trackable_object_graph_proto_rawDesc), len(file_tensorflow_core_protobuf_trackable_object_graph_proto_rawDesc)), + NumEnums: 0, + NumMessages: 5, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_trackable_object_graph_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_trackable_object_graph_proto_depIdxs, + MessageInfos: file_tensorflow_core_protobuf_trackable_object_graph_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_trackable_object_graph_proto = out.File + file_tensorflow_core_protobuf_trackable_object_graph_proto_goTypes = nil + file_tensorflow_core_protobuf_trackable_object_graph_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/transport_options.pb.go b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/transport_options.pb.go new file mode 100644 index 0000000..fda7bcf --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/transport_options.pb.go @@ -0,0 +1,124 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/transport_options.proto + +package for_core_protos_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Extra data needed on a non-RDMA RecvBufResponse. +type RecvBufRespExtra struct { + state protoimpl.MessageState `protogen:"open.v1"` + TensorContent [][]byte `protobuf:"bytes,1,rep,name=tensor_content,json=tensorContent,proto3" json:"tensor_content,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RecvBufRespExtra) Reset() { + *x = RecvBufRespExtra{} + mi := &file_tensorflow_core_protobuf_transport_options_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RecvBufRespExtra) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RecvBufRespExtra) ProtoMessage() {} + +func (x *RecvBufRespExtra) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_transport_options_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RecvBufRespExtra.ProtoReflect.Descriptor instead. +func (*RecvBufRespExtra) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_transport_options_proto_rawDescGZIP(), []int{0} +} + +func (x *RecvBufRespExtra) GetTensorContent() [][]byte { + if x != nil { + return x.TensorContent + } + return nil +} + +var File_tensorflow_core_protobuf_transport_options_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_transport_options_proto_rawDesc = "" + + "\n" + + "0tensorflow/core/protobuf/transport_options.proto\x12\n" + + "tensorflow\"9\n" + + "\x10RecvBufRespExtra\x12%\n" + + "\x0etensor_content\x18\x01 \x03(\fR\rtensorContentBWZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_protob\x06proto3" + +var ( + file_tensorflow_core_protobuf_transport_options_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_transport_options_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_transport_options_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_transport_options_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_transport_options_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_transport_options_proto_rawDesc), len(file_tensorflow_core_protobuf_transport_options_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_transport_options_proto_rawDescData +} + +var file_tensorflow_core_protobuf_transport_options_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_tensorflow_core_protobuf_transport_options_proto_goTypes = []any{ + (*RecvBufRespExtra)(nil), // 0: tensorflow.RecvBufRespExtra +} +var file_tensorflow_core_protobuf_transport_options_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_transport_options_proto_init() } +func file_tensorflow_core_protobuf_transport_options_proto_init() { + if File_tensorflow_core_protobuf_transport_options_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_transport_options_proto_rawDesc), len(file_tensorflow_core_protobuf_transport_options_proto_rawDesc)), + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_transport_options_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_transport_options_proto_depIdxs, + MessageInfos: file_tensorflow_core_protobuf_transport_options_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_transport_options_proto = out.File + file_tensorflow_core_protobuf_transport_options_proto_goTypes = nil + file_tensorflow_core_protobuf_transport_options_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/verifier_config.pb.go b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/verifier_config.pb.go new file mode 100644 index 0000000..8a64647 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/verifier_config.pb.go @@ -0,0 +1,194 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/verifier_config.proto + +package for_core_protos_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type VerifierConfig_Toggle int32 + +const ( + VerifierConfig_DEFAULT VerifierConfig_Toggle = 0 + VerifierConfig_ON VerifierConfig_Toggle = 1 + VerifierConfig_OFF VerifierConfig_Toggle = 2 +) + +// Enum value maps for VerifierConfig_Toggle. +var ( + VerifierConfig_Toggle_name = map[int32]string{ + 0: "DEFAULT", + 1: "ON", + 2: "OFF", + } + VerifierConfig_Toggle_value = map[string]int32{ + "DEFAULT": 0, + "ON": 1, + "OFF": 2, + } +) + +func (x VerifierConfig_Toggle) Enum() *VerifierConfig_Toggle { + p := new(VerifierConfig_Toggle) + *p = x + return p +} + +func (x VerifierConfig_Toggle) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (VerifierConfig_Toggle) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_protobuf_verifier_config_proto_enumTypes[0].Descriptor() +} + +func (VerifierConfig_Toggle) Type() protoreflect.EnumType { + return &file_tensorflow_core_protobuf_verifier_config_proto_enumTypes[0] +} + +func (x VerifierConfig_Toggle) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use VerifierConfig_Toggle.Descriptor instead. +func (VerifierConfig_Toggle) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_verifier_config_proto_rawDescGZIP(), []int{0, 0} +} + +// The config for graph verifiers. +type VerifierConfig struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Deadline for completion of all verification i.e. all the Toggle ON + // verifiers must complete execution within this time. + VerificationTimeoutInMs int64 `protobuf:"varint,1,opt,name=verification_timeout_in_ms,json=verificationTimeoutInMs,proto3" json:"verification_timeout_in_ms,omitempty"` + // Perform structural validation on a tensorflow graph. Default is OFF. + StructureVerifier VerifierConfig_Toggle `protobuf:"varint,2,opt,name=structure_verifier,json=structureVerifier,proto3,enum=tensorflow.VerifierConfig_Toggle" json:"structure_verifier,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *VerifierConfig) Reset() { + *x = VerifierConfig{} + mi := &file_tensorflow_core_protobuf_verifier_config_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *VerifierConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VerifierConfig) ProtoMessage() {} + +func (x *VerifierConfig) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_verifier_config_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use VerifierConfig.ProtoReflect.Descriptor instead. +func (*VerifierConfig) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_verifier_config_proto_rawDescGZIP(), []int{0} +} + +func (x *VerifierConfig) GetVerificationTimeoutInMs() int64 { + if x != nil { + return x.VerificationTimeoutInMs + } + return 0 +} + +func (x *VerifierConfig) GetStructureVerifier() VerifierConfig_Toggle { + if x != nil { + return x.StructureVerifier + } + return VerifierConfig_DEFAULT +} + +var File_tensorflow_core_protobuf_verifier_config_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_verifier_config_proto_rawDesc = "" + + "\n" + + ".tensorflow/core/protobuf/verifier_config.proto\x12\n" + + "tensorflow\"\xc7\x01\n" + + "\x0eVerifierConfig\x12;\n" + + "\x1averification_timeout_in_ms\x18\x01 \x01(\x03R\x17verificationTimeoutInMs\x12P\n" + + "\x12structure_verifier\x18\x02 \x01(\x0e2!.tensorflow.VerifierConfig.ToggleR\x11structureVerifier\"&\n" + + "\x06Toggle\x12\v\n" + + "\aDEFAULT\x10\x00\x12\x06\n" + + "\x02ON\x10\x01\x12\a\n" + + "\x03OFF\x10\x02B\x8c\x01\n" + + "\x18org.tensorflow.frameworkB\x14VerifierConfigProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_verifier_config_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_verifier_config_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_verifier_config_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_verifier_config_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_verifier_config_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_verifier_config_proto_rawDesc), len(file_tensorflow_core_protobuf_verifier_config_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_verifier_config_proto_rawDescData +} + +var file_tensorflow_core_protobuf_verifier_config_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_tensorflow_core_protobuf_verifier_config_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_tensorflow_core_protobuf_verifier_config_proto_goTypes = []any{ + (VerifierConfig_Toggle)(0), // 0: tensorflow.VerifierConfig.Toggle + (*VerifierConfig)(nil), // 1: tensorflow.VerifierConfig +} +var file_tensorflow_core_protobuf_verifier_config_proto_depIdxs = []int32{ + 0, // 0: tensorflow.VerifierConfig.structure_verifier:type_name -> tensorflow.VerifierConfig.Toggle + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_verifier_config_proto_init() } +func file_tensorflow_core_protobuf_verifier_config_proto_init() { + if File_tensorflow_core_protobuf_verifier_config_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_verifier_config_proto_rawDesc), len(file_tensorflow_core_protobuf_verifier_config_proto_rawDesc)), + NumEnums: 1, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_verifier_config_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_verifier_config_proto_depIdxs, + EnumInfos: file_tensorflow_core_protobuf_verifier_config_proto_enumTypes, + MessageInfos: file_tensorflow_core_protobuf_verifier_config_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_verifier_config_proto = out.File + file_tensorflow_core_protobuf_verifier_config_proto_goTypes = nil + file_tensorflow_core_protobuf_verifier_config_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/worker.pb.go b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/worker.pb.go new file mode 100644 index 0000000..67b79d2 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/worker.pb.go @@ -0,0 +1,2752 @@ +// Copyright 2016 The TensorFlow Authors. All Rights Reserved. +// +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +//============================================================================== + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/worker.proto + +package for_core_protos_go_proto + +import ( + cost_graph_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/cost_graph_go_proto" + device_attributes_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/device_attributes_go_proto" + graph_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/graph_go_proto" + step_stats_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/step_stats_go_proto" + tensor_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_go_proto" + tensor_shape_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_shape_go_proto" + types_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/types_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + anypb "google.golang.org/protobuf/types/known/anypb" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type GetStatusRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetStatusRequest) Reset() { + *x = GetStatusRequest{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetStatusRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetStatusRequest) ProtoMessage() {} + +func (x *GetStatusRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetStatusRequest.ProtoReflect.Descriptor instead. +func (*GetStatusRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{0} +} + +type GetStatusResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + DeviceAttributes []*device_attributes_go_proto.DeviceAttributes `protobuf:"bytes,1,rep,name=device_attributes,json=deviceAttributes,proto3" json:"device_attributes,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetStatusResponse) Reset() { + *x = GetStatusResponse{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetStatusResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetStatusResponse) ProtoMessage() {} + +func (x *GetStatusResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetStatusResponse.ProtoReflect.Descriptor instead. +func (*GetStatusResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{1} +} + +func (x *GetStatusResponse) GetDeviceAttributes() []*device_attributes_go_proto.DeviceAttributes { + if x != nil { + return x.DeviceAttributes + } + return nil +} + +type CreateWorkerSessionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Sessions are identified by a given handle. + SessionHandle string `protobuf:"bytes,1,opt,name=session_handle,json=sessionHandle,proto3" json:"session_handle,omitempty"` + // Defines the configuration of a TensorFlow worker. + ServerDef *ServerDef `protobuf:"bytes,2,opt,name=server_def,json=serverDef,proto3" json:"server_def,omitempty"` + // If true, any resources such as Variables used in the session will not be + // shared with other sessions. + IsolateSessionState bool `protobuf:"varint,3,opt,name=isolate_session_state,json=isolateSessionState,proto3" json:"isolate_session_state,omitempty"` + // The device attributes of all the devices in the cluster. + ClusterDeviceAttributes []*device_attributes_go_proto.DeviceAttributes `protobuf:"bytes,4,rep,name=cluster_device_attributes,json=clusterDeviceAttributes,proto3" json:"cluster_device_attributes,omitempty"` + // The master task name from which the request is sent. + MasterTask string `protobuf:"bytes,5,opt,name=master_task,json=masterTask,proto3" json:"master_task,omitempty"` + // The incarnation ID of the master task local CPU device. + // If the target worker already has a WorkerSession created previously with + // the same master task name but a different incarnation, it usually indicates + // that the previous master failed before deleting the WorkerSession on the + // worker. To prevent memory leaks, the worker should garbage collect the old + // WorkerSessions. + MasterIncarnation int64 `protobuf:"varint,6,opt,name=master_incarnation,json=masterIncarnation,proto3" json:"master_incarnation,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateWorkerSessionRequest) Reset() { + *x = CreateWorkerSessionRequest{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateWorkerSessionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateWorkerSessionRequest) ProtoMessage() {} + +func (x *CreateWorkerSessionRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateWorkerSessionRequest.ProtoReflect.Descriptor instead. +func (*CreateWorkerSessionRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{2} +} + +func (x *CreateWorkerSessionRequest) GetSessionHandle() string { + if x != nil { + return x.SessionHandle + } + return "" +} + +func (x *CreateWorkerSessionRequest) GetServerDef() *ServerDef { + if x != nil { + return x.ServerDef + } + return nil +} + +func (x *CreateWorkerSessionRequest) GetIsolateSessionState() bool { + if x != nil { + return x.IsolateSessionState + } + return false +} + +func (x *CreateWorkerSessionRequest) GetClusterDeviceAttributes() []*device_attributes_go_proto.DeviceAttributes { + if x != nil { + return x.ClusterDeviceAttributes + } + return nil +} + +func (x *CreateWorkerSessionRequest) GetMasterTask() string { + if x != nil { + return x.MasterTask + } + return "" +} + +func (x *CreateWorkerSessionRequest) GetMasterIncarnation() int64 { + if x != nil { + return x.MasterIncarnation + } + return 0 +} + +type CreateWorkerSessionResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateWorkerSessionResponse) Reset() { + *x = CreateWorkerSessionResponse{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateWorkerSessionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateWorkerSessionResponse) ProtoMessage() {} + +func (x *CreateWorkerSessionResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateWorkerSessionResponse.ProtoReflect.Descriptor instead. +func (*CreateWorkerSessionResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{3} +} + +type DeleteWorkerSessionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Sessions are identified by a given handle. + SessionHandle string `protobuf:"bytes,1,opt,name=session_handle,json=sessionHandle,proto3" json:"session_handle,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteWorkerSessionRequest) Reset() { + *x = DeleteWorkerSessionRequest{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteWorkerSessionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteWorkerSessionRequest) ProtoMessage() {} + +func (x *DeleteWorkerSessionRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteWorkerSessionRequest.ProtoReflect.Descriptor instead. +func (*DeleteWorkerSessionRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{4} +} + +func (x *DeleteWorkerSessionRequest) GetSessionHandle() string { + if x != nil { + return x.SessionHandle + } + return "" +} + +type DeleteWorkerSessionResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteWorkerSessionResponse) Reset() { + *x = DeleteWorkerSessionResponse{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteWorkerSessionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteWorkerSessionResponse) ProtoMessage() {} + +func (x *DeleteWorkerSessionResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteWorkerSessionResponse.ProtoReflect.Descriptor instead. +func (*DeleteWorkerSessionResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{5} +} + +type RegisterGraphRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Subgraphs are scoped within one session. + SessionHandle string `protobuf:"bytes,1,opt,name=session_handle,json=sessionHandle,proto3" json:"session_handle,omitempty"` + // Set to true if `CreateWorkerSession` was called for `session_handle`. + CreateWorkerSessionCalled bool `protobuf:"varint,6,opt,name=create_worker_session_called,json=createWorkerSessionCalled,proto3" json:"create_worker_session_called,omitempty"` + // "graph_def" has the subgraph of nodes for this worker, with each node + // having its device_name filled in. + GraphDef *graph_go_proto.GraphDef `protobuf:"bytes,2,opt,name=graph_def,json=graphDef,proto3" json:"graph_def,omitempty"` + // True iff the graph (before partitioning) contains control flow nodes. + // + // As of 01/11/2015, this is no longer set by clients. + // + // Deprecated: Marked as deprecated in tensorflow/core/protobuf/worker.proto. + HasControlFlow bool `protobuf:"varint,3,opt,name=has_control_flow,json=hasControlFlow,proto3" json:"has_control_flow,omitempty"` + // Configuration options for the session in which this graph was created. + GraphOptions *GraphOptions `protobuf:"bytes,4,opt,name=graph_options,json=graphOptions,proto3" json:"graph_options,omitempty"` + // Field(s) used by TensorFlow Debugger (tfdbg). + DebugOptions *DebugOptions `protobuf:"bytes,5,opt,name=debug_options,json=debugOptions,proto3" json:"debug_options,omitempty"` + // If graph_def contains any collective ops this must be a positive + // integer used to coordinate execution with other graphs. All + // graphs in a distributed execution with the same + // collective_graph_key will coordinate to use the same step_id + // concurrently so that BufRendezvous entries will make the correct + // values accessible. + CollectiveGraphKey int64 `protobuf:"varint,7,opt,name=collective_graph_key,json=collectiveGraphKey,proto3" json:"collective_graph_key,omitempty"` + // ConfigProto from the session in which this graph was created. + // Contains additional parameters beyond graph_options, including + // the name of the requested executor. + ConfigProto *ConfigProto `protobuf:"bytes,8,opt,name=config_proto,json=configProto,proto3" json:"config_proto,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RegisterGraphRequest) Reset() { + *x = RegisterGraphRequest{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RegisterGraphRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RegisterGraphRequest) ProtoMessage() {} + +func (x *RegisterGraphRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RegisterGraphRequest.ProtoReflect.Descriptor instead. +func (*RegisterGraphRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{6} +} + +func (x *RegisterGraphRequest) GetSessionHandle() string { + if x != nil { + return x.SessionHandle + } + return "" +} + +func (x *RegisterGraphRequest) GetCreateWorkerSessionCalled() bool { + if x != nil { + return x.CreateWorkerSessionCalled + } + return false +} + +func (x *RegisterGraphRequest) GetGraphDef() *graph_go_proto.GraphDef { + if x != nil { + return x.GraphDef + } + return nil +} + +// Deprecated: Marked as deprecated in tensorflow/core/protobuf/worker.proto. +func (x *RegisterGraphRequest) GetHasControlFlow() bool { + if x != nil { + return x.HasControlFlow + } + return false +} + +func (x *RegisterGraphRequest) GetGraphOptions() *GraphOptions { + if x != nil { + return x.GraphOptions + } + return nil +} + +func (x *RegisterGraphRequest) GetDebugOptions() *DebugOptions { + if x != nil { + return x.DebugOptions + } + return nil +} + +func (x *RegisterGraphRequest) GetCollectiveGraphKey() int64 { + if x != nil { + return x.CollectiveGraphKey + } + return 0 +} + +func (x *RegisterGraphRequest) GetConfigProto() *ConfigProto { + if x != nil { + return x.ConfigProto + } + return nil +} + +type RegisterGraphResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // If the registration succeeds, returns an opaque graph_handle to + // the master. The master calls RunGraph with graph_handle to + // compute different steps. + GraphHandle string `protobuf:"bytes,1,opt,name=graph_handle,json=graphHandle,proto3" json:"graph_handle,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RegisterGraphResponse) Reset() { + *x = RegisterGraphResponse{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RegisterGraphResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RegisterGraphResponse) ProtoMessage() {} + +func (x *RegisterGraphResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RegisterGraphResponse.ProtoReflect.Descriptor instead. +func (*RegisterGraphResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{7} +} + +func (x *RegisterGraphResponse) GetGraphHandle() string { + if x != nil { + return x.GraphHandle + } + return "" +} + +type DeregisterGraphRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The session_handle used when registering the graph. If session_handle is + // empty, a single global namespace is used. + SessionHandle string `protobuf:"bytes,2,opt,name=session_handle,json=sessionHandle,proto3" json:"session_handle,omitempty"` + // Set to true if `CreateWorkerSession` was called for `session_handle`. + CreateWorkerSessionCalled bool `protobuf:"varint,3,opt,name=create_worker_session_called,json=createWorkerSessionCalled,proto3" json:"create_worker_session_called,omitempty"` + // REQUIRED: graph_handle must be returned by a RegisterGraph call + // to the same WorkerService. + GraphHandle string `protobuf:"bytes,1,opt,name=graph_handle,json=graphHandle,proto3" json:"graph_handle,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeregisterGraphRequest) Reset() { + *x = DeregisterGraphRequest{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeregisterGraphRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeregisterGraphRequest) ProtoMessage() {} + +func (x *DeregisterGraphRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeregisterGraphRequest.ProtoReflect.Descriptor instead. +func (*DeregisterGraphRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{8} +} + +func (x *DeregisterGraphRequest) GetSessionHandle() string { + if x != nil { + return x.SessionHandle + } + return "" +} + +func (x *DeregisterGraphRequest) GetCreateWorkerSessionCalled() bool { + if x != nil { + return x.CreateWorkerSessionCalled + } + return false +} + +func (x *DeregisterGraphRequest) GetGraphHandle() string { + if x != nil { + return x.GraphHandle + } + return "" +} + +type DeregisterGraphResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeregisterGraphResponse) Reset() { + *x = DeregisterGraphResponse{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeregisterGraphResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeregisterGraphResponse) ProtoMessage() {} + +func (x *DeregisterGraphResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeregisterGraphResponse.ProtoReflect.Descriptor instead. +func (*DeregisterGraphResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{9} +} + +type CleanupAllRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // A list of container names. + // + // If 'container' is not empty, releases resources in the given + // containers in all devices. + // + // If 'container' is empty, releases resources in the default + // container in all devices. + Container []string `protobuf:"bytes,1,rep,name=container,proto3" json:"container,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CleanupAllRequest) Reset() { + *x = CleanupAllRequest{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CleanupAllRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CleanupAllRequest) ProtoMessage() {} + +func (x *CleanupAllRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CleanupAllRequest.ProtoReflect.Descriptor instead. +func (*CleanupAllRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{10} +} + +func (x *CleanupAllRequest) GetContainer() []string { + if x != nil { + return x.Container + } + return nil +} + +type CleanupAllResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CleanupAllResponse) Reset() { + *x = CleanupAllResponse{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CleanupAllResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CleanupAllResponse) ProtoMessage() {} + +func (x *CleanupAllResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CleanupAllResponse.ProtoReflect.Descriptor instead. +func (*CleanupAllResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{11} +} + +// Options specific to the execution of a single step. +type ExecutorOpts struct { + state protoimpl.MessageState `protogen:"open.v1"` + RecordCosts bool `protobuf:"varint,1,opt,name=record_costs,json=recordCosts,proto3" json:"record_costs,omitempty"` + RecordTimeline bool `protobuf:"varint,3,opt,name=record_timeline,json=recordTimeline,proto3" json:"record_timeline,omitempty"` + RecordPartitionGraphs bool `protobuf:"varint,4,opt,name=record_partition_graphs,json=recordPartitionGraphs,proto3" json:"record_partition_graphs,omitempty"` + ReportTensorAllocationsUponOom bool `protobuf:"varint,5,opt,name=report_tensor_allocations_upon_oom,json=reportTensorAllocationsUponOom,proto3" json:"report_tensor_allocations_upon_oom,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ExecutorOpts) Reset() { + *x = ExecutorOpts{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ExecutorOpts) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExecutorOpts) ProtoMessage() {} + +func (x *ExecutorOpts) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ExecutorOpts.ProtoReflect.Descriptor instead. +func (*ExecutorOpts) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{12} +} + +func (x *ExecutorOpts) GetRecordCosts() bool { + if x != nil { + return x.RecordCosts + } + return false +} + +func (x *ExecutorOpts) GetRecordTimeline() bool { + if x != nil { + return x.RecordTimeline + } + return false +} + +func (x *ExecutorOpts) GetRecordPartitionGraphs() bool { + if x != nil { + return x.RecordPartitionGraphs + } + return false +} + +func (x *ExecutorOpts) GetReportTensorAllocationsUponOom() bool { + if x != nil { + return x.ReportTensorAllocationsUponOom + } + return false +} + +type RunGraphRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // session_handle is the master-generated unique id for this session. + // If session_handle is non-empty, it must be the same as used when + // registering the graph. If it is empty, a single global namespace is used to + // search for the graph_handle. + SessionHandle string `protobuf:"bytes,8,opt,name=session_handle,json=sessionHandle,proto3" json:"session_handle,omitempty"` + // Set to true if `CreateWorkerSession` was called for `session_handle`. + CreateWorkerSessionCalled bool `protobuf:"varint,10,opt,name=create_worker_session_called,json=createWorkerSessionCalled,proto3" json:"create_worker_session_called,omitempty"` + // REQUIRED: graph_handle must be returned by a RegisterGraph call + // to the same WorkerService. + GraphHandle string `protobuf:"bytes,1,opt,name=graph_handle,json=graphHandle,proto3" json:"graph_handle,omitempty"` + // A unique ID to distinguish different runs of the same graph. + // + // The master generates a global unique `step_id` to distinguish + // different runs of the graph computation. Subgraphs communicate + // (e.g., send/recv ops) with each other using `step_id` to + // distinguish tensors generated by different runs. + StepId int64 `protobuf:"varint,2,opt,name=step_id,json=stepId,proto3" json:"step_id,omitempty"` + // Options for this step. + ExecOpts *ExecutorOpts `protobuf:"bytes,5,opt,name=exec_opts,json=execOpts,proto3" json:"exec_opts,omitempty"` + // Runs the graph. + // + // Sends the tensors in "send" into the graph before the run and + // fetches the keys into `RunGraphResponse.recv` after the run. + Send []*NamedTensorProto `protobuf:"bytes,3,rep,name=send,proto3" json:"send,omitempty"` + RecvKey []string `protobuf:"bytes,4,rep,name=recv_key,json=recvKey,proto3" json:"recv_key,omitempty"` + // True if the RunGraphRequest is a partial run request. + IsPartial bool `protobuf:"varint,6,opt,name=is_partial,json=isPartial,proto3" json:"is_partial,omitempty"` + // True if this is the last partial run request in a sequence of requests. + IsLastPartialRun bool `protobuf:"varint,7,opt,name=is_last_partial_run,json=isLastPartialRun,proto3" json:"is_last_partial_run,omitempty"` + // If true then some errors, e.g., execution errors that have long + // error messages, may return an OK RunGraphResponse with the actual + // error saved in the status_code/status_error_message fields of the + // response body. This is a workaround since the RPC subsystem may + // truncate long metadata messages. + StoreErrorsInResponseBody bool `protobuf:"varint,9,opt,name=store_errors_in_response_body,json=storeErrorsInResponseBody,proto3" json:"store_errors_in_response_body,omitempty"` + // Unique identifier for this request. Every RunGraphRequest must have a + // unique request_id, and retried RunGraphRequests must have the same + // request_id. If request_id is zero, retry detection is disabled. + // + // Retried RunGraphRequests are problematic because they may issue a + // RecvTensor that will have no corresponding sender and will wait forever. + // Workers use request_ids to reject retried RunGraph requests instead of + // waiting forever. + RequestId int64 `protobuf:"varint,11,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RunGraphRequest) Reset() { + *x = RunGraphRequest{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RunGraphRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RunGraphRequest) ProtoMessage() {} + +func (x *RunGraphRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[13] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RunGraphRequest.ProtoReflect.Descriptor instead. +func (*RunGraphRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{13} +} + +func (x *RunGraphRequest) GetSessionHandle() string { + if x != nil { + return x.SessionHandle + } + return "" +} + +func (x *RunGraphRequest) GetCreateWorkerSessionCalled() bool { + if x != nil { + return x.CreateWorkerSessionCalled + } + return false +} + +func (x *RunGraphRequest) GetGraphHandle() string { + if x != nil { + return x.GraphHandle + } + return "" +} + +func (x *RunGraphRequest) GetStepId() int64 { + if x != nil { + return x.StepId + } + return 0 +} + +func (x *RunGraphRequest) GetExecOpts() *ExecutorOpts { + if x != nil { + return x.ExecOpts + } + return nil +} + +func (x *RunGraphRequest) GetSend() []*NamedTensorProto { + if x != nil { + return x.Send + } + return nil +} + +func (x *RunGraphRequest) GetRecvKey() []string { + if x != nil { + return x.RecvKey + } + return nil +} + +func (x *RunGraphRequest) GetIsPartial() bool { + if x != nil { + return x.IsPartial + } + return false +} + +func (x *RunGraphRequest) GetIsLastPartialRun() bool { + if x != nil { + return x.IsLastPartialRun + } + return false +} + +func (x *RunGraphRequest) GetStoreErrorsInResponseBody() bool { + if x != nil { + return x.StoreErrorsInResponseBody + } + return false +} + +func (x *RunGraphRequest) GetRequestId() int64 { + if x != nil { + return x.RequestId + } + return 0 +} + +type RunGraphResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // A list of tensors corresponding to those requested by + // `RunGraphRequest.recv_key`. + Recv []*NamedTensorProto `protobuf:"bytes,1,rep,name=recv,proto3" json:"recv,omitempty"` + // If the request asked for execution stats, the cost graph, or the partition + // graphs, these are returned here. + // TODO(suharshs): Package these in a RunMetadata instead. + StepStats *step_stats_go_proto.StepStats `protobuf:"bytes,2,opt,name=step_stats,json=stepStats,proto3" json:"step_stats,omitempty"` + CostGraph *cost_graph_go_proto.CostGraphDef `protobuf:"bytes,3,opt,name=cost_graph,json=costGraph,proto3" json:"cost_graph,omitempty"` + PartitionGraph []*graph_go_proto.GraphDef `protobuf:"bytes,4,rep,name=partition_graph,json=partitionGraph,proto3" json:"partition_graph,omitempty"` + // If store_errors_in_response_body is true in the request, then + // optionally the server may return an OK status for the RPC and + // fill the true status into the fields below, to allow for messages + // that are too long to fit in metadata. + StatusCode Code `protobuf:"varint,5,opt,name=status_code,json=statusCode,proto3,enum=tensorflow.error.Code" json:"status_code,omitempty"` + StatusErrorMessage string `protobuf:"bytes,6,opt,name=status_error_message,json=statusErrorMessage,proto3" json:"status_error_message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RunGraphResponse) Reset() { + *x = RunGraphResponse{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RunGraphResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RunGraphResponse) ProtoMessage() {} + +func (x *RunGraphResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[14] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RunGraphResponse.ProtoReflect.Descriptor instead. +func (*RunGraphResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{14} +} + +func (x *RunGraphResponse) GetRecv() []*NamedTensorProto { + if x != nil { + return x.Recv + } + return nil +} + +func (x *RunGraphResponse) GetStepStats() *step_stats_go_proto.StepStats { + if x != nil { + return x.StepStats + } + return nil +} + +func (x *RunGraphResponse) GetCostGraph() *cost_graph_go_proto.CostGraphDef { + if x != nil { + return x.CostGraph + } + return nil +} + +func (x *RunGraphResponse) GetPartitionGraph() []*graph_go_proto.GraphDef { + if x != nil { + return x.PartitionGraph + } + return nil +} + +func (x *RunGraphResponse) GetStatusCode() Code { + if x != nil { + return x.StatusCode + } + return Code_OK +} + +func (x *RunGraphResponse) GetStatusErrorMessage() string { + if x != nil { + return x.StatusErrorMessage + } + return "" +} + +type CleanupGraphRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + StepId int64 `protobuf:"varint,1,opt,name=step_id,json=stepId,proto3" json:"step_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CleanupGraphRequest) Reset() { + *x = CleanupGraphRequest{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CleanupGraphRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CleanupGraphRequest) ProtoMessage() {} + +func (x *CleanupGraphRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[15] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CleanupGraphRequest.ProtoReflect.Descriptor instead. +func (*CleanupGraphRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{15} +} + +func (x *CleanupGraphRequest) GetStepId() int64 { + if x != nil { + return x.StepId + } + return 0 +} + +type CleanupGraphResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CleanupGraphResponse) Reset() { + *x = CleanupGraphResponse{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CleanupGraphResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CleanupGraphResponse) ProtoMessage() {} + +func (x *CleanupGraphResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[16] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CleanupGraphResponse.ProtoReflect.Descriptor instead. +func (*CleanupGraphResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{16} +} + +type RecvTensorRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The step in which the tensor will be produced. + // + // REQUIRED: This must eventually correspond to the `step_id` passed + // into a RunGraph call on the same WorkerService. + StepId int64 `protobuf:"varint,1,opt,name=step_id,json=stepId,proto3" json:"step_id,omitempty"` + // A key identifying the channel to receive tensors from. A RecvTensor request + // retrieves one tensor from the channel, but multiple tensors can be sent and + // received over the same channel with multiple RecvTensor requests. See + // rendezvous.h for details. + RendezvousKey string `protobuf:"bytes,2,opt,name=rendezvous_key,json=rendezvousKey,proto3" json:"rendezvous_key,omitempty"` + // If true, use an out-of-band DMA mechanism to transfer the + // received tensor. + DmaOk bool `protobuf:"varint,3,opt,name=dma_ok,json=dmaOk,proto3" json:"dma_ok,omitempty"` + // Optional information on client-side device locality. + ClientLocality *device_attributes_go_proto.DeviceLocality `protobuf:"bytes,4,opt,name=client_locality,json=clientLocality,proto3" json:"client_locality,omitempty"` + // Optional information on server-side device locality. + ServerLocality *device_attributes_go_proto.DeviceLocality `protobuf:"bytes,5,opt,name=server_locality,json=serverLocality,proto3" json:"server_locality,omitempty"` + // Optional information needed by the RPC subsystem. + TransportOptions *anypb.Any `protobuf:"bytes,6,opt,name=transport_options,json=transportOptions,proto3" json:"transport_options,omitempty"` + // Unique identifier for this request. Every RecvTensorRequest must have a + // unique request_id, and retried RecvTensorRequests must have the same + // request_id. If request_id is zero, retry detection and response cache + // are disabled. + // + // Retried RecvTensorRequests are problematic because a RecvTensor with no + // corresponding sender will wait forever, and the tensor may have been + // delivered to a previous retry. Workers use request_ids to reject retried + // RecvTensor requests instead of waiting forever. + RequestId int64 `protobuf:"varint,7,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RecvTensorRequest) Reset() { + *x = RecvTensorRequest{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RecvTensorRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RecvTensorRequest) ProtoMessage() {} + +func (x *RecvTensorRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[17] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RecvTensorRequest.ProtoReflect.Descriptor instead. +func (*RecvTensorRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{17} +} + +func (x *RecvTensorRequest) GetStepId() int64 { + if x != nil { + return x.StepId + } + return 0 +} + +func (x *RecvTensorRequest) GetRendezvousKey() string { + if x != nil { + return x.RendezvousKey + } + return "" +} + +func (x *RecvTensorRequest) GetDmaOk() bool { + if x != nil { + return x.DmaOk + } + return false +} + +func (x *RecvTensorRequest) GetClientLocality() *device_attributes_go_proto.DeviceLocality { + if x != nil { + return x.ClientLocality + } + return nil +} + +func (x *RecvTensorRequest) GetServerLocality() *device_attributes_go_proto.DeviceLocality { + if x != nil { + return x.ServerLocality + } + return nil +} + +func (x *RecvTensorRequest) GetTransportOptions() *anypb.Any { + if x != nil { + return x.TransportOptions + } + return nil +} + +func (x *RecvTensorRequest) GetRequestId() int64 { + if x != nil { + return x.RequestId + } + return 0 +} + +type RecvTensorResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The tensor as a proto. + Tensor *tensor_go_proto.TensorProto `protobuf:"bytes,1,opt,name=tensor,proto3" json:"tensor,omitempty"` + // If true, this tensor was the output of a dead node, and the + // content is invalid. + IsDead bool `protobuf:"varint,2,opt,name=is_dead,json=isDead,proto3" json:"is_dead,omitempty"` + // The time at which tensor was available and started to be returned. + SendStartMicros int64 `protobuf:"varint,3,opt,name=send_start_micros,json=sendStartMicros,proto3" json:"send_start_micros,omitempty"` + // Optional additional information about how to receive the tensor, + // e.g. in the event that `RecvTensorRequest.dma_ok` was true. + TransportOptions *anypb.Any `protobuf:"bytes,4,opt,name=transport_options,json=transportOptions,proto3" json:"transport_options,omitempty"` + // Whether the receiver should send a MarkRecvFinishedRequest to the sender + // to ack the message. + RequireAck bool `protobuf:"varint,5,opt,name=require_ack,json=requireAck,proto3" json:"require_ack,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RecvTensorResponse) Reset() { + *x = RecvTensorResponse{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RecvTensorResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RecvTensorResponse) ProtoMessage() {} + +func (x *RecvTensorResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[18] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RecvTensorResponse.ProtoReflect.Descriptor instead. +func (*RecvTensorResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{18} +} + +func (x *RecvTensorResponse) GetTensor() *tensor_go_proto.TensorProto { + if x != nil { + return x.Tensor + } + return nil +} + +func (x *RecvTensorResponse) GetIsDead() bool { + if x != nil { + return x.IsDead + } + return false +} + +func (x *RecvTensorResponse) GetSendStartMicros() int64 { + if x != nil { + return x.SendStartMicros + } + return 0 +} + +func (x *RecvTensorResponse) GetTransportOptions() *anypb.Any { + if x != nil { + return x.TransportOptions + } + return nil +} + +func (x *RecvTensorResponse) GetRequireAck() bool { + if x != nil { + return x.RequireAck + } + return false +} + +// Message for managing the response cache maintained on the sender side. +// Currently only used by the gRPC worker service. +type MarkRecvFinishedRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + RequestId int64 `protobuf:"varint,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MarkRecvFinishedRequest) Reset() { + *x = MarkRecvFinishedRequest{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MarkRecvFinishedRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MarkRecvFinishedRequest) ProtoMessage() {} + +func (x *MarkRecvFinishedRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[19] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MarkRecvFinishedRequest.ProtoReflect.Descriptor instead. +func (*MarkRecvFinishedRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{19} +} + +func (x *MarkRecvFinishedRequest) GetRequestId() int64 { + if x != nil { + return x.RequestId + } + return 0 +} + +type MarkRecvFinishedResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MarkRecvFinishedResponse) Reset() { + *x = MarkRecvFinishedResponse{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MarkRecvFinishedResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MarkRecvFinishedResponse) ProtoMessage() {} + +func (x *MarkRecvFinishedResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[20] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MarkRecvFinishedResponse.ProtoReflect.Descriptor instead. +func (*MarkRecvFinishedResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{20} +} + +// Out-of-band request to begin or end logging, or +// to retrieve logs for particular steps. +type LoggingRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // If true, RPC logging will be enabled. + EnableRpcLogging bool `protobuf:"varint,1,opt,name=enable_rpc_logging,json=enableRpcLogging,proto3" json:"enable_rpc_logging,omitempty"` + // If true, RPC logging will be disabled. + DisableRpcLogging bool `protobuf:"varint,4,opt,name=disable_rpc_logging,json=disableRpcLogging,proto3" json:"disable_rpc_logging,omitempty"` + // If true, discard any saved logging data (for all steps). + Clear bool `protobuf:"varint,2,opt,name=clear,proto3" json:"clear,omitempty"` + // When set, requests all saved log data pertaining to the step. + // Any log data retrieved is eliminated from the store and cannot be + // retrieved again. + FetchStepId []int64 `protobuf:"varint,3,rep,packed,name=fetch_step_id,json=fetchStepId,proto3" json:"fetch_step_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LoggingRequest) Reset() { + *x = LoggingRequest{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LoggingRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LoggingRequest) ProtoMessage() {} + +func (x *LoggingRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[21] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LoggingRequest.ProtoReflect.Descriptor instead. +func (*LoggingRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{21} +} + +func (x *LoggingRequest) GetEnableRpcLogging() bool { + if x != nil { + return x.EnableRpcLogging + } + return false +} + +func (x *LoggingRequest) GetDisableRpcLogging() bool { + if x != nil { + return x.DisableRpcLogging + } + return false +} + +func (x *LoggingRequest) GetClear() bool { + if x != nil { + return x.Clear + } + return false +} + +func (x *LoggingRequest) GetFetchStepId() []int64 { + if x != nil { + return x.FetchStepId + } + return nil +} + +type LabeledStepStats struct { + state protoimpl.MessageState `protogen:"open.v1"` + StepId int64 `protobuf:"varint,1,opt,name=step_id,json=stepId,proto3" json:"step_id,omitempty"` + StepStats *step_stats_go_proto.StepStats `protobuf:"bytes,2,opt,name=step_stats,json=stepStats,proto3" json:"step_stats,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LabeledStepStats) Reset() { + *x = LabeledStepStats{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LabeledStepStats) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LabeledStepStats) ProtoMessage() {} + +func (x *LabeledStepStats) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[22] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LabeledStepStats.ProtoReflect.Descriptor instead. +func (*LabeledStepStats) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{22} +} + +func (x *LabeledStepStats) GetStepId() int64 { + if x != nil { + return x.StepId + } + return 0 +} + +func (x *LabeledStepStats) GetStepStats() *step_stats_go_proto.StepStats { + if x != nil { + return x.StepStats + } + return nil +} + +type LoggingResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Step []*LabeledStepStats `protobuf:"bytes,1,rep,name=step,proto3" json:"step,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LoggingResponse) Reset() { + *x = LoggingResponse{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LoggingResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LoggingResponse) ProtoMessage() {} + +func (x *LoggingResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[23] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LoggingResponse.ProtoReflect.Descriptor instead. +func (*LoggingResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{23} +} + +func (x *LoggingResponse) GetStep() []*LabeledStepStats { + if x != nil { + return x.Step + } + return nil +} + +type TraceOpts struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Length of the trace to be taken, in seconds. + Duration float64 `protobuf:"fixed64,1,opt,name=duration,proto3" json:"duration,omitempty"` + // If true, capture step profile locally in each worker. Currently + // unimplemented. + UseStepProfiler bool `protobuf:"varint,2,opt,name=use_step_profiler,json=useStepProfiler,proto3" json:"use_step_profiler,omitempty"` + // If true, capture kernel events from each worker. + UseKernelProfiler bool `protobuf:"varint,3,opt,name=use_kernel_profiler,json=useKernelProfiler,proto3" json:"use_kernel_profiler,omitempty"` + // If true, capture extended profiling events from TensorFlow process. + UseExtendedProfiler bool `protobuf:"varint,4,opt,name=use_extended_profiler,json=useExtendedProfiler,proto3" json:"use_extended_profiler,omitempty"` + // If true, capture GPU profiling events locally on each + // machine. Currently unimplemented. + UseGpuProfiler bool `protobuf:"varint,5,opt,name=use_gpu_profiler,json=useGpuProfiler,proto3" json:"use_gpu_profiler,omitempty"` + // If true, collect sampled profile events. Currently unimplemented. + UseSampleProfiler bool `protobuf:"varint,6,opt,name=use_sample_profiler,json=useSampleProfiler,proto3" json:"use_sample_profiler,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TraceOpts) Reset() { + *x = TraceOpts{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TraceOpts) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TraceOpts) ProtoMessage() {} + +func (x *TraceOpts) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[24] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TraceOpts.ProtoReflect.Descriptor instead. +func (*TraceOpts) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{24} +} + +func (x *TraceOpts) GetDuration() float64 { + if x != nil { + return x.Duration + } + return 0 +} + +func (x *TraceOpts) GetUseStepProfiler() bool { + if x != nil { + return x.UseStepProfiler + } + return false +} + +func (x *TraceOpts) GetUseKernelProfiler() bool { + if x != nil { + return x.UseKernelProfiler + } + return false +} + +func (x *TraceOpts) GetUseExtendedProfiler() bool { + if x != nil { + return x.UseExtendedProfiler + } + return false +} + +func (x *TraceOpts) GetUseGpuProfiler() bool { + if x != nil { + return x.UseGpuProfiler + } + return false +} + +func (x *TraceOpts) GetUseSampleProfiler() bool { + if x != nil { + return x.UseSampleProfiler + } + return false +} + +// Out-of-band request to configure distributed tracing. +type TracingRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Options *TraceOpts `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TracingRequest) Reset() { + *x = TracingRequest{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TracingRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TracingRequest) ProtoMessage() {} + +func (x *TracingRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[25] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TracingRequest.ProtoReflect.Descriptor instead. +func (*TracingRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{25} +} + +func (x *TracingRequest) GetOptions() *TraceOpts { + if x != nil { + return x.Options + } + return nil +} + +type TracingResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TracingResponse) Reset() { + *x = TracingResponse{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TracingResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TracingResponse) ProtoMessage() {} + +func (x *TracingResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[26] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TracingResponse.ProtoReflect.Descriptor instead. +func (*TracingResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{26} +} + +type RecvBufRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Used at server side to find the correct BufRendezvous. + StepId int64 `protobuf:"varint,1,opt,name=step_id,json=stepId,proto3" json:"step_id,omitempty"` + // Arbitrary string identifying a BufRendezvous entry. + BufRendezvousKey string `protobuf:"bytes,2,opt,name=buf_rendezvous_key,json=bufRendezvousKey,proto3" json:"buf_rendezvous_key,omitempty"` + // Size of value expected, must agree with BufRendezvous entry. + NumBytes int64 `protobuf:"varint,3,opt,name=num_bytes,json=numBytes,proto3" json:"num_bytes,omitempty"` + // When RDMA is in use, address of destination field on client. + BufPtr uint64 `protobuf:"fixed64,4,opt,name=buf_ptr,json=bufPtr,proto3" json:"buf_ptr,omitempty"` + // Optional information on client-side device locality. + ClientLocality *device_attributes_go_proto.DeviceLocality `protobuf:"bytes,5,opt,name=client_locality,json=clientLocality,proto3" json:"client_locality,omitempty"` + // Optional information on server-side device locality. + ServerLocality *device_attributes_go_proto.DeviceLocality `protobuf:"bytes,6,opt,name=server_locality,json=serverLocality,proto3" json:"server_locality,omitempty"` + // Optional, implementation-specific data. + TransportOptions *anypb.Any `protobuf:"bytes,7,opt,name=transport_options,json=transportOptions,proto3" json:"transport_options,omitempty"` + // For annotating timeline and device incarnation check. + SrcDevice string `protobuf:"bytes,8,opt,name=src_device,json=srcDevice,proto3" json:"src_device,omitempty"` + // Optional, for annotating the timeline. + DstDevice string `protobuf:"bytes,9,opt,name=dst_device,json=dstDevice,proto3" json:"dst_device,omitempty"` + // Depending on the RPC system in use, it may be necessary to set this + // id to detect resends of RPCs where the server is not aware that + // the prior RPC failed. + RequestId int64 `protobuf:"varint,10,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + // Incarnation number of the source device, used to detect worker failures. + SrcIncarnation uint64 `protobuf:"varint,11,opt,name=src_incarnation,json=srcIncarnation,proto3" json:"src_incarnation,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RecvBufRequest) Reset() { + *x = RecvBufRequest{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RecvBufRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RecvBufRequest) ProtoMessage() {} + +func (x *RecvBufRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[27] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RecvBufRequest.ProtoReflect.Descriptor instead. +func (*RecvBufRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{27} +} + +func (x *RecvBufRequest) GetStepId() int64 { + if x != nil { + return x.StepId + } + return 0 +} + +func (x *RecvBufRequest) GetBufRendezvousKey() string { + if x != nil { + return x.BufRendezvousKey + } + return "" +} + +func (x *RecvBufRequest) GetNumBytes() int64 { + if x != nil { + return x.NumBytes + } + return 0 +} + +func (x *RecvBufRequest) GetBufPtr() uint64 { + if x != nil { + return x.BufPtr + } + return 0 +} + +func (x *RecvBufRequest) GetClientLocality() *device_attributes_go_proto.DeviceLocality { + if x != nil { + return x.ClientLocality + } + return nil +} + +func (x *RecvBufRequest) GetServerLocality() *device_attributes_go_proto.DeviceLocality { + if x != nil { + return x.ServerLocality + } + return nil +} + +func (x *RecvBufRequest) GetTransportOptions() *anypb.Any { + if x != nil { + return x.TransportOptions + } + return nil +} + +func (x *RecvBufRequest) GetSrcDevice() string { + if x != nil { + return x.SrcDevice + } + return "" +} + +func (x *RecvBufRequest) GetDstDevice() string { + if x != nil { + return x.DstDevice + } + return "" +} + +func (x *RecvBufRequest) GetRequestId() int64 { + if x != nil { + return x.RequestId + } + return 0 +} + +func (x *RecvBufRequest) GetSrcIncarnation() uint64 { + if x != nil { + return x.SrcIncarnation + } + return 0 +} + +type RecvBufResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + BufPtr uint64 `protobuf:"fixed64,1,opt,name=buf_ptr,json=bufPtr,proto3" json:"buf_ptr,omitempty"` // Address of source field on server. + NumBytes int64 `protobuf:"varint,2,opt,name=num_bytes,json=numBytes,proto3" json:"num_bytes,omitempty"` // Byte length of buf_ptr field, if set. + IsDead bool `protobuf:"varint,3,opt,name=is_dead,json=isDead,proto3" json:"is_dead,omitempty"` // True if value is 'dead' like a tensor. + // Optional, implementation-specific data. + TransportOptions *anypb.Any `protobuf:"bytes,4,opt,name=transport_options,json=transportOptions,proto3" json:"transport_options,omitempty"` + // Optional, for timeline. + SendStartMicros int64 `protobuf:"varint,5,opt,name=send_start_micros,json=sendStartMicros,proto3" json:"send_start_micros,omitempty"` + // Whether the receiver should send a MarkRecvFinishedRequest to the sender + // to ack the message. + RequireAck bool `protobuf:"varint,6,opt,name=require_ack,json=requireAck,proto3" json:"require_ack,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RecvBufResponse) Reset() { + *x = RecvBufResponse{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RecvBufResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RecvBufResponse) ProtoMessage() {} + +func (x *RecvBufResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[28] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RecvBufResponse.ProtoReflect.Descriptor instead. +func (*RecvBufResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{28} +} + +func (x *RecvBufResponse) GetBufPtr() uint64 { + if x != nil { + return x.BufPtr + } + return 0 +} + +func (x *RecvBufResponse) GetNumBytes() int64 { + if x != nil { + return x.NumBytes + } + return 0 +} + +func (x *RecvBufResponse) GetIsDead() bool { + if x != nil { + return x.IsDead + } + return false +} + +func (x *RecvBufResponse) GetTransportOptions() *anypb.Any { + if x != nil { + return x.TransportOptions + } + return nil +} + +func (x *RecvBufResponse) GetSendStartMicros() int64 { + if x != nil { + return x.SendStartMicros + } + return 0 +} + +func (x *RecvBufResponse) GetRequireAck() bool { + if x != nil { + return x.RequireAck + } + return false +} + +// Supplies one or more device names as members of the group identified by +// group_key. Service will respond when all group_size devices become known. +// All devices in group must have same type. +type CompleteGroupRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + GroupKey int32 `protobuf:"varint,1,opt,name=group_key,json=groupKey,proto3" json:"group_key,omitempty"` + GroupSize int32 `protobuf:"varint,2,opt,name=group_size,json=groupSize,proto3" json:"group_size,omitempty"` + DeviceType string `protobuf:"bytes,3,opt,name=device_type,json=deviceType,proto3" json:"device_type,omitempty"` + CollectiveType int32 `protobuf:"varint,5,opt,name=collective_type,json=collectiveType,proto3" json:"collective_type,omitempty"` + DeviceAttributes *device_attributes_go_proto.DeviceAttributes `protobuf:"bytes,6,opt,name=device_attributes,json=deviceAttributes,proto3" json:"device_attributes,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CompleteGroupRequest) Reset() { + *x = CompleteGroupRequest{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CompleteGroupRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CompleteGroupRequest) ProtoMessage() {} + +func (x *CompleteGroupRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[29] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CompleteGroupRequest.ProtoReflect.Descriptor instead. +func (*CompleteGroupRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{29} +} + +func (x *CompleteGroupRequest) GetGroupKey() int32 { + if x != nil { + return x.GroupKey + } + return 0 +} + +func (x *CompleteGroupRequest) GetGroupSize() int32 { + if x != nil { + return x.GroupSize + } + return 0 +} + +func (x *CompleteGroupRequest) GetDeviceType() string { + if x != nil { + return x.DeviceType + } + return "" +} + +func (x *CompleteGroupRequest) GetCollectiveType() int32 { + if x != nil { + return x.CollectiveType + } + return 0 +} + +func (x *CompleteGroupRequest) GetDeviceAttributes() *device_attributes_go_proto.DeviceAttributes { + if x != nil { + return x.DeviceAttributes + } + return nil +} + +// Gives the complete membership of the group identified by group_key. +type CompleteGroupResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + GroupKey int32 `protobuf:"varint,1,opt,name=group_key,json=groupKey,proto3" json:"group_key,omitempty"` + GroupSize int32 `protobuf:"varint,2,opt,name=group_size,json=groupSize,proto3" json:"group_size,omitempty"` + DeviceType string `protobuf:"bytes,3,opt,name=device_type,json=deviceType,proto3" json:"device_type,omitempty"` + NumTasks int32 `protobuf:"varint,4,opt,name=num_tasks,json=numTasks,proto3" json:"num_tasks,omitempty"` // number of distinct tasks hosting the devices + CommunicatorKey []byte `protobuf:"bytes,7,opt,name=communicator_key,json=communicatorKey,proto3" json:"communicator_key,omitempty"` + DeviceAttributes []*device_attributes_go_proto.DeviceAttributes `protobuf:"bytes,8,rep,name=device_attributes,json=deviceAttributes,proto3" json:"device_attributes,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CompleteGroupResponse) Reset() { + *x = CompleteGroupResponse{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CompleteGroupResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CompleteGroupResponse) ProtoMessage() {} + +func (x *CompleteGroupResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[30] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CompleteGroupResponse.ProtoReflect.Descriptor instead. +func (*CompleteGroupResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{30} +} + +func (x *CompleteGroupResponse) GetGroupKey() int32 { + if x != nil { + return x.GroupKey + } + return 0 +} + +func (x *CompleteGroupResponse) GetGroupSize() int32 { + if x != nil { + return x.GroupSize + } + return 0 +} + +func (x *CompleteGroupResponse) GetDeviceType() string { + if x != nil { + return x.DeviceType + } + return "" +} + +func (x *CompleteGroupResponse) GetNumTasks() int32 { + if x != nil { + return x.NumTasks + } + return 0 +} + +func (x *CompleteGroupResponse) GetCommunicatorKey() []byte { + if x != nil { + return x.CommunicatorKey + } + return nil +} + +func (x *CompleteGroupResponse) GetDeviceAttributes() []*device_attributes_go_proto.DeviceAttributes { + if x != nil { + return x.DeviceAttributes + } + return nil +} + +// Supplies data about one collective op belonging to the instance identified +// by instance_key. Service will respond when all group_size ops have +// become known. Most of the data being sent is for correctness checking, +// to ensure that all ops in the instance share common attributes. +type CompleteInstanceRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Type int32 `protobuf:"varint,2,opt,name=type,proto3" json:"type,omitempty"` + DataType types_go_proto.DataType `protobuf:"varint,3,opt,name=data_type,json=dataType,proto3,enum=tensorflow.DataType" json:"data_type,omitempty"` + Shape *tensor_shape_go_proto.TensorShapeProto `protobuf:"bytes,4,opt,name=shape,proto3" json:"shape,omitempty"` + GroupKey int32 `protobuf:"varint,5,opt,name=group_key,json=groupKey,proto3" json:"group_key,omitempty"` + GroupSize int32 `protobuf:"varint,6,opt,name=group_size,json=groupSize,proto3" json:"group_size,omitempty"` + InstanceKey int32 `protobuf:"varint,7,opt,name=instance_key,json=instanceKey,proto3" json:"instance_key,omitempty"` + DeviceType string `protobuf:"bytes,8,opt,name=device_type,json=deviceType,proto3" json:"device_type,omitempty"` + SubdivOffset []int32 `protobuf:"varint,9,rep,packed,name=subdiv_offset,json=subdivOffset,proto3" json:"subdiv_offset,omitempty"` + Device string `protobuf:"bytes,10,opt,name=device,proto3" json:"device,omitempty"` + IsSource bool `protobuf:"varint,11,opt,name=is_source,json=isSource,proto3" json:"is_source,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CompleteInstanceRequest) Reset() { + *x = CompleteInstanceRequest{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CompleteInstanceRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CompleteInstanceRequest) ProtoMessage() {} + +func (x *CompleteInstanceRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[31] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CompleteInstanceRequest.ProtoReflect.Descriptor instead. +func (*CompleteInstanceRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{31} +} + +func (x *CompleteInstanceRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CompleteInstanceRequest) GetType() int32 { + if x != nil { + return x.Type + } + return 0 +} + +func (x *CompleteInstanceRequest) GetDataType() types_go_proto.DataType { + if x != nil { + return x.DataType + } + return types_go_proto.DataType(0) +} + +func (x *CompleteInstanceRequest) GetShape() *tensor_shape_go_proto.TensorShapeProto { + if x != nil { + return x.Shape + } + return nil +} + +func (x *CompleteInstanceRequest) GetGroupKey() int32 { + if x != nil { + return x.GroupKey + } + return 0 +} + +func (x *CompleteInstanceRequest) GetGroupSize() int32 { + if x != nil { + return x.GroupSize + } + return 0 +} + +func (x *CompleteInstanceRequest) GetInstanceKey() int32 { + if x != nil { + return x.InstanceKey + } + return 0 +} + +func (x *CompleteInstanceRequest) GetDeviceType() string { + if x != nil { + return x.DeviceType + } + return "" +} + +func (x *CompleteInstanceRequest) GetSubdivOffset() []int32 { + if x != nil { + return x.SubdivOffset + } + return nil +} + +func (x *CompleteInstanceRequest) GetDevice() string { + if x != nil { + return x.Device + } + return "" +} + +func (x *CompleteInstanceRequest) GetIsSource() bool { + if x != nil { + return x.IsSource + } + return false +} + +// Confirms that every op in the instance has consistently declared itself. +// Also gives the source_rank in case of broadcast. +type CompleteInstanceResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + InstanceKey int32 `protobuf:"varint,1,opt,name=instance_key,json=instanceKey,proto3" json:"instance_key,omitempty"` + SourceRank int32 `protobuf:"varint,2,opt,name=source_rank,json=sourceRank,proto3" json:"source_rank,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CompleteInstanceResponse) Reset() { + *x = CompleteInstanceResponse{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CompleteInstanceResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CompleteInstanceResponse) ProtoMessage() {} + +func (x *CompleteInstanceResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[32] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CompleteInstanceResponse.ProtoReflect.Descriptor instead. +func (*CompleteInstanceResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{32} +} + +func (x *CompleteInstanceResponse) GetInstanceKey() int32 { + if x != nil { + return x.InstanceKey + } + return 0 +} + +func (x *CompleteInstanceResponse) GetSourceRank() int32 { + if x != nil { + return x.SourceRank + } + return 0 +} + +// Request for next agreed-upon step_id for the specified graph_keys. +// This is used to enable multiple graphs containing nodes from +// a common collective instance to coordinate using the same step_ids. +type GetStepSequenceRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + GraphKey []int64 `protobuf:"varint,1,rep,packed,name=graph_key,json=graphKey,proto3" json:"graph_key,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetStepSequenceRequest) Reset() { + *x = GetStepSequenceRequest{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[33] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetStepSequenceRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetStepSequenceRequest) ProtoMessage() {} + +func (x *GetStepSequenceRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[33] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetStepSequenceRequest.ProtoReflect.Descriptor instead. +func (*GetStepSequenceRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{33} +} + +func (x *GetStepSequenceRequest) GetGraphKey() []int64 { + if x != nil { + return x.GraphKey + } + return nil +} + +type StepSequence struct { + state protoimpl.MessageState `protogen:"open.v1"` + GraphKey int64 `protobuf:"varint,1,opt,name=graph_key,json=graphKey,proto3" json:"graph_key,omitempty"` + NextStepId int64 `protobuf:"varint,2,opt,name=next_step_id,json=nextStepId,proto3" json:"next_step_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *StepSequence) Reset() { + *x = StepSequence{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[34] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *StepSequence) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StepSequence) ProtoMessage() {} + +func (x *StepSequence) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[34] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StepSequence.ProtoReflect.Descriptor instead. +func (*StepSequence) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{34} +} + +func (x *StepSequence) GetGraphKey() int64 { + if x != nil { + return x.GraphKey + } + return 0 +} + +func (x *StepSequence) GetNextStepId() int64 { + if x != nil { + return x.NextStepId + } + return 0 +} + +// Next valid step_ids for one or more graph_keys. +type GetStepSequenceResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + StepSequence []*StepSequence `protobuf:"bytes,1,rep,name=step_sequence,json=stepSequence,proto3" json:"step_sequence,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetStepSequenceResponse) Reset() { + *x = GetStepSequenceResponse{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[35] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetStepSequenceResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetStepSequenceResponse) ProtoMessage() {} + +func (x *GetStepSequenceResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[35] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetStepSequenceResponse.ProtoReflect.Descriptor instead. +func (*GetStepSequenceResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{35} +} + +func (x *GetStepSequenceResponse) GetStepSequence() []*StepSequence { + if x != nil { + return x.StepSequence + } + return nil +} + +var File_tensorflow_core_protobuf_worker_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_worker_proto_rawDesc = "" + + "\n" + + "%tensorflow/core/protobuf/worker.proto\x12\n" + + "tensorflow\x1a\x19google/protobuf/any.proto\x1a*tensorflow/core/framework/cost_graph.proto\x1a1tensorflow/core/framework/device_attributes.proto\x1a%tensorflow/core/framework/graph.proto\x1a*tensorflow/core/framework/step_stats.proto\x1a&tensorflow/core/framework/tensor.proto\x1a,tensorflow/core/framework/tensor_shape.proto\x1a%tensorflow/core/framework/types.proto\x1a%tensorflow/core/protobuf/config.proto\x1a$tensorflow/core/protobuf/debug.proto\x1a*tensorflow/core/protobuf/error_codes.proto\x1a+tensorflow/core/protobuf/named_tensor.proto\x1a0tensorflow/core/protobuf/tensorflow_server.proto\"\x12\n" + + "\x10GetStatusRequest\"^\n" + + "\x11GetStatusResponse\x12I\n" + + "\x11device_attributes\x18\x01 \x03(\v2\x1c.tensorflow.DeviceAttributesR\x10deviceAttributes\"\xd7\x02\n" + + "\x1aCreateWorkerSessionRequest\x12%\n" + + "\x0esession_handle\x18\x01 \x01(\tR\rsessionHandle\x124\n" + + "\n" + + "server_def\x18\x02 \x01(\v2\x15.tensorflow.ServerDefR\tserverDef\x122\n" + + "\x15isolate_session_state\x18\x03 \x01(\bR\x13isolateSessionState\x12X\n" + + "\x19cluster_device_attributes\x18\x04 \x03(\v2\x1c.tensorflow.DeviceAttributesR\x17clusterDeviceAttributes\x12\x1f\n" + + "\vmaster_task\x18\x05 \x01(\tR\n" + + "masterTask\x12-\n" + + "\x12master_incarnation\x18\x06 \x01(\x03R\x11masterIncarnation\"\x1d\n" + + "\x1bCreateWorkerSessionResponse\"C\n" + + "\x1aDeleteWorkerSessionRequest\x12%\n" + + "\x0esession_handle\x18\x01 \x01(\tR\rsessionHandle\"\x1d\n" + + "\x1bDeleteWorkerSessionResponse\"\xcb\x03\n" + + "\x14RegisterGraphRequest\x12%\n" + + "\x0esession_handle\x18\x01 \x01(\tR\rsessionHandle\x12?\n" + + "\x1ccreate_worker_session_called\x18\x06 \x01(\bR\x19createWorkerSessionCalled\x121\n" + + "\tgraph_def\x18\x02 \x01(\v2\x14.tensorflow.GraphDefR\bgraphDef\x12,\n" + + "\x10has_control_flow\x18\x03 \x01(\bB\x02\x18\x01R\x0ehasControlFlow\x12=\n" + + "\rgraph_options\x18\x04 \x01(\v2\x18.tensorflow.GraphOptionsR\fgraphOptions\x12=\n" + + "\rdebug_options\x18\x05 \x01(\v2\x18.tensorflow.DebugOptionsR\fdebugOptions\x120\n" + + "\x14collective_graph_key\x18\a \x01(\x03R\x12collectiveGraphKey\x12:\n" + + "\fconfig_proto\x18\b \x01(\v2\x17.tensorflow.ConfigProtoR\vconfigProto\":\n" + + "\x15RegisterGraphResponse\x12!\n" + + "\fgraph_handle\x18\x01 \x01(\tR\vgraphHandle\"\xa3\x01\n" + + "\x16DeregisterGraphRequest\x12%\n" + + "\x0esession_handle\x18\x02 \x01(\tR\rsessionHandle\x12?\n" + + "\x1ccreate_worker_session_called\x18\x03 \x01(\bR\x19createWorkerSessionCalled\x12!\n" + + "\fgraph_handle\x18\x01 \x01(\tR\vgraphHandle\"\x19\n" + + "\x17DeregisterGraphResponse\"1\n" + + "\x11CleanupAllRequest\x12\x1c\n" + + "\tcontainer\x18\x01 \x03(\tR\tcontainer\"\x14\n" + + "\x12CleanupAllResponse\"\xde\x01\n" + + "\fExecutorOpts\x12!\n" + + "\frecord_costs\x18\x01 \x01(\bR\vrecordCosts\x12'\n" + + "\x0frecord_timeline\x18\x03 \x01(\bR\x0erecordTimeline\x126\n" + + "\x17record_partition_graphs\x18\x04 \x01(\bR\x15recordPartitionGraphs\x12J\n" + + "\"report_tensor_allocations_upon_oom\x18\x05 \x01(\bR\x1ereportTensorAllocationsUponOom\"\xe8\x03\n" + + "\x0fRunGraphRequest\x12%\n" + + "\x0esession_handle\x18\b \x01(\tR\rsessionHandle\x12?\n" + + "\x1ccreate_worker_session_called\x18\n" + + " \x01(\bR\x19createWorkerSessionCalled\x12!\n" + + "\fgraph_handle\x18\x01 \x01(\tR\vgraphHandle\x12\x17\n" + + "\astep_id\x18\x02 \x01(\x03R\x06stepId\x125\n" + + "\texec_opts\x18\x05 \x01(\v2\x18.tensorflow.ExecutorOptsR\bexecOpts\x120\n" + + "\x04send\x18\x03 \x03(\v2\x1c.tensorflow.NamedTensorProtoR\x04send\x12\x19\n" + + "\brecv_key\x18\x04 \x03(\tR\arecvKey\x12\x1d\n" + + "\n" + + "is_partial\x18\x06 \x01(\bR\tisPartial\x12-\n" + + "\x13is_last_partial_run\x18\a \x01(\bR\x10isLastPartialRun\x12@\n" + + "\x1dstore_errors_in_response_body\x18\t \x01(\bR\x19storeErrorsInResponseBody\x12\x1d\n" + + "\n" + + "request_id\x18\v \x01(\x03R\trequestId\"\xdd\x02\n" + + "\x10RunGraphResponse\x120\n" + + "\x04recv\x18\x01 \x03(\v2\x1c.tensorflow.NamedTensorProtoR\x04recv\x124\n" + + "\n" + + "step_stats\x18\x02 \x01(\v2\x15.tensorflow.StepStatsR\tstepStats\x127\n" + + "\n" + + "cost_graph\x18\x03 \x01(\v2\x18.tensorflow.CostGraphDefR\tcostGraph\x12=\n" + + "\x0fpartition_graph\x18\x04 \x03(\v2\x14.tensorflow.GraphDefR\x0epartitionGraph\x127\n" + + "\vstatus_code\x18\x05 \x01(\x0e2\x16.tensorflow.error.CodeR\n" + + "statusCode\x120\n" + + "\x14status_error_message\x18\x06 \x01(\tR\x12statusErrorMessage\".\n" + + "\x13CleanupGraphRequest\x12\x17\n" + + "\astep_id\x18\x01 \x01(\x03R\x06stepId\"\x16\n" + + "\x14CleanupGraphResponse\"\xd6\x02\n" + + "\x11RecvTensorRequest\x12\x17\n" + + "\astep_id\x18\x01 \x01(\x03R\x06stepId\x12%\n" + + "\x0erendezvous_key\x18\x02 \x01(\tR\rrendezvousKey\x12\x15\n" + + "\x06dma_ok\x18\x03 \x01(\bR\x05dmaOk\x12C\n" + + "\x0fclient_locality\x18\x04 \x01(\v2\x1a.tensorflow.DeviceLocalityR\x0eclientLocality\x12C\n" + + "\x0fserver_locality\x18\x05 \x01(\v2\x1a.tensorflow.DeviceLocalityR\x0eserverLocality\x12A\n" + + "\x11transport_options\x18\x06 \x01(\v2\x14.google.protobuf.AnyR\x10transportOptions\x12\x1d\n" + + "\n" + + "request_id\x18\a \x01(\x03R\trequestId\"\xee\x01\n" + + "\x12RecvTensorResponse\x12/\n" + + "\x06tensor\x18\x01 \x01(\v2\x17.tensorflow.TensorProtoR\x06tensor\x12\x17\n" + + "\ais_dead\x18\x02 \x01(\bR\x06isDead\x12*\n" + + "\x11send_start_micros\x18\x03 \x01(\x03R\x0fsendStartMicros\x12A\n" + + "\x11transport_options\x18\x04 \x01(\v2\x14.google.protobuf.AnyR\x10transportOptions\x12\x1f\n" + + "\vrequire_ack\x18\x05 \x01(\bR\n" + + "requireAck\"8\n" + + "\x17MarkRecvFinishedRequest\x12\x1d\n" + + "\n" + + "request_id\x18\x01 \x01(\x03R\trequestId\"\x1a\n" + + "\x18MarkRecvFinishedResponse\"\xa8\x01\n" + + "\x0eLoggingRequest\x12,\n" + + "\x12enable_rpc_logging\x18\x01 \x01(\bR\x10enableRpcLogging\x12.\n" + + "\x13disable_rpc_logging\x18\x04 \x01(\bR\x11disableRpcLogging\x12\x14\n" + + "\x05clear\x18\x02 \x01(\bR\x05clear\x12\"\n" + + "\rfetch_step_id\x18\x03 \x03(\x03R\vfetchStepId\"a\n" + + "\x10LabeledStepStats\x12\x17\n" + + "\astep_id\x18\x01 \x01(\x03R\x06stepId\x124\n" + + "\n" + + "step_stats\x18\x02 \x01(\v2\x15.tensorflow.StepStatsR\tstepStats\"C\n" + + "\x0fLoggingResponse\x120\n" + + "\x04step\x18\x01 \x03(\v2\x1c.tensorflow.LabeledStepStatsR\x04step\"\x91\x02\n" + + "\tTraceOpts\x12\x1a\n" + + "\bduration\x18\x01 \x01(\x01R\bduration\x12*\n" + + "\x11use_step_profiler\x18\x02 \x01(\bR\x0fuseStepProfiler\x12.\n" + + "\x13use_kernel_profiler\x18\x03 \x01(\bR\x11useKernelProfiler\x122\n" + + "\x15use_extended_profiler\x18\x04 \x01(\bR\x13useExtendedProfiler\x12(\n" + + "\x10use_gpu_profiler\x18\x05 \x01(\bR\x0euseGpuProfiler\x12.\n" + + "\x13use_sample_profiler\x18\x06 \x01(\bR\x11useSampleProfiler\"A\n" + + "\x0eTracingRequest\x12/\n" + + "\aoptions\x18\x01 \x01(\v2\x15.tensorflow.TraceOptsR\aoptions\"\x11\n" + + "\x0fTracingResponse\"\xe0\x03\n" + + "\x0eRecvBufRequest\x12\x17\n" + + "\astep_id\x18\x01 \x01(\x03R\x06stepId\x12,\n" + + "\x12buf_rendezvous_key\x18\x02 \x01(\tR\x10bufRendezvousKey\x12\x1b\n" + + "\tnum_bytes\x18\x03 \x01(\x03R\bnumBytes\x12\x17\n" + + "\abuf_ptr\x18\x04 \x01(\x06R\x06bufPtr\x12C\n" + + "\x0fclient_locality\x18\x05 \x01(\v2\x1a.tensorflow.DeviceLocalityR\x0eclientLocality\x12C\n" + + "\x0fserver_locality\x18\x06 \x01(\v2\x1a.tensorflow.DeviceLocalityR\x0eserverLocality\x12A\n" + + "\x11transport_options\x18\a \x01(\v2\x14.google.protobuf.AnyR\x10transportOptions\x12\x1d\n" + + "\n" + + "src_device\x18\b \x01(\tR\tsrcDevice\x12\x1d\n" + + "\n" + + "dst_device\x18\t \x01(\tR\tdstDevice\x12\x1d\n" + + "\n" + + "request_id\x18\n" + + " \x01(\x03R\trequestId\x12'\n" + + "\x0fsrc_incarnation\x18\v \x01(\x04R\x0esrcIncarnation\"\xf0\x01\n" + + "\x0fRecvBufResponse\x12\x17\n" + + "\abuf_ptr\x18\x01 \x01(\x06R\x06bufPtr\x12\x1b\n" + + "\tnum_bytes\x18\x02 \x01(\x03R\bnumBytes\x12\x17\n" + + "\ais_dead\x18\x03 \x01(\bR\x06isDead\x12A\n" + + "\x11transport_options\x18\x04 \x01(\v2\x14.google.protobuf.AnyR\x10transportOptions\x12*\n" + + "\x11send_start_micros\x18\x05 \x01(\x03R\x0fsendStartMicros\x12\x1f\n" + + "\vrequire_ack\x18\x06 \x01(\bR\n" + + "requireAck\"\xed\x01\n" + + "\x14CompleteGroupRequest\x12\x1b\n" + + "\tgroup_key\x18\x01 \x01(\x05R\bgroupKey\x12\x1d\n" + + "\n" + + "group_size\x18\x02 \x01(\x05R\tgroupSize\x12\x1f\n" + + "\vdevice_type\x18\x03 \x01(\tR\n" + + "deviceType\x12'\n" + + "\x0fcollective_type\x18\x05 \x01(\x05R\x0ecollectiveType\x12I\n" + + "\x11device_attributes\x18\x06 \x01(\v2\x1c.tensorflow.DeviceAttributesR\x10deviceAttributesJ\x04\b\x04\x10\x05\"\x93\x02\n" + + "\x15CompleteGroupResponse\x12\x1b\n" + + "\tgroup_key\x18\x01 \x01(\x05R\bgroupKey\x12\x1d\n" + + "\n" + + "group_size\x18\x02 \x01(\x05R\tgroupSize\x12\x1f\n" + + "\vdevice_type\x18\x03 \x01(\tR\n" + + "deviceType\x12\x1b\n" + + "\tnum_tasks\x18\x04 \x01(\x05R\bnumTasks\x12)\n" + + "\x10communicator_key\x18\a \x01(\fR\x0fcommunicatorKey\x12I\n" + + "\x11device_attributes\x18\b \x03(\v2\x1c.tensorflow.DeviceAttributesR\x10deviceAttributesJ\x04\b\x05\x10\x06J\x04\b\x06\x10\a\"\x82\x03\n" + + "\x17CompleteInstanceRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x12\n" + + "\x04type\x18\x02 \x01(\x05R\x04type\x121\n" + + "\tdata_type\x18\x03 \x01(\x0e2\x14.tensorflow.DataTypeR\bdataType\x122\n" + + "\x05shape\x18\x04 \x01(\v2\x1c.tensorflow.TensorShapeProtoR\x05shape\x12\x1b\n" + + "\tgroup_key\x18\x05 \x01(\x05R\bgroupKey\x12\x1d\n" + + "\n" + + "group_size\x18\x06 \x01(\x05R\tgroupSize\x12!\n" + + "\finstance_key\x18\a \x01(\x05R\vinstanceKey\x12\x1f\n" + + "\vdevice_type\x18\b \x01(\tR\n" + + "deviceType\x12#\n" + + "\rsubdiv_offset\x18\t \x03(\x05R\fsubdivOffset\x12\x16\n" + + "\x06device\x18\n" + + " \x01(\tR\x06device\x12\x1b\n" + + "\tis_source\x18\v \x01(\bR\bisSource\"d\n" + + "\x18CompleteInstanceResponse\x12!\n" + + "\finstance_key\x18\x01 \x01(\x05R\vinstanceKey\x12\x1f\n" + + "\vsource_rank\x18\x02 \x01(\x05R\n" + + "sourceRankJ\x04\b\x03\x10\x04\"5\n" + + "\x16GetStepSequenceRequest\x12\x1b\n" + + "\tgraph_key\x18\x01 \x03(\x03R\bgraphKey\"M\n" + + "\fStepSequence\x12\x1b\n" + + "\tgraph_key\x18\x01 \x01(\x03R\bgraphKey\x12 \n" + + "\fnext_step_id\x18\x02 \x01(\x03R\n" + + "nextStepId\"X\n" + + "\x17GetStepSequenceResponse\x12=\n" + + "\rstep_sequence\x18\x01 \x03(\v2\x18.tensorflow.StepSequenceR\fstepSequenceB\x86\x01\n" + + "\x1aorg.tensorflow.distruntimeB\fWorkerProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_worker_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_worker_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_worker_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_worker_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_worker_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_worker_proto_rawDesc), len(file_tensorflow_core_protobuf_worker_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_worker_proto_rawDescData +} + +var file_tensorflow_core_protobuf_worker_proto_msgTypes = make([]protoimpl.MessageInfo, 36) +var file_tensorflow_core_protobuf_worker_proto_goTypes = []any{ + (*GetStatusRequest)(nil), // 0: tensorflow.GetStatusRequest + (*GetStatusResponse)(nil), // 1: tensorflow.GetStatusResponse + (*CreateWorkerSessionRequest)(nil), // 2: tensorflow.CreateWorkerSessionRequest + (*CreateWorkerSessionResponse)(nil), // 3: tensorflow.CreateWorkerSessionResponse + (*DeleteWorkerSessionRequest)(nil), // 4: tensorflow.DeleteWorkerSessionRequest + (*DeleteWorkerSessionResponse)(nil), // 5: tensorflow.DeleteWorkerSessionResponse + (*RegisterGraphRequest)(nil), // 6: tensorflow.RegisterGraphRequest + (*RegisterGraphResponse)(nil), // 7: tensorflow.RegisterGraphResponse + (*DeregisterGraphRequest)(nil), // 8: tensorflow.DeregisterGraphRequest + (*DeregisterGraphResponse)(nil), // 9: tensorflow.DeregisterGraphResponse + (*CleanupAllRequest)(nil), // 10: tensorflow.CleanupAllRequest + (*CleanupAllResponse)(nil), // 11: tensorflow.CleanupAllResponse + (*ExecutorOpts)(nil), // 12: tensorflow.ExecutorOpts + (*RunGraphRequest)(nil), // 13: tensorflow.RunGraphRequest + (*RunGraphResponse)(nil), // 14: tensorflow.RunGraphResponse + (*CleanupGraphRequest)(nil), // 15: tensorflow.CleanupGraphRequest + (*CleanupGraphResponse)(nil), // 16: tensorflow.CleanupGraphResponse + (*RecvTensorRequest)(nil), // 17: tensorflow.RecvTensorRequest + (*RecvTensorResponse)(nil), // 18: tensorflow.RecvTensorResponse + (*MarkRecvFinishedRequest)(nil), // 19: tensorflow.MarkRecvFinishedRequest + (*MarkRecvFinishedResponse)(nil), // 20: tensorflow.MarkRecvFinishedResponse + (*LoggingRequest)(nil), // 21: tensorflow.LoggingRequest + (*LabeledStepStats)(nil), // 22: tensorflow.LabeledStepStats + (*LoggingResponse)(nil), // 23: tensorflow.LoggingResponse + (*TraceOpts)(nil), // 24: tensorflow.TraceOpts + (*TracingRequest)(nil), // 25: tensorflow.TracingRequest + (*TracingResponse)(nil), // 26: tensorflow.TracingResponse + (*RecvBufRequest)(nil), // 27: tensorflow.RecvBufRequest + (*RecvBufResponse)(nil), // 28: tensorflow.RecvBufResponse + (*CompleteGroupRequest)(nil), // 29: tensorflow.CompleteGroupRequest + (*CompleteGroupResponse)(nil), // 30: tensorflow.CompleteGroupResponse + (*CompleteInstanceRequest)(nil), // 31: tensorflow.CompleteInstanceRequest + (*CompleteInstanceResponse)(nil), // 32: tensorflow.CompleteInstanceResponse + (*GetStepSequenceRequest)(nil), // 33: tensorflow.GetStepSequenceRequest + (*StepSequence)(nil), // 34: tensorflow.StepSequence + (*GetStepSequenceResponse)(nil), // 35: tensorflow.GetStepSequenceResponse + (*device_attributes_go_proto.DeviceAttributes)(nil), // 36: tensorflow.DeviceAttributes + (*ServerDef)(nil), // 37: tensorflow.ServerDef + (*graph_go_proto.GraphDef)(nil), // 38: tensorflow.GraphDef + (*GraphOptions)(nil), // 39: tensorflow.GraphOptions + (*DebugOptions)(nil), // 40: tensorflow.DebugOptions + (*ConfigProto)(nil), // 41: tensorflow.ConfigProto + (*NamedTensorProto)(nil), // 42: tensorflow.NamedTensorProto + (*step_stats_go_proto.StepStats)(nil), // 43: tensorflow.StepStats + (*cost_graph_go_proto.CostGraphDef)(nil), // 44: tensorflow.CostGraphDef + (Code)(0), // 45: tensorflow.error.Code + (*device_attributes_go_proto.DeviceLocality)(nil), // 46: tensorflow.DeviceLocality + (*anypb.Any)(nil), // 47: google.protobuf.Any + (*tensor_go_proto.TensorProto)(nil), // 48: tensorflow.TensorProto + (types_go_proto.DataType)(0), // 49: tensorflow.DataType + (*tensor_shape_go_proto.TensorShapeProto)(nil), // 50: tensorflow.TensorShapeProto +} +var file_tensorflow_core_protobuf_worker_proto_depIdxs = []int32{ + 36, // 0: tensorflow.GetStatusResponse.device_attributes:type_name -> tensorflow.DeviceAttributes + 37, // 1: tensorflow.CreateWorkerSessionRequest.server_def:type_name -> tensorflow.ServerDef + 36, // 2: tensorflow.CreateWorkerSessionRequest.cluster_device_attributes:type_name -> tensorflow.DeviceAttributes + 38, // 3: tensorflow.RegisterGraphRequest.graph_def:type_name -> tensorflow.GraphDef + 39, // 4: tensorflow.RegisterGraphRequest.graph_options:type_name -> tensorflow.GraphOptions + 40, // 5: tensorflow.RegisterGraphRequest.debug_options:type_name -> tensorflow.DebugOptions + 41, // 6: tensorflow.RegisterGraphRequest.config_proto:type_name -> tensorflow.ConfigProto + 12, // 7: tensorflow.RunGraphRequest.exec_opts:type_name -> tensorflow.ExecutorOpts + 42, // 8: tensorflow.RunGraphRequest.send:type_name -> tensorflow.NamedTensorProto + 42, // 9: tensorflow.RunGraphResponse.recv:type_name -> tensorflow.NamedTensorProto + 43, // 10: tensorflow.RunGraphResponse.step_stats:type_name -> tensorflow.StepStats + 44, // 11: tensorflow.RunGraphResponse.cost_graph:type_name -> tensorflow.CostGraphDef + 38, // 12: tensorflow.RunGraphResponse.partition_graph:type_name -> tensorflow.GraphDef + 45, // 13: tensorflow.RunGraphResponse.status_code:type_name -> tensorflow.error.Code + 46, // 14: tensorflow.RecvTensorRequest.client_locality:type_name -> tensorflow.DeviceLocality + 46, // 15: tensorflow.RecvTensorRequest.server_locality:type_name -> tensorflow.DeviceLocality + 47, // 16: tensorflow.RecvTensorRequest.transport_options:type_name -> google.protobuf.Any + 48, // 17: tensorflow.RecvTensorResponse.tensor:type_name -> tensorflow.TensorProto + 47, // 18: tensorflow.RecvTensorResponse.transport_options:type_name -> google.protobuf.Any + 43, // 19: tensorflow.LabeledStepStats.step_stats:type_name -> tensorflow.StepStats + 22, // 20: tensorflow.LoggingResponse.step:type_name -> tensorflow.LabeledStepStats + 24, // 21: tensorflow.TracingRequest.options:type_name -> tensorflow.TraceOpts + 46, // 22: tensorflow.RecvBufRequest.client_locality:type_name -> tensorflow.DeviceLocality + 46, // 23: tensorflow.RecvBufRequest.server_locality:type_name -> tensorflow.DeviceLocality + 47, // 24: tensorflow.RecvBufRequest.transport_options:type_name -> google.protobuf.Any + 47, // 25: tensorflow.RecvBufResponse.transport_options:type_name -> google.protobuf.Any + 36, // 26: tensorflow.CompleteGroupRequest.device_attributes:type_name -> tensorflow.DeviceAttributes + 36, // 27: tensorflow.CompleteGroupResponse.device_attributes:type_name -> tensorflow.DeviceAttributes + 49, // 28: tensorflow.CompleteInstanceRequest.data_type:type_name -> tensorflow.DataType + 50, // 29: tensorflow.CompleteInstanceRequest.shape:type_name -> tensorflow.TensorShapeProto + 34, // 30: tensorflow.GetStepSequenceResponse.step_sequence:type_name -> tensorflow.StepSequence + 31, // [31:31] is the sub-list for method output_type + 31, // [31:31] is the sub-list for method input_type + 31, // [31:31] is the sub-list for extension type_name + 31, // [31:31] is the sub-list for extension extendee + 0, // [0:31] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_worker_proto_init() } +func file_tensorflow_core_protobuf_worker_proto_init() { + if File_tensorflow_core_protobuf_worker_proto != nil { + return + } + file_tensorflow_core_protobuf_config_proto_init() + file_tensorflow_core_protobuf_debug_proto_init() + file_tensorflow_core_protobuf_error_codes_proto_init() + file_tensorflow_core_protobuf_named_tensor_proto_init() + file_tensorflow_core_protobuf_tensorflow_server_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_worker_proto_rawDesc), len(file_tensorflow_core_protobuf_worker_proto_rawDesc)), + NumEnums: 0, + NumMessages: 36, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_worker_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_worker_proto_depIdxs, + MessageInfos: file_tensorflow_core_protobuf_worker_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_worker_proto = out.File + file_tensorflow_core_protobuf_worker_proto_goTypes = nil + file_tensorflow_core_protobuf_worker_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/worker_service.pb.go b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/worker_service.pb.go new file mode 100644 index 0000000..d1f0e6c --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/worker_service.pb.go @@ -0,0 +1,155 @@ +// Copyright 2016 The TensorFlow Authors. All Rights Reserved. +// +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +//============================================================================== + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/worker_service.proto + +package for_core_protos_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +var File_tensorflow_core_protobuf_worker_service_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_worker_service_proto_rawDesc = "" + + "\n" + + "-tensorflow/core/protobuf/worker_service.proto\x12\x0ftensorflow.grpc\x1a%tensorflow/core/protobuf/worker.proto2\xf0\t\n" + + "\rWorkerService\x12H\n" + + "\tGetStatus\x12\x1c.tensorflow.GetStatusRequest\x1a\x1d.tensorflow.GetStatusResponse\x12f\n" + + "\x13CreateWorkerSession\x12&.tensorflow.CreateWorkerSessionRequest\x1a'.tensorflow.CreateWorkerSessionResponse\x12f\n" + + "\x13DeleteWorkerSession\x12&.tensorflow.DeleteWorkerSessionRequest\x1a'.tensorflow.DeleteWorkerSessionResponse\x12T\n" + + "\rRegisterGraph\x12 .tensorflow.RegisterGraphRequest\x1a!.tensorflow.RegisterGraphResponse\x12Z\n" + + "\x0fDeregisterGraph\x12\".tensorflow.DeregisterGraphRequest\x1a#.tensorflow.DeregisterGraphResponse\x12E\n" + + "\bRunGraph\x12\x1b.tensorflow.RunGraphRequest\x1a\x1c.tensorflow.RunGraphResponse\x12Q\n" + + "\fCleanupGraph\x12\x1f.tensorflow.CleanupGraphRequest\x1a .tensorflow.CleanupGraphResponse\x12K\n" + + "\n" + + "CleanupAll\x12\x1d.tensorflow.CleanupAllRequest\x1a\x1e.tensorflow.CleanupAllResponse\x12M\n" + + "\n" + + "RecvTensor\x12\x1d.tensorflow.RecvTensorRequest\x1a\x1e.tensorflow.RecvTensorResponse\"\x00\x12B\n" + + "\aLogging\x12\x1a.tensorflow.LoggingRequest\x1a\x1b.tensorflow.LoggingResponse\x12B\n" + + "\aTracing\x12\x1a.tensorflow.TracingRequest\x1a\x1b.tensorflow.TracingResponse\x12D\n" + + "\aRecvBuf\x12\x1a.tensorflow.RecvBufRequest\x1a\x1b.tensorflow.RecvBufResponse\"\x00\x12Z\n" + + "\x0fGetStepSequence\x12\".tensorflow.GetStepSequenceRequest\x1a#.tensorflow.GetStepSequenceResponse\x12T\n" + + "\rCompleteGroup\x12 .tensorflow.CompleteGroupRequest\x1a!.tensorflow.CompleteGroupResponse\x12]\n" + + "\x10CompleteInstance\x12#.tensorflow.CompleteInstanceRequest\x1a$.tensorflow.CompleteInstanceResponseB\x8a\x01\n" + + "\x1aorg.tensorflow.distruntimeB\x13WorkerServiceProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_protob\x06proto3" + +var file_tensorflow_core_protobuf_worker_service_proto_goTypes = []any{ + (*GetStatusRequest)(nil), // 0: tensorflow.GetStatusRequest + (*CreateWorkerSessionRequest)(nil), // 1: tensorflow.CreateWorkerSessionRequest + (*DeleteWorkerSessionRequest)(nil), // 2: tensorflow.DeleteWorkerSessionRequest + (*RegisterGraphRequest)(nil), // 3: tensorflow.RegisterGraphRequest + (*DeregisterGraphRequest)(nil), // 4: tensorflow.DeregisterGraphRequest + (*RunGraphRequest)(nil), // 5: tensorflow.RunGraphRequest + (*CleanupGraphRequest)(nil), // 6: tensorflow.CleanupGraphRequest + (*CleanupAllRequest)(nil), // 7: tensorflow.CleanupAllRequest + (*RecvTensorRequest)(nil), // 8: tensorflow.RecvTensorRequest + (*LoggingRequest)(nil), // 9: tensorflow.LoggingRequest + (*TracingRequest)(nil), // 10: tensorflow.TracingRequest + (*RecvBufRequest)(nil), // 11: tensorflow.RecvBufRequest + (*GetStepSequenceRequest)(nil), // 12: tensorflow.GetStepSequenceRequest + (*CompleteGroupRequest)(nil), // 13: tensorflow.CompleteGroupRequest + (*CompleteInstanceRequest)(nil), // 14: tensorflow.CompleteInstanceRequest + (*GetStatusResponse)(nil), // 15: tensorflow.GetStatusResponse + (*CreateWorkerSessionResponse)(nil), // 16: tensorflow.CreateWorkerSessionResponse + (*DeleteWorkerSessionResponse)(nil), // 17: tensorflow.DeleteWorkerSessionResponse + (*RegisterGraphResponse)(nil), // 18: tensorflow.RegisterGraphResponse + (*DeregisterGraphResponse)(nil), // 19: tensorflow.DeregisterGraphResponse + (*RunGraphResponse)(nil), // 20: tensorflow.RunGraphResponse + (*CleanupGraphResponse)(nil), // 21: tensorflow.CleanupGraphResponse + (*CleanupAllResponse)(nil), // 22: tensorflow.CleanupAllResponse + (*RecvTensorResponse)(nil), // 23: tensorflow.RecvTensorResponse + (*LoggingResponse)(nil), // 24: tensorflow.LoggingResponse + (*TracingResponse)(nil), // 25: tensorflow.TracingResponse + (*RecvBufResponse)(nil), // 26: tensorflow.RecvBufResponse + (*GetStepSequenceResponse)(nil), // 27: tensorflow.GetStepSequenceResponse + (*CompleteGroupResponse)(nil), // 28: tensorflow.CompleteGroupResponse + (*CompleteInstanceResponse)(nil), // 29: tensorflow.CompleteInstanceResponse +} +var file_tensorflow_core_protobuf_worker_service_proto_depIdxs = []int32{ + 0, // 0: tensorflow.grpc.WorkerService.GetStatus:input_type -> tensorflow.GetStatusRequest + 1, // 1: tensorflow.grpc.WorkerService.CreateWorkerSession:input_type -> tensorflow.CreateWorkerSessionRequest + 2, // 2: tensorflow.grpc.WorkerService.DeleteWorkerSession:input_type -> tensorflow.DeleteWorkerSessionRequest + 3, // 3: tensorflow.grpc.WorkerService.RegisterGraph:input_type -> tensorflow.RegisterGraphRequest + 4, // 4: tensorflow.grpc.WorkerService.DeregisterGraph:input_type -> tensorflow.DeregisterGraphRequest + 5, // 5: tensorflow.grpc.WorkerService.RunGraph:input_type -> tensorflow.RunGraphRequest + 6, // 6: tensorflow.grpc.WorkerService.CleanupGraph:input_type -> tensorflow.CleanupGraphRequest + 7, // 7: tensorflow.grpc.WorkerService.CleanupAll:input_type -> tensorflow.CleanupAllRequest + 8, // 8: tensorflow.grpc.WorkerService.RecvTensor:input_type -> tensorflow.RecvTensorRequest + 9, // 9: tensorflow.grpc.WorkerService.Logging:input_type -> tensorflow.LoggingRequest + 10, // 10: tensorflow.grpc.WorkerService.Tracing:input_type -> tensorflow.TracingRequest + 11, // 11: tensorflow.grpc.WorkerService.RecvBuf:input_type -> tensorflow.RecvBufRequest + 12, // 12: tensorflow.grpc.WorkerService.GetStepSequence:input_type -> tensorflow.GetStepSequenceRequest + 13, // 13: tensorflow.grpc.WorkerService.CompleteGroup:input_type -> tensorflow.CompleteGroupRequest + 14, // 14: tensorflow.grpc.WorkerService.CompleteInstance:input_type -> tensorflow.CompleteInstanceRequest + 15, // 15: tensorflow.grpc.WorkerService.GetStatus:output_type -> tensorflow.GetStatusResponse + 16, // 16: tensorflow.grpc.WorkerService.CreateWorkerSession:output_type -> tensorflow.CreateWorkerSessionResponse + 17, // 17: tensorflow.grpc.WorkerService.DeleteWorkerSession:output_type -> tensorflow.DeleteWorkerSessionResponse + 18, // 18: tensorflow.grpc.WorkerService.RegisterGraph:output_type -> tensorflow.RegisterGraphResponse + 19, // 19: tensorflow.grpc.WorkerService.DeregisterGraph:output_type -> tensorflow.DeregisterGraphResponse + 20, // 20: tensorflow.grpc.WorkerService.RunGraph:output_type -> tensorflow.RunGraphResponse + 21, // 21: tensorflow.grpc.WorkerService.CleanupGraph:output_type -> tensorflow.CleanupGraphResponse + 22, // 22: tensorflow.grpc.WorkerService.CleanupAll:output_type -> tensorflow.CleanupAllResponse + 23, // 23: tensorflow.grpc.WorkerService.RecvTensor:output_type -> tensorflow.RecvTensorResponse + 24, // 24: tensorflow.grpc.WorkerService.Logging:output_type -> tensorflow.LoggingResponse + 25, // 25: tensorflow.grpc.WorkerService.Tracing:output_type -> tensorflow.TracingResponse + 26, // 26: tensorflow.grpc.WorkerService.RecvBuf:output_type -> tensorflow.RecvBufResponse + 27, // 27: tensorflow.grpc.WorkerService.GetStepSequence:output_type -> tensorflow.GetStepSequenceResponse + 28, // 28: tensorflow.grpc.WorkerService.CompleteGroup:output_type -> tensorflow.CompleteGroupResponse + 29, // 29: tensorflow.grpc.WorkerService.CompleteInstance:output_type -> tensorflow.CompleteInstanceResponse + 15, // [15:30] is the sub-list for method output_type + 0, // [0:15] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_worker_service_proto_init() } +func file_tensorflow_core_protobuf_worker_service_proto_init() { + if File_tensorflow_core_protobuf_worker_service_proto != nil { + return + } + file_tensorflow_core_protobuf_worker_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_worker_service_proto_rawDesc), len(file_tensorflow_core_protobuf_worker_service_proto_rawDesc)), + NumEnums: 0, + NumMessages: 0, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_tensorflow_core_protobuf_worker_service_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_worker_service_proto_depIdxs, + }.Build() + File_tensorflow_core_protobuf_worker_service_proto = out.File + file_tensorflow_core_protobuf_worker_service_proto_goTypes = nil + file_tensorflow_core_protobuf_worker_service_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/doc.go b/third_party/go-tensorflow/tensorflow/go/doc.go new file mode 100644 index 0000000..8d2a235 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/doc.go @@ -0,0 +1,26 @@ +/* +Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package tensorflow is a Go binding to TensorFlow. +// +// The API is subject to change and may break at any time. +// +// TensorFlow (www.tensorflow.org) is an open source software library for +// numerical computation using data flow graphs. This package provides +// functionality to build and execute such graphs and depends on +// TensorFlow being available. For installation instructions see +// https://github.com/tensorflow/tensorflow/blob/master/tensorflow/go/README.md +package tensorflow diff --git a/third_party/go-tensorflow/tensorflow/go/example_inception_inference_test.go b/third_party/go-tensorflow/tensorflow/go/example_inception_inference_test.go new file mode 100644 index 0000000..f84a588 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/example_inception_inference_test.go @@ -0,0 +1,291 @@ +/* +Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package tensorflow_test + +import ( + "archive/zip" + "bufio" + "flag" + "fmt" + "io" + "io/ioutil" + "log" + "net/http" + "os" + "path/filepath" + + tf "github.com/tensorflow/tensorflow/tensorflow/go" + "github.com/tensorflow/tensorflow/tensorflow/go/op" +) + +func Example() { + // An example for using the TensorFlow Go API for image recognition + // using a pre-trained inception model (http://arxiv.org/abs/1512.00567). + // + // Sample usage: -dir=/tmp/modeldir -image=/path/to/some/jpeg + // + // The pre-trained model takes input in the form of a 4-dimensional + // tensor with shape [ BATCH_SIZE, IMAGE_HEIGHT, IMAGE_WIDTH, 3 ], + // where: + // - BATCH_SIZE allows for inference of multiple images in one pass through the graph + // - IMAGE_HEIGHT is the height of the images on which the model was trained + // - IMAGE_WIDTH is the width of the images on which the model was trained + // - 3 is the (R, G, B) values of the pixel colors represented as a float. + // + // And produces as output a vector with shape [ NUM_LABELS ]. + // output[i] is the probability that the input image was recognized as + // having the i-th label. + // + // A separate file contains a list of string labels corresponding to the + // integer indices of the output. + // + // This example: + // - Loads the serialized representation of the pre-trained model into a Graph + // - Creates a Session to execute operations on the Graph + // - Converts an image file to a Tensor to provide as input to a Session run + // - Executes the Session and prints out the label with the highest probability + // + // To convert an image file to a Tensor suitable for input to the Inception model, + // this example: + // - Constructs another TensorFlow graph to normalize the image into a + // form suitable for the model (for example, resizing the image) + // - Creates and executes a Session to obtain a Tensor in this normalized form. + modeldir := flag.String("dir", "", "Directory containing the trained model files. The directory will be created and the model downloaded into it if necessary") + imagefile := flag.String("image", "", "Path of a JPEG-image to extract labels for") + flag.Parse() + if *modeldir == "" || *imagefile == "" { + flag.Usage() + return + } + // Load the serialized GraphDef from a file. + modelfile, labelsfile, err := modelFiles(*modeldir) + if err != nil { + log.Fatal(err) + } + model, err := ioutil.ReadFile(modelfile) + if err != nil { + log.Fatal(err) + } + + // Construct an in-memory graph from the serialized form. + graph := tf.NewGraph() + if err := graph.Import(model, ""); err != nil { + log.Fatal(err) + } + + // Create a session for inference over graph. + session, err := tf.NewSession(graph, nil) + if err != nil { + log.Fatal(err) + } + defer session.Close() + + // Run inference on *imageFile. + // For multiple images, session.Run() can be called in a loop (and + // concurrently). Alternatively, images can be batched since the model + // accepts batches of image data as input. + tensor, err := makeTensorFromImage(*imagefile) + if err != nil { + log.Fatal(err) + } + output, err := session.Run( + map[tf.Output]*tf.Tensor{ + graph.Operation("input").Output(0): tensor, + }, + []tf.Output{ + graph.Operation("output").Output(0), + }, + nil) + if err != nil { + log.Fatal(err) + } + // output[0].Value() is a vector containing probabilities of + // labels for each image in the "batch". The batch size was 1. + // Find the most probably label index. + probabilities := output[0].Value().([][]float32)[0] + printBestLabel(probabilities, labelsfile) +} + +func printBestLabel(probabilities []float32, labelsFile string) { + bestIdx := 0 + for i, p := range probabilities { + if p > probabilities[bestIdx] { + bestIdx = i + } + } + // Found the best match. Read the string from labelsFile, which + // contains one line per label. + file, err := os.Open(labelsFile) + if err != nil { + log.Fatal(err) + } + defer file.Close() + scanner := bufio.NewScanner(file) + var labels []string + for scanner.Scan() { + labels = append(labels, scanner.Text()) + } + if err := scanner.Err(); err != nil { + log.Printf("ERROR: failed to read %s: %v", labelsFile, err) + } + fmt.Printf("BEST MATCH: (%2.0f%% likely) %s\n", probabilities[bestIdx]*100.0, labels[bestIdx]) +} + +// Convert the image in filename to a Tensor suitable as input to the Inception model. +func makeTensorFromImage(filename string) (*tf.Tensor, error) { + bytes, err := ioutil.ReadFile(filename) + if err != nil { + return nil, err + } + // DecodeJpeg uses a scalar String-valued tensor as input. + tensor, err := tf.NewTensor(string(bytes)) + if err != nil { + return nil, err + } + // Construct a graph to normalize the image + graph, input, output, err := constructGraphToNormalizeImage() + if err != nil { + return nil, err + } + // Execute that graph to normalize this one image + session, err := tf.NewSession(graph, nil) + if err != nil { + return nil, err + } + defer session.Close() + normalized, err := session.Run( + map[tf.Output]*tf.Tensor{input: tensor}, + []tf.Output{output}, + nil) + if err != nil { + return nil, err + } + return normalized[0], nil +} + +// The inception model takes as input the image described by a Tensor in a very +// specific normalized format (a particular image size, shape of the input tensor, +// normalized pixel values etc.). +// +// This function constructs a graph of TensorFlow operations which takes as +// input a JPEG-encoded string and returns a tensor suitable as input to the +// inception model. +func constructGraphToNormalizeImage() (graph *tf.Graph, input, output tf.Output, err error) { + // Some constants specific to the pre-trained model at: + // https://storage.googleapis.com/download.tensorflow.org/models/inception5h.zip + // + // - The model was trained after with images scaled to 224x224 pixels. + // - The colors, represented as R, G, B in 1-byte each were converted to + // float using (value - Mean)/Scale. + const ( + H, W = 224, 224 + Mean = float32(117) + Scale = float32(1) + ) + // - input is a String-Tensor, where the string the JPEG-encoded image. + // - The inception model takes a 4D tensor of shape + // [BatchSize, Height, Width, Colors=3], where each pixel is + // represented as a triplet of floats + // - Apply normalization on each pixel and use ExpandDims to make + // this single image be a "batch" of size 1 for ResizeBilinear. + s := op.NewScope() + input = op.Placeholder(s, tf.String) + output = op.Div(s, + op.Sub(s, + op.ResizeBilinear(s, + op.ExpandDims(s, + op.Cast(s, + op.DecodeJpeg(s, input, op.DecodeJpegChannels(3)), tf.Float), + op.Const(s.SubScope("make_batch"), int32(0))), + op.Const(s.SubScope("size"), []int32{H, W})), + op.Const(s.SubScope("mean"), Mean)), + op.Const(s.SubScope("scale"), Scale)) + graph, err = s.Finalize() + return graph, input, output, err +} + +func modelFiles(dir string) (modelfile, labelsfile string, err error) { + const URL = "https://storage.googleapis.com/download.tensorflow.org/models/inception5h.zip" + var ( + model = filepath.Join(dir, "tensorflow_inception_graph.pb") + labels = filepath.Join(dir, "imagenet_comp_graph_label_strings.txt") + zipfile = filepath.Join(dir, "inception5h.zip") + ) + if filesExist(model, labels) == nil { + return model, labels, nil + } + log.Println("Did not find model in", dir, "downloading from", URL) + if err := os.MkdirAll(dir, 0755); err != nil { + return "", "", err + } + if err := download(URL, zipfile); err != nil { + return "", "", fmt.Errorf("failed to download %v - %v", URL, err) + } + if err := unzip(dir, zipfile); err != nil { + return "", "", fmt.Errorf("failed to extract contents from model archive: %v", err) + } + os.Remove(zipfile) + return model, labels, filesExist(model, labels) +} + +func filesExist(files ...string) error { + for _, f := range files { + if _, err := os.Stat(f); err != nil { + return fmt.Errorf("unable to stat %s: %v", f, err) + } + } + return nil +} + +func download(URL, filename string) error { + resp, err := http.Get(URL) + if err != nil { + return err + } + defer resp.Body.Close() + file, err := os.OpenFile(filename, os.O_RDWR|os.O_CREATE, 0644) + if err != nil { + return err + } + defer file.Close() + _, err = io.Copy(file, resp.Body) + return err +} + +func unzip(dir, zipfile string) error { + r, err := zip.OpenReader(zipfile) + if err != nil { + return err + } + defer r.Close() + for _, f := range r.File { + src, err := f.Open() + if err != nil { + return err + } + log.Println("Extracting", f.Name) + dst, err := os.OpenFile(filepath.Join(dir, f.Name), os.O_WRONLY|os.O_CREATE, 0644) + if err != nil { + return err + } + if _, err := io.Copy(dst, src); err != nil { + return err + } + dst.Close() + } + return nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/genop/.gitignore b/third_party/go-tensorflow/tensorflow/go/genop/.gitignore new file mode 100644 index 0000000..a848384 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/genop/.gitignore @@ -0,0 +1,2 @@ +# .pb.go files generated by generate.sh +internal/proto/* diff --git a/third_party/go-tensorflow/tensorflow/go/genop/generate.go b/third_party/go-tensorflow/tensorflow/go/genop/generate.go new file mode 100644 index 0000000..3a02ff3 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/genop/generate.go @@ -0,0 +1,21 @@ +/* +Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package stub file for non-Windows builds. + +//go:generate bash generate.sh + +package main diff --git a/third_party/go-tensorflow/tensorflow/go/genop/generate.sh b/third_party/go-tensorflow/tensorflow/go/genop/generate.sh new file mode 100644 index 0000000..4aee23f --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/genop/generate.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +# Copyright 2016 The TensorFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================== + +set -e + +go get github.com/golang/protobuf/proto +go get github.com/golang/protobuf/protoc-gen-go + +if [ -z "${GOPATH}" ] +then + GOPATH=$(go env GOPATH) +fi + +# convert GOPATH's Windows style to UNIX style +if [[ $1 == "win" ]]; then + # eg: convert "D:\go-14;D:\go-13" to "D\go-14;D\go-13" + GOPATH=${GOPATH//:\\/\\} + # eg: convert "D\go-14;D\go-13" to "\D\go-14:\D\go-13" + GOPATH=\\${GOPATH//;/:\\} + # eg: convert "\D\go-14:\D\go-13" to "/D/go-14:/D/go-13" + GOPATH=${GOPATH//\\/\/} +fi + +cd $(dirname $0) +for g in $(echo "${GOPATH//:/ }"); do + TF_DIR="${g}/src/github.com/tensorflow/tensorflow" + PROTOC="${TF_DIR}/bazel-out/host/bin/external/protobuf/protoc" + if [ -x "${PROTOC}" ]; then + break + fi +done + +if [ ! -x "${PROTOC}" ] +then + set +e + PATH_PROTOC=$(which protoc) + if [ ! -x "${PATH_PROTOC}" ] + then + echo "Protocol buffer compiler protoc not found in PATH or in ${PROTOC}" + echo "Perhaps build it using:" + echo "bazel build --config opt @com_google_protobuf//:protoc" + exit 1 + fi + PROTOC=$PATH_PROTOC + set -e +fi + +# Ensure that protoc-gen-go is available in $PATH +# Since ${PROTOC} will require it. +export PATH=$PATH:${GOPATH}/bin +mkdir -p ../vendor +for FILE in ${TF_DIR}/tensorflow/core/framework/*.proto \ + ${TF_DIR}/tensorflow/core/protobuf/*.proto \ + ${TF_DIR}/tensorflow/stream_executor/*.proto; do + ${PROTOC} \ + -I ${TF_DIR} \ + --go_out=../vendor \ + $FILE +done diff --git a/third_party/go-tensorflow/tensorflow/go/genop/generate.win.go b/third_party/go-tensorflow/tensorflow/go/genop/generate.win.go new file mode 100644 index 0000000..5b50dda --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/genop/generate.win.go @@ -0,0 +1,21 @@ +/* +Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package stub file for Windows builds. + +//go:generate bash generate.sh win + +package main diff --git a/third_party/go-tensorflow/tensorflow/go/genop/internal/api_def_map.go b/third_party/go-tensorflow/tensorflow/go/genop/internal/api_def_map.go new file mode 100644 index 0000000..7fa21f8 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/genop/internal/api_def_map.go @@ -0,0 +1,128 @@ +/* +Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package internal + +/* +#include +#include + +#include "tensorflow/c/c_api.h" +*/ +import "C" + +import ( + "errors" + "fmt" + "runtime" + "unsafe" + + "github.com/golang/protobuf/proto" + adpb "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/api_def_go_proto" + odpb "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/op_def_go_proto" +) + +// Encapsulates a collection of API definitions. +// +// apiDefMap represents a map from operation name to corresponding +// ApiDef proto (see +// https://www.tensorflow.org/code/tensorflow/core/framework/api_def.proto +// for ApiDef proto definition). +type apiDefMap struct { + c *C.TF_ApiDefMap +} + +// Creates and returns a new apiDefMap instance. +// +// oplist is and OpList proto instance (see +// https://www.tensorflow.org/code/tensorflow/core/framework/op_def.proto +// for OpList proto definition). + +func newAPIDefMap(oplist *odpb.OpList) (*apiDefMap, error) { + // Create a buffer containing the serialized OpList. + opdefSerialized, err := proto.Marshal(oplist) + if err != nil { + return nil, fmt.Errorf("could not serialize OpDef for %s", oplist.String()) + } + data := C.CBytes(opdefSerialized) + defer C.free(data) + + opbuf := C.TF_NewBuffer() + defer C.TF_DeleteBuffer(opbuf) + opbuf.data = data + opbuf.length = C.size_t(len(opdefSerialized)) + + // Create ApiDefMap. + status := C.TF_NewStatus() + defer C.TF_DeleteStatus(status) + capimap := C.TF_NewApiDefMap(opbuf, status) + if C.TF_GetCode(status) != C.TF_OK { + return nil, errors.New(C.GoString(C.TF_Message(status))) + } + apimap := &apiDefMap{capimap} + runtime.SetFinalizer( + apimap, + func(a *apiDefMap) { + C.TF_DeleteApiDefMap(a.c) + }) + return apimap, nil +} + +// Updates apiDefMap with the overrides specified in `data`. +// +// data - ApiDef text proto. +func (m *apiDefMap) Put(data string) error { + cdata := C.CString(data) + defer C.free(unsafe.Pointer(cdata)) + status := C.TF_NewStatus() + defer C.TF_DeleteStatus(status) + C.TF_ApiDefMapPut(m.c, cdata, C.size_t(len(data)), status) + if C.TF_GetCode(status) != C.TF_OK { + return errors.New(C.GoString(C.TF_Message(status))) + } + return nil +} + +// Returns ApiDef proto instance for the TensorFlow operation +// named `opname`. +func (m *apiDefMap) Get(opname string) (*adpb.ApiDef, error) { + cname := C.CString(opname) + defer C.free(unsafe.Pointer(cname)) + status := C.TF_NewStatus() + defer C.TF_DeleteStatus(status) + apidefBuf := C.TF_ApiDefMapGet( + m.c, cname, C.size_t(len(opname)), status) + defer C.TF_DeleteBuffer(apidefBuf) + if C.TF_GetCode(status) != C.TF_OK { + return nil, errors.New(C.GoString(C.TF_Message(status))) + } + if apidefBuf == nil { + return nil, fmt.Errorf("could not find ApiDef for %s", opname) + } + + var ( + apidef = new(adpb.ApiDef) + size = int(apidefBuf.length) + // A []byte backed by C memory. + // See: https://github.com/golang/go/wiki/cgo#turning-c-arrays-into-go-slices + data = (*[1 << 30]byte)(unsafe.Pointer(apidefBuf.data))[:size:size] + err = proto.Unmarshal(data, apidef) + ) + if err != nil { + return nil, err + } + return apidef, nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/genop/internal/genop.go b/third_party/go-tensorflow/tensorflow/go/genop/internal/genop.go new file mode 100644 index 0000000..f6bfdbb --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/genop/internal/genop.go @@ -0,0 +1,590 @@ +/* +Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package internal generates Go source code with functions for TensorFlow operations. +// +// The basic outline of the generated API is as follows: +// +// - One function for each TensorFlow operation +// - The arguments to the function are the inputs and required attributes of the operation +// - The function returns the outputs +// - A function is also generated for each optional attribute of the operation. +// +// There is a possibility that there are name collisions between the functions +// generated for ops and the functions generated for optional attributes. For +// now, we ignore those, but will need to revisit if a collision is actually +// encountered. +package internal + +/* +#include + +#include "tensorflow/c/c_api.h" +*/ +import "C" + +import ( + "fmt" + "io" + "io/ioutil" + "path" + "reflect" + "strings" + "text/template" + "unsafe" + + "github.com/golang/protobuf/proto" + adpb "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/api_def_go_proto" + odpb "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/op_def_go_proto" +) + +// GenerateFunctionsForRegisteredOps writes a Go source code file to w +// containing functions for each TensorFlow operation registered in the address +// space of the calling process. +// apidefDirs should be a contain of directories containing api_def_*.pbtxt +// files to load. +func GenerateFunctionsForRegisteredOps( + w io.Writer, apidefDirs []string) error { + ops, apimap, err := registeredOps() + if err != nil { + return err + } + for _, dir := range apidefDirs { + if err = updateAPIDefs(apimap, dir); err != nil { + return err + } + } + return generateFunctionsForOps(w, ops, apimap) +} + +func registeredOps() (*odpb.OpList, *apiDefMap, error) { + buf := C.TF_GetAllOpList() + defer C.TF_DeleteBuffer(buf) + var ( + list = new(odpb.OpList) + size = int(buf.length) + // A []byte backed by C memory. + // See: https://github.com/golang/go/wiki/cgo#turning-c-arrays-into-go-slices + data = (*[1 << 30]byte)(unsafe.Pointer(buf.data))[:size:size] + err = proto.Unmarshal(data, list) + ) + if err != nil { + return nil, nil, err + } + apimap, err := newAPIDefMap(list) + return list, apimap, err +} + +func updateAPIDefs(m *apiDefMap, dir string) error { + files, err := ioutil.ReadDir(dir) + if err != nil { + return err + } + for _, file := range files { + data, err := ioutil.ReadFile(path.Join(dir, file.Name())) + if err != nil { + return fmt.Errorf("failed to read %q: %v", file.Name(), err) + } + if err = m.Put(string(data)); err != nil { + return fmt.Errorf("failed to process %q: %v", file.Name(), err) + } + } + return nil +} + +func generateFunctionsForOps(w io.Writer, ops *odpb.OpList, apimap *apiDefMap) error { + thisPackage := reflect.TypeOf(tmplArgs{}).PkgPath() + if err := tmplHeader.Execute(w, thisPackage); err != nil { + return err + } + denylist := map[string]bool{ + "Const": true, + "PyFunc": true, + "PyFuncStateless": true, + } + for _, op := range ops.Op { + if denylist[op.Name] { + continue + } + apidef, err := apimap.Get(op.Name) + if err != nil { + return err + } + if err := generateFunctionForOp(w, op, apidef); err != nil { + return err + } + } + return nil +} + +func generateFunctionForOp(w io.Writer, op *odpb.OpDef, apidef *adpb.ApiDef) error { + if strings.HasPrefix(op.Name, "_") { // Internal operation + return nil + } + // Ignore operations where the Go types corresponding to the TensorFlow + // type haven't been worked out (such as "func"s). + for _, a := range op.Attr { + if _, err := goType(a.Type); err != nil { + return nil + } + } + // Also, haven't figured out reference types yet, so ignore those too. + for _, a := range op.InputArg { + if a.IsRef { + return nil + } + } + for _, a := range op.OutputArg { + if a.IsRef { + return nil + } + } + if apidef.Summary == "" { + // Undocumented operation, perhaps a sign of not being ready to + // export. + return nil + } + tmplArgs, err := newTmplArgs(op, apidef) + if err != nil { + return err + } + return tmplOp.Execute(w, tmplArgs) +} + +var ( + // Go keywords that cannot be used as identifiers. + // From https://golang.org/ref/spec#Keywords + keywords = []string{ + "break", "default", "func", "interface", "select", "case", + "defer", "go", "map", "struct", "chan", "else", "goto", + "package", "switch", "const", "fallthrough", "if", "range", + "type", "continue", "for", "import", "return", "var", + } + + tmplHeader = template.Must(template.New("header").Parse(`// DO NOT EDIT +// This file was machine generated by {{.}} +// +// WARNING: This generation of wrapper function for TensorFlow ops is in an +// experimental state. The generated API can change without notice. + +package op + +import tf "github.com/tensorflow/tensorflow/tensorflow/go" + +// optionalAttr is an intentionally un-exported type to hide +// details of how optional attributes to operations are implemented. +type optionalAttr map[string]interface{} + +func makeOutputList(op *tf.Operation, start int, output string) ([]tf.Output, int, error) { + size, err := op.OutputListSize(output) + if err != nil { + return nil, start, err + } + list := make([]tf.Output, size) + for i := 0; i < size; i++ { + list[i] = op.Output(start + i) + } + return list, start + size, nil +} +`)) + + tmplOp = template.Must(template.New("op").Funcs(template.FuncMap{ + "MakeComment": makeComment, + "GoType": goType, + "CamelCase": camelCase, + "Identifier": identifier, + "IsListArg": isListArg, + "IsListAttr": isListAttr, + "StripLeadingColon": stripLeadingColon, + }).Parse(` +{{if .OptionalAttrs -}} +{{/* Type for specifying all optional attributes. */ -}} +// {{.Op.Name}}Attr is an optional argument to {{.Op.Name}}. +type {{.Op.Name}}Attr func(optionalAttr) + +{{range .OptionalAttrs}} +// {{$.Op.Name}}{{CamelCase .RenameTo}} sets the optional {{.RenameTo}} attribute to value. +{{- if .Description}} +// +// value: {{MakeComment .Description}} +{{- end}} +// If not specified, defaults to {{StripLeadingColon .DefaultValue}} +{{- if .HasMinimum}} +// +// {{if .IsListAttr }}REQUIRES: len(value) >= {{.Minimum}}{{else}}REQUIRES: value >= {{.Minimum}}{{end}} +{{- end}} +func {{$.Op.Name}}{{CamelCase .RenameTo}}(value {{GoType .Type}}) {{$.Op.Name}}Attr { + return func(m optionalAttr) { + m[{{printf "%q" .Name}}] = value + } +} +{{end}} +{{end}} + +{{- /* Create a godoc friendly comment. */ -}} + +// {{MakeComment .APIDef.Summary}} + +{{- with .Op.Deprecation}} +// +// DEPRECATED at GraphDef version {{.Version}}: {{.Explanation}} +{{- end -}} + +{{- with .APIDef.Description}} +// +// {{MakeComment .}} +{{- end -}} + +{{- if .DescribeArguments}} +// +// Arguments: +{{- range .InArgsReordered}} +// {{if .Description}}{{Identifier .RenameTo}}: {{MakeComment .Description}}{{end}} +{{- end -}} +{{- range .RequiredAttrs}} +// {{if .Description}}{{Identifier .RenameTo}}: {{MakeComment .Description}}{{end}} +{{- end -}} +{{- end -}} + +{{- if (not .Op.OutputArg) }} +// +// Returns the created operation. +{{- else }} +{{- if .DescribeOutputs}} +// +{{- if eq (len .OutArgs) 1 }} +// Returns {{range .OutArgs}}{{MakeComment .Description}}{{end}} +{{- else }} +// Returns: +{{- range .OutArgs}} +// {{Identifier .RenameTo}}{{if .Description}}: {{MakeComment .Description}}{{end}} +{{- end -}} +{{- end -}} +{{- end -}} +{{- end -}} +{{- /* + + The function signature. + Since OpDef.Name is in CamelCase, it cannot conflict with a reserved keyword in Golang +*/}} +func {{.Op.Name}} + +{{- /* + Fill in input arguments: + (1) The Scope + (2) All input arguments (which may be either []tf.Output or tf.Output) + (3) All required attributes + (4) Variadic list of optional attributes +*/ -}} + +(scope *Scope +{{- range $i, $a := .InArgsReordered}}, {{Identifier $a.RenameTo}} {{if $a.IsListArg}}[]{{end}}tf.Output{{end -}} +{{range $i, $a := .RequiredAttrs}}, {{Identifier $a.RenameTo}} {{GoType $a.Type}}{{end -}} +{{if .OptionalAttrs}}, optional ...{{.Op.Name}}Attr{{end -}} +) + +{{- /* Construct outputs: len(.OutArgs) or a *tf.Operation */ -}} + +{{if .OutArgs -}} +({{range $i,$a := .OutArgs}}{{if $i}}, {{end}}{{Identifier $a.RenameTo}} {{if $a.IsListArg}}[]{{end}}tf.Output{{end -}}) +{{- else -}} +(o *tf.Operation) +{{- end }} { + if scope.Err() != nil { + return + } + {{if .HasAttrs -}} + attrs := map[string]interface{}{ {{- range .RequiredAttrs}}{{printf "%q" .Name}}: {{Identifier .RenameTo}},{{end}}} + {{if .OptionalAttrs -}} + for _, a := range optional { + a(attrs) + } + {{end -}} + {{end -}} + opspec := tf.OpSpec{ + Type: {{printf "%q" .Op.Name}}, + {{if .InArgs -}} + Input: []tf.Input{ + {{range $i,$a := .InArgs}}{{if $a.IsListArg}}tf.OutputList({{Identifier $a.RenameTo}}){{else}}{{Identifier $a.RenameTo}}{{end}}, {{end}} + }, + {{- end}} + {{- if .HasAttrs}} + Attrs: attrs, + {{- end}} + } + {{- if .OutArgs}} + {{- if .HasListOutput}} + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + {{- range $i, $a := .OutArgs}} + {{- if $a.IsListArg}} + if {{Identifier .RenameTo}}, idx, err = makeOutputList(op, idx, {{printf "%q" .Name}}); err != nil { + scope.UpdateErr({{printf "%q" $.Op.Name}}, err) + return + } + {{- else }} + {{Identifier .RenameTo}} = op.Output(idx) + {{- end }}{{- /* if IsListArg */}} + {{- end }}{{- /* range .OutArgs */}} + return {{range $i, $a := .OutArgs}}{{if $i}}, {{end}}{{Identifier .RenameTo}}{{end}} + {{- else }} + op := scope.AddOperation(opspec) + return {{range $i, $a := .OutArgs}}{{if $i}}, {{end}}op.Output({{$i}}){{end}} + {{- end }}{{- /* if .HasListOutput */}} + {{- else }} + return scope.AddOperation(opspec) + {{- end }}{{- /* if .OutArgs */}} +} +`)) +) + +type attrWrapper struct { + op *odpb.OpDef_AttrDef + api *adpb.ApiDef_Attr +} + +func (a *attrWrapper) Name() string { return a.api.Name } +func (a *attrWrapper) RenameTo() string { return a.api.RenameTo } +func (a *attrWrapper) Description() string { return a.api.Description } +func (a *attrWrapper) Type() string { return a.op.Type } +func (a *attrWrapper) IsListAttr() bool { return isListAttr(a.op) } +func (a *attrWrapper) HasMinimum() bool { return a.op.HasMinimum } +func (a *attrWrapper) Minimum() int64 { return a.op.Minimum } +func (a *attrWrapper) DefaultValue() interface{} { return a.api.DefaultValue } + +type argWrapper struct { + op *odpb.OpDef_ArgDef + api *adpb.ApiDef_Arg +} + +func (a *argWrapper) Name() string { return a.api.Name } +func (a *argWrapper) RenameTo() string { return a.api.RenameTo } +func (a *argWrapper) Description() string { return a.api.Description } +func (a *argWrapper) IsListArg() bool { return isListArg(a.op) } + +type tmplArgs struct { + Op *odpb.OpDef + APIDef *adpb.ApiDef + // Op.Attr is split into two categories + // (1) Required: These must be specified by the client and are thus + // included in the function signature. + // (2) Optional: These need not be specified (as they have default + // values) and thus do not appear in the function signature. + RequiredAttrs []*attrWrapper + OptionalAttrs []*attrWrapper + InArgs []*argWrapper + // Input arguments ordered based on arg_order field of ApiDef. + InArgsReordered []*argWrapper + OutArgs []*argWrapper +} + +func newTmplArgs(op *odpb.OpDef, apidef *adpb.ApiDef) (*tmplArgs, error) { + ret := tmplArgs{Op: op, APIDef: apidef} + + // Setup InArgs field + for i, in := range op.InputArg { + argCombined := argWrapper{op: in, api: apidef.InArg[i]} + ret.InArgs = append(ret.InArgs, &argCombined) + } + + // Setup OutArgs field + for i, out := range op.OutputArg { + argCombined := argWrapper{op: out, api: apidef.OutArg[i]} + ret.OutArgs = append(ret.OutArgs, &argCombined) + } + + // Setup InArgsReordered field + for _, argName := range apidef.ArgOrder { + // Find the argument in op.InputArg + argIndex := -1 + for i, in := range op.InputArg { + if in.Name == argName { + argIndex = i + break + } + } + if argIndex == -1 { + return nil, fmt.Errorf( + "couldn't find argument %s in ApiDef for op %s", + argName, op.Name) + } + argCombined := argWrapper{ + op: op.InputArg[argIndex], api: apidef.InArg[argIndex]} + ret.InArgsReordered = append(ret.InArgsReordered, &argCombined) + } + + if len(op.Attr) == 0 { + return &ret, nil + } + // Attributes related to the InputArg's type are inferred automatically + // and are not exposed to the client. + inferred := make(map[string]bool) + for _, in := range op.InputArg { + switch { + case in.TypeAttr != "": + inferred[in.TypeAttr] = true + case in.TypeListAttr != "": + inferred[in.TypeListAttr] = true + } + if in.NumberAttr != "" { + inferred[in.NumberAttr] = true + } + } + for i, attr := range op.Attr { + if inferred[attr.Name] { + continue + } + attrCombined := attrWrapper{op: attr, api: apidef.Attr[i]} + if attr.DefaultValue == nil { + ret.RequiredAttrs = append(ret.RequiredAttrs, &attrCombined) + } else { + ret.OptionalAttrs = append(ret.OptionalAttrs, &attrCombined) + } + } + return &ret, nil +} + +func (a *tmplArgs) HasAttrs() bool { return len(a.RequiredAttrs)+len(a.OptionalAttrs) > 0 } +func (a *tmplArgs) DescribeArguments() bool { + for _, arg := range a.InArgs { + if arg.Description() != "" { + return true + } + } + for _, attr := range a.RequiredAttrs { + if attr.Description() != "" { + return true + } + } + return false + +} +func (a *tmplArgs) DescribeOutputs() bool { + for _, arg := range a.OutArgs { + if arg.Description() != "" { + return true + } + } + return false +} +func (a *tmplArgs) HasListOutput() bool { + for _, arg := range a.OutArgs { + if arg.IsListArg() { + return true + } + } + return false +} + +func makeComment(lines string) string { + return strings.Join(strings.SplitAfter(lines, "\n"), "// ") +} + +// goType converts a TensorFlow "type" ('string', 'int', 'list(string)' etc.) +// to the corresponding type in Go. +func goType(tfType string) (string, error) { + list, tfType := parseTFType(tfType) + var gotype string + switch tfType { + case "int": + gotype = "int64" + case "float": + gotype = "float32" + case "bool": + gotype = "bool" + case "type": + gotype = "tf.DataType" + case "shape": + gotype = "tf.Shape" + case "tensor": + gotype = "tf.Tensor" + case "string": + gotype = "string" + default: + return "", fmt.Errorf("%q is not a recognized DataType", tfType) + } + if list { + gotype = "[]" + gotype + } + return gotype, nil +} + +func camelCase(snakeCase string) string { + words := strings.Split(snakeCase, "_") + for i, w := range words { + words[i] = strings.ToUpper(string(w[0])) + w[1:] + } + return strings.Join(words, "") +} + +// identifier creates an identifier for s usable in the generated Go source +// code. +// +// Avoids collisions with keywords and other identifiers used in the generated +// code. +func identifier(s string) string { + // Identifiers used in the generated code. + if s == "tf" || s == "scope" || s == "err" || s == "op" { + return s + "_" + } + for _, k := range keywords { + if s == k { + // Alternatively, make the first letter upper case. + return s + "_" + } + } + return s +} + +func isListArg(argdef *odpb.OpDef_ArgDef) bool { + return argdef.TypeListAttr != "" || argdef.NumberAttr != "" +} + +func isListAttr(attrdef *odpb.OpDef_AttrDef) bool { + list, _ := parseTFType(attrdef.Type) + return list +} + +// stripLeadingColon removes the prefix of the string up to the first colon. +// +// This is useful when 's' corresponds to a "oneof" protocol buffer message. +// For example, consider the protocol buffer message: +// oneof value { bool b = 1; int64 i = 2; } +// proto.CompactTextString) will print "b:true", or "i:7" etc. This function +// strips out the leading "b:" or "i:". +func stripLeadingColon(m proto.Message) string { + x := proto.CompactTextString(m) + y := strings.SplitN(x, ":", 2) + if len(y) < 2 { + return x + } + return y[1] +} + +func parseTFType(tfType string) (list bool, typ string) { + const ( + listPrefix = "list(" + listSuffix = ")" + ) + if strings.HasPrefix(tfType, listPrefix) && strings.HasSuffix(tfType, listSuffix) { + return true, strings.TrimSuffix(strings.TrimPrefix(tfType, listPrefix), listSuffix) + } + return false, tfType +} diff --git a/third_party/go-tensorflow/tensorflow/go/genop/internal/genop_test.go b/third_party/go-tensorflow/tensorflow/go/genop/internal/genop_test.go new file mode 100644 index 0000000..b467efc --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/genop/internal/genop_test.go @@ -0,0 +1,820 @@ +/* +Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package internal + +import ( + "bytes" + "go/format" + "testing" + + "github.com/golang/protobuf/proto" + adpb "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/api_def_go_proto" + odpb "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/op_def_go_proto" +) + +// Creates an ApiDef based on opdef and applies overrides +// from apidefText (ApiDef text proto). +func GetAPIDef(t *testing.T, opdef *odpb.OpDef, apidefText string) *adpb.ApiDef { + opdefList := &odpb.OpList{Op: []*odpb.OpDef{opdef}} + apimap, err := newAPIDefMap(opdefList) + if err != nil { + t.Fatal(err) + } + err = apimap.Put(apidefText) + if err != nil { + t.Fatal(err) + } + apidef, err := apimap.Get(opdef.Name) + if err != nil { + t.Fatal(err) + } + return apidef +} + +func TestGenerateOp(t *testing.T) { + // TestGenerateOp validates the generated source code for an op. + // The OpDef for the test cases are simplified forms of real ops. + testdata := []struct { + tag string + opdef string + apidef string + wanted string + }{ + { + tag: "NoOp", + opdef: ` +name: "NoOp" +`, + apidef: ` +op: < +graph_op_name: "NoOp" +summary: "No. Op." +> +`, + wanted: ` +// No. Op. +// +// Returns the created operation. +func NoOp(scope *Scope) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "NoOp", + } + return scope.AddOperation(opspec) +} +`, + }, + { + tag: "NoAttributes", + opdef: ` +name: "Add" +input_arg: < + name: "x" + type_attr: "T" +> +input_arg: < + name: "y" + type_attr: "T" +> +output_arg: < + name: "z" + type_attr: "T" +> +attr: < + name: "T" + type: "type" + allowed_values: < + list: < + type: DT_FLOAT + type: DT_INT64 + > + > +> +`, + apidef: ` +op: < +graph_op_name: "Add" +summary: "Returns x + y element-wise." +description: "Blah blah", +> +`, + wanted: ` +// Returns x + y element-wise. +// +// Blah blah +func Add(scope *Scope, x tf.Output, y tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Add", + Input: []tf.Input{ + x, y, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} +`, + }, + { + tag: "RequiredAttributes", + opdef: ` +name: "Cast" +input_arg: < + name: "x" + type_attr: "SrcT" +> +output_arg: < + name: "y" + type_attr: "DstT" +> +attr: < + name: "SrcT" + type: "type" +> +attr: < + name: "DstT" + type: "type" +> +`, + apidef: ` +op: < +graph_op_name: "Cast" +summary: "Cast x of type SrcT to y of DstT." +> +`, + wanted: ` +// Cast x of type SrcT to y of DstT. +func Cast(scope *Scope, x tf.Output, DstT tf.DataType) (y tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"DstT": DstT} + opspec := tf.OpSpec{ + Type: "Cast", + Input: []tf.Input{ + x, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} +`, + }, + { + tag: "OptionalAttributes", + opdef: ` +name: "DecodeJpeg" +input_arg: < + name: "contents" + type: DT_STRING +> +output_arg: < + name: "image" + type: DT_UINT8 +> +attr: < + name: "channels" + type: "int" + default_value: < + i: 0 + > +> +attr: < + name: "fancy_upscaling" + type: "bool" + default_value: < + b: true + > +> +attr: < + name: "acceptable_fraction" + type: "float" + default_value: < + f: 1 + > +> +`, + apidef: ` +op: < +graph_op_name: "DecodeJpeg" +in_arg: < + name: "contents" + description: "0-D. The JPEG-encoded image." +> +out_arg: < + name: "image" + description: "3-D with shape [height, width, channels]" +> +attr: < + name: "channels" + description: "Number of color channels for the decoded image." +> +attr: < + name: "fancy_upscaling" + description: "If true use a slower but nicer upscaling of the\nchroma planes (yuv420/422 only)." +> +attr: < + name: "acceptable_fraction" + description: "The minimum required fraction of lines before a truncated\ninput is accepted." +> +summary: "Decode a JPEG-encoded image to a uint8 tensor." +description: "Norna dorna fjord\nkajorna\nhahaha" +> +`, + wanted: ` +// DecodeJpegAttr is an optional argument to DecodeJpeg. +type DecodeJpegAttr func(optionalAttr) + +// DecodeJpegChannels sets the optional channels attribute to value. +// +// value: Number of color channels for the decoded image. +// If not specified, defaults to 0 +func DecodeJpegChannels(value int64) DecodeJpegAttr { + return func(m optionalAttr) { + m["channels"] = value + } +} + +// DecodeJpegFancyUpscaling sets the optional fancy_upscaling attribute to value. +// +// value: If true use a slower but nicer upscaling of the +// chroma planes (yuv420/422 only). +// If not specified, defaults to true +func DecodeJpegFancyUpscaling(value bool) DecodeJpegAttr { + return func(m optionalAttr) { + m["fancy_upscaling"] = value + } +} + +// DecodeJpegAcceptableFraction sets the optional acceptable_fraction attribute to value. +// +// value: The minimum required fraction of lines before a truncated +// input is accepted. +// If not specified, defaults to 1 +func DecodeJpegAcceptableFraction(value float32) DecodeJpegAttr { + return func(m optionalAttr) { + m["acceptable_fraction"] = value + } +} + +// Decode a JPEG-encoded image to a uint8 tensor. +// +// Norna dorna fjord +// kajorna +// hahaha +// +// Arguments: +// contents: 0-D. The JPEG-encoded image. +// +// Returns 3-D with shape [height, width, channels] +func DecodeJpeg(scope *Scope, contents tf.Output, optional ...DecodeJpegAttr) (image tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "DecodeJpeg", + Input: []tf.Input{ + contents, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} +`, + }, + { + tag: "MultipleOutputs", + opdef: ` +name: "TwoOutputs" +input_arg: < + name: "input" + type_attr: "T" +> +output_arg < + name: "x" + type_attr: "T" +> +output_arg < + name: "y" + type_attr: "T" +> +attr: < + name: "T" + type: "type" +> +`, + apidef: ` +op: < +graph_op_name: "TwoOutputs" +summary: "Op that produces multiple outputs" +> +`, + wanted: ` +// Op that produces multiple outputs +func TwoOutputs(scope *Scope, input tf.Output) (x tf.Output, y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "TwoOutputs", + Input: []tf.Input{ + input, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} +`, + }, + { + tag: "ListOutput", + opdef: ` +name: "ShapeN" +input_arg: < + name: "input" + type_attr: "T" + number_attr: "N" +> +output_arg: < + name: "output" + type_attr: "out_type" + number_attr: "N" +> +attr: < + name: "N" + type: "int" + has_minimum: true + minimum: 1 +> +attr: < + name: "T" + type: "type" +> +attr: < + name: "out_type" + type: "type" + default_value: < + type: DT_INT32 + > + allowed_values: < + list: < + type: DT_INT32 + type: DT_INT64 + > + > +> +`, + apidef: ` +op: < +graph_op_name: "ShapeN" +summary: "Returns shape of tensors." +description: "Some description here." +> +`, + wanted: ` +// ShapeNAttr is an optional argument to ShapeN. +type ShapeNAttr func(optionalAttr) + +// ShapeNOutType sets the optional out_type attribute to value. +// If not specified, defaults to DT_INT32 +func ShapeNOutType(value tf.DataType) ShapeNAttr { + return func(m optionalAttr) { + m["out_type"] = value + } +} + +// Returns shape of tensors. +// +// Some description here. +func ShapeN(scope *Scope, input []tf.Output, optional ...ShapeNAttr) (output []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ShapeN", + Input: []tf.Input{ + tf.OutputList(input), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if output, idx, err = makeOutputList(op, idx, "output"); err != nil { + scope.UpdateErr("ShapeN", err) + return + } + return output +} +`, + }, + { + tag: "ApiDefOverrides", + opdef: ` +name: "TestOp" +input_arg: < + name: "a" + type: DT_STRING +> +input_arg: < + name: "b" + type: DT_STRING +> +output_arg: < + name: "c" + type: DT_UINT8 +> +attr: < + name: "d" + type: "int" + default_value: < + i: 0 + > +> +`, + apidef: ` +op: < +graph_op_name: "TestOp" +in_arg: < + name: "a" + rename_to: "aa" + description: "Description for aa." +> +in_arg: < + name: "b" + rename_to: "bb" + description: "Description for bb." +> +arg_order: "b" +arg_order: "a" +out_arg: < + name: "c" + rename_to: "cc" + description: "Description for cc." +> +attr: < + name: "d" + rename_to: "dd" + description: "Description for dd." +> +summary: "Summary for TestOp." +description: "Description for TestOp." +> +`, + wanted: ` +// TestOpAttr is an optional argument to TestOp. +type TestOpAttr func(optionalAttr) + +// TestOpDd sets the optional dd attribute to value. +// +// value: Description for dd. +// If not specified, defaults to 0 +func TestOpDd(value int64) TestOpAttr { + return func(m optionalAttr) { + m["d"] = value + } +} + +// Summary for TestOp. +// +// Description for TestOp. +// +// Arguments: +// bb: Description for bb. +// aa: Description for aa. +// +// Returns Description for cc. +func TestOp(scope *Scope, bb tf.Output, aa tf.Output, optional ...TestOpAttr) (cc tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "TestOp", + Input: []tf.Input{ + aa, bb, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} +`, + }, + { + tag: "SampleDistortedBoundingBox", + opdef: ` +name: "SampleDistortedBoundingBox" +input_arg { + name: "image_size" + type_attr: "T" +} +input_arg { + name: "bounding_boxes" + type: DT_FLOAT +} +output_arg { + name: "begin" + type_attr: "T" +} +output_arg { + name: "size" + type_attr: "T" +} +output_arg { + name: "bboxes" + type: DT_FLOAT +} +attr { + name: "T" + type: "type" + allowed_values { + list { + type: DT_UINT8 + type: DT_INT8 + type: DT_INT16 + type: DT_INT32 + type: DT_INT64 + } + } +} +attr { + name: "seed" + type: "int" + default_value { + i: 0 + } +} +attr { + name: "seed2" + type: "int" + default_value { + i: 0 + } +} +attr { + name: "min_object_covered" + type: "float" + default_value { + f: 0.1 + } +} +attr { + name: "aspect_ratio_range" + type: "list(float)" + default_value { + list { + f: 0.75 + f: 1.33 + } + } +} +attr { + name: "area_range" + type: "list(float)" + default_value { + list { + f: 0.05 + f: 1 + } + } +} +attr { + name: "max_attempts" + type: "int" + default_value { + i: 100 + } +} +attr { + name: "use_image_if_no_bounding_boxes" + type: "bool" + default_value { + b: false + } +} +is_stateful: true +`, + apidef: ` +op { + graph_op_name: "SampleDistortedBoundingBox" + in_arg { + name: "image_size" + description: "Blah blah" + } + in_arg { + name: "bounding_boxes" + description: "Blah blah" + } + out_arg { + name: "begin" + description: "Blah blah" + } + out_arg { + name: "size" + description: "Blah blah" + } + out_arg { + name: "bboxes" + description: "Blah blah" + } + attr { + name: "seed" + description: "Blah blah" + } + attr { + name: "seed2" + description: "Blah blah" + } + attr { + name: "min_object_covered" + description: "Blah blah" + } + attr { + name: "aspect_ratio_range" + description: "Blah blah" + } + attr { + name: "area_range" + description: "Blah blah" + } + attr { + name: "max_attempts" + description: "Blah blah" + } + attr { + name: "use_image_if_no_bounding_boxes" + description: "Blah blah" + } + summary: "Generate a single randomly distorted bounding box for an image." + description: "Blah blah" +} +`, + wanted: ` +// SampleDistortedBoundingBoxAttr is an optional argument to SampleDistortedBoundingBox. +type SampleDistortedBoundingBoxAttr func(optionalAttr) + +// SampleDistortedBoundingBoxSeed sets the optional seed attribute to value. +// +// value: Blah blah +// If not specified, defaults to 0 +func SampleDistortedBoundingBoxSeed(value int64) SampleDistortedBoundingBoxAttr { + return func(m optionalAttr) { + m["seed"] = value + } +} + +// SampleDistortedBoundingBoxSeed2 sets the optional seed2 attribute to value. +// +// value: Blah blah +// If not specified, defaults to 0 +func SampleDistortedBoundingBoxSeed2(value int64) SampleDistortedBoundingBoxAttr { + return func(m optionalAttr) { + m["seed2"] = value + } +} + +// SampleDistortedBoundingBoxMinObjectCovered sets the optional min_object_covered attribute to value. +// +// value: Blah blah +// If not specified, defaults to 0.1 +func SampleDistortedBoundingBoxMinObjectCovered(value float32) SampleDistortedBoundingBoxAttr { + return func(m optionalAttr) { + m["min_object_covered"] = value + } +} + +// SampleDistortedBoundingBoxAspectRatioRange sets the optional aspect_ratio_range attribute to value. +// +// value: Blah blah +// If not specified, defaults to +func SampleDistortedBoundingBoxAspectRatioRange(value []float32) SampleDistortedBoundingBoxAttr { + return func(m optionalAttr) { + m["aspect_ratio_range"] = value + } +} + +// SampleDistortedBoundingBoxAreaRange sets the optional area_range attribute to value. +// +// value: Blah blah +// If not specified, defaults to +func SampleDistortedBoundingBoxAreaRange(value []float32) SampleDistortedBoundingBoxAttr { + return func(m optionalAttr) { + m["area_range"] = value + } +} + +// SampleDistortedBoundingBoxMaxAttempts sets the optional max_attempts attribute to value. +// +// value: Blah blah +// If not specified, defaults to 100 +func SampleDistortedBoundingBoxMaxAttempts(value int64) SampleDistortedBoundingBoxAttr { + return func(m optionalAttr) { + m["max_attempts"] = value + } +} + +// SampleDistortedBoundingBoxUseImageIfNoBoundingBoxes sets the optional use_image_if_no_bounding_boxes attribute to value. +// +// value: Blah blah +// If not specified, defaults to false +func SampleDistortedBoundingBoxUseImageIfNoBoundingBoxes(value bool) SampleDistortedBoundingBoxAttr { + return func(m optionalAttr) { + m["use_image_if_no_bounding_boxes"] = value + } +} + +// Generate a single randomly distorted bounding box for an image. +// +// Blah blah +// +// Arguments: +// image_size: Blah blah +// bounding_boxes: Blah blah +// +// Returns: +// begin: Blah blah +// size: Blah blah +// bboxes: Blah blah +func SampleDistortedBoundingBox(scope *Scope, image_size tf.Output, bounding_boxes tf.Output, optional ...SampleDistortedBoundingBoxAttr) (begin tf.Output, size tf.Output, bboxes tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "SampleDistortedBoundingBox", + Input: []tf.Input{ + image_size, bounding_boxes, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} +`, + }, + } + + for _, test := range testdata { + t.Run(test.tag, func(t *testing.T) { + var opdef odpb.OpDef + var apidef *adpb.ApiDef + var buf bytes.Buffer + if err := proto.UnmarshalText(test.opdef, &opdef); err != nil { + t.Fatal(err) + } + apidef = GetAPIDef(t, &opdef, test.apidef) + if err := generateFunctionForOp(&buf, &opdef, apidef); err != nil { + t.Fatal(err) + } + got, err := format.Source(buf.Bytes()) + if err != nil { + t.Fatalf("Unable to format: %v\n%s", err, buf.Bytes()) + } + want, err := format.Source([]byte(test.wanted)) + if err != nil { + t.Fatalf("Unable to format: %v\n%s", err, test.wanted) + } + if !bytes.Equal(got, want) { + t.Fatalf("Got:\n%s\nWant:\n%s\n", got, want) + } + }) + } +} diff --git a/third_party/go-tensorflow/tensorflow/go/genop/internal/lib.go b/third_party/go-tensorflow/tensorflow/go/genop/internal/lib.go new file mode 100644 index 0000000..0ae6fd0 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/genop/internal/lib.go @@ -0,0 +1,22 @@ +/* +Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package internal generates Go source code with functions for TensorFlow operations. +package internal + +// #cgo LDFLAGS: -ltensorflow +// #cgo CFLAGS: -I${SRCDIR}/../../../../ +import "C" diff --git a/third_party/go-tensorflow/tensorflow/go/genop/main.go b/third_party/go-tensorflow/tensorflow/go/genop/main.go new file mode 100644 index 0000000..87c1d27 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/genop/main.go @@ -0,0 +1,70 @@ +/* +Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Command genop generates a Go source file with functions for TensorFlow ops. +package main + +import ( + "bytes" + "flag" + "go/format" + "io/ioutil" + "log" + "os" + "path/filepath" + "strings" + + "github.com/tensorflow/tensorflow/tensorflow/go/genop/internal" +) + +func main() { + var ( + filename = flag.String("outfile", "", "File to write generated source code to.") + header = flag.String("header", "", "Path to a file whose contents will be copied into the generated file. Can be empty") + apiDefDirs = flag.String("api_def_dirs", "", "Comma-separated directories containing api_def_*.pbtxt files.") + buf bytes.Buffer + ) + flag.Parse() + if *filename == "" { + log.Fatal("-outfile must be set") + } + if *header != "" { + hdr, err := ioutil.ReadFile(*header) + if err != nil { + log.Fatalf("Unable to read %s: %v", *header, err) + } + buf.Write(hdr) + buf.WriteString("\n\n") + } + os.MkdirAll(filepath.Dir(*filename), 0755) + + apiDefDirsList := []string{} + if len(*apiDefDirs) > 0 { + apiDefDirsList = strings.Split(*apiDefDirs, ",") + } + + if err := internal.GenerateFunctionsForRegisteredOps( + &buf, apiDefDirsList); err != nil { + log.Fatal(err) + } + formatted, err := format.Source(buf.Bytes()) + if err != nil { + log.Fatalf("Failed to generate valid source? 'go fmt' failed: %v", err) + } + if err := ioutil.WriteFile(*filename, formatted, 0644); err != nil { + log.Fatalf("Failed to write to %q: %v", *filename, err) + } +} diff --git a/third_party/go-tensorflow/tensorflow/go/graph.go b/third_party/go-tensorflow/tensorflow/go/graph.go new file mode 100644 index 0000000..60de1e1 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/graph.go @@ -0,0 +1,528 @@ +/* +Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package tensorflow + +// #include "tensorflow/c/c_api.h" +// +// #include +// #include +// +// void TF_SetAttrShapeList_Helper(TF_OperationDescription* desc, +// const char* attr_name, +// const int64_t* flat_dims, +// const int* num_dims, +// int num_shapes) { +// const int64_t** dims = +// (const int64_t**)malloc(sizeof(const int64_t*) * num_shapes); +// int i = 0; +// for (i = 0; i < num_shapes; i++) { +// dims[i] = flat_dims; +// if (num_dims[i] > 0) { +// // flat_dims will be NULL iff num_shapes is 0 or all elements in num_dims are <= 0. +// flat_dims += num_dims[i]; +// } +// } +// TF_SetAttrShapeList(desc, attr_name, dims, num_dims, num_shapes); +// free(dims); +// } +import "C" + +import ( + "fmt" + "io" + "runtime" + "unsafe" +) + +// Graph represents a computation graph. Graphs may be shared between sessions. +type Graph struct { + c *C.TF_Graph +} + +// The GraphImportOptions struct holds parameters for the ImportWithOptions function. +type GraphImportOptions struct { + // Node prefix + Prefix string + + // Execution device + Device string + + // inputMapping defines a mapping between Outputs in the graph + // and Outputs they should be replaced with. + inputMapping map[struct { + Name string + Index int + }]Output + + // TODO: extend this structure to support more options from TF_ImportGraphDefOptions +} + +// AddInputMapping adds a mapping between an Output in the imported graph +// and an Ouput in the destination graph that it should be replaced with, +// where src:srcIndex is the name of the Operation and Output index to +// replace and dst is the output to replace it with. +func (o *GraphImportOptions) AddInputMapping(src string, srcIndex int, dst Output) { + if o.inputMapping == nil { + o.inputMapping = make(map[struct { + Name string + Index int + }]Output) + } + o.inputMapping[struct { + Name string + Index int + }{src, srcIndex}] = dst +} + +// NewGraph returns a new Graph. +func NewGraph() *Graph { + g := &Graph{C.TF_NewGraph()} + runtime.SetFinalizer(g, (*Graph).finalizer) + return g +} + +func (g *Graph) finalizer() { + C.TF_DeleteGraph(g.c) +} + +// WriteTo writes out a serialized representation of g to w. +// +// Implements the io.WriterTo interface. +func (g *Graph) WriteTo(w io.Writer) (int64, error) { + buf := C.TF_NewBuffer() + defer C.TF_DeleteBuffer(buf) + status := newStatus() + C.TF_GraphToGraphDef(g.c, buf, status.c) + if err := status.Err(); err != nil { + return 0, err + } + if buf.length > (1 << 30) { + // For very large graphs, the writes can be chunked. + // Punt on that for now. + return 0, fmt.Errorf("Graph is too large to write out, Graph.WriteTo needs to be updated") + } + // A []byte slice backed by C memory. + // See: https://github.com/golang/go/wiki/cgo#turning-c-arrays-into-go-slices + length := int(buf.length) + var slice []byte + if unsafe.Sizeof(unsafe.Pointer(nil)) == 8 { + slice = (*[1<<50 - 1]byte)(unsafe.Pointer(buf.data))[:length:length] + } else { + slice = (*[1 << 30]byte)(unsafe.Pointer(buf.data))[:length:length] + } + n, err := w.Write(slice) + return int64(n), err +} + +// ImportWithOptions imports the nodes and edges from a serialized representation of +// another Graph into g. +// +// Multiple options can be specified for the newly imported nodes. +func (g *Graph) ImportWithOptions(def []byte, options GraphImportOptions) error { + cprefix := C.CString(options.Prefix) + defer C.free(unsafe.Pointer(cprefix)) + + opts := C.TF_NewImportGraphDefOptions() + defer C.TF_DeleteImportGraphDefOptions(opts) + C.TF_ImportGraphDefOptionsSetPrefix(opts, cprefix) + + if len(options.Device) != 0 { + cdev := C.CString(options.Device) + defer C.free(unsafe.Pointer(cdev)) + C.TF_ImportGraphDefOptionsSetDefaultDevice(opts, cdev) + } + + for src, dst := range options.inputMapping { + cSrcName := C.CString(src.Name) + C.TF_ImportGraphDefOptionsAddInputMapping(opts, cSrcName, C.int(src.Index), dst.c()) + C.free(unsafe.Pointer(cSrcName)) + } + + buf := C.TF_NewBuffer() + defer C.TF_DeleteBuffer(buf) + buf.length = C.size_t(len(def)) + buf.data = C.CBytes(def) + if buf.data == nil { + return fmt.Errorf("unable to allocate memory") + } + defer C.free(buf.data) + + status := newStatus() + + C.TF_GraphImportGraphDef(g.c, buf, opts, status.c) + if err := status.Err(); err != nil { + return err + } + + return nil +} + +// Import imports the nodes and edges from a serialized representation of +// another Graph into g. +// +// Names of imported nodes will be prefixed with prefix. +func (g *Graph) Import(def []byte, prefix string) error { + return g.ImportWithOptions(def, GraphImportOptions{Prefix: prefix}) +} + +// Operation returns the Operation named name in the Graph, or nil if no such +// operation is present. +func (g *Graph) Operation(name string) *Operation { + cname := C.CString(name) + defer C.free(unsafe.Pointer(cname)) + cop := C.TF_GraphOperationByName(g.c, cname) + if cop == nil { + return nil + } + return &Operation{cop, g} +} + +// Operations returns a list of all operations in the graph +func (g *Graph) Operations() []Operation { + var pos C.size_t + ops := []Operation{} + for { + cop := C.TF_GraphNextOperation(g.c, &pos) + if cop == nil { + break + } + ops = append(ops, Operation{cop, g}) + } + return ops +} + +// AddGradients adds operations to compute the partial derivatives of the sum of tensors in y +// with respect to tensors in x, i.e., d(y[0] + y[1] + ...) / d x[0], d(y[0] + y[1] + ... ) / d x[1] etc. +// +// prefix, if non-empty, is the name prefix used for all operations added to the graph to compute +// these gradients. +func (g *Graph) AddGradients(prefix string, y []Output, x []Output, dx []Output) ([]Output, error) { + var ( + cprefix *C.char + + cy = make([]C.TF_Output, len(y)) + cx = make([]C.TF_Output, len(x)) + cdx = make([]C.TF_Output, len(dx)) + cdy = make([]C.TF_Output, len(x)) + + pcy *C.TF_Output + pcx *C.TF_Output + pcdx *C.TF_Output + pcdy *C.TF_Output + + status = newStatus() + ) + + if len(y) > 0 { + pcy = &cy[0] + for i, o := range y { + cy[i] = o.c() + } + } + if len(x) > 0 { + pcx = &cx[0] + for i, o := range x { + cx[i] = o.c() + } + pcdy = &cdy[0] + } + if len(dx) > 0 { + pcdx = &cdx[0] + for i, o := range dx { + cdx[i] = o.c() + } + } + + // If prefix is "", the C.TF_AddGradientsWithPrefix need cprefix to be nil but not "" + if len(prefix) != 0 { + cprefix = C.CString(prefix) + defer C.free(unsafe.Pointer(cprefix)) + } + + C.TF_AddGradientsWithPrefix(g.c, cprefix, pcy, C.int(len(y)), pcx, C.int(len(x)), pcdx, status.c, pcdy) + + if err := status.Err(); err != nil { + return nil, err + } + dy := make([]Output, len(x)) + for i, co := range cdy { + op := &Operation{co.oper, g} + dy[i] = Output{op, int(co.index)} + } + + return dy, nil +} + +// OpSpec is the specification of an Operation to be added to a Graph +// (using Graph.AddOperation). +type OpSpec struct { + // Type of the operation (e.g., "Add", "MatMul"). + Type string + + // Name by which the added operation will be referred to in the Graph. + // If omitted, defaults to Type. + Name string + + // Inputs to this operation, which in turn must be outputs + // of other operations already added to the Graph. + // + // An operation may have multiple inputs with individual inputs being + // either a single tensor produced by another operation or a list of + // tensors produced by multiple operations. For example, the "Concat" + // operation takes two inputs: (1) the dimension along which to + // concatenate and (2) a list of tensors to concatenate. Thus, for + // Concat, len(Input) must be 2, with the first element being an Output + // and the second being an OutputList. + Input []Input + + // Map from attribute name to its value that will be attached to this + // operation. + Attrs map[string]interface{} + + // Operations that must be executed before executing the operation + // being added. + ControlDependencies []*Operation + + // The device on which the operation should be executed. + // If omitted, an appropriate device will automatically be selected. + // + // For example, if set of "/device:GPU:0", then the operation will + // execute on GPU #0. + Device string + + // Other possible fields: ColocateWith. +} + +// AddOperation adds an operation to g. +func (g *Graph) AddOperation(args OpSpec) (*Operation, error) { + if args.Name == "" { + args.Name = args.Type + } + cname := C.CString(args.Name) + ctype := C.CString(args.Type) + cdesc := C.TF_NewOperation(g.c, ctype, cname) + C.free(unsafe.Pointer(cname)) + C.free(unsafe.Pointer(ctype)) + + for _, in := range args.Input { + switch in := in.(type) { + case Output: + C.TF_AddInput(cdesc, in.c()) + case OutputList: + size := len(in) + list := make([]C.TF_Output, size) + for i, v := range in { + list[i] = v.c() + } + if size > 0 { + C.TF_AddInputList(cdesc, &list[0], C.int(size)) + } else { + C.TF_AddInputList(cdesc, nil, 0) + } + } + } + for _, in := range args.ControlDependencies { + C.TF_AddControlInput(cdesc, in.c) + } + status := newStatus() + for name, value := range args.Attrs { + if err := setAttr(cdesc, status, name, value); err != nil { + // Memory leak here as the TF_OperationDescription + // object will not be cleaned up. At the time of this + // writing, this was next to impossible since it + // required value to be a string tensor with + // incorrectly encoded strings. Given this rarity, live + // with the memory leak. If it becomes a real problem, + // consider adding a TF_DeleteOperationDescription + // function to the C API. + return nil, fmt.Errorf("%v (memory will be leaked)", err) + } + } + if len(args.Device) > 0 { + cdevice := C.CString(args.Device) + C.TF_SetDevice(cdesc, cdevice) + C.free(unsafe.Pointer(cdevice)) + } + c := C.TF_FinishOperation(cdesc, status.c) + if err := status.Err(); err != nil { + return nil, err + } + return &Operation{c, g}, nil +} + +func setAttr(cdesc *C.TF_OperationDescription, status *status, name string, value interface{}) error { + cAttrName := C.CString(name) + defer C.free(unsafe.Pointer(cAttrName)) + switch value := value.(type) { + case string: + cstr := C.CString(value) + C.TF_SetAttrString(cdesc, cAttrName, unsafe.Pointer(cstr), C.size_t(len(value))) + C.free(unsafe.Pointer(cstr)) + case []string: + size := len(value) + list := make([]unsafe.Pointer, size) + lens := make([]C.size_t, size) + for i, s := range value { + list[i] = unsafe.Pointer(C.CString(s)) + lens[i] = C.size_t(len(s)) + } + if size > 0 { + C.TF_SetAttrStringList(cdesc, cAttrName, &list[0], &lens[0], C.int(size)) + } else { + C.TF_SetAttrStringList(cdesc, cAttrName, nil, nil, 0) + } + for _, s := range list { + C.free(s) + } + case int64: + C.TF_SetAttrInt(cdesc, cAttrName, C.int64_t(value)) + case []int64: + size := len(value) + list := make([]C.int64_t, size) + for i, v := range value { + list[i] = C.int64_t(v) + } + if size > 0 { + C.TF_SetAttrIntList(cdesc, cAttrName, &list[0], C.int(size)) + } else { + C.TF_SetAttrIntList(cdesc, cAttrName, nil, 0) + } + case float32: + C.TF_SetAttrFloat(cdesc, cAttrName, C.float(value)) + case []float32: + size := len(value) + list := make([]C.float, size) + for i, v := range value { + list[i] = C.float(v) + } + if size > 0 { + C.TF_SetAttrFloatList(cdesc, cAttrName, &list[0], C.int(size)) + } else { + C.TF_SetAttrFloatList(cdesc, cAttrName, nil, 0) + } + case bool: + v := C.uchar(0) + if value { + v = 1 + } + C.TF_SetAttrBool(cdesc, cAttrName, v) + case []bool: + size := len(value) + list := make([]C.uchar, size) + for i, v := range value { + if v { + list[i] = 1 + } + } + if size > 0 { + C.TF_SetAttrBoolList(cdesc, cAttrName, &list[0], C.int(size)) + } else { + C.TF_SetAttrBoolList(cdesc, cAttrName, nil, 0) + } + case DataType: + C.TF_SetAttrType(cdesc, cAttrName, C.TF_DataType(value)) + case []DataType: + var list *C.TF_DataType + if len(value) > 0 { + list = (*C.TF_DataType)(&value[0]) + } + C.TF_SetAttrTypeList(cdesc, cAttrName, list, C.int(len(value))) + case *Tensor: + C.TF_SetAttrTensor(cdesc, cAttrName, value.c, status.c) + if err := status.Err(); err != nil { + return fmt.Errorf("bad value for attribute %q: %v", name, err) + } + case []*Tensor: + size := len(value) + list := make([]*C.TF_Tensor, size) + for i, v := range value { + list[i] = v.c + } + var plist **C.TF_Tensor + if size > 0 { + plist = &list[0] + } + C.TF_SetAttrTensorList(cdesc, cAttrName, plist, C.int(size), status.c) + if err := status.Err(); err != nil { + return fmt.Errorf("bad value for attribute %q: %v", name, err) + } + case Shape: + ndims := C.int(value.NumDimensions()) + var dimsp *C.int64_t + if ndims > 0 { + dims := make([]C.int64_t, ndims) + for i, d := range value.dims { + dims[i] = C.int64_t(d) + } + dimsp = &dims[0] + } + C.TF_SetAttrShape(cdesc, cAttrName, dimsp, ndims) + case []Shape: + if len(value) == 0 { + C.TF_SetAttrShapeList(cdesc, cAttrName, nil, nil, 0) + } else { + var flatDims []C.int64_t + ndims := make([]C.int, len(value)) + for i, s := range value { + nd := s.NumDimensions() + ndims[i] = C.int(nd) + for _, d := range s.dims { + flatDims = append(flatDims, C.int64_t(d)) + } + } + var flatDimsp *C.int64_t + if len(flatDims) > 0 { + flatDimsp = &flatDims[0] + } + C.TF_SetAttrShapeList_Helper(cdesc, cAttrName, flatDimsp, &ndims[0], C.int(len(value))) + } + default: + return fmt.Errorf("attribute %q has a type (%T) which is not valid for operation attributes", name, value) + } + return nil +} + +type LibraryHandler struct { + cptr *C.TF_Library +} + +// Load library content into current context, useful to load ops implementation into non-monolitic TF build. Returns LibraryHandler or nil and error +func LoadLibrary(path string) (*LibraryHandler, error) { + status := newStatus() + + cpath := C.CString(path) + defer C.free(unsafe.Pointer(cpath)) + cptr := C.TF_LoadLibrary(cpath, status.c) + if cptr == nil || status.Code() != C.TF_OK { + return nil, fmt.Errorf("could not load library %s: code: %d, error: %s", path, status.Code(), status.String()) + } + + lh := &LibraryHandler{ + cptr: cptr, + } + + runtime.SetFinalizer(lh, (*LibraryHandler).free) + return lh, nil +} + +func (lh *LibraryHandler) free() { + if lh == nil || lh.cptr == nil { + return + } + + C.TF_DeleteLibraryHandle(lh.cptr) +} diff --git a/third_party/go-tensorflow/tensorflow/go/graph_test.go b/third_party/go-tensorflow/tensorflow/go/graph_test.go new file mode 100644 index 0000000..bb11230 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/graph_test.go @@ -0,0 +1,407 @@ +/* +Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package tensorflow + +import ( + "bytes" + "fmt" + "strings" + "testing" +) + +func hasOperations(g *Graph, ops ...string) error { + var missing []string + for _, op := range ops { + if g.Operation(op) == nil { + missing = append(missing, op) + } + } + if len(missing) != 0 { + return fmt.Errorf("Graph does not have the operations %v", missing) + } + + inList := map[string]bool{} + for _, op := range g.Operations() { + inList[op.Name()] = true + } + + for _, op := range ops { + if !inList[op] { + missing = append(missing, op) + } + } + + if len(missing) != 0 { + return fmt.Errorf("Operations %v are missing from graph.Operations()", missing) + } + + return nil +} + +func TestGraphWriteToAndImport(t *testing.T) { + // Construct a graph + g := NewGraph() + v, err := NewTensor(int64(1)) + if err != nil { + t.Fatal(err) + } + input, err := Placeholder(g, "input", v.DataType()) + if err != nil { + t.Fatal(err) + } + if _, err := Neg(g, "neg", input); err != nil { + t.Fatal(err) + } + + // Serialize the graph + buf := new(bytes.Buffer) + if _, err := g.WriteTo(buf); err != nil { + t.Fatal(err) + } + + // Import it into the same graph, with a prefix + if err := g.Import(buf.Bytes(), "imported"); err != nil { + t.Error(err) + } + if err := hasOperations(g, "input", "neg", "imported/input", "imported/neg"); err != nil { + t.Error(err) + } +} + +func TestGraphInputMapping(t *testing.T) { + // Construct a graph + g := NewGraph() + v, err := NewTensor(int64(1)) + if err != nil { + t.Fatal(err) + } + input, err := Placeholder(g, "input", v.DataType()) + if err != nil { + t.Fatal(err) + } + neg, err := Neg(g, "neg", input) + if err != nil { + t.Fatal(err) + } + + // Serialize the graph + buf := new(bytes.Buffer) + if _, err := g.WriteTo(buf); err != nil { + t.Fatal(err) + } + + g = NewGraph() + v, err = NewTensor(int64(1)) + if err != nil { + t.Fatal(err) + } + + replacement, err := Placeholder(g, "replacement", v.DataType()) + if err != nil { + t.Fatal(err) + } + + options := GraphImportOptions{ + Prefix: "imported", + } + options.AddInputMapping("input", 0, replacement) + // Import it into the same graph, with a prefix and replacement + if err := g.ImportWithOptions(buf.Bytes(), options); err != nil { + t.Error(err) + } + if err := hasOperations(g, "replacement", "imported/neg"); err != nil { + t.Error(err) + } + + sess, err := NewSession(g, nil) + if err != nil { + t.Fatal(err) + } + + neg = g.Operation("imported/neg").Output(0) + + outputs, err := sess.Run( + map[Output]*Tensor{replacement: v}, + []Output{neg}, + nil) + if err != nil { + t.Fatal(err) + } + if len(outputs) != 1 { + t.Fatal(len(outputs)) + } + if outputs[0].Value().(int64) != -1 { + t.Fatalf("Got %v, wanted int64 -1", outputs[0].Value()) + } +} + +func TestGraphAddGradients(t *testing.T) { + g := NewGraph() + x1, err := Placeholder(g, "x1", Float) + if err != nil { + t.Fatal(err) + } + x2, err := Placeholder(g, "x2", Float) + if err != nil { + t.Fatal(err) + } + op0, err := g.AddOperation(OpSpec{ + Type: "Square", + Name: "y0", + Input: []Input{x1}, + }) + if err != nil { + t.Fatal(err) + } + y0 := op0.Output(0) + op1, err := g.AddOperation(OpSpec{ + Type: "Square", + Name: "y1", + Input: []Input{y0}, + }) + if err != nil { + t.Fatal(err) + } + y1 := op1.Output(0) + op2, err := g.AddOperation(OpSpec{ + Type: "AddN", + Input: []Input{OutputList([]Output{y0, x2})}, + }) + if err != nil { + t.Fatal(err) + } + y2 := op2.Output(0) + + grads0, err := g.AddGradients("", []Output{y1}, []Output{x1}, nil) + if err != nil { + t.Fatal(err) + } + if len(grads0) != 1 { + t.Fatal(len(grads0)) + } + if grads0[0].DataType() != Float { + t.Fatalf("Got DataType %v, wanted %v", grads0[0].DataType(), Float) + } + + grads1, err := g.AddGradients("", []Output{y2}, []Output{x1, x2}, nil) + if err != nil { + t.Fatal(err) + } + if len(grads1) != 2 { + t.Fatal(len(grads1)) + } + if grads1[0].DataType() != Float { + t.Fatalf("Got DataType %v, wanted %v", grads1[0].DataType(), Float) + } + if grads1[1].DataType() != Float { + t.Fatalf("Got DataType %v, wanted %v", grads1[1].DataType(), Float) + } + + sess, err := NewSession(g, nil) + if err != nil { + t.Fatal(err) + } + + c1, _ := NewTensor(float32(3.0)) + c2, _ := NewTensor(float32(2.0)) + outputs, err := sess.Run( + map[Output]*Tensor{x1: c1, x2: c2}, + []Output{grads0[0], grads1[0], grads1[1]}, + nil) + if err != nil { + t.Fatal(err) + } + if len(outputs) != 3 { + t.Fatal(len(outputs)) + } + if outputs[0].Value().(float32) != 108.0 { + t.Fatalf("Got %v, wanted float 108.0", outputs[0].Value()) + } + if outputs[1].Value().(float32) != 6.0 { + t.Fatalf("Got %v, wanted float 6.0", outputs[1].Value()) + } + if outputs[2].Value().(float32) != 1.0 { + t.Fatalf("Got %v, wanted float 1.0", outputs[2].Value()) + } +} + +func TestGraphAddGradientsSums(t *testing.T) { + g := NewGraph() + x, err := Placeholder(g, "x", Float) + if err != nil { + t.Fatal(err) + } + op0, err := g.AddOperation(OpSpec{ + Type: "Square", + Name: "y0", + Input: []Input{x}, + }) + if err != nil { + t.Fatal(err) + } + y0 := op0.Output(0) + op1, err := g.AddOperation(OpSpec{ + Type: "Square", + Name: "y1", + Input: []Input{y0}, + }) + y1 := op1.Output(0) + + grad, err := g.AddGradients("", []Output{y0, y1}, []Output{x}, nil) + if err != nil { + t.Fatal(err) + } + if len(grad) != 1 { + t.Fatal(len(grad)) + } + if grad[0].DataType() != Float { + t.Fatalf("Got DataType %v, wanted %v", grad[0].DataType(), Float) + } + + sess, err := NewSession(g, nil) + if err != nil { + t.Fatal(err) + } + + c, _ := NewTensor(float32(3.0)) + outputs, err := sess.Run( + map[Output]*Tensor{x: c}, + []Output{grad[0]}, + nil) + if err != nil { + t.Fatal(err) + } + if outputs[0].Value().(float32) != 114.0 { + t.Fatalf("Got %v, wanted float 114.0", outputs[0].Value()) + } +} + +func TestGraphAddGradientsWithInitialValues(t *testing.T) { + g := NewGraph() + x, err := Placeholder(g, "x", Float) + op0, err := g.AddOperation(OpSpec{ + Type: "Square", + Name: "y0", + Input: []Input{x}, + }) + if err != nil { + t.Fatal(err) + } + y0 := op0.Output(0) + op1, err := g.AddOperation(OpSpec{ + Type: "Square", + Name: "y1", + Input: []Input{y0}, + }) + if err != nil { + t.Fatal(err) + } + y1 := op1.Output(0) + + grads0, err := g.AddGradients("", []Output{y1}, []Output{y0}, nil) + if err != nil { + t.Fatal(err) + } + if len(grads0) != 1 { + t.Fatal(len(grads0)) + } + if grads0[0].DataType() != Float { + t.Fatalf("Got DataType %v, wanted %v", grads0[0].DataType(), Float) + } + + grads1, err := g.AddGradients("", []Output{y0}, []Output{x}, []Output{grads0[0]}) + if err != nil { + t.Fatal(err) + } + if len(grads1) != 1 { + t.Fatal(len(grads1)) + } + if grads1[0].DataType() != Float { + t.Fatalf("Got DataType %v, wanted %v", grads1[0].DataType(), Float) + } + + sess, err := NewSession(g, nil) + if err != nil { + t.Fatal(err) + } + + c, _ := NewTensor(float32(3.0)) + outputs, err := sess.Run( + map[Output]*Tensor{x: c}, + []Output{grads1[0]}, + nil) + if err != nil { + t.Fatal(err) + } + if outputs[0].Value().(float32) != 108.0 { + t.Fatalf("Got %v, wanted float 108.0", outputs[0].Value()) + } +} + +func TestGraphValidateGradientsNames(t *testing.T) { + g := NewGraph() + x, err := Placeholder(g, "x", Float) + if err != nil { + t.Fatal(err) + } + op0, err := g.AddOperation(OpSpec{ + Type: "Square", + Name: "y0", + Input: []Input{x}, + }) + if err != nil { + t.Fatal(err) + } + y0 := op0.Output(0) + + grads0, err := g.AddGradients("", []Output{y0}, []Output{x}, nil) + if err != nil { + t.Fatal(err) + } + if !strings.HasPrefix(grads0[0].Op.Name(), "gradients/") { + t.Fatalf("Got name %v, wanted started with gradients/", grads0[0].Op.Name()) + } + + grads1, err := g.AddGradients("", []Output{y0}, []Output{x}, nil) + if err != nil { + t.Fatal(err) + } + if !strings.HasPrefix(grads1[0].Op.Name(), "gradients_1/") { + t.Fatalf("Got name %v, wanted started with gradients_1/", grads1[0].Op.Name()) + } + + grads2, err := g.AddGradients("more_gradients", []Output{y0}, []Output{x}, nil) + if err != nil { + t.Fatal(err) + } + if !strings.HasPrefix(grads2[0].Op.Name(), "more_gradients/") { + t.Fatalf("Got name %v, wanted started with more_gradients/", grads2[0].Op.Name()) + } + + grads3, err := g.AddGradients("even_more_gradients", []Output{y0}, []Output{x}, nil) + if err != nil { + t.Fatal(err) + } + if !strings.HasPrefix(grads3[0].Op.Name(), "even_more_gradients/") { + t.Fatalf("Got name %v, wanted started with even_more_gradients/", grads3[0].Op.Name()) + } + + _, err = g.AddGradients("even_more_gradients", []Output{y0}, []Output{x}, nil) + if err == nil { + t.Error("AddGradients should have failed if gradients name is already existing") + } +} diff --git a/third_party/go-tensorflow/tensorflow/go/lib.go b/third_party/go-tensorflow/tensorflow/go/lib.go new file mode 100644 index 0000000..2800ede --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/lib.go @@ -0,0 +1,21 @@ +/* +Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package tensorflow + +// #cgo LDFLAGS: -ltensorflow +// #cgo CFLAGS: -I${SRCDIR}/../../ +import "C" diff --git a/third_party/go-tensorflow/tensorflow/go/op/generate.go b/third_party/go-tensorflow/tensorflow/go/op/generate.go new file mode 100644 index 0000000..e5a9bea --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/op/generate.go @@ -0,0 +1,20 @@ +/* +Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +//go:generate go generate ../genop +//go:generate go run ../genop/main.go -outfile wrappers.go -api_def_dirs ../../core/api_def/base_api/ + +package op diff --git a/third_party/go-tensorflow/tensorflow/go/op/gradients.go b/third_party/go-tensorflow/tensorflow/go/op/gradients.go new file mode 100644 index 0000000..c595678 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/op/gradients.go @@ -0,0 +1,49 @@ +/* +Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package op + +import ( + "fmt" + + tf "github.com/tensorflow/tensorflow/tensorflow/go" +) + +// Gradients adds gradients computation ops to the graph according to scope. +// +// Arguments: +// y: output of the function to derive +// x: inputs of the function for which partial derivatives are computed +// dx: if not null, the partial derivatives of some loss function L w.r.t. y +// +// return the partial derivatives +func Gradients(scope *Scope, y []tf.Output, x []tf.Output, dx ...tf.Output) (output []tf.Output) { + if len(scope.controlDependencies) > 0 { + scope.UpdateErr("Gradients", fmt.Errorf("Gradients does not currently support control dependencies (via Scope.WithControlDependencies).")) + return + } + if scope.device != "" { + scope.UpdateErr("Gradients", fmt.Errorf("Gradients does not currently support device annotations (via Scope.WithDevice).")) + return + } + + var err error + if output, err = scope.graph.AddGradients(scope.opName("Gradients"), y, x, dx); err != nil { + scope.UpdateErr("Gradients", err) + return + } + return output +} diff --git a/third_party/go-tensorflow/tensorflow/go/op/gradients_test.go b/third_party/go-tensorflow/tensorflow/go/op/gradients_test.go new file mode 100644 index 0000000..3d1d57b --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/op/gradients_test.go @@ -0,0 +1,246 @@ +/* +Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package op + +import ( + "strings" + "testing" + + tf "github.com/tensorflow/tensorflow/tensorflow/go" +) + +func TestAddGradients(t *testing.T) { + var ( + s = NewScope() + x1 = Placeholder(s.SubScope("x1"), tf.Float) + x2 = Placeholder(s.SubScope("x2"), tf.Float) + y0 = Square(s.SubScope("y0"), x1) + y1 = Square(s.SubScope("y1"), y0) + y2 = AddN(s.SubScope("y2"), []tf.Output{y0, x2}) + ) + + grads0 := Gradients(s, []tf.Output{y1}, []tf.Output{x1}) + if err := s.Err(); err != nil { + t.Fatal(err) + } + if len(grads0) != 1 { + t.Fatal(len(grads0)) + } + if grads0[0].DataType() != tf.Float { + t.Fatalf("Got DataType %v, wanted %v", grads0[0].DataType(), tf.Float) + } + + sub := s.SubScope("sub") + grads1 := Gradients(sub, []tf.Output{y2}, []tf.Output{x1, x2}) + if err := sub.Err(); err != nil { + t.Fatal(err) + } + if len(grads1) != 2 { + t.Fatal(len(grads1)) + } + if grads1[0].DataType() != tf.Float { + t.Fatalf("Got DataType %v, wanted %v", grads1[0].DataType(), tf.Float) + } + if grads1[1].DataType() != tf.Float { + t.Fatalf("Got DataType %v, wanted %v", grads1[1].DataType(), tf.Float) + } + + graph, err := sub.Finalize() + if err != nil { + t.Fatal(err) + } + sess, err := tf.NewSession(graph, nil) + if err != nil { + t.Fatal(err) + } + + c1, _ := tf.NewTensor(float32(3.0)) + c2, _ := tf.NewTensor(float32(3.0)) + outputs, err := sess.Run( + map[tf.Output]*tf.Tensor{x1: c1, x2: c2}, + []tf.Output{grads0[0], grads1[0], grads1[1]}, + nil) + if err != nil { + t.Fatal(err) + } + if len(outputs) != 3 { + t.Fatal(len(outputs)) + } + if outputs[0].Value().(float32) != 108.0 { + t.Fatalf("Got %v, wanted float 108.0", outputs[0].Value()) + } + if outputs[1].Value().(float32) != 6.0 { + t.Fatalf("Got %v, wanted float 6.0", outputs[1].Value()) + } + if outputs[2].Value().(float32) != 1.0 { + t.Fatalf("Got %v, wanted float 1.0", outputs[2].Value()) + } +} + +func TestAddGradientsSums(t *testing.T) { + var ( + s = NewScope() + x = Placeholder(s.SubScope("x"), tf.Float) + y0 = Square(s.SubScope("y0"), x) + y1 = Square(s.SubScope("y1"), y0) + ) + + grad := Gradients(s, []tf.Output{y0, y1}, []tf.Output{x}) + if err := s.Err(); err != nil { + t.Fatal(err) + } + if len(grad) != 1 { + t.Fatal(len(grad)) + } + if grad[0].DataType() != tf.Float { + t.Fatalf("Got DataType %v, wanted %v", grad[0].DataType(), tf.Float) + } + + graph, err := s.Finalize() + if err != nil { + t.Fatal(err) + } + sess, err := tf.NewSession(graph, nil) + if err != nil { + t.Fatal(err) + } + + c, _ := tf.NewTensor(float32(3.0)) + outputs, err := sess.Run( + map[tf.Output]*tf.Tensor{x: c}, + []tf.Output{grad[0]}, + nil) + if err != nil { + t.Fatal(err) + } + if outputs[0].Value().(float32) != 114.0 { + t.Fatalf("Got %v, wanted float 114.0", outputs[0].Value()) + } +} + +func TestAddGradientsWithInitialValues(t *testing.T) { + var ( + s = NewScope() + x = Placeholder(s.SubScope("x1"), tf.Float) + y0 = Square(s.SubScope("y0"), x) + y1 = Square(s.SubScope("y1"), y0) + ) + + grads0 := Gradients(s, []tf.Output{y1}, []tf.Output{y0}) + if err := s.Err(); err != nil { + t.Fatal(err) + } + if len(grads0) != 1 { + t.Fatal(len(grads0)) + } + if grads0[0].DataType() != tf.Float { + t.Fatalf("Got DataType %v, wanted %v", grads0[0].DataType(), tf.Float) + } + + sub := s.SubScope("sub") + grads1 := Gradients(sub, []tf.Output{y0}, []tf.Output{x}, grads0[0]) + if err := sub.Err(); err != nil { + t.Fatal(err) + } + if len(grads1) != 1 { + t.Fatal(len(grads1)) + } + if grads1[0].DataType() != tf.Float { + t.Fatalf("Got DataType %v, wanted %v", grads1[0].DataType(), tf.Float) + } + + graph, err := sub.Finalize() + if err != nil { + t.Fatal(err) + } + sess, err := tf.NewSession(graph, nil) + if err != nil { + t.Fatal(err) + } + + c, _ := tf.NewTensor(float32(3.0)) + outputs, err := sess.Run( + map[tf.Output]*tf.Tensor{x: c}, + []tf.Output{grads1[0]}, + nil) + if err != nil { + t.Fatal(err) + } + if outputs[0].Value().(float32) != 108.0 { + t.Fatalf("Got %v, wanted float 108.0", outputs[0].Value()) + } +} + +func TestValidateGradientsNames(t *testing.T) { + var ( + s = NewScope() + x = Placeholder(s.SubScope("x"), tf.Float) + y0 = Square(s.SubScope("y0"), x) + ) + + grads0 := Gradients(s, []tf.Output{y0}, []tf.Output{x}) + if err := s.Err(); err != nil { + t.Fatal(err) + } + if !strings.HasPrefix(grads0[0].Op.Name(), "Gradients/") { + t.Fatalf("Got name %v, wanted started with Gradients/", grads0[0].Op.Name()) + } + + sub := s.SubScope("sub") + grads1 := Gradients(sub, []tf.Output{y0}, []tf.Output{x}) + if err := s.Err(); err != nil { + t.Fatal(err) + } + if !strings.HasPrefix(grads1[0].Op.Name(), "sub/Gradients/") { + t.Fatalf("Got name %v, wanted started with sub/Gradients/", grads1[0].Op.Name()) + } + + Gradients(sub, []tf.Output{y0}, []tf.Output{x}) + if err := s.Err(); err == nil { + t.Error("Gradients should have failed if executed more than once for scope of the same namespace") + } +} + +func TestAddGradientsWithControlDependencies(t *testing.T) { + var ( + s = NewScope() + zero = Const(s.SubScope("zero"), int32(0)) + x = Placeholder(s.SubScope("x"), tf.Float) + y0 = Square(s.SubScope("y0"), x) + variable = VarHandleOp(s, tf.Int32, tf.ScalarShape()) + init = AssignVariableOp(s, variable, zero) + readDeps = []*tf.Operation{init} + ) + s = s.WithControlDependencies(readDeps...) + Gradients(s, []tf.Output{y0}, []tf.Output{x}) + if err := s.Err(); err == nil { + t.Error("Gradients should have failed when control dependencies are set") + } +} + +func TestAddGradientsWithDevice(t *testing.T) { + var ( + s = NewScope() + x = Placeholder(s.SubScope("x"), tf.Float) + y0 = Square(s.SubScope("y0"), x) + ) + s = s.WithDevice("/device:GPU:0") + Gradients(s, []tf.Output{y0}, []tf.Output{x}) + if err := s.Err(); err == nil { + t.Error("Gradients should have failed when device is set") + } +} diff --git a/third_party/go-tensorflow/tensorflow/go/op/op.go b/third_party/go-tensorflow/tensorflow/go/op/op.go new file mode 100644 index 0000000..1c20bd4 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/op/op.go @@ -0,0 +1,51 @@ +/* +Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package op defines functions for adding TensorFlow operations to a Graph. +// +// Functions for adding an operation to a graph take a Scope object as the +// first argument. The Scope object encapsulates a graph and a set of +// properties (such as a name prefix) for all operations being added +// to the graph. +// +// WARNING: The API in this package has not been finalized and can +// change without notice. +package op + +import ( + tf "github.com/tensorflow/tensorflow/tensorflow/go" +) + +// Const adds an operation to graph that produces value as output. +func Const(scope *Scope, value interface{}) (output tf.Output) { + if scope.Err() != nil { + return + } + t, ok := value.(*tf.Tensor) + if !ok { + var err error + if t, err = tf.NewTensor(value); err != nil { + scope.UpdateErr("Const", err) + return + } + } + return scope.AddOperation(tf.OpSpec{ + Type: "Const", + Attrs: map[string]interface{}{ + "dtype": t.DataType(), + "value": t, + }}).Output(0) +} diff --git a/third_party/go-tensorflow/tensorflow/go/op/op_test.go b/third_party/go-tensorflow/tensorflow/go/op/op_test.go new file mode 100644 index 0000000..842dee9 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/op/op_test.go @@ -0,0 +1,133 @@ +/* +Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Tests for the generated code of some operations. + +package op + +import ( + "strings" + "testing" + + tf "github.com/tensorflow/tensorflow/tensorflow/go" +) + +func TestPlaceholder(t *testing.T) { + s := NewScope() + Placeholder(s.SubScope("x"), tf.Float, PlaceholderShape(tf.MakeShape(-1, 10))) + Placeholder(s.SubScope("y"), tf.Float, PlaceholderShape(tf.ScalarShape())) + Placeholder(s.SubScope("z"), tf.Float, PlaceholderShape(tf.Shape{})) + if _, err := s.Finalize(); err != nil { + t.Fatal(err) + } +} + +func TestAddOperationFailure(t *testing.T) { + // Inspired from https://github.com/tensorflow/tensorflow/issues/9931 + s := NewScope() + + resize := ResizeArea(s, Placeholder(s, tf.Float), Const(s, []int64{80, 80})) + if err := s.Err(); err == nil { + t.Fatal("ResizeArea expects an int32 Tensor for size, should fail when an int64 is provided") + } + // And any use of resize should panic with an error message more informative than SIGSEGV + defer func() { + r := recover() + if r == nil { + return + } + s, ok := r.(string) + if ok && strings.Contains(s, "see Scope.Err() for details") { + return + } + t.Errorf("Expected panic string to Scope.Err(), found %T: %q", r, r) + }() + _ = resize.Shape() + t.Errorf("resize.Shape() should have paniced since the underlying Operation was not created") +} + +func TestShapeAttribute(t *testing.T) { + s := NewScope() + x := Placeholder(s.SubScope("x"), tf.Int32, PlaceholderShape(tf.MakeShape(1))) + y := Placeholder(s.SubScope("y"), tf.Int32, PlaceholderShape(tf.Shape{})) + z := Add(s, x, y) + graph, err := s.Finalize() + if err != nil { + t.Fatal(err) + } + sess, err := tf.NewSession(graph, nil) + if err != nil { + t.Fatal(err) + } + + value, err := tf.NewTensor([]int32{7}) + if err != nil { + t.Fatal(err) + } + feeds := map[tf.Output]*tf.Tensor{ + x: value, + y: value, + } + fetched, err := sess.Run(feeds, []tf.Output{z}, nil) + if err != nil { + t.Fatal(err) + } + if got, want := len(fetched), 1; got != want { + t.Fatalf("Fetched %d tensors, expected %d", got, want) + } + if got, want := fetched[0].Value().([]int32), []int32{14}; len(got) != len(want) || len(got) != 1 || got[0] != want[0] { + t.Fatalf("Got %v, want %v", got, want) + } +} + +func TestDataset(t *testing.T) { + var ( + s = NewScope() + + // The use of a non-scalar here is inspired by + // https://github.com/tensorflow/tensorflow/issues/14891 + c = Const(s, []int32{21718, 31415}) + types = []tf.DataType{c.DataType()} + shapes = []tf.Shape{c.Shape()} + dataset = TensorDataset(s, []tf.Output{c}, shapes) + + iterator = Iterator(s, "", "", types, shapes) + next = IteratorGetNext(s, iterator, types, shapes) + init = MakeIterator(s, dataset, iterator) + ) + graph, err := s.Finalize() + if err != nil { + t.Fatal(err) + } + sess, err := tf.NewSession(graph, nil) + if err != nil { + t.Fatal(err) + } + if _, err := sess.Run(nil, nil, []*tf.Operation{init}); err != nil { + t.Fatal(err) + } + results, err := sess.Run(nil, next, nil) + if err != nil { + t.Fatal(err) + } + got := results[0].Value().([]int32) + if len(got) != 2 || got[0] != 21718 || got[1] != 31415 { + t.Errorf("Got %v, want {21718, 31415}", got) + } + if _, err := sess.Run(nil, next, nil); err == nil { + t.Errorf("Expected sess.Run() to fail since the iterator should have reached the end of the dataset") + } +} diff --git a/third_party/go-tensorflow/tensorflow/go/op/scope.go b/third_party/go-tensorflow/tensorflow/go/op/scope.go new file mode 100644 index 0000000..83cc6e3 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/op/scope.go @@ -0,0 +1,185 @@ +/* +Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package op + +import ( + "fmt" + "runtime/debug" + + tf "github.com/tensorflow/tensorflow/tensorflow/go" +) + +// Scope encapsulates common operation properties when building a Graph. +// +// A Scope object (and its derivatives, e.g., obtained from Scope.SubScope) +// act as a builder for graphs. They allow common properties (such as +// a name prefix) to be specified for multiple operations being added +// to the graph. +// +// A Scope object and all its derivatives (e.g., obtained from Scope.SubScope) +// are not safe for concurrent use by multiple goroutines. +type Scope struct { + graph *tf.Graph + namemap map[string]int + namespace string + controlDependencies []*tf.Operation + device string + err *scopeErr +} + +// scopeErr is used to share errors between all derivatives of a root scope. +type scopeErr struct { + err error +} + +// NewScope creates a Scope initialized with an empty Graph. +func NewScope() *Scope { + return &Scope{graph: tf.NewGraph(), namemap: make(map[string]int), err: new(scopeErr)} +} + +// NewScopeWithGraph creates a Scope initialized with the Graph thats passed in +func NewScopeWithGraph(g *tf.Graph) *Scope { + return &Scope{graph: g, namemap: make(map[string]int), err: new(scopeErr)} +} + +// Finalize returns the Graph on which this scope operates on and renders s +// unusable. If there was an error during graph construction, that error is +// returned instead. +func (s *Scope) Finalize() (*tf.Graph, error) { + if err := s.Err(); err != nil { + return nil, err + } + s.err.err = fmt.Errorf("Scope has been finalized and is no longer usable") + return s.graph, nil +} + +// AddOperation adds the operation to the Graph managed by s. +// +// If there is a name prefix associated with s (such as if s was created +// by a call to SubScope), then this prefix will be applied to the name +// of the operation being added. See also Graph.AddOperation. +func (s *Scope) AddOperation(args tf.OpSpec) *tf.Operation { + if s.Err() != nil { + return nil + } + if args.Name == "" { + args.Name = args.Type + } + if s.namespace != "" { + args.Name = s.namespace + "/" + args.Name + } + args.ControlDependencies = append(args.ControlDependencies, s.controlDependencies...) + args.Device = s.device + op, err := s.graph.AddOperation(args) + if err != nil { + s.UpdateErr(args.Type, err) + } + return op +} + +// SubScope returns a new Scope which will cause all operations added to the +// graph to be namespaced with 'namespace'. If namespace collides with an +// existing namespace within the scope, then a suffix will be added. +func (s *Scope) SubScope(namespace string) *Scope { + namespace = s.uniqueName(namespace) + if s.namespace != "" { + namespace = s.namespace + "/" + namespace + } + return &Scope{ + graph: s.graph, + namemap: make(map[string]int), + namespace: namespace, + controlDependencies: s.controlDependencies, + device: s.device, + err: s.err, + } +} + +// WithControlDependencies returns a new Scope which will cause all operations +// added to the graph to execute only after all the provided operations have +// executed first (in addition to any other control dependencies in s). +func (s *Scope) WithControlDependencies(ops ...*tf.Operation) *Scope { + // Force a copy of the control dependencies into a new underlying array on + // every call. We cannot alias the same underlying array as `ops`, otherwise + // the user could modify that array after calling s.WithControlDependencies, + // which would be confusing. We cannot alias the same underlying array as the + // original `s.controlDependencies`, since Scopes form a logical tree, and + // other calls to s.WithControlDependencies could stomp on each other. + deps := make([]*tf.Operation, 0, len(s.controlDependencies)+len(ops)) + deps = append(deps, s.controlDependencies...) + deps = append(deps, ops...) + return &Scope{ + graph: s.graph, + namemap: s.namemap, + namespace: s.namespace, + controlDependencies: deps, + device: s.device, + err: s.err, + } +} + +// WithDevice returns a new Scope which will cause all operations added to the +// graph to execute on devices that match the provided device specification. +// +// For example, WithDevice("/device:GPU:0") will cause operations added to +// the graph to execute on GPU #0. +// +// An empty string removes any device restrictions. +func (s *Scope) WithDevice(device string) *Scope { + return &Scope{ + graph: s.graph, + namemap: s.namemap, + namespace: s.namespace, + controlDependencies: s.controlDependencies, + device: device, + err: s.err, + } +} + +// Err returns the error, if any, encountered during the construction +// of the Graph managed by s. +// +// Once Err returns a non-nil error, all future calls will do the same, +// indicating that the scope should be discarded as the graph could not +// be constructed. +func (s *Scope) Err() error { + return s.err.err +} + +// UpdateErr is used to notify Scope of any graph construction errors +// while creating the operation op. +func (s *Scope) UpdateErr(op string, err error) { + if s.err.err == nil { + s.err.err = fmt.Errorf("failed to add operation %q: %v (Stacktrace: %s)", op, err, debug.Stack()) + } +} + +func (s *Scope) uniqueName(name string) string { + count := s.namemap[name] + s.namemap[name]++ + if count == 0 { + return name + } + return fmt.Sprint(name, "_", count) +} + +func (s *Scope) opName(typ string) string { + if s.namespace == "" { + return typ + } + return s.namespace + "/" + typ +} diff --git a/third_party/go-tensorflow/tensorflow/go/op/scope_test.go b/third_party/go-tensorflow/tensorflow/go/op/scope_test.go new file mode 100644 index 0000000..be7b0ad --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/op/scope_test.go @@ -0,0 +1,201 @@ +/* +Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package op + +import ( + "fmt" + "testing" + + tf "github.com/tensorflow/tensorflow/tensorflow/go" +) + +func TestScopeSubScope(t *testing.T) { + var ( + root = NewScope() + sub1 = root.SubScope("x") + sub2 = root.SubScope("x") + sub1a = sub1.SubScope("y") + sub2a = sub2.SubScope("y") + ) + testdata := []struct { + scope *Scope + name string + }{ + {root, "Const"}, + {sub1, "x/Const"}, + {sub1a, "x/y/Const"}, + {sub2, "x_1/Const"}, + {sub2a, "x_1/y/Const"}, + } + for _, test := range testdata { + c := Const(test.scope, int64(1)) + if err := test.scope.Err(); err != nil { + t.Fatalf("%q: %v", test.name, err) + } + if got := c.Op.Name(); got != test.name { + t.Errorf("%q: Got %q", test.name, got) + } + } +} + +func TestScopeSubScopeErrors(t *testing.T) { + var ( + root = NewScope() + sub = root.SubScope("x") + ) + // Error on the root, even after sub has been created should be propagated. + // Force an error by creating a Const which has a type that does not + // translate to the TensorFlow type system. + Const(root, int(1)) + if err := root.Err(); err == nil { + t.Fatal("Expected error") + } + if err := sub.Err(); err == nil { + t.Errorf("Root scope had error [%v], but sub-scope did not", root.Err()) + } +} + +func TestControlDependencies(t *testing.T) { + var ( + s = NewScope() + zero = Const(s.SubScope("zero"), int32(0)) + one = Const(s.SubScope("one"), int32(1)) + variable = VarHandleOp(s, tf.Int32, tf.ScalarShape()) + init = AssignVariableOp(s, variable, zero) + update = AssignAddVariableOp(s, variable, one) + readDeps = []*tf.Operation{update} + ) + // We intend for `read` to have a control dependency on `update`. + s = s.WithControlDependencies(readDeps...) + // Ensure that Scope.WithControlDependencies makes a copy of the underlying + // array, rather than just holding a slice reference to the same user-supplied + // underlying array. If the copy is correctly performed, overwriting + // readDeps[0] should have no effect on control dependencies for `read`. + readDeps[0] = init + read := ReadVariableOp(s, variable, tf.Int32) + + graph, err := s.Finalize() + if err != nil { + t.Fatal(err) + } + sess, err := tf.NewSession(graph, nil) + if err != nil { + t.Fatal(err) + } + if _, err = sess.Run(nil, nil, []*tf.Operation{init}); err != nil { + t.Fatal(err) + } + // Without the control dependency, the read operation may not see the + // update. + for i := int32(0); i < 10; i++ { + out, err := sess.Run(nil, []tf.Output{read}, nil) + if err != nil { + t.Fatal(err) + } + if got, want := out[0].Value().(int32), i+1; got != want { + t.Errorf("Got %d, want %d", got, want) + } + } +} + +func TestDevice(t *testing.T) { + s := NewScope() + matrix := Const(s, [][]float32{{3.0}}) + s = s.WithDevice("/device:GPU:0") + square := MatMul(s.SubScope("square"), matrix, matrix) + s = s.WithDevice("") + cube := MatMul(s.SubScope("cube"), square, matrix) + if got, want := square.Op.Device(), "/device:GPU:0"; got != want { + t.Errorf("Got %q, want %q", got, want) + } + if got, want := cube.Op.Device(), ""; got != want { + t.Errorf("Got %q, want %q", got, want) + } +} + +func TestScopeFinalize(t *testing.T) { + var ( + root = NewScope() + sub1 = root.SubScope("x") + sub2 = sub1.SubScope("y") + ) + if _, err := sub1.Finalize(); err != nil { + t.Fatal(err) + } + if err := root.Err(); err == nil { + t.Error("Root scope's Err() should be non-nil once Finalize has been called") + } + if err := sub2.Err(); err == nil { + t.Error("Sub scope's Err() should be non-nil once Finalize has been called") + } +} + +func TestMultipleGeneratedOps(t *testing.T) { + s := NewScope() + Placeholder(s.SubScope("x"), tf.Float) + Placeholder(s.SubScope("y"), tf.Float) + if _, err := s.Finalize(); err != nil { + t.Fatal(err) + } +} + +func TestScopeWithGraph(t *testing.T) { + s1 := NewScope() + Const(s1, "hello") + graph, err := s1.Finalize() + if err != nil { + t.Fatal(err) + } + + s2 := NewScopeWithGraph(graph) + Const(s2.SubScope("addition"), "world") + if err := s2.Err(); err != nil { + t.Fatal(err) + } +} + +func Example() { + // This example creates a Graph that multiplies a constant matrix with + // a matrix to be provided during graph execution (via + // tensorflow.Session). + s := NewScope() + input := Placeholder(s, tf.Float) // Matrix to be provided to Session.Run + output := MatMul(s, + Const(s, [][]float32{{10}, {20}}), // Constant 2x1 matrix + input, + MatMulTransposeB(true)) + if s.Err() != nil { + panic(s.Err()) + } + // Shape of the product: The number of rows is fixed by m1, but the + // number of columns will depend on m2, which is unknown. + fmt.Println(output.Shape()) + // Output: [2, ?] +} + +func ExampleScope_SubScope() { + var ( + s = NewScope() + c1 = Const(s.SubScope("x"), int64(1)) + c2 = Const(s.SubScope("x"), int64(1)) + ) + if s.Err() != nil { + panic(s.Err()) + } + fmt.Println(c1.Op.Name(), c2.Op.Name()) + // Output: x/Const x_1/Const +} diff --git a/third_party/go-tensorflow/tensorflow/go/op/wrappers.go b/third_party/go-tensorflow/tensorflow/go/op/wrappers.go new file mode 100644 index 0000000..d3d0362 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/op/wrappers.go @@ -0,0 +1,54391 @@ +// DO NOT EDIT +// This file was machine generated by github.com/tensorflow/tensorflow/tensorflow/go/genop/internal +// +// WARNING: This generation of wrapper function for TensorFlow ops is in an +// experimental state. The generated API can change without notice. + +package op + +import tf "github.com/tensorflow/tensorflow/tensorflow/go" + +// optionalAttr is an intentionally un-exported type to hide +// details of how optional attributes to operations are implemented. +type optionalAttr map[string]interface{} + +func makeOutputList(op *tf.Operation, start int, output string) ([]tf.Output, int, error) { + size, err := op.OutputListSize(output) + if err != nil { + return nil, start, err + } + list := make([]tf.Output, size) + for i := 0; i < size; i++ { + list[i] = op.Output(start + i) + } + return list, start + size, nil +} + +// Generate a sharded filename. The filename is printf formatted as +// +// %s-%05d-of-%05d, basename, shard, num_shards. +func ShardedFilename(scope *Scope, basename tf.Output, shard tf.Output, num_shards tf.Output) (filename tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "ShardedFilename", + Input: []tf.Input{ + basename, shard, num_shards, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes softplus gradients for a softplus operation. +// +// Arguments: +// +// gradients: The backpropagated gradients to the corresponding softplus operation. +// features: The features passed as input to the corresponding softplus operation. +// +// Returns The gradients: `gradients / (1 + exp(-features))`. +func SoftplusGrad(scope *Scope, gradients tf.Output, features tf.Output) (backprops tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "SoftplusGrad", + Input: []tf.Input{ + gradients, features, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Sets up TPUEmbedding in a distributed TPU system. +// +// Arguments: +// +// config: Serialized tensorflow.tpu.TPUEmbeddingConfiguration that +// +// describes the embedding lookups of the program. +// +// Returns the created operation. +func ConfigureTPUEmbedding(scope *Scope, config string) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"config": config} + opspec := tf.OpSpec{ + Type: "ConfigureTPUEmbedding", + + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// SparseSegmentMeanAttr is an optional argument to SparseSegmentMean. +type SparseSegmentMeanAttr func(optionalAttr) + +// SparseSegmentMeanSparseGradient sets the optional sparse_gradient attribute to value. +// If not specified, defaults to false +func SparseSegmentMeanSparseGradient(value bool) SparseSegmentMeanAttr { + return func(m optionalAttr) { + m["sparse_gradient"] = value + } +} + +// Computes the mean along sparse segments of a tensor. +// +// See `tf.sparse.segment_sum` for usage examples. +// +// Like `SegmentMean`, but `segment_ids` can have rank less than `data`'s first +// dimension, selecting a subset of dimension 0, specified by `indices`. +// +// Arguments: +// +// indices: A 1-D tensor. Has same rank as `segment_ids`. +// segment_ids: A 1-D tensor. Values should be sorted and can be repeated. +// +// Returns Has same shape as data, except for dimension 0 which +// has size `k`, the number of segments. +func SparseSegmentMean(scope *Scope, data tf.Output, indices tf.Output, segment_ids tf.Output, optional ...SparseSegmentMeanAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "SparseSegmentMean", + Input: []tf.Input{ + data, indices, segment_ids, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// AvgPool3DAttr is an optional argument to AvgPool3D. +type AvgPool3DAttr func(optionalAttr) + +// AvgPool3DDataFormat sets the optional data_format attribute to value. +// +// value: The data format of the input and output data. With the +// default format "NDHWC", the data is stored in the order of: +// +// [batch, in_depth, in_height, in_width, in_channels]. +// +// Alternatively, the format could be "NCDHW", the data storage order is: +// +// [batch, in_channels, in_depth, in_height, in_width]. +// +// If not specified, defaults to "NDHWC" +func AvgPool3DDataFormat(value string) AvgPool3DAttr { + return func(m optionalAttr) { + m["data_format"] = value + } +} + +// Performs 3D average pooling on the input. +// +// Each entry in `output` is the mean of the corresponding size `ksize` window in +// `value`. +// +// Arguments: +// +// input: Shape `[batch, depth, rows, cols, channels]` tensor to pool over. +// ksize: 1-D tensor of length 5. The size of the window for each dimension of +// +// the input tensor. Must have `ksize[0] = ksize[4] = 1`. +// +// strides: 1-D tensor of length 5. The stride of the sliding window for each +// +// dimension of `input`. Must have `strides[0] = strides[4] = 1`. +// +// padding: The type of padding algorithm to use. +// +// Returns The average pooled output tensor. +func AvgPool3D(scope *Scope, input tf.Output, ksize []int64, strides []int64, padding string, optional ...AvgPool3DAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"ksize": ksize, "strides": strides, "padding": padding} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "AvgPool3D", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// QueueDequeueUpToV2Attr is an optional argument to QueueDequeueUpToV2. +type QueueDequeueUpToV2Attr func(optionalAttr) + +// QueueDequeueUpToV2TimeoutMs sets the optional timeout_ms attribute to value. +// +// value: If the queue has fewer than n elements, this operation +// will block for up to timeout_ms milliseconds. +// Note: This option is not supported yet. +// If not specified, defaults to -1 +func QueueDequeueUpToV2TimeoutMs(value int64) QueueDequeueUpToV2Attr { + return func(m optionalAttr) { + m["timeout_ms"] = value + } +} + +// Dequeues `n` tuples of one or more tensors from the given queue. +// +// This operation is not supported by all queues. If a queue does not support +// DequeueUpTo, then an Unimplemented error is returned. +// +// If the queue is closed and there are more than 0 but less than `n` +// elements remaining, then instead of returning an OutOfRange error like +// QueueDequeueMany, less than `n` elements are returned immediately. If +// the queue is closed and there are 0 elements left in the queue, then +// an OutOfRange error is returned just like in QueueDequeueMany. +// Otherwise the behavior is identical to QueueDequeueMany: +// +// This operation concatenates queue-element component tensors along the +// 0th dimension to make a single component tensor. All of the components +// in the dequeued tuple will have size n in the 0th dimension. +// +// This operation has `k` outputs, where `k` is the number of components in +// the tuples stored in the given queue, and output `i` is the ith +// component of the dequeued tuple. +// +// Arguments: +// +// handle: The handle to a queue. +// n: The number of tuples to dequeue. +// component_types: The type of each component in a tuple. +// +// Returns One or more tensors that were dequeued as a tuple. +func QueueDequeueUpToV2(scope *Scope, handle tf.Output, n tf.Output, component_types []tf.DataType, optional ...QueueDequeueUpToV2Attr) (components []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"component_types": component_types} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "QueueDequeueUpToV2", + Input: []tf.Input{ + handle, n, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if components, idx, err = makeOutputList(op, idx, "components"); err != nil { + scope.UpdateErr("QueueDequeueUpToV2", err) + return + } + return components +} + +// ThreadPoolHandleAttr is an optional argument to ThreadPoolHandle. +type ThreadPoolHandleAttr func(optionalAttr) + +// ThreadPoolHandleMaxIntraOpParallelism sets the optional max_intra_op_parallelism attribute to value. +// +// value: The maximum degree of parallelism to use within operations that execute on this +// threadpool. +// If not specified, defaults to 1 +func ThreadPoolHandleMaxIntraOpParallelism(value int64) ThreadPoolHandleAttr { + return func(m optionalAttr) { + m["max_intra_op_parallelism"] = value + } +} + +// ThreadPoolHandleContainer sets the optional container attribute to value. +// If not specified, defaults to "" +func ThreadPoolHandleContainer(value string) ThreadPoolHandleAttr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// ThreadPoolHandleSharedName sets the optional shared_name attribute to value. +// If not specified, defaults to "" +func ThreadPoolHandleSharedName(value string) ThreadPoolHandleAttr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// Creates a dataset that uses a custom thread pool to compute `input_dataset`. +// +// Arguments: +// +// num_threads: The number of threads in the thread pool. +// display_name: A human-readable name for the threads that may be visible in some +// +// visualizations. +// threadpool. +// +// Returns A resource that can be consumed by one or more ExperimentalThreadPoolDataset +// ops. +func ThreadPoolHandle(scope *Scope, num_threads int64, display_name string, optional ...ThreadPoolHandleAttr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_threads": num_threads, "display_name": display_name} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ThreadPoolHandle", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns x + y element-wise. +// +// *NOTE*: `Add` supports broadcasting. `AddN` does not. More about broadcasting +// [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) +// +// Given two input tensors, the `tf.add` operation computes the sum for every element in the tensor. +// +// Both input and output have a range `(-inf, inf)`. +func Add(scope *Scope, x tf.Output, y tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Add", + Input: []tf.Input{ + x, y, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Produces the max pool of the input tensor for quantized types. +// +// Arguments: +// +// input: The 4D (batch x rows x cols x depth) Tensor to MaxReduce over. +// min_input: The float value that the lowest quantized input value represents. +// max_input: The float value that the highest quantized input value represents. +// ksize: The size of the window for each dimension of the input tensor. +// +// The length must be 4 to match the number of dimensions of the input. +// +// strides: The stride of the sliding window for each dimension of the input +// +// tensor. The length must be 4 to match the number of dimensions of the input. +// +// padding: The type of padding algorithm to use. +// +// Returns: +// +// output +// min_output: The float value that the lowest quantized output value represents. +// max_output: The float value that the highest quantized output value represents. +func QuantizedMaxPool(scope *Scope, input tf.Output, min_input tf.Output, max_input tf.Output, ksize []int64, strides []int64, padding string) (output tf.Output, min_output tf.Output, max_output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"ksize": ksize, "strides": strides, "padding": padding} + opspec := tf.OpSpec{ + Type: "QuantizedMaxPool", + Input: []tf.Input{ + input, min_input, max_input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// CudnnRNNCanonicalToParamsAttr is an optional argument to CudnnRNNCanonicalToParams. +type CudnnRNNCanonicalToParamsAttr func(optionalAttr) + +// CudnnRNNCanonicalToParamsRnnMode sets the optional rnn_mode attribute to value. +// If not specified, defaults to "lstm" +func CudnnRNNCanonicalToParamsRnnMode(value string) CudnnRNNCanonicalToParamsAttr { + return func(m optionalAttr) { + m["rnn_mode"] = value + } +} + +// CudnnRNNCanonicalToParamsInputMode sets the optional input_mode attribute to value. +// If not specified, defaults to "linear_input" +func CudnnRNNCanonicalToParamsInputMode(value string) CudnnRNNCanonicalToParamsAttr { + return func(m optionalAttr) { + m["input_mode"] = value + } +} + +// CudnnRNNCanonicalToParamsDirection sets the optional direction attribute to value. +// If not specified, defaults to "unidirectional" +func CudnnRNNCanonicalToParamsDirection(value string) CudnnRNNCanonicalToParamsAttr { + return func(m optionalAttr) { + m["direction"] = value + } +} + +// CudnnRNNCanonicalToParamsDropout sets the optional dropout attribute to value. +// If not specified, defaults to 0 +func CudnnRNNCanonicalToParamsDropout(value float32) CudnnRNNCanonicalToParamsAttr { + return func(m optionalAttr) { + m["dropout"] = value + } +} + +// CudnnRNNCanonicalToParamsSeed sets the optional seed attribute to value. +// If not specified, defaults to 0 +func CudnnRNNCanonicalToParamsSeed(value int64) CudnnRNNCanonicalToParamsAttr { + return func(m optionalAttr) { + m["seed"] = value + } +} + +// CudnnRNNCanonicalToParamsSeed2 sets the optional seed2 attribute to value. +// If not specified, defaults to 0 +func CudnnRNNCanonicalToParamsSeed2(value int64) CudnnRNNCanonicalToParamsAttr { + return func(m optionalAttr) { + m["seed2"] = value + } +} + +// Converts CudnnRNN params from canonical form to usable form. +// +// Writes a set of weights into the opaque params buffer so they can be used in +// upcoming training or inferences. +// +// Note that the params buffer may not be compatible across different GPUs. So any +// save and restoration should be converted to and from the canonical weights and +// biases. +// +// num_layers: Specifies the number of layers in the RNN model. +// num_units: Specifies the size of the hidden state. +// input_size: Specifies the size of the input state. +// weights: the canonical form of weights that can be used for saving +// +// and restoration. They are more likely to be compatible across different +// generations. +// +// biases: the canonical form of biases that can be used for saving +// +// and restoration. They are more likely to be compatible across different +// generations. +// +// num_params: number of parameter sets for all layers. +// +// Each layer may contain multiple parameter sets, with each set consisting of +// a weight matrix and a bias vector. +// +// rnn_mode: Indicates the type of the RNN model. +// input_mode: Indicate whether there is a linear projection between the input and +// +// The actual computation before the first layer. 'skip_input' is only allowed +// when input_size == num_units; 'auto_select' implies 'skip_input' when +// input_size == num_units; otherwise, it implies 'linear_input'. +// +// direction: Indicates whether a bidirectional model will be used. +// +// dir = (direction == bidirectional) ? 2 : 1 +// +// dropout: dropout probability. When set to 0., dropout is disabled. +// seed: the 1st part of a seed to initialize dropout. +// seed2: the 2nd part of a seed to initialize dropout. +func CudnnRNNCanonicalToParams(scope *Scope, num_layers tf.Output, num_units tf.Output, input_size tf.Output, weights []tf.Output, biases []tf.Output, optional ...CudnnRNNCanonicalToParamsAttr) (params tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "CudnnRNNCanonicalToParams", + Input: []tf.Input{ + num_layers, num_units, input_size, tf.OutputList(weights), tf.OutputList(biases), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// IRFFT2DAttr is an optional argument to IRFFT2D. +type IRFFT2DAttr func(optionalAttr) + +// IRFFT2DTreal sets the optional Treal attribute to value. +// If not specified, defaults to DT_FLOAT +func IRFFT2DTreal(value tf.DataType) IRFFT2DAttr { + return func(m optionalAttr) { + m["Treal"] = value + } +} + +// Inverse 2D real-valued fast Fourier transform. +// +// Computes the inverse 2-dimensional discrete Fourier transform of a real-valued +// signal over the inner-most 2 dimensions of `input`. +// +// The inner-most 2 dimensions of `input` are assumed to be the result of `RFFT2D`: +// The inner-most dimension contains the `fft_length / 2 + 1` unique components of +// the DFT of a real-valued signal. If `fft_length` is not provided, it is computed +// from the size of the inner-most 2 dimensions of `input`. If the FFT length used +// to compute `input` is odd, it should be provided since it cannot be inferred +// properly. +// +// Along each axis `IRFFT2D` is computed on, if `fft_length` (or +// `fft_length / 2 + 1` for the inner-most dimension) is smaller than the +// corresponding dimension of `input`, the dimension is cropped. If it is larger, +// the dimension is padded with zeros. +// +// Arguments: +// +// input: A complex tensor. +// fft_length: An int32 tensor of shape [2]. The FFT length for each dimension. +// +// Returns A float32 tensor of the same rank as `input`. The inner-most 2 +// +// dimensions of `input` are replaced with the `fft_length` samples of their +// inverse 2D Fourier transform. +// +// @compatibility(numpy) +// Equivalent to np.fft.irfft2 +// @end_compatibility +func IRFFT2D(scope *Scope, input tf.Output, fft_length tf.Output, optional ...IRFFT2DAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "IRFFT2D", + Input: []tf.Input{ + input, fft_length, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Converts a tensor to a scalar predicate. +// +// Converts a tensor to a scalar predicate with the following rules: +// +// - For 0D tensors, truthiness is determined by comparing against a "zero" +// value. For numerical types it is the obvious zero. For strings it is the +// empty string. +// +// - For >0D tensors, truthiness is determined by looking at the number of +// elements. If has zero elements, then the result is false. Otherwise the +// result is true. +// +// This matches the behavior of If and While for determining if a tensor counts +// as true/false for a branch condition. +func ToBool(scope *Scope, input tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "ToBool", + Input: []tf.Input{ + input, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// QuantizedDepthwiseConv2DWithBiasAttr is an optional argument to QuantizedDepthwiseConv2DWithBias. +type QuantizedDepthwiseConv2DWithBiasAttr func(optionalAttr) + +// QuantizedDepthwiseConv2DWithBiasOutType sets the optional out_type attribute to value. +// +// value: The type of the output. +// If not specified, defaults to DT_QINT32 +func QuantizedDepthwiseConv2DWithBiasOutType(value tf.DataType) QuantizedDepthwiseConv2DWithBiasAttr { + return func(m optionalAttr) { + m["out_type"] = value + } +} + +// QuantizedDepthwiseConv2DWithBiasDilations sets the optional dilations attribute to value. +// +// value: List of dilation values. +// If not specified, defaults to +func QuantizedDepthwiseConv2DWithBiasDilations(value []int64) QuantizedDepthwiseConv2DWithBiasAttr { + return func(m optionalAttr) { + m["dilations"] = value + } +} + +// Computes quantized depthwise Conv2D with Bias. +// +// Arguments: +// +// input: The original input tensor. +// filter: The original filter tensor. +// bias: The original bias tensor. +// min_input: The float value that the minimum quantized input value represents. +// max_input: The float value that the maximum quantized input value represents. +// min_filter: The float value that the minimum quantized filter value represents. +// max_filter: The float value that the maximum quantized filter value represents. +// strides: List of stride values. +// +// Returns: +// +// output: The output tensor. +// min_output: The float value that the minimum quantized output value represents. +// max_output: The float value that the maximum quantized output value represents. +func QuantizedDepthwiseConv2DWithBias(scope *Scope, input tf.Output, filter tf.Output, bias tf.Output, min_input tf.Output, max_input tf.Output, min_filter tf.Output, max_filter tf.Output, strides []int64, padding string, optional ...QuantizedDepthwiseConv2DWithBiasAttr) (output tf.Output, min_output tf.Output, max_output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"strides": strides, "padding": padding} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "QuantizedDepthwiseConv2DWithBias", + Input: []tf.Input{ + input, filter, bias, min_input, max_input, min_filter, max_filter, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// OrderedMapSizeAttr is an optional argument to OrderedMapSize. +type OrderedMapSizeAttr func(optionalAttr) + +// OrderedMapSizeCapacity sets the optional capacity attribute to value. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func OrderedMapSizeCapacity(value int64) OrderedMapSizeAttr { + return func(m optionalAttr) { + m["capacity"] = value + } +} + +// OrderedMapSizeMemoryLimit sets the optional memory_limit attribute to value. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func OrderedMapSizeMemoryLimit(value int64) OrderedMapSizeAttr { + return func(m optionalAttr) { + m["memory_limit"] = value + } +} + +// OrderedMapSizeContainer sets the optional container attribute to value. +// If not specified, defaults to "" +func OrderedMapSizeContainer(value string) OrderedMapSizeAttr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// OrderedMapSizeSharedName sets the optional shared_name attribute to value. +// If not specified, defaults to "" +func OrderedMapSizeSharedName(value string) OrderedMapSizeAttr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// Op returns the number of elements in the underlying container. +func OrderedMapSize(scope *Scope, dtypes []tf.DataType, optional ...OrderedMapSizeAttr) (size tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtypes": dtypes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "OrderedMapSize", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Deprecated, use python implementation tf.linalg.matrix_exponential. +// +// DEPRECATED at GraphDef version 27: Use Python implementation tf.linalg.matrix_exponential instead. +func MatrixExponential(scope *Scope, input tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "MatrixExponential", + Input: []tf.Input{ + input, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// AudioSummaryV2Attr is an optional argument to AudioSummaryV2. +type AudioSummaryV2Attr func(optionalAttr) + +// AudioSummaryV2MaxOutputs sets the optional max_outputs attribute to value. +// +// value: Max number of batch elements to generate audio for. +// If not specified, defaults to 3 +// +// REQUIRES: value >= 1 +func AudioSummaryV2MaxOutputs(value int64) AudioSummaryV2Attr { + return func(m optionalAttr) { + m["max_outputs"] = value + } +} + +// Outputs a `Summary` protocol buffer with audio. +// +// The summary has up to `max_outputs` summary values containing audio. The +// audio is built from `tensor` which must be 3-D with shape `[batch_size, +// frames, channels]` or 2-D with shape `[batch_size, frames]`. The values are +// assumed to be in the range of `[-1.0, 1.0]` with a sample rate of `sample_rate`. +// +// The `tag` argument is a scalar `Tensor` of type `string`. It is used to +// build the `tag` of the summary values: +// +// - If `max_outputs` is 1, the summary value tag is '*tag*/audio'. +// - If `max_outputs` is greater than 1, the summary value tags are +// generated sequentially as '*tag*/audio/0', '*tag*/audio/1', etc. +// +// Arguments: +// +// tag: Scalar. Used to build the `tag` attribute of the summary values. +// tensor: 2-D of shape `[batch_size, frames]`. +// sample_rate: The sample rate of the signal in hertz. +// +// Returns Scalar. Serialized `Summary` protocol buffer. +func AudioSummaryV2(scope *Scope, tag tf.Output, tensor tf.Output, sample_rate tf.Output, optional ...AudioSummaryV2Attr) (summary tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "AudioSummaryV2", + Input: []tf.Input{ + tag, tensor, sample_rate, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// UniqueWithCountsAttr is an optional argument to UniqueWithCounts. +type UniqueWithCountsAttr func(optionalAttr) + +// UniqueWithCountsOutIdx sets the optional out_idx attribute to value. +// If not specified, defaults to DT_INT32 +func UniqueWithCountsOutIdx(value tf.DataType) UniqueWithCountsAttr { + return func(m optionalAttr) { + m["out_idx"] = value + } +} + +// Finds unique elements in a 1-D tensor. +// +// This operation returns a tensor `y` containing all of the unique elements of `x` +// sorted in the same order that they occur in `x`. This operation also returns a +// tensor `idx` the same size as `x` that contains the index of each value of `x` +// in the unique output `y`. Finally, it returns a third tensor `count` that +// contains the count of each element of `y` in `x`. In other words: +// +// `y[idx[i]] = x[i] for i in [0, 1,...,rank(x) - 1]` +// +// For example: +// +// ``` +// # tensor 'x' is [1, 1, 2, 4, 4, 4, 7, 8, 8] +// y, idx, count = unique_with_counts(x) +// y ==> [1, 2, 4, 7, 8] +// idx ==> [0, 0, 1, 2, 2, 2, 3, 4, 4] +// count ==> [2, 1, 3, 1, 2] +// ``` +// +// Arguments: +// +// x: 1-D. +// +// Returns: +// +// y: 1-D. +// idx: 1-D. +// count: 1-D. +func UniqueWithCounts(scope *Scope, x tf.Output, optional ...UniqueWithCountsAttr) (y tf.Output, idx tf.Output, count tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "UniqueWithCounts", + Input: []tf.Input{ + x, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// BoostedTreesCalculateBestFeatureSplitAttr is an optional argument to BoostedTreesCalculateBestFeatureSplit. +type BoostedTreesCalculateBestFeatureSplitAttr func(optionalAttr) + +// BoostedTreesCalculateBestFeatureSplitSplitType sets the optional split_type attribute to value. +// +// value: A string indicating if this Op should perform inequality split or equality split. +// If not specified, defaults to "inequality" +func BoostedTreesCalculateBestFeatureSplitSplitType(value string) BoostedTreesCalculateBestFeatureSplitAttr { + return func(m optionalAttr) { + m["split_type"] = value + } +} + +// Calculates gains for each feature and returns the best possible split information for the feature. +// +// The split information is the best threshold (bucket id), gains and left/right node contributions per node for each feature. +// +// It is possible that not all nodes can be split on each feature. Hence, the list of possible nodes can differ between the features. Therefore, we return `node_ids_list` for each feature, containing the list of nodes that this feature can be used to split. +// +// In this manner, the output is the best split per features and per node, so that it needs to be combined later to produce the best split for each node (among all possible features). +// +// The output shapes are compatible in a way that the first dimension of all tensors are the same and equal to the number of possible split nodes for each feature. +// +// Arguments: +// +// node_id_range: A Rank 1 tensor (shape=[2]) to specify the range [first, last) of node ids to process within `stats_summary_list`. The nodes are iterated between the two nodes specified by the tensor, as like `for node_id in range(node_id_range[0], node_id_range[1])` (Note that the last index node_id_range[1] is exclusive). +// stats_summary: A Rank 4 tensor (#shape=[max_splits, feature_dims, bucket, stats_dims]) for accumulated stats summary (gradient/hessian) per node, per dimension, per buckets for each feature. +// +// The first dimension of the tensor is the maximum number of splits, and thus not all elements of it will be used, but only the indexes specified by node_ids will be used. +// +// l1: l1 regularization factor on leaf weights, per instance based. +// l2: l2 regularization factor on leaf weights, per instance based. +// tree_complexity: adjustment to the gain, per leaf based. +// min_node_weight: minimum avg of hessians in a node before required for the node to be considered for splitting. +// logits_dimension: The dimension of logit, i.e., number of classes. +// +// Returns: +// +// node_ids: A Rank 1 tensors indicating possible split node ids for each feature. The length of the list is num_features, but each tensor has different size as each feature provides different possible nodes. See above for details like shapes and sizes. +// gains: A Rank 1 tensors indicating the best gains for each feature to split for certain nodes. See above for details like shapes and sizes. +// feature_dimensions: A Rank 1 tensors indicating the best feature dimension for each feature to split for certain nodes if the feature is multi-dimension. See above for details like shapes and sizes. +// thresholds: A Rank 1 tensors indicating the bucket id to compare with (as a threshold) for split in each node. See above for details like shapes and sizes. +// left_node_contribs: A Rank 2 tensors indicating the contribution of the left nodes when branching from parent nodes (given by the tensor element in the output node_ids_list) to the left direction by the given threshold for each feature. This value will be used to make the left node value by adding to the parent node value. Second dimension size is 1 for 1-dimensional logits, but would be larger for multi-class problems. See above for details like shapes and sizes. +// right_node_contribs: A Rank 2 tensors, with the same shape/conditions as left_node_contribs_list, but just that the value is for the right node. +// split_with_default_directions: A Rank 1 tensors indicating the which direction to go if data is missing. See above for details like shapes and sizes. +// +// Inequality with default left returns 0, inequality with default right returns 1, equality with default right returns 2. +func BoostedTreesCalculateBestFeatureSplit(scope *Scope, node_id_range tf.Output, stats_summary tf.Output, l1 tf.Output, l2 tf.Output, tree_complexity tf.Output, min_node_weight tf.Output, logits_dimension int64, optional ...BoostedTreesCalculateBestFeatureSplitAttr) (node_ids tf.Output, gains tf.Output, feature_dimensions tf.Output, thresholds tf.Output, left_node_contribs tf.Output, right_node_contribs tf.Output, split_with_default_directions tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"logits_dimension": logits_dimension} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "BoostedTreesCalculateBestFeatureSplit", + Input: []tf.Input{ + node_id_range, stats_summary, l1, l2, tree_complexity, min_node_weight, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2), op.Output(3), op.Output(4), op.Output(5), op.Output(6) +} + +// Converts the given variant tensor to an iterator and stores it in the given resource. +// +// Arguments: +// +// resource_handle: A handle to an iterator resource. +// serialized: A variant tensor storing the state of the iterator contained in the +// +// resource. +// +// Returns the created operation. +func DeserializeIterator(scope *Scope, resource_handle tf.Output, serialized tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "DeserializeIterator", + Input: []tf.Input{ + resource_handle, serialized, + }, + } + return scope.AddOperation(opspec) +} + +// Compute the upper regularized incomplete Gamma function `Q(a, x)`. +// +// The upper regularized incomplete Gamma function is defined as: +// +// \\(Q(a, x) = Gamma(a, x) / Gamma(a) = 1 - P(a, x)\\) +// +// where +// +// \\(Gamma(a, x) = int_{x}^{\infty} t^{a-1} exp(-t) dt\\) +// +// is the upper incomplete Gama function. +// +// Note, above `P(a, x)` (`Igamma`) is the lower regularized complete +// Gamma function. +func Igammac(scope *Scope, a tf.Output, x tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Igammac", + Input: []tf.Input{ + a, x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// FusedBatchNormGradV3Attr is an optional argument to FusedBatchNormGradV3. +type FusedBatchNormGradV3Attr func(optionalAttr) + +// FusedBatchNormGradV3Epsilon sets the optional epsilon attribute to value. +// +// value: A small float number added to the variance of x. +// If not specified, defaults to 0.0001 +func FusedBatchNormGradV3Epsilon(value float32) FusedBatchNormGradV3Attr { + return func(m optionalAttr) { + m["epsilon"] = value + } +} + +// FusedBatchNormGradV3DataFormat sets the optional data_format attribute to value. +// +// value: The data format for y_backprop, x, x_backprop. +// Either "NHWC" (default) or "NCHW". +// If not specified, defaults to "NHWC" +func FusedBatchNormGradV3DataFormat(value string) FusedBatchNormGradV3Attr { + return func(m optionalAttr) { + m["data_format"] = value + } +} + +// FusedBatchNormGradV3IsTraining sets the optional is_training attribute to value. +// +// value: A bool value to indicate the operation is for training (default) +// or inference. +// If not specified, defaults to true +func FusedBatchNormGradV3IsTraining(value bool) FusedBatchNormGradV3Attr { + return func(m optionalAttr) { + m["is_training"] = value + } +} + +// Gradient for batch normalization. +// +// Note that the size of 4D Tensors are defined by either "NHWC" or "NCHW". +// The size of 1D Tensors matches the dimension C of the 4D Tensors. +// +// Arguments: +// +// y_backprop: A 4D Tensor for the gradient with respect to y. +// x: A 4D Tensor for input data. +// scale: A 1D Tensor for scaling factor, to scale the normalized x. +// reserve_space_1: When is_training is True, a 1D Tensor for the computed batch +// +// mean to be reused in gradient computation. When is_training is +// False, a 1D Tensor for the population mean to be reused in both +// 1st and 2nd order gradient computation. +// +// reserve_space_2: When is_training is True, a 1D Tensor for the computed batch +// +// variance (inverted variance in the cuDNN case) to be reused in +// gradient computation. When is_training is False, a 1D Tensor +// for the population variance to be reused in both 1st and 2nd +// order gradient computation. +// +// reserve_space_3: When is_training is True, a 1D Tensor for some intermediate results to be reused +// +// in gradient computation. When is_training is False, a dummy empty Tensor will be +// created. +// +// Returns: +// +// x_backprop: A 4D Tensor for the gradient with respect to x. +// scale_backprop: A 1D Tensor for the gradient with respect to scale. +// offset_backprop: A 1D Tensor for the gradient with respect to offset. +// reserve_space_4: Unused placeholder to match the mean input in FusedBatchNorm. +// reserve_space_5: Unused placeholder to match the variance input +// +// in FusedBatchNorm. +func FusedBatchNormGradV3(scope *Scope, y_backprop tf.Output, x tf.Output, scale tf.Output, reserve_space_1 tf.Output, reserve_space_2 tf.Output, reserve_space_3 tf.Output, optional ...FusedBatchNormGradV3Attr) (x_backprop tf.Output, scale_backprop tf.Output, offset_backprop tf.Output, reserve_space_4 tf.Output, reserve_space_5 tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "FusedBatchNormGradV3", + Input: []tf.Input{ + y_backprop, x, scale, reserve_space_1, reserve_space_2, reserve_space_3, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2), op.Output(3), op.Output(4) +} + +// Broadcast an array for a compatible shape. +// +// Broadcasting is the process of making arrays to have compatible shapes +// for arithmetic operations. Two shapes are compatible if for each +// dimension pair they are either equal or one of them is one. When trying +// to broadcast a Tensor to a shape, it starts with the trailing dimensions, +// and works its way forward. +// +// For example, +// +// >>> x = tf.constant([1, 2, 3]) +// >>> y = tf.broadcast_to(x, [3, 3]) +// >>> print(y) +// tf.Tensor( +// +// [[1 2 3] +// [1 2 3] +// [1 2 3]], shape=(3, 3), dtype=int32) +// +// In the above example, the input Tensor with the shape of `[1, 3]` +// is broadcasted to output Tensor with shape of `[3, 3]`. +// +// When doing broadcasted operations such as multiplying a tensor +// by a scalar, broadcasting (usually) confers some time or space +// benefit, as the broadcasted tensor is never materialized. +// +// However, `broadcast_to` does not carry with it any such benefits. +// The newly-created tensor takes the full memory of the broadcasted +// shape. (In a graph context, `broadcast_to` might be fused to +// subsequent operation and then be optimized away, however.) +// +// Arguments: +// +// input: A Tensor to broadcast. +// shape: An 1-D `int` Tensor. The shape of the desired output. +// +// Returns A Tensor. +func BroadcastTo(scope *Scope, input tf.Output, shape tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "BroadcastTo", + Input: []tf.Input{ + input, shape, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// DepthwiseConv2dNativeBackpropFilterAttr is an optional argument to DepthwiseConv2dNativeBackpropFilter. +type DepthwiseConv2dNativeBackpropFilterAttr func(optionalAttr) + +// DepthwiseConv2dNativeBackpropFilterExplicitPaddings sets the optional explicit_paddings attribute to value. +// If not specified, defaults to <> +func DepthwiseConv2dNativeBackpropFilterExplicitPaddings(value []int64) DepthwiseConv2dNativeBackpropFilterAttr { + return func(m optionalAttr) { + m["explicit_paddings"] = value + } +} + +// DepthwiseConv2dNativeBackpropFilterDataFormat sets the optional data_format attribute to value. +// +// value: Specify the data format of the input and output data. With the +// default format "NHWC", the data is stored in the order of: +// +// [batch, height, width, channels]. +// +// Alternatively, the format could be "NCHW", the data storage order of: +// +// [batch, channels, height, width]. +// +// If not specified, defaults to "NHWC" +func DepthwiseConv2dNativeBackpropFilterDataFormat(value string) DepthwiseConv2dNativeBackpropFilterAttr { + return func(m optionalAttr) { + m["data_format"] = value + } +} + +// DepthwiseConv2dNativeBackpropFilterDilations sets the optional dilations attribute to value. +// +// value: 1-D tensor of length 4. The dilation factor for each dimension of +// `input`. If set to k > 1, there will be k-1 skipped cells between each filter +// element on that dimension. The dimension order is determined by the value of +// `data_format`, see above for details. Dilations in the batch and depth +// dimensions must be 1. +// If not specified, defaults to +func DepthwiseConv2dNativeBackpropFilterDilations(value []int64) DepthwiseConv2dNativeBackpropFilterAttr { + return func(m optionalAttr) { + m["dilations"] = value + } +} + +// Computes the gradients of depthwise convolution with respect to the filter. +// +// Arguments: +// +// input: 4-D with shape based on `data_format`. For example, if +// +// `data_format` is 'NHWC' then `input` is a 4-D `[batch, in_height, +// in_width, in_channels]` tensor. +// +// filter_sizes: An integer vector representing the tensor shape of `filter`, +// +// where `filter` is a 4-D +// `[filter_height, filter_width, in_channels, depthwise_multiplier]` tensor. +// +// out_backprop: 4-D with shape based on `data_format`. +// +// For example, if `data_format` is 'NHWC' then +// out_backprop shape is `[batch, out_height, out_width, out_channels]`. +// Gradients w.r.t. the output of the convolution. +// +// strides: The stride of the sliding window for each dimension of the input +// +// of the convolution. +// +// padding: The type of padding algorithm to use. +// +// Returns 4-D with shape +// `[filter_height, filter_width, in_channels, out_channels]`. Gradient w.r.t. +// the `filter` input of the convolution. +func DepthwiseConv2dNativeBackpropFilter(scope *Scope, input tf.Output, filter_sizes tf.Output, out_backprop tf.Output, strides []int64, padding string, optional ...DepthwiseConv2dNativeBackpropFilterAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"strides": strides, "padding": padding} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "DepthwiseConv2dNativeBackpropFilter", + Input: []tf.Input{ + input, filter_sizes, out_backprop, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// MaxPoolGradGradWithArgmaxAttr is an optional argument to MaxPoolGradGradWithArgmax. +type MaxPoolGradGradWithArgmaxAttr func(optionalAttr) + +// MaxPoolGradGradWithArgmaxIncludeBatchInIndex sets the optional include_batch_in_index attribute to value. +// +// value: Whether to include batch dimension in flattened index of `argmax`. +// If not specified, defaults to false +func MaxPoolGradGradWithArgmaxIncludeBatchInIndex(value bool) MaxPoolGradGradWithArgmaxAttr { + return func(m optionalAttr) { + m["include_batch_in_index"] = value + } +} + +// Computes second-order gradients of the maxpooling function. +// +// Arguments: +// +// input: The original input. +// grad: 4-D with shape `[batch, height, width, channels]`. Gradients w.r.t. the +// +// input of `max_pool`. +// +// argmax: The indices of the maximum values chosen for each output of `max_pool`. +// ksize: The size of the window for each dimension of the input tensor. +// strides: The stride of the sliding window for each dimension of the +// +// input tensor. +// +// padding: The type of padding algorithm to use. +// +// Returns Gradients of gradients w.r.t. the input of `max_pool`. +func MaxPoolGradGradWithArgmax(scope *Scope, input tf.Output, grad tf.Output, argmax tf.Output, ksize []int64, strides []int64, padding string, optional ...MaxPoolGradGradWithArgmaxAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"ksize": ksize, "strides": strides, "padding": padding} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "MaxPoolGradGradWithArgmax", + Input: []tf.Input{ + input, grad, argmax, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes gradients for the scaled exponential linear (Selu) operation. +// +// Arguments: +// +// gradients: The backpropagated gradients to the corresponding Selu operation. +// outputs: The outputs of the corresponding Selu operation. +// +// Returns The gradients: `gradients * (outputs + scale * alpha)` +// if outputs < 0, `scale * gradients` otherwise. +func SeluGrad(scope *Scope, gradients tf.Output, outputs tf.Output) (backprops tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "SeluGrad", + Input: []tf.Input{ + gradients, outputs, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Compute the polygamma function \\(\psi^{(n)}(x)\\). +// +// The polygamma function is defined as: +// +// \\(\psi^{(a)}(x) = \frac{d^a}{dx^a} \psi(x)\\) +// +// where \\(\psi(x)\\) is the digamma function. +// The polygamma function is defined only for non-negative integer orders \\a\\. +func Polygamma(scope *Scope, a tf.Output, x tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Polygamma", + Input: []tf.Input{ + a, x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// QuantizeAndDequantizeV2Attr is an optional argument to QuantizeAndDequantizeV2. +type QuantizeAndDequantizeV2Attr func(optionalAttr) + +// QuantizeAndDequantizeV2SignedInput sets the optional signed_input attribute to value. +// +// value: Whether the quantization is signed or unsigned. (actually this parameter should +// have been called `signed_output`) +// If not specified, defaults to true +func QuantizeAndDequantizeV2SignedInput(value bool) QuantizeAndDequantizeV2Attr { + return func(m optionalAttr) { + m["signed_input"] = value + } +} + +// QuantizeAndDequantizeV2NumBits sets the optional num_bits attribute to value. +// +// value: The bitwidth of the quantization. +// If not specified, defaults to 8 +func QuantizeAndDequantizeV2NumBits(value int64) QuantizeAndDequantizeV2Attr { + return func(m optionalAttr) { + m["num_bits"] = value + } +} + +// QuantizeAndDequantizeV2RangeGiven sets the optional range_given attribute to value. +// +// value: Whether the range is given or should be determined from the `input` tensor. +// If not specified, defaults to false +func QuantizeAndDequantizeV2RangeGiven(value bool) QuantizeAndDequantizeV2Attr { + return func(m optionalAttr) { + m["range_given"] = value + } +} + +// QuantizeAndDequantizeV2RoundMode sets the optional round_mode attribute to value. +// +// value: The 'round_mode' attribute controls which rounding tie-breaking algorithm is +// used when rounding float values to their quantized equivalents. The following +// rounding modes are currently supported: +// +// - HALF_TO_EVEN: this is the default round_mode. +// - HALF_UP: round towards positive. In this mode 7.5 rounds up to 8 and -7.5 +// rounds up to -7. +// +// If not specified, defaults to "HALF_TO_EVEN" +func QuantizeAndDequantizeV2RoundMode(value string) QuantizeAndDequantizeV2Attr { + return func(m optionalAttr) { + m["round_mode"] = value + } +} + +// QuantizeAndDequantizeV2NarrowRange sets the optional narrow_range attribute to value. +// +// value: If True, then the absolute value of the quantized minimum value is the same as +// the quantized maximum value, instead of 1 greater. +// i.e. for 8 bit quantization, the minimum value is -127 instead of -128. +// If not specified, defaults to false +func QuantizeAndDequantizeV2NarrowRange(value bool) QuantizeAndDequantizeV2Attr { + return func(m optionalAttr) { + m["narrow_range"] = value + } +} + +// QuantizeAndDequantizeV2Axis sets the optional axis attribute to value. +// +// value: If specified, this axis is treated as a channel or slice axis, and a separate +// quantization range is used for each channel or slice along this axis. +// If not specified, defaults to -1 +func QuantizeAndDequantizeV2Axis(value int64) QuantizeAndDequantizeV2Attr { + return func(m optionalAttr) { + m["axis"] = value + } +} + +// Quantizes then dequantizes a tensor. +// +// This op simulates the precision loss from the quantized forward pass by: +// +// 1. Quantizing the tensor to fixed point numbers, which should match the target +// quantization method when it is used in inference. +// 2. Dequantizing it back to floating point numbers for the following ops, most +// likely matmul. +// +// There are different ways to quantize. This version uses only scaling, so 0.0 +// maps to 0. +// +// From the specified 'num_bits' in the quantized output type, it determines +// minimum and maximum representable quantized values. +// +// e.g. +// +// * [-128, 127] for signed, num_bits = 8, or +// * [0, 255] for unsigned, num_bits = 8. +// +// If range_given == False, the initial input_min, input_max will be determined +// automatically as the minimum and maximum values in the input tensor, otherwise +// the specified values of input_min, input_max are used. +// +// Note: If the input_min, input_max are specified, they do not need to equal the +// actual minimum and maximum values in the tensor. e.g. in some cases it may be +// beneficial to specify these values such that the low probability extremes of the +// input distribution are clipped. +// +// This op determines the maximum scale_factor that would map the initial +// [input_min, input_max] range to a range that lies within the representable +// quantized range. +// +// It determines the scale from one of input_min and input_max, then updates the +// other one to maximize the representable range. +// +// e.g. +// +// - if the output is signed, num_bits = 8, [input_min, input_max] = [-10.0, +// 5.0]: it would use a scale_factor of -128 / -10.0 = 12.8 In this case, it +// would update input_max to be 127 / 12.8 = 9.921875 +// - if the output is signed, num_bits = 8, [input_min, input_max] = [-10.0, +// 10.0]: it would use a scale_factor of 127 / 10.0 = 12.7 In this case, it +// would update input_min to be 128.0 / 12.7 = -10.07874 +// - if the output is unsigned, input_min is forced to be 0, and only the +// specified input_max is used. +// +// After determining the scale_factor and updating the input range, it applies the +// following to each value in the 'input' tensor. +// +// output = round(clamp(value, input_min, input_max) * scale_factor) / scale_factor. +// +// The above round function rounds the value based on the given round_mode. +// +// Arguments: +// +// input: Tensor to quantize and then dequantize. +// input_min: If `range_given == True`, this specifies the minimum input value that needs to +// +// be represented, otherwise it is determined from the min value of the `input` +// tensor. +// +// input_max: If `range_given == True`, this specifies the maximum input value that needs to +// +// be represented, otherwise it is determined from the max value of the `input` +// tensor. +func QuantizeAndDequantizeV2(scope *Scope, input tf.Output, input_min tf.Output, input_max tf.Output, optional ...QuantizeAndDequantizeV2Attr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "QuantizeAndDequantizeV2", + Input: []tf.Input{ + input, input_min, input_max, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Concatenates a list of `N` tensors along the first dimension. +// +// The input tensors are all required to have size 1 in the first dimension. +// +// For example: +// +// ``` +// # 'x' is [[1, 4]] +// # 'y' is [[2, 5]] +// # 'z' is [[3, 6]] +// parallel_concat([x, y, z]) => [[1, 4], [2, 5], [3, 6]] # Pack along first dim. +// ``` +// +// The difference between concat and parallel_concat is that concat requires all +// of the inputs be computed before the operation will begin but doesn't require +// that the input shapes be known during graph construction. Parallel concat +// will copy pieces of the input into the output as they become available, in +// some situations this can provide a performance benefit. +// +// Arguments: +// +// values: Tensors to be concatenated. All must have size 1 in the first dimension +// +// and same shape. +// +// shape: the final shape of the result; should be equal to the shapes of any input +// +// but with the number of input values in the first dimension. +// +// Returns The concatenated tensor. +func ParallelConcat(scope *Scope, values []tf.Output, shape tf.Shape) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"shape": shape} + opspec := tf.OpSpec{ + Type: "ParallelConcat", + Input: []tf.Input{ + tf.OutputList(values), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// DatasetToSingleElementAttr is an optional argument to DatasetToSingleElement. +type DatasetToSingleElementAttr func(optionalAttr) + +// DatasetToSingleElementMetadata sets the optional metadata attribute to value. +// If not specified, defaults to "" +func DatasetToSingleElementMetadata(value string) DatasetToSingleElementAttr { + return func(m optionalAttr) { + m["metadata"] = value + } +} + +// Outputs the single element from the given dataset. +// +// Arguments: +// +// dataset: A handle to a dataset that contains a single element. +// +// Returns The components of the single element of `input`. +func DatasetToSingleElement(scope *Scope, dataset tf.Output, output_types []tf.DataType, output_shapes []tf.Shape, optional ...DatasetToSingleElementAttr) (components []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "DatasetToSingleElement", + Input: []tf.Input{ + dataset, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if components, idx, err = makeOutputList(op, idx, "components"); err != nil { + scope.UpdateErr("DatasetToSingleElement", err) + return + } + return components +} + +// ThreadUnsafeUnigramCandidateSamplerAttr is an optional argument to ThreadUnsafeUnigramCandidateSampler. +type ThreadUnsafeUnigramCandidateSamplerAttr func(optionalAttr) + +// ThreadUnsafeUnigramCandidateSamplerSeed sets the optional seed attribute to value. +// +// value: If either seed or seed2 are set to be non-zero, the random number +// generator is seeded by the given seed. Otherwise, it is seeded by a +// random seed. +// If not specified, defaults to 0 +func ThreadUnsafeUnigramCandidateSamplerSeed(value int64) ThreadUnsafeUnigramCandidateSamplerAttr { + return func(m optionalAttr) { + m["seed"] = value + } +} + +// ThreadUnsafeUnigramCandidateSamplerSeed2 sets the optional seed2 attribute to value. +// +// value: An second seed to avoid seed collision. +// If not specified, defaults to 0 +func ThreadUnsafeUnigramCandidateSamplerSeed2(value int64) ThreadUnsafeUnigramCandidateSamplerAttr { + return func(m optionalAttr) { + m["seed2"] = value + } +} + +// Generates labels for candidate sampling with a learned unigram distribution. +// +// See explanations of candidate sampling and the data formats at +// go/candidate-sampling. +// +// For each batch, this op picks a single set of sampled candidate labels. +// +// The advantages of sampling candidates per-batch are simplicity and the +// possibility of efficient dense matrix multiplication. The disadvantage is that +// the sampled candidates must be chosen independently of the context and of the +// true labels. +// +// Arguments: +// +// true_classes: A batch_size * num_true matrix, in which each row contains the +// +// IDs of the num_true target_classes in the corresponding original label. +// +// num_true: Number of true labels per context. +// num_sampled: Number of candidates to randomly sample. +// unique: If unique is true, we sample with rejection, so that all sampled +// +// candidates in a batch are unique. This requires some approximation to +// estimate the post-rejection sampling probabilities. +// +// range_max: The sampler will sample integers from the interval [0, range_max). +// +// Returns: +// +// sampled_candidates: A vector of length num_sampled, in which each element is +// +// the ID of a sampled candidate. +// +// true_expected_count: A batch_size * num_true matrix, representing +// +// the number of times each candidate is expected to occur in a batch +// of sampled candidates. If unique=true, then this is a probability. +// +// sampled_expected_count: A vector of length num_sampled, for each sampled +// +// candidate representing the number of times the candidate is expected +// to occur in a batch of sampled candidates. If unique=true, then this is a +// probability. +func ThreadUnsafeUnigramCandidateSampler(scope *Scope, true_classes tf.Output, num_true int64, num_sampled int64, unique bool, range_max int64, optional ...ThreadUnsafeUnigramCandidateSamplerAttr) (sampled_candidates tf.Output, true_expected_count tf.Output, sampled_expected_count tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_true": num_true, "num_sampled": num_sampled, "unique": unique, "range_max": range_max} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ThreadUnsafeUnigramCandidateSampler", + Input: []tf.Input{ + true_classes, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// VariableShapeAttr is an optional argument to VariableShape. +type VariableShapeAttr func(optionalAttr) + +// VariableShapeOutType sets the optional out_type attribute to value. +// If not specified, defaults to DT_INT32 +func VariableShapeOutType(value tf.DataType) VariableShapeAttr { + return func(m optionalAttr) { + m["out_type"] = value + } +} + +// Returns the shape of the variable pointed to by `resource`. +// +// This operation returns a 1-D integer tensor representing the shape of `input`. +// +// For example: +// +// ``` +// # 't' is [[[1, 1, 1], [2, 2, 2]], [[3, 3, 3], [4, 4, 4]]] +// shape(t) ==> [2, 2, 3] +// ``` +func VariableShape(scope *Scope, input tf.Output, optional ...VariableShapeAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "VariableShape", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Shuffle dimensions of x according to a permutation. +// +// The output `y` has the same rank as `x`. The shapes of `x` and `y` satisfy: +// +// `y.shape[i] == x.shape[perm[i]] for i in [0, 1, ..., rank(x) - 1]` +func Transpose(scope *Scope, x tf.Output, perm tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Transpose", + Input: []tf.Input{ + x, perm, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ResourceApplyAdamWithAmsgradAttr is an optional argument to ResourceApplyAdamWithAmsgrad. +type ResourceApplyAdamWithAmsgradAttr func(optionalAttr) + +// ResourceApplyAdamWithAmsgradUseLocking sets the optional use_locking attribute to value. +// +// value: If `True`, updating of the var, m, and v tensors will be protected +// by a lock; otherwise the behavior is undefined, but may exhibit less +// contention. +// If not specified, defaults to false +func ResourceApplyAdamWithAmsgradUseLocking(value bool) ResourceApplyAdamWithAmsgradAttr { + return func(m optionalAttr) { + m["use_locking"] = value + } +} + +// Update '*var' according to the Adam algorithm. +// +// $$\text{lr}_t := \mathrm{learning_rate} * \sqrt{1 - \beta_2^t} / (1 - \beta_1^t)$$ +// $$m_t := \beta_1 * m_{t-1} + (1 - \beta_1) * g$$ +// $$v_t := \beta_2 * v_{t-1} + (1 - \beta_2) * g * g$$ +// $$\hat{v}_t := max{\hat{v}_{t-1}, v_t}$$ +// $$\text{variable} := \text{variable} - \text{lr}_t * m_t / (\sqrt{\hat{v}_t} + \epsilon)$$ +// +// Arguments: +// +// var_: Should be from a Variable(). +// m: Should be from a Variable(). +// v: Should be from a Variable(). +// vhat: Should be from a Variable(). +// beta1_power: Must be a scalar. +// beta2_power: Must be a scalar. +// lr: Scaling factor. Must be a scalar. +// beta1: Momentum factor. Must be a scalar. +// beta2: Momentum factor. Must be a scalar. +// epsilon: Ridge term. Must be a scalar. +// grad: The gradient. +// +// Returns the created operation. +func ResourceApplyAdamWithAmsgrad(scope *Scope, var_ tf.Output, m tf.Output, v tf.Output, vhat tf.Output, beta1_power tf.Output, beta2_power tf.Output, lr tf.Output, beta1 tf.Output, beta2 tf.Output, epsilon tf.Output, grad tf.Output, optional ...ResourceApplyAdamWithAmsgradAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ResourceApplyAdamWithAmsgrad", + Input: []tf.Input{ + var_, m, v, vhat, beta1_power, beta2_power, lr, beta1, beta2, epsilon, grad, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// InfeedEnqueueAttr is an optional argument to InfeedEnqueue. +type InfeedEnqueueAttr func(optionalAttr) + +// InfeedEnqueueShape sets the optional shape attribute to value. +// +// value: The shape of the tensor. +// If not specified, defaults to <> +func InfeedEnqueueShape(value tf.Shape) InfeedEnqueueAttr { + return func(m optionalAttr) { + m["shape"] = value + } +} + +// InfeedEnqueueLayout sets the optional layout attribute to value. +// +// value: A vector holding the requested layout in minor-to-major sequence. +// If a layout attribute is passed, but its values are all -1, the layout will +// be computed by the infeed operation. +// If not specified, defaults to <> +func InfeedEnqueueLayout(value []int64) InfeedEnqueueAttr { + return func(m optionalAttr) { + m["layout"] = value + } +} + +// InfeedEnqueueDeviceOrdinal sets the optional device_ordinal attribute to value. +// +// value: The TPU device to use. This should be -1 when the Op +// is running on a TPU device, and >= 0 when the Op is running on the CPU +// device. +// If not specified, defaults to -1 +func InfeedEnqueueDeviceOrdinal(value int64) InfeedEnqueueAttr { + return func(m optionalAttr) { + m["device_ordinal"] = value + } +} + +// An op which feeds a single Tensor value into the computation. +// +// Arguments: +// +// input: A tensor that will be provided using the infeed mechanism. +// +// Returns the created operation. +func InfeedEnqueue(scope *Scope, input tf.Output, optional ...InfeedEnqueueAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "InfeedEnqueue", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// Op that loads and executes a TPU program on a TPU device. +// +// For the internal use of the distributed TPU compiler. +func TPUExecute(scope *Scope, args []tf.Output, key tf.Output, Tresults []tf.DataType) (results []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"Tresults": Tresults} + opspec := tf.OpSpec{ + Type: "TPUExecute", + Input: []tf.Input{ + tf.OutputList(args), key, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if results, idx, err = makeOutputList(op, idx, "results"); err != nil { + scope.UpdateErr("TPUExecute", err) + return + } + return results +} + +// Returns the item in the list with the given index. +// +// input_handle: the list +// index: the position in the list from which an element will be retrieved +// item: the element at that position +func TensorListGetItem(scope *Scope, input_handle tf.Output, index tf.Output, element_shape tf.Output, element_dtype tf.DataType) (item tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"element_dtype": element_dtype} + opspec := tf.OpSpec{ + Type: "TensorListGetItem", + Input: []tf.Input{ + input_handle, index, element_shape, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes the power of one value to another. +// +// Given a tensor `x` and a tensor `y`, this operation computes \\(x^y\\) for +// corresponding elements in `x` and `y`. For example: +// +// ``` +// # tensor 'x' is [[2, 2]], [3, 3]] +// # tensor 'y' is [[8, 16], [2, 3]] +// tf.pow(x, y) ==> [[256, 65536], [9, 27]] +// ``` +func Pow(scope *Scope, x tf.Output, y tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Pow", + Input: []tf.Input{ + x, y, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes requantization range per channel. +// +// Arguments: +// +// input: The original input tensor. +// input_min: The minimum value of the input tensor +// input_max: The maximum value of the input tensor. +// clip_value_max: The maximum value of the output that needs to be clipped. +// +// Example: set this to 6 for Relu6. +// +// Returns: +// +// output_min: The minimum value of the final output tensor +// output_max: The maximum value of the final output tensor. +func RequantizationRangePerChannel(scope *Scope, input tf.Output, input_min tf.Output, input_max tf.Output, clip_value_max float32) (output_min tf.Output, output_max tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"clip_value_max": clip_value_max} + opspec := tf.OpSpec{ + Type: "RequantizationRangePerChannel", + Input: []tf.Input{ + input, input_min, input_max, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// Wraps the XLA DynamicUpdateSlice operator, documented at +// +// https://www.tensorflow.org/performance/xla/operation_semantics#dynamicupdateslice +// +// . +// +// XlaDynamicUpdateSlice generates a result which is the value of the `input` +// operand, with a slice update overwritten at `indices`. The shape of `update` +// determines the shape of the sub-array of the result which is updated. The shape +// of indices must be rank == 1, with dimension size equal to the rank of `input`. +// +// Handling of out-of-bounds slice indices is implementation-defined. +// +// Arguments: +// +// input: A `Tensor` of type T. +// update: A `Tensor` of type T. Same rank as `input`. +// indices: A vector of indices into `input`. Must have length equal to the rank of +// +// `input`. +// +// Returns A `Tensor` of type T. +func XlaDynamicUpdateSlice(scope *Scope, input tf.Output, update tf.Output, indices tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "XlaDynamicUpdateSlice", + Input: []tf.Input{ + input, update, indices, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// RandomShuffleAttr is an optional argument to RandomShuffle. +type RandomShuffleAttr func(optionalAttr) + +// RandomShuffleSeed sets the optional seed attribute to value. +// +// value: If either `seed` or `seed2` are set to be non-zero, the random number +// generator is seeded by the given seed. Otherwise, it is seeded by a +// random seed. +// If not specified, defaults to 0 +func RandomShuffleSeed(value int64) RandomShuffleAttr { + return func(m optionalAttr) { + m["seed"] = value + } +} + +// RandomShuffleSeed2 sets the optional seed2 attribute to value. +// +// value: A second seed to avoid seed collision. +// If not specified, defaults to 0 +func RandomShuffleSeed2(value int64) RandomShuffleAttr { + return func(m optionalAttr) { + m["seed2"] = value + } +} + +// Randomly shuffles a tensor along its first dimension. +// +// The tensor is shuffled along dimension 0, such that each `value[j]` is mapped +// to one and only one `output[i]`. For example, a mapping that might occur for a +// 3x2 tensor is: +// +// ``` +// [[1, 2], [[5, 6], +// +// [3, 4], ==> [1, 2], +// [5, 6]] [3, 4]] +// +// ``` +// +// Arguments: +// +// value: The tensor to be shuffled. +// +// Returns A tensor of same shape and type as `value`, shuffled along its first +// dimension. +func RandomShuffle(scope *Scope, value tf.Output, optional ...RandomShuffleAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "RandomShuffle", + Input: []tf.Input{ + value, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// NonMaxSuppressionV4Attr is an optional argument to NonMaxSuppressionV4. +type NonMaxSuppressionV4Attr func(optionalAttr) + +// NonMaxSuppressionV4PadToMaxOutputSize sets the optional pad_to_max_output_size attribute to value. +// +// value: If true, the output `selected_indices` is padded to be of length +// `max_output_size`. Defaults to false. +// If not specified, defaults to false +func NonMaxSuppressionV4PadToMaxOutputSize(value bool) NonMaxSuppressionV4Attr { + return func(m optionalAttr) { + m["pad_to_max_output_size"] = value + } +} + +// Greedily selects a subset of bounding boxes in descending order of score, +// +// pruning away boxes that have high intersection-over-union (IOU) overlap +// with previously selected boxes. Bounding boxes with score less than +// `score_threshold` are removed. Bounding boxes are supplied as +// [y1, x1, y2, x2], where (y1, x1) and (y2, x2) are the coordinates of any +// diagonal pair of box corners and the coordinates can be provided as normalized +// (i.e., lying in the interval [0, 1]) or absolute. Note that this algorithm +// is agnostic to where the origin is in the coordinate system and more +// generally is invariant to orthogonal transformations and translations +// of the coordinate system; thus translating or reflections of the coordinate +// system result in the same boxes being selected by the algorithm. +// The output of this operation is a set of integers indexing into the input +// collection of bounding boxes representing the selected boxes. The bounding +// box coordinates corresponding to the selected indices can then be obtained +// using the `tf.gather operation`. For example: +// +// selected_indices = tf.image.non_max_suppression_v2( +// boxes, scores, max_output_size, iou_threshold, score_threshold) +// selected_boxes = tf.gather(boxes, selected_indices) +// +// Arguments: +// +// boxes: A 2-D float tensor of shape `[num_boxes, 4]`. +// scores: A 1-D float tensor of shape `[num_boxes]` representing a single +// +// score corresponding to each box (each row of boxes). +// +// max_output_size: A scalar integer tensor representing the maximum number of +// +// boxes to be selected by non max suppression. +// +// iou_threshold: A 0-D float tensor representing the threshold for deciding whether +// +// boxes overlap too much with respect to IOU. +// +// score_threshold: A 0-D float tensor representing the threshold for deciding when to remove +// +// boxes based on score. +// +// Returns: +// +// selected_indices: A 1-D integer tensor of shape `[M]` representing the selected +// +// indices from the boxes tensor, where `M <= max_output_size`. +// +// valid_outputs: A 0-D integer tensor representing the number of valid elements in +// +// `selected_indices`, with the valid elements appearing first. +func NonMaxSuppressionV4(scope *Scope, boxes tf.Output, scores tf.Output, max_output_size tf.Output, iou_threshold tf.Output, score_threshold tf.Output, optional ...NonMaxSuppressionV4Attr) (selected_indices tf.Output, valid_outputs tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "NonMaxSuppressionV4", + Input: []tf.Input{ + boxes, scores, max_output_size, iou_threshold, score_threshold, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// Set a summary_writer_interface to record statistics using given stats_aggregator. +// +// Returns the created operation. +func StatsAggregatorSetSummaryWriter(scope *Scope, stats_aggregator tf.Output, summary tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "StatsAggregatorSetSummaryWriter", + Input: []tf.Input{ + stats_aggregator, summary, + }, + } + return scope.AddOperation(opspec) +} + +// AvgPoolGradAttr is an optional argument to AvgPoolGrad. +type AvgPoolGradAttr func(optionalAttr) + +// AvgPoolGradDataFormat sets the optional data_format attribute to value. +// +// value: Specify the data format of the input and output data. With the +// default format "NHWC", the data is stored in the order of: +// +// [batch, in_height, in_width, in_channels]. +// +// Alternatively, the format could be "NCHW", the data storage order of: +// +// [batch, in_channels, in_height, in_width]. +// +// If not specified, defaults to "NHWC" +func AvgPoolGradDataFormat(value string) AvgPoolGradAttr { + return func(m optionalAttr) { + m["data_format"] = value + } +} + +// Computes gradients of the average pooling function. +// +// Arguments: +// +// orig_input_shape: 1-D. Shape of the original input to `avg_pool`. +// grad: 4-D with shape `[batch, height, width, channels]`. Gradients w.r.t. +// +// the output of `avg_pool`. +// +// ksize: The size of the sliding window for each dimension of the input. +// strides: The stride of the sliding window for each dimension of the input. +// padding: The type of padding algorithm to use. +// +// Returns 4-D. Gradients w.r.t. the input of `avg_pool`. +func AvgPoolGrad(scope *Scope, orig_input_shape tf.Output, grad tf.Output, ksize []int64, strides []int64, padding string, optional ...AvgPoolGradAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"ksize": ksize, "strides": strides, "padding": padding} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "AvgPoolGrad", + Input: []tf.Input{ + orig_input_shape, grad, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// StatelessSampleDistortedBoundingBoxAttr is an optional argument to StatelessSampleDistortedBoundingBox. +type StatelessSampleDistortedBoundingBoxAttr func(optionalAttr) + +// StatelessSampleDistortedBoundingBoxAspectRatioRange sets the optional aspect_ratio_range attribute to value. +// +// value: The cropped area of the image must have an aspect ratio = +// width / height within this range. +// If not specified, defaults to +func StatelessSampleDistortedBoundingBoxAspectRatioRange(value []float32) StatelessSampleDistortedBoundingBoxAttr { + return func(m optionalAttr) { + m["aspect_ratio_range"] = value + } +} + +// StatelessSampleDistortedBoundingBoxAreaRange sets the optional area_range attribute to value. +// +// value: The cropped area of the image must contain a fraction of the +// supplied image within this range. +// If not specified, defaults to +func StatelessSampleDistortedBoundingBoxAreaRange(value []float32) StatelessSampleDistortedBoundingBoxAttr { + return func(m optionalAttr) { + m["area_range"] = value + } +} + +// StatelessSampleDistortedBoundingBoxMaxAttempts sets the optional max_attempts attribute to value. +// +// value: Number of attempts at generating a cropped region of the image +// of the specified constraints. After `max_attempts` failures, return the entire +// image. +// If not specified, defaults to 100 +func StatelessSampleDistortedBoundingBoxMaxAttempts(value int64) StatelessSampleDistortedBoundingBoxAttr { + return func(m optionalAttr) { + m["max_attempts"] = value + } +} + +// StatelessSampleDistortedBoundingBoxUseImageIfNoBoundingBoxes sets the optional use_image_if_no_bounding_boxes attribute to value. +// +// value: Controls behavior if no bounding boxes supplied. +// If true, assume an implicit bounding box covering the whole input. If false, +// raise an error. +// If not specified, defaults to false +func StatelessSampleDistortedBoundingBoxUseImageIfNoBoundingBoxes(value bool) StatelessSampleDistortedBoundingBoxAttr { + return func(m optionalAttr) { + m["use_image_if_no_bounding_boxes"] = value + } +} + +// Generate a randomly distorted bounding box for an image deterministically. +// +// Bounding box annotations are often supplied in addition to ground-truth labels +// in image recognition or object localization tasks. A common technique for +// training such a system is to randomly distort an image while preserving its +// content, i.e. *data augmentation*. This Op, given the same `seed`, +// deterministically outputs a randomly distorted localization of an object, i.e. +// bounding box, given an `image_size`, `bounding_boxes` and a series of +// constraints. +// +// The output of this Op is a single bounding box that may be used to crop the +// original image. The output is returned as 3 tensors: `begin`, `size` and +// `bboxes`. The first 2 tensors can be fed directly into `tf.slice` to crop the +// image. The latter may be supplied to `tf.image.draw_bounding_boxes` to visualize +// what the bounding box looks like. +// +// Bounding boxes are supplied and returned as `[y_min, x_min, y_max, x_max]`. The +// bounding box coordinates are floats in `[0.0, 1.0]` relative to the width and +// the height of the underlying image. +// +// The output of this Op is guaranteed to be the same given the same `seed` and is +// independent of how many times the function is called, and independent of global +// seed settings (e.g. `tf.random.set_seed`). +// +// Example usage: +// +// >>> image = np.array([[[1], [2], [3]], [[4], [5], [6]], [[7], [8], [9]]]) +// >>> bbox = tf.constant( +// ... [0.0, 0.0, 1.0, 1.0], dtype=tf.float32, shape=[1, 1, 4]) +// >>> seed = (1, 2) +// >>> # Generate a single distorted bounding box. +// >>> bbox_begin, bbox_size, bbox_draw = ( +// ... tf.image.stateless_sample_distorted_bounding_box( +// ... tf.shape(image), bounding_boxes=bbox, seed=seed)) +// >>> # Employ the bounding box to distort the image. +// >>> tf.slice(image, bbox_begin, bbox_size) +// +// +// >>> # Draw the bounding box in an image summary. +// >>> colors = np.array([[1.0, 0.0, 0.0], [0.0, 0.0, 1.0]]) +// >>> tf.image.draw_bounding_boxes( +// ... tf.expand_dims(tf.cast(image, tf.float32),0), bbox_draw, colors) +// +// +// Note that if no bounding box information is available, setting +// `use_image_if_no_bounding_boxes = true` will assume there is a single implicit +// bounding box covering the whole image. If `use_image_if_no_bounding_boxes` is +// false and no bounding boxes are supplied, an error is raised. +// +// Arguments: +// +// image_size: 1-D, containing `[height, width, channels]`. +// bounding_boxes: 3-D with shape `[batch, N, 4]` describing the N bounding boxes +// +// associated with the image. +// +// min_object_covered: The cropped area of the image must contain at least this +// +// fraction of any bounding box supplied. The value of this parameter should be +// non-negative. In the case of 0, the cropped area does not need to overlap +// any of the bounding boxes supplied. +// +// seed: 1-D with shape `[2]`. The seed to the random number generator. Must have dtype +// +// `int32` or `int64`. (When using XLA, only `int32` is allowed.) +// +// Returns: +// +// begin: 1-D, containing `[offset_height, offset_width, 0]`. Provide as input to +// +// `tf.slice`. +// +// size: 1-D, containing `[target_height, target_width, -1]`. Provide as input to +// +// `tf.slice`. +// +// bboxes: 3-D with shape `[1, 1, 4]` containing the distorted bounding box. +// +// Provide as input to `tf.image.draw_bounding_boxes`. +func StatelessSampleDistortedBoundingBox(scope *Scope, image_size tf.Output, bounding_boxes tf.Output, min_object_covered tf.Output, seed tf.Output, optional ...StatelessSampleDistortedBoundingBoxAttr) (begin tf.Output, size tf.Output, bboxes tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "StatelessSampleDistortedBoundingBox", + Input: []tf.Input{ + image_size, bounding_boxes, min_object_covered, seed, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// Concats all tensors in the list along the 0th dimension. +// +// Requires that all tensors have the same shape except the first dimension. +// +// input_handle: The input list. +// element_shape: The shape of the uninitialized elements in the list. If the first +// +// dimension is not -1, it is assumed that all list elements have the same +// leading dim. +// +// leading_dims: The list of leading dims of uninitialized list elements. Used if +// +// the leading dim of input_handle.element_shape or the element_shape input arg +// is not already set. +// +// tensor: The concated result. +// lengths: Output tensor containing sizes of the 0th dimension of tensors in the list, used for computing the gradient. +func TensorListConcatV2(scope *Scope, input_handle tf.Output, element_shape tf.Output, leading_dims tf.Output, element_dtype tf.DataType) (tensor tf.Output, lengths tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"element_dtype": element_dtype} + opspec := tf.OpSpec{ + Type: "TensorListConcatV2", + Input: []tf.Input{ + input_handle, element_shape, leading_dims, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// Restores tensors from a V2 checkpoint. +// +// For backward compatibility with the V1 format, this Op currently allows +// restoring from a V1 checkpoint as well: +// - This Op first attempts to find the V2 index file pointed to by "prefix", and +// if found proceed to read it as a V2 checkpoint; +// - Otherwise the V1 read path is invoked. +// +// Relying on this behavior is not recommended, as the ability to fall back to read +// V1 might be deprecated and eventually removed. +// +// By default, restores the named tensors in full. If the caller wishes to restore +// specific slices of stored tensors, "shape_and_slices" should be non-empty +// strings and correspondingly well-formed. +// +// Callers must ensure all the named tensors are indeed stored in the checkpoint. +// +// Arguments: +// +// prefix: Must have a single element. The prefix of a V2 checkpoint. +// tensor_names: shape {N}. The names of the tensors to be restored. +// shape_and_slices: shape {N}. The slice specs of the tensors to be restored. +// +// Empty strings indicate that they are non-partitioned tensors. +// +// dtypes: shape {N}. The list of expected dtype for the tensors. Must match +// +// those stored in the checkpoint. +// +// Returns shape {N}. The restored tensors, whose shapes are read from the +// checkpoint directly. +func RestoreV2(scope *Scope, prefix tf.Output, tensor_names tf.Output, shape_and_slices tf.Output, dtypes []tf.DataType) (tensors []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtypes": dtypes} + opspec := tf.OpSpec{ + Type: "RestoreV2", + Input: []tf.Input{ + prefix, tensor_names, shape_and_slices, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if tensors, idx, err = makeOutputList(op, idx, "tensors"); err != nil { + scope.UpdateErr("RestoreV2", err) + return + } + return tensors +} + +// Returns the number of tensors in the input tensor map. +// +// input_handle: the input map +// size: the number of tensors in the map +func TensorMapSize(scope *Scope, input_handle tf.Output) (size tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "TensorMapSize", + Input: []tf.Input{ + input_handle, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// DecodeCompressedAttr is an optional argument to DecodeCompressed. +type DecodeCompressedAttr func(optionalAttr) + +// DecodeCompressedCompressionType sets the optional compression_type attribute to value. +// +// value: A scalar containing either (i) the empty string (no +// compression), (ii) "ZLIB", or (iii) "GZIP". +// If not specified, defaults to "" +func DecodeCompressedCompressionType(value string) DecodeCompressedAttr { + return func(m optionalAttr) { + m["compression_type"] = value + } +} + +// Decompress strings. +// +// This op decompresses each element of the `bytes` input `Tensor`, which +// is assumed to be compressed using the given `compression_type`. +// +// The `output` is a string `Tensor` of the same shape as `bytes`, +// each element containing the decompressed data from the corresponding +// element in `bytes`. +// +// Arguments: +// +// bytes: A Tensor of string which is compressed. +// +// Returns A Tensor with the same shape as input `bytes`, uncompressed +// from bytes. +func DecodeCompressed(scope *Scope, bytes tf.Output, optional ...DecodeCompressedAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "DecodeCompressed", + Input: []tf.Input{ + bytes, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// SpaceToBatch for 4-D tensors of type T. +// +// This is a legacy version of the more general SpaceToBatchND. +// +// Zero-pads and then rearranges (permutes) blocks of spatial data into batch. +// More specifically, this op outputs a copy of the input tensor where values from +// the `height` and `width` dimensions are moved to the `batch` dimension. After +// the zero-padding, both `height` and `width` of the input must be divisible by the +// block size. +// +// Arguments: +// +// input: 4-D with shape `[batch, height, width, depth]`. +// paddings: 2-D tensor of non-negative integers with shape `[2, 2]`. It specifies +// the padding of the input with zeros across the spatial dimensions as follows: +// +// paddings = [[pad_top, pad_bottom], [pad_left, pad_right]] +// +// The effective spatial dimensions of the zero-padded input tensor will be: +// +// height_pad = pad_top + height + pad_bottom +// width_pad = pad_left + width + pad_right +// +// The attr `block_size` must be greater than one. It indicates the block size. +// +// - Non-overlapping blocks of size `block_size x block size` in the height and +// width dimensions are rearranged into the batch dimension at each location. +// - The batch of the output tensor is `batch * block_size * block_size`. +// - Both height_pad and width_pad must be divisible by block_size. +// +// The shape of the output will be: +// +// [batch*block_size*block_size, height_pad/block_size, width_pad/block_size, +// depth] +// +// Some examples: +// +// (1) For the following input of shape `[1, 2, 2, 1]` and block_size of 2: +// +// ``` +// x = [[[[1], [2]], [[3], [4]]]] +// ``` +// +// The output tensor has shape `[4, 1, 1, 1]` and value: +// +// ``` +// [[[[1]]], [[[2]]], [[[3]]], [[[4]]]] +// ``` +// +// (2) For the following input of shape `[1, 2, 2, 3]` and block_size of 2: +// +// ``` +// x = [[[[1, 2, 3], [4, 5, 6]], +// +// [[7, 8, 9], [10, 11, 12]]]] +// +// ``` +// +// The output tensor has shape `[4, 1, 1, 3]` and value: +// +// ``` +// [[[[1, 2, 3]]], [[[4, 5, 6]]], [[[7, 8, 9]]], [[[10, 11, 12]]]] +// ``` +// +// (3) For the following input of shape `[1, 4, 4, 1]` and block_size of 2: +// +// ``` +// x = [[[[1], [2], [3], [4]], +// +// [[5], [6], [7], [8]], +// [[9], [10], [11], [12]], +// [[13], [14], [15], [16]]]] +// +// ``` +// +// The output tensor has shape `[4, 2, 2, 1]` and value: +// +// ``` +// x = [[[[1], [3]], [[9], [11]]], +// +// [[[2], [4]], [[10], [12]]], +// [[[5], [7]], [[13], [15]]], +// [[[6], [8]], [[14], [16]]]] +// +// ``` +// +// (4) For the following input of shape `[2, 2, 4, 1]` and block_size of 2: +// +// ``` +// x = [[[[1], [2], [3], [4]], +// +// [[5], [6], [7], [8]]], +// [[[9], [10], [11], [12]], +// [[13], [14], [15], [16]]]] +// +// ``` +// +// The output tensor has shape `[8, 1, 2, 1]` and value: +// +// ``` +// x = [[[[1], [3]]], [[[9], [11]]], [[[2], [4]]], [[[10], [12]]], +// +// [[[5], [7]]], [[[13], [15]]], [[[6], [8]]], [[[14], [16]]]] +// +// ``` +// +// Among others, this operation is useful for reducing atrous convolution into +// regular convolution. +func SpaceToBatch(scope *Scope, input tf.Output, paddings tf.Output, block_size int64) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"block_size": block_size} + opspec := tf.OpSpec{ + Type: "SpaceToBatch", + Input: []tf.Input{ + input, paddings, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// QuantizeAndDequantizeV4GradAttr is an optional argument to QuantizeAndDequantizeV4Grad. +type QuantizeAndDequantizeV4GradAttr func(optionalAttr) + +// QuantizeAndDequantizeV4GradAxis sets the optional axis attribute to value. +// If not specified, defaults to -1 +func QuantizeAndDequantizeV4GradAxis(value int64) QuantizeAndDequantizeV4GradAttr { + return func(m optionalAttr) { + m["axis"] = value + } +} + +// Returns the gradient of `QuantizeAndDequantizeV4`. +// +// Returns a gradient of 1 for inputs that are within the quantization range, +// or 0 otherwise. +func QuantizeAndDequantizeV4Grad(scope *Scope, gradients tf.Output, input tf.Output, input_min tf.Output, input_max tf.Output, optional ...QuantizeAndDequantizeV4GradAttr) (input_backprop tf.Output, input_min_backprop tf.Output, input_max_backprop tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "QuantizeAndDequantizeV4Grad", + Input: []tf.Input{ + gradients, input, input_min, input_max, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// RandomCropAttr is an optional argument to RandomCrop. +type RandomCropAttr func(optionalAttr) + +// RandomCropSeed sets the optional seed attribute to value. +// +// value: If either seed or seed2 are set to be non-zero, the random number +// generator is seeded by the given seed. Otherwise, it is seeded by a +// random seed. +// If not specified, defaults to 0 +func RandomCropSeed(value int64) RandomCropAttr { + return func(m optionalAttr) { + m["seed"] = value + } +} + +// RandomCropSeed2 sets the optional seed2 attribute to value. +// +// value: An second seed to avoid seed collision. +// If not specified, defaults to 0 +func RandomCropSeed2(value int64) RandomCropAttr { + return func(m optionalAttr) { + m["seed2"] = value + } +} + +// Randomly crop `image`. +// +// DEPRECATED at GraphDef version 8: Random crop is now pure Python +// +// `size` is a 1-D int64 tensor with 2 elements representing the crop height and +// width. The values must be non negative. +// +// This Op picks a random location in `image` and crops a `height` by `width` +// rectangle from that location. The random location is picked so the cropped +// area will fit inside the original image. +// +// Arguments: +// +// image: 3-D of shape `[height, width, channels]`. +// size: 1-D of length 2 containing: `crop_height`, `crop_width`.. +// +// Returns 3-D of shape `[crop_height, crop_width, channels].` +func RandomCrop(scope *Scope, image tf.Output, size tf.Output, optional ...RandomCropAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "RandomCrop", + Input: []tf.Input{ + image, size, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// RepeatDatasetAttr is an optional argument to RepeatDataset. +type RepeatDatasetAttr func(optionalAttr) + +// RepeatDatasetMetadata sets the optional metadata attribute to value. +// If not specified, defaults to "" +func RepeatDatasetMetadata(value string) RepeatDatasetAttr { + return func(m optionalAttr) { + m["metadata"] = value + } +} + +// Creates a dataset that emits the outputs of `input_dataset` `count` times. +// +// Arguments: +// +// count: A scalar representing the number of times that `input_dataset` should +// +// be repeated. A value of `-1` indicates that it should be repeated infinitely. +func RepeatDataset(scope *Scope, input_dataset tf.Output, count tf.Output, output_types []tf.DataType, output_shapes []tf.Shape, optional ...RepeatDatasetAttr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "RepeatDataset", + Input: []tf.Input{ + input_dataset, count, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// SparseTensorDenseMatMulAttr is an optional argument to SparseTensorDenseMatMul. +type SparseTensorDenseMatMulAttr func(optionalAttr) + +// SparseTensorDenseMatMulAdjointA sets the optional adjoint_a attribute to value. +// +// value: Use the adjoint of A in the matrix multiply. If A is complex, this +// is transpose(conj(A)). Otherwise it's transpose(A). +// If not specified, defaults to false +func SparseTensorDenseMatMulAdjointA(value bool) SparseTensorDenseMatMulAttr { + return func(m optionalAttr) { + m["adjoint_a"] = value + } +} + +// SparseTensorDenseMatMulAdjointB sets the optional adjoint_b attribute to value. +// +// value: Use the adjoint of B in the matrix multiply. If B is complex, this +// is transpose(conj(B)). Otherwise it's transpose(B). +// If not specified, defaults to false +func SparseTensorDenseMatMulAdjointB(value bool) SparseTensorDenseMatMulAttr { + return func(m optionalAttr) { + m["adjoint_b"] = value + } +} + +// Multiply SparseTensor (of rank 2) "A" by dense matrix "B". +// +// No validity checking is performed on the indices of A. However, the following +// input format is recommended for optimal behavior: +// +// if adjoint_a == false: +// +// A should be sorted in lexicographically increasing order. Use SparseReorder +// if you're not sure. +// +// if adjoint_a == true: +// +// A should be sorted in order of increasing dimension 1 (i.e., "column major" +// order instead of "row major" order). +// +// Arguments: +// +// a_indices: 2-D. The `indices` of the `SparseTensor`, size `[nnz, 2]` Matrix. +// a_values: 1-D. The `values` of the `SparseTensor`, size `[nnz]` Vector. +// a_shape: 1-D. The `shape` of the `SparseTensor`, size `[2]` Vector. +// b: 2-D. A dense Matrix. +func SparseTensorDenseMatMul(scope *Scope, a_indices tf.Output, a_values tf.Output, a_shape tf.Output, b tf.Output, optional ...SparseTensorDenseMatMulAttr) (product tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "SparseTensorDenseMatMul", + Input: []tf.Input{ + a_indices, a_values, a_shape, b, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Wraps the XLA Sort operator, documented at +// +// https://www.tensorflow.org/performance/xla/operation_semantics#sort +// +// . +// +// Sorts a tensor. Currently only sorts in ascending order are supported. +// +// Arguments: +// +// keys: A `Tensor` of type K. +// values: A `Tensor` of type V. +// +// Returns: +// +// sorted_keys: A `Tensor` of type K. +// sorted_values: A `Tensor` of type V. +func XlaKeyValueSort(scope *Scope, keys tf.Output, values tf.Output) (sorted_keys tf.Output, sorted_values tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "XlaKeyValueSort", + Input: []tf.Input{ + keys, values, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// QuantizedConv2DAttr is an optional argument to QuantizedConv2D. +type QuantizedConv2DAttr func(optionalAttr) + +// QuantizedConv2DOutType sets the optional out_type attribute to value. +// If not specified, defaults to DT_QINT32 +func QuantizedConv2DOutType(value tf.DataType) QuantizedConv2DAttr { + return func(m optionalAttr) { + m["out_type"] = value + } +} + +// QuantizedConv2DDilations sets the optional dilations attribute to value. +// +// value: 1-D tensor of length 4. The dilation factor for each dimension of +// `input`. If set to k > 1, there will be k-1 skipped cells between each +// filter element on that dimension. The dimension order is determined by the +// value of `data_format`, see above for details. Dilations in the batch and +// depth dimensions must be 1. +// If not specified, defaults to +func QuantizedConv2DDilations(value []int64) QuantizedConv2DAttr { + return func(m optionalAttr) { + m["dilations"] = value + } +} + +// Computes a 2D convolution given quantized 4D input and filter tensors. +// +// The inputs are quantized tensors where the lowest value represents the real +// number of the associated minimum, and the highest represents the maximum. +// This means that you can only interpret the quantized output in the same way, by +// taking the returned minimum and maximum values into account. +// +// Arguments: +// +// filter: filter's input_depth dimension must match input's depth dimensions. +// min_input: The float value that the lowest quantized input value represents. +// max_input: The float value that the highest quantized input value represents. +// min_filter: The float value that the lowest quantized filter value represents. +// max_filter: The float value that the highest quantized filter value represents. +// strides: The stride of the sliding window for each dimension of the input +// +// tensor. +// +// padding: The type of padding algorithm to use. +// +// Returns: +// +// output +// min_output: The float value that the lowest quantized output value represents. +// max_output: The float value that the highest quantized output value represents. +func QuantizedConv2D(scope *Scope, input tf.Output, filter tf.Output, min_input tf.Output, max_input tf.Output, min_filter tf.Output, max_filter tf.Output, strides []int64, padding string, optional ...QuantizedConv2DAttr) (output tf.Output, min_output tf.Output, max_output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"strides": strides, "padding": padding} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "QuantizedConv2D", + Input: []tf.Input{ + input, filter, min_input, max_input, min_filter, max_filter, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// ResourceApplyAdamAttr is an optional argument to ResourceApplyAdam. +type ResourceApplyAdamAttr func(optionalAttr) + +// ResourceApplyAdamUseLocking sets the optional use_locking attribute to value. +// +// value: If `True`, updating of the var, m, and v tensors will be protected +// by a lock; otherwise the behavior is undefined, but may exhibit less +// contention. +// If not specified, defaults to false +func ResourceApplyAdamUseLocking(value bool) ResourceApplyAdamAttr { + return func(m optionalAttr) { + m["use_locking"] = value + } +} + +// ResourceApplyAdamUseNesterov sets the optional use_nesterov attribute to value. +// +// value: If `True`, uses the nesterov update. +// If not specified, defaults to false +func ResourceApplyAdamUseNesterov(value bool) ResourceApplyAdamAttr { + return func(m optionalAttr) { + m["use_nesterov"] = value + } +} + +// Update '*var' according to the Adam algorithm. +// +// $$\text{lr}_t := \mathrm{learning_rate} * \sqrt{1 - \beta_2^t} / (1 - \beta_1^t)$$ +// $$m_t := \beta_1 * m_{t-1} + (1 - \beta_1) * g$$ +// $$v_t := \beta_2 * v_{t-1} + (1 - \beta_2) * g * g$$ +// $$\text{variable} := \text{variable} - \text{lr}_t * m_t / (\sqrt{v_t} + \epsilon)$$ +// +// Arguments: +// +// var_: Should be from a Variable(). +// m: Should be from a Variable(). +// v: Should be from a Variable(). +// beta1_power: Must be a scalar. +// beta2_power: Must be a scalar. +// lr: Scaling factor. Must be a scalar. +// beta1: Momentum factor. Must be a scalar. +// beta2: Momentum factor. Must be a scalar. +// epsilon: Ridge term. Must be a scalar. +// grad: The gradient. +// +// Returns the created operation. +func ResourceApplyAdam(scope *Scope, var_ tf.Output, m tf.Output, v tf.Output, beta1_power tf.Output, beta2_power tf.Output, lr tf.Output, beta1 tf.Output, beta2 tf.Output, epsilon tf.Output, grad tf.Output, optional ...ResourceApplyAdamAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ResourceApplyAdam", + Input: []tf.Input{ + var_, m, v, beta1_power, beta2_power, lr, beta1, beta2, epsilon, grad, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// OutfeedDequeueTupleAttr is an optional argument to OutfeedDequeueTuple. +type OutfeedDequeueTupleAttr func(optionalAttr) + +// OutfeedDequeueTupleDeviceOrdinal sets the optional device_ordinal attribute to value. +// +// value: The TPU device to use. This should be -1 when the Op +// is running on a TPU device, and >= 0 when the Op is running on the CPU +// device. +// If not specified, defaults to -1 +func OutfeedDequeueTupleDeviceOrdinal(value int64) OutfeedDequeueTupleAttr { + return func(m optionalAttr) { + m["device_ordinal"] = value + } +} + +// Retrieve multiple values from the computation outfeed. +// +// This operation will block indefinitely until data is available. Output `i` +// corresponds to XLA tuple element `i`. +// +// Arguments: +// +// dtypes: The element types of each element in `outputs`. +// shapes: The shapes of each tensor in `outputs`. +// +// Returns A list of tensors that will be read from the outfeed. +func OutfeedDequeueTuple(scope *Scope, dtypes []tf.DataType, shapes []tf.Shape, optional ...OutfeedDequeueTupleAttr) (outputs []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtypes": dtypes, "shapes": shapes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "OutfeedDequeueTuple", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if outputs, idx, err = makeOutputList(op, idx, "outputs"); err != nil { + scope.UpdateErr("OutfeedDequeueTuple", err) + return + } + return outputs +} + +// Does nothing. Serves as a control trigger for scheduling. +// +// Only useful as a placeholder for control edges. +// +// Returns the created operation. +func ControlTrigger(scope *Scope) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "ControlTrigger", + } + return scope.AddOperation(opspec) +} + +// Encodes a `RaggedTensor` into a `variant` Tensor. +// +// Encodes the given `RaggedTensor` and returns a `variant` Tensor. If +// `batched_input` is True, then input `RaggedTensor` is unbatched along the +// zero-th dimension, each component `RaggedTensor` is encoded into a scalar +// `variant` Tensor, and these are stacked to return a 1-D `variant` Tensor. +// If `batched_input` is False, then the input `RaggedTensor` is encoded as is and +// a scalar `variant` Tensor is returned. A `RaggedTensor` is encoded by first +// creating a 1-D `variant` Tensor with `ragged_rank + 1` elements, containing the +// splits and values Tensors of the `RaggedTensor`. Then the 1-D `variant` Tensor +// is wrapped in a scalar `variant` Tensor. See `RaggedTensorFromVariant` for the +// corresponding decoding logic. +// +// Arguments: +// +// rt_nested_splits: A list of one or more Tensors representing the splits of the input +// +// `RaggedTensor`. +// +// rt_dense_values: A Tensor representing the values of the input `RaggedTensor`. +// batched_input: A `bool` denoting whether the input is a batched `RaggedTensor`. +// +// Returns A `variant` Tensor that containing encoded `RaggedTensor`. +func RaggedTensorToVariant(scope *Scope, rt_nested_splits []tf.Output, rt_dense_values tf.Output, batched_input bool) (encoded_ragged tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"batched_input": batched_input} + opspec := tf.OpSpec{ + Type: "RaggedTensorToVariant", + Input: []tf.Input{ + tf.OutputList(rt_nested_splits), rt_dense_values, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ResourceSparseApplyProximalGradientDescentAttr is an optional argument to ResourceSparseApplyProximalGradientDescent. +type ResourceSparseApplyProximalGradientDescentAttr func(optionalAttr) + +// ResourceSparseApplyProximalGradientDescentUseLocking sets the optional use_locking attribute to value. +// +// value: If True, the subtraction will be protected by a lock; +// otherwise the behavior is undefined, but may exhibit less contention. +// If not specified, defaults to false +func ResourceSparseApplyProximalGradientDescentUseLocking(value bool) ResourceSparseApplyProximalGradientDescentAttr { + return func(m optionalAttr) { + m["use_locking"] = value + } +} + +// Sparse update '*var' as FOBOS algorithm with fixed learning rate. +// +// That is for rows we have grad for, we update var as follows: +// prox_v = var - alpha * grad +// var = sign(prox_v)/(1+alpha*l2) * max{|prox_v|-alpha*l1,0} +// +// Arguments: +// +// var_: Should be from a Variable(). +// alpha: Scaling factor. Must be a scalar. +// l1: L1 regularization. Must be a scalar. +// l2: L2 regularization. Must be a scalar. +// grad: The gradient. +// indices: A vector of indices into the first dimension of var and accum. +// +// Returns the created operation. +func ResourceSparseApplyProximalGradientDescent(scope *Scope, var_ tf.Output, alpha tf.Output, l1 tf.Output, l2 tf.Output, grad tf.Output, indices tf.Output, optional ...ResourceSparseApplyProximalGradientDescentAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ResourceSparseApplyProximalGradientDescent", + Input: []tf.Input{ + var_, alpha, l1, l2, grad, indices, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// RandomPoissonV2Attr is an optional argument to RandomPoissonV2. +type RandomPoissonV2Attr func(optionalAttr) + +// RandomPoissonV2Seed sets the optional seed attribute to value. +// +// value: If either `seed` or `seed2` are set to be non-zero, the random number +// generator is seeded by the given seed. Otherwise, it is seeded by a +// random seed. +// If not specified, defaults to 0 +func RandomPoissonV2Seed(value int64) RandomPoissonV2Attr { + return func(m optionalAttr) { + m["seed"] = value + } +} + +// RandomPoissonV2Seed2 sets the optional seed2 attribute to value. +// +// value: A second seed to avoid seed collision. +// If not specified, defaults to 0 +func RandomPoissonV2Seed2(value int64) RandomPoissonV2Attr { + return func(m optionalAttr) { + m["seed2"] = value + } +} + +// RandomPoissonV2Dtype sets the optional dtype attribute to value. +// If not specified, defaults to DT_INT64 +func RandomPoissonV2Dtype(value tf.DataType) RandomPoissonV2Attr { + return func(m optionalAttr) { + m["dtype"] = value + } +} + +// Outputs random values from the Poisson distribution(s) described by rate. +// +// This op uses two algorithms, depending on rate. If rate >= 10, then +// the algorithm by Hormann is used to acquire samples via +// transformation-rejection. +// See http://www.sciencedirect.com/science/article/pii/0167668793909974. +// +// Otherwise, Knuth's algorithm is used to acquire samples via multiplying uniform +// random variables. +// See Donald E. Knuth (1969). Seminumerical Algorithms. The Art of Computer +// Programming, Volume 2. Addison Wesley +// +// Arguments: +// +// shape: 1-D integer tensor. Shape of independent samples to draw from each +// +// distribution described by the shape parameters given in rate. +// +// rate: A tensor in which each scalar is a "rate" parameter describing the +// +// associated poisson distribution. +// +// Returns A tensor with shape `shape + shape(rate)`. Each slice +// `[:, ..., :, i0, i1, ...iN]` contains the samples drawn for +// `rate[i0, i1, ...iN]`. +func RandomPoissonV2(scope *Scope, shape tf.Output, rate tf.Output, optional ...RandomPoissonV2Attr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "RandomPoissonV2", + Input: []tf.Input{ + shape, rate, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Convert a (possibly batched) CSRSparseMatrix to dense. +// +// Arguments: +// +// sparse_input: A batched CSRSparseMatrix. +// +// Returns A dense tensor. +func CSRSparseMatrixToDense(scope *Scope, sparse_input tf.Output, type_ tf.DataType) (dense_output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"type": type_} + opspec := tf.OpSpec{ + Type: "CSRSparseMatrixToDense", + Input: []tf.Input{ + sparse_input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// StridedSliceAttr is an optional argument to StridedSlice. +type StridedSliceAttr func(optionalAttr) + +// StridedSliceBeginMask sets the optional begin_mask attribute to value. +// +// value: a bitmask where a bit i being 1 means to ignore the begin +// value and instead use the largest interval possible. At runtime +// begin[i] will be replaced with `[0, n-1)` if `stride[i] > 0` or +// `[-1, n-1]` if `stride[i] < 0` +// If not specified, defaults to 0 +func StridedSliceBeginMask(value int64) StridedSliceAttr { + return func(m optionalAttr) { + m["begin_mask"] = value + } +} + +// StridedSliceEndMask sets the optional end_mask attribute to value. +// +// value: analogous to `begin_mask` +// If not specified, defaults to 0 +func StridedSliceEndMask(value int64) StridedSliceAttr { + return func(m optionalAttr) { + m["end_mask"] = value + } +} + +// StridedSliceEllipsisMask sets the optional ellipsis_mask attribute to value. +// +// value: a bitmask where bit `i` being 1 means the `i`th +// position is actually an ellipsis. One bit at most can be 1. +// If `ellipsis_mask == 0`, then an implicit ellipsis mask of `1 << (m+1)` +// is provided. This means that `foo[3:5] == foo[3:5, ...]`. An ellipsis +// implicitly creates as many range specifications as necessary to fully +// specify the sliced range for every dimension. For example for a 4-dimensional +// tensor `foo` the slice `foo[2, ..., 5:8]` implies `foo[2, :, :, 5:8]`. +// If not specified, defaults to 0 +func StridedSliceEllipsisMask(value int64) StridedSliceAttr { + return func(m optionalAttr) { + m["ellipsis_mask"] = value + } +} + +// StridedSliceNewAxisMask sets the optional new_axis_mask attribute to value. +// +// value: a bitmask where bit `i` being 1 means the `i`th +// specification creates a new shape 1 dimension. For example +// `foo[:4, tf.newaxis, :2]` would produce a shape `(4, 1, 2)` tensor. +// If not specified, defaults to 0 +func StridedSliceNewAxisMask(value int64) StridedSliceAttr { + return func(m optionalAttr) { + m["new_axis_mask"] = value + } +} + +// StridedSliceShrinkAxisMask sets the optional shrink_axis_mask attribute to value. +// +// value: a bitmask where bit `i` implies that the `i`th +// specification should shrink the dimensionality. begin and end +// must imply a slice of size 1 in the dimension. For example in +// python one might do `foo[:, 3, :]` which would result in +// `shrink_axis_mask` being 2. +// If not specified, defaults to 0 +func StridedSliceShrinkAxisMask(value int64) StridedSliceAttr { + return func(m optionalAttr) { + m["shrink_axis_mask"] = value + } +} + +// Return a strided slice from `input`. +// +// Note, most python users will want to use the Python `Tensor.__getitem__` +// or `Variable.__getitem__` rather than this op directly. +// +// The goal of this op is to produce a new tensor with a subset of +// the elements from the `n` dimensional `input` tensor. The subset is chosen using +// a sequence of `m` sparse range specifications encoded into the arguments +// of this function. Note, in some cases +// `m` could be equal to `n`, but this need not be the case. Each +// range specification entry can be one of the following: +// +// - An ellipsis (...). Ellipses are used to imply zero or more +// dimensions of full-dimension selection and are produced using +// `ellipsis_mask`. For example, `foo[...]` is the identity slice. +// +// - A new axis. This is used to insert a new shape=1 dimension and is +// produced using `new_axis_mask`. For example, `foo[:, ...]` where +// `foo` is shape `(3, 4)` produces a `(1, 3, 4)` tensor. +// +// - A range `begin:end:stride`. This is used to specify how much to choose from +// a given dimension. `stride` can be any integer but 0. `begin` is an integer +// which represents the index of the first value to select while `end` represents +// the index of the last value to select. The number of values selected in each +// dimension is `end - begin` if `stride > 0` and `begin - end` if `stride < 0`. +// `begin` and `end` can be negative where `-1` is the last element, `-2` is +// the second to last. `begin_mask` controls whether to replace the explicitly +// given `begin` with an implicit effective value of `0` if `stride > 0` and +// `-1` if `stride < 0`. `end_mask` is analogous but produces the number +// required to create the largest open interval. For example, given a shape +// `(3,)` tensor `foo[:]`, the effective `begin` and `end` are `0` and `3`. Do +// not assume this is equivalent to `foo[0:-1]` which has an effective `begin` +// and `end` of `0` and `2`. Another example is `foo[-2::-1]` which reverses the +// first dimension of a tensor while dropping the last two (in the original +// order elements). For example `foo = [1,2,3,4]; foo[-2::-1]` is `[4,3]`. +// +// - A single index. This is used to keep only elements that have a given +// index. For example (`foo[2, :]` on a shape `(5,6)` tensor produces a +// shape `(6,)` tensor. This is encoded in `begin` and `end` and +// `shrink_axis_mask`. +// +// Each conceptual range specification is encoded in the op's argument. This +// encoding is best understand by considering a non-trivial example. In +// particular, +// `foo[1, 2:4, None, ..., :-3:-1, :]` will be encoded as +// +// ``` +// begin = [1, 2, x, x, 0, x] # x denotes don't care (usually 0) +// end = [2, 4, x, x, -3, x] +// strides = [1, 1, x, x, -1, 1] +// begin_mask = 1<<4 | 1<<5 = 48 +// end_mask = 1<<5 = 32 +// ellipsis_mask = 1<<3 = 8 +// new_axis_mask = 1<<2 = 4 +// shrink_axis_mask = 1<<0 = 1 +// ``` +// +// In this case if `foo.shape` is (5, 5, 5, 5, 5, 5) the final shape of +// the slice becomes (2, 1, 5, 5, 2, 5). +// Let us walk step by step through each argument specification. +// +// 1. The first argument in the example slice is turned into `begin = 1` and +// `end = begin + 1 = 2`. To disambiguate from the original spec `2:4` we +// also set the appropriate bit in `shrink_axis_mask`. +// +// 2. `2:4` is contributes 2, 4, 1 to begin, end, and stride. All masks have +// zero bits contributed. +// +// 3. None is a synonym for `tf.newaxis`. This means insert a dimension of size 1 +// dimension in the final shape. Dummy values are contributed to begin, +// end and stride, while the new_axis_mask bit is set. +// +// 4. `...` grab the full ranges from as many dimensions as needed to +// fully specify a slice for every dimension of the input shape. +// +// 5. `:-3:-1` shows the use of negative indices. A negative index `i` associated +// with a dimension that has shape `s` is converted to a positive index +// `s + i`. So `-1` becomes `s-1` (i.e. the last element). This conversion +// is done internally so begin, end and strides receive x, -3, and -1. +// The appropriate begin_mask bit is set to indicate the start range is the +// full range (ignoring the x). +// +// 6. `:` indicates that the entire contents of the corresponding dimension +// is selected. This is equivalent to `::` or `0::1`. begin, end, and strides +// receive 0, 0, and 1, respectively. The appropriate bits in `begin_mask` and +// `end_mask` are also set. +// +// *Requirements*: +// +// `0 != strides[i] for i in [0, m)` +// `ellipsis_mask must be a power of two (only one ellipsis)` +// +// Arguments: +// +// begin: `begin[k]` specifies the offset into the `k`th range specification. +// +// The exact dimension this corresponds to will be determined by context. +// Out-of-bounds values will be silently clamped. If the `k`th bit of +// `begin_mask` then `begin[k]` is ignored and the full range of the +// appropriate dimension is used instead. Negative values causes indexing +// to start from the highest element e.g. If `foo==[1,2,3]` then `foo[-1]==3`. +// +// end: `end[i]` is like `begin` with the exception that `end_mask` is +// +// used to determine full ranges. +// +// strides: `strides[i]` specifies the increment in the `i`th specification +// +// after extracting a given element. Negative indices will reverse +// the original order. Out or range values are +// clamped to `[0,dim[i]) if slice[i]>0` or `[-1,dim[i]-1] if slice[i] < 0` +func StridedSlice(scope *Scope, input tf.Output, begin tf.Output, end tf.Output, strides tf.Output, optional ...StridedSliceAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "StridedSlice", + Input: []tf.Input{ + input, begin, end, strides, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Component-wise divides a SparseTensor by a dense Tensor. +// +// *Limitation*: this Op only broadcasts the dense side to the sparse side, but not +// the other direction. +// +// Arguments: +// +// sp_indices: 2-D. `N x R` matrix with the indices of non-empty values in a +// +// SparseTensor, possibly not in canonical ordering. +// +// sp_values: 1-D. `N` non-empty values corresponding to `sp_indices`. +// sp_shape: 1-D. Shape of the input SparseTensor. +// dense: `R`-D. The dense Tensor operand. +// +// Returns 1-D. The `N` values that are operated on. +func SparseDenseCwiseDiv(scope *Scope, sp_indices tf.Output, sp_values tf.Output, sp_shape tf.Output, dense tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "SparseDenseCwiseDiv", + Input: []tf.Input{ + sp_indices, sp_values, sp_shape, dense, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ResourceApplyPowerSignAttr is an optional argument to ResourceApplyPowerSign. +type ResourceApplyPowerSignAttr func(optionalAttr) + +// ResourceApplyPowerSignUseLocking sets the optional use_locking attribute to value. +// +// value: If `True`, updating of the var and m tensors is +// protected by a lock; otherwise the behavior is undefined, but may exhibit less +// contention. +// If not specified, defaults to false +func ResourceApplyPowerSignUseLocking(value bool) ResourceApplyPowerSignAttr { + return func(m optionalAttr) { + m["use_locking"] = value + } +} + +// Update '*var' according to the AddSign update. +// +// m_t <- beta1 * m_{t-1} + (1 - beta1) * g +// update <- exp(logbase * sign_decay * sign(g) * sign(m_t)) * g +// variable <- variable - lr_t * update +// +// Arguments: +// +// var_: Should be from a Variable(). +// m: Should be from a Variable(). +// lr: Scaling factor. Must be a scalar. +// logbase: Must be a scalar. +// sign_decay: Must be a scalar. +// beta: Must be a scalar. +// grad: The gradient. +// +// Returns the created operation. +func ResourceApplyPowerSign(scope *Scope, var_ tf.Output, m tf.Output, lr tf.Output, logbase tf.Output, sign_decay tf.Output, beta tf.Output, grad tf.Output, optional ...ResourceApplyPowerSignAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ResourceApplyPowerSign", + Input: []tf.Input{ + var_, m, lr, logbase, sign_decay, beta, grad, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// QuantizedDepthwiseConv2DWithBiasAndReluAndRequantizeAttr is an optional argument to QuantizedDepthwiseConv2DWithBiasAndReluAndRequantize. +type QuantizedDepthwiseConv2DWithBiasAndReluAndRequantizeAttr func(optionalAttr) + +// QuantizedDepthwiseConv2DWithBiasAndReluAndRequantizeOutType sets the optional out_type attribute to value. +// +// value: The type of the output. +// If not specified, defaults to DT_QUINT8 +func QuantizedDepthwiseConv2DWithBiasAndReluAndRequantizeOutType(value tf.DataType) QuantizedDepthwiseConv2DWithBiasAndReluAndRequantizeAttr { + return func(m optionalAttr) { + m["out_type"] = value + } +} + +// QuantizedDepthwiseConv2DWithBiasAndReluAndRequantizeDilations sets the optional dilations attribute to value. +// +// value: List of dilation values. +// If not specified, defaults to +func QuantizedDepthwiseConv2DWithBiasAndReluAndRequantizeDilations(value []int64) QuantizedDepthwiseConv2DWithBiasAndReluAndRequantizeAttr { + return func(m optionalAttr) { + m["dilations"] = value + } +} + +// QuantizedDepthwiseConv2DWithBiasAndReluAndRequantizePaddingList sets the optional padding_list attribute to value. +// If not specified, defaults to <> +func QuantizedDepthwiseConv2DWithBiasAndReluAndRequantizePaddingList(value []int64) QuantizedDepthwiseConv2DWithBiasAndReluAndRequantizeAttr { + return func(m optionalAttr) { + m["padding_list"] = value + } +} + +// Computes quantized depthwise Conv2D with Bias, Relu and Requantize. +// +// Arguments: +// +// input: The original input tensor. +// filter: The original filter tensor. +// bias: The original bias tensor. +// min_input: The float value that the minimum quantized input value represents. +// max_input: The float value that the maximum quantized input value represents. +// min_filter: The float value that the minimum quantized filter value represents. +// max_filter: The float value that the maximum quantized filter value represents. +// min_freezed_output: The minimum float value of the output tensor. +// max_freezed_output: The maximum float value of the output tensor. +// strides: List of stride values. +// +// Returns: +// +// output: The output tensor. +// min_output: The float value that the minimum quantized output value represents. +// max_output: The float value that the maximum quantized output value represents. +func QuantizedDepthwiseConv2DWithBiasAndReluAndRequantize(scope *Scope, input tf.Output, filter tf.Output, bias tf.Output, min_input tf.Output, max_input tf.Output, min_filter tf.Output, max_filter tf.Output, min_freezed_output tf.Output, max_freezed_output tf.Output, strides []int64, padding string, optional ...QuantizedDepthwiseConv2DWithBiasAndReluAndRequantizeAttr) (output tf.Output, min_output tf.Output, max_output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"strides": strides, "padding": padding} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "QuantizedDepthwiseConv2DWithBiasAndReluAndRequantize", + Input: []tf.Input{ + input, filter, bias, min_input, max_input, min_filter, max_filter, min_freezed_output, max_freezed_output, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// BoostedTreesEnsembleResourceHandleOpAttr is an optional argument to BoostedTreesEnsembleResourceHandleOp. +type BoostedTreesEnsembleResourceHandleOpAttr func(optionalAttr) + +// BoostedTreesEnsembleResourceHandleOpContainer sets the optional container attribute to value. +// If not specified, defaults to "" +func BoostedTreesEnsembleResourceHandleOpContainer(value string) BoostedTreesEnsembleResourceHandleOpAttr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// BoostedTreesEnsembleResourceHandleOpSharedName sets the optional shared_name attribute to value. +// If not specified, defaults to "" +func BoostedTreesEnsembleResourceHandleOpSharedName(value string) BoostedTreesEnsembleResourceHandleOpAttr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// Creates a handle to a BoostedTreesEnsembleResource +func BoostedTreesEnsembleResourceHandleOp(scope *Scope, optional ...BoostedTreesEnsembleResourceHandleOpAttr) (resource tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "BoostedTreesEnsembleResourceHandleOp", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Elementwise computes the bitwise OR of `x` and `y`. +// +// The result will have those bits set, that are set in `x`, `y` or both. The +// computation is performed on the underlying representations of `x` and `y`. +// +// For example: +// +// ```python +// import tensorflow as tf +// from tensorflow.python.ops import bitwise_ops +// dtype_list = [tf.int8, tf.int16, tf.int32, tf.int64, +// +// tf.uint8, tf.uint16, tf.uint32, tf.uint64] +// +// for dtype in dtype_list: +// +// lhs = tf.constant([0, 5, 3, 14], dtype=dtype) +// rhs = tf.constant([5, 0, 7, 11], dtype=dtype) +// exp = tf.constant([5, 5, 7, 15], dtype=tf.float32) +// +// res = bitwise_ops.bitwise_or(lhs, rhs) +// tf.assert_equal(tf.cast(res, tf.float32), exp) # TRUE +// +// ``` +func BitwiseOr(scope *Scope, x tf.Output, y tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "BitwiseOr", + Input: []tf.Input{ + x, y, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// RangeDatasetAttr is an optional argument to RangeDataset. +type RangeDatasetAttr func(optionalAttr) + +// RangeDatasetMetadata sets the optional metadata attribute to value. +// If not specified, defaults to "" +func RangeDatasetMetadata(value string) RangeDatasetAttr { + return func(m optionalAttr) { + m["metadata"] = value + } +} + +// RangeDatasetReplicateOnSplit sets the optional replicate_on_split attribute to value. +// If not specified, defaults to false +func RangeDatasetReplicateOnSplit(value bool) RangeDatasetAttr { + return func(m optionalAttr) { + m["replicate_on_split"] = value + } +} + +// Creates a dataset with a range of values. Corresponds to python's xrange. +// +// Arguments: +// +// start: corresponds to start in python's xrange(). +// stop: corresponds to stop in python's xrange(). +// step: corresponds to step in python's xrange(). +func RangeDataset(scope *Scope, start tf.Output, stop tf.Output, step tf.Output, output_types []tf.DataType, output_shapes []tf.Shape, optional ...RangeDatasetAttr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "RangeDataset", + Input: []tf.Input{ + start, stop, step, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// MaxPoolGradAttr is an optional argument to MaxPoolGrad. +type MaxPoolGradAttr func(optionalAttr) + +// MaxPoolGradExplicitPaddings sets the optional explicit_paddings attribute to value. +// If not specified, defaults to <> +func MaxPoolGradExplicitPaddings(value []int64) MaxPoolGradAttr { + return func(m optionalAttr) { + m["explicit_paddings"] = value + } +} + +// MaxPoolGradDataFormat sets the optional data_format attribute to value. +// +// value: Specify the data format of the input and output data. With the +// default format "NHWC", the data is stored in the order of: +// +// [batch, in_height, in_width, in_channels]. +// +// Alternatively, the format could be "NCHW", the data storage order of: +// +// [batch, in_channels, in_height, in_width]. +// +// If not specified, defaults to "NHWC" +func MaxPoolGradDataFormat(value string) MaxPoolGradAttr { + return func(m optionalAttr) { + m["data_format"] = value + } +} + +// Computes gradients of the maxpooling function. +// +// Arguments: +// +// orig_input: The original input tensor. +// orig_output: The original output tensor. +// grad: 4-D. Gradients w.r.t. the output of `max_pool`. +// ksize: The size of the window for each dimension of the input tensor. +// strides: The stride of the sliding window for each dimension of the +// +// input tensor. +// +// padding: The type of padding algorithm to use. +// +// Returns Gradients w.r.t. the input to `max_pool`. +func MaxPoolGrad(scope *Scope, orig_input tf.Output, orig_output tf.Output, grad tf.Output, ksize []int64, strides []int64, padding string, optional ...MaxPoolGradAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"ksize": ksize, "strides": strides, "padding": padding} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "MaxPoolGrad", + Input: []tf.Input{ + orig_input, orig_output, grad, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Wraps the XLA ConvGeneralDilated operator, documented at +// +// https://www.tensorflow.org/performance/xla/operation_semantics#conv_convolution +// +// . +// +// Arguments: +// +// lhs: the input tensor +// rhs: the kernel tensor +// window_strides: the inter-window strides +// padding: the padding to apply at the start and end of each input dimensions +// lhs_dilation: dilation to apply between input elements +// rhs_dilation: dilation to apply between kernel elements +// feature_group_count: number of feature groups for grouped convolution. +// dimension_numbers: a serialized xla::ConvolutionDimensionNumbers proto. +// precision_config: a serialized xla::PrecisionConfig proto. +func XlaConv(scope *Scope, lhs tf.Output, rhs tf.Output, window_strides tf.Output, padding tf.Output, lhs_dilation tf.Output, rhs_dilation tf.Output, feature_group_count tf.Output, dimension_numbers string, precision_config string) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dimension_numbers": dimension_numbers, "precision_config": precision_config} + opspec := tf.OpSpec{ + Type: "XlaConv", + Input: []tf.Input{ + lhs, rhs, window_strides, padding, lhs_dilation, rhs_dilation, feature_group_count, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns true if queue is closed. +// +// This operation returns true if the queue is closed and false if the queue +// is open. +// +// Arguments: +// +// handle: The handle to a queue. +func QueueIsClosedV2(scope *Scope, handle tf.Output) (is_closed tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "QueueIsClosedV2", + Input: []tf.Input{ + handle, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ComplexAttr is an optional argument to Complex. +type ComplexAttr func(optionalAttr) + +// ComplexTout sets the optional Tout attribute to value. +// If not specified, defaults to DT_COMPLEX64 +func ComplexTout(value tf.DataType) ComplexAttr { + return func(m optionalAttr) { + m["Tout"] = value + } +} + +// Converts two real numbers to a complex number. +// +// Given a tensor `real` representing the real part of a complex number, and a +// tensor `imag` representing the imaginary part of a complex number, this +// operation returns complex numbers elementwise of the form \\(a + bj\\), where +// *a* represents the `real` part and *b* represents the `imag` part. +// +// The input tensors `real` and `imag` must have the same shape. +// +// For example: +// +// ``` +// # tensor 'real' is [2.25, 3.25] +// # tensor `imag` is [4.75, 5.75] +// tf.complex(real, imag) ==> [[2.25 + 4.75j], [3.25 + 5.75j]] +// ``` +func Complex(scope *Scope, real tf.Output, imag tf.Output, optional ...ComplexAttr) (out tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Complex", + Input: []tf.Input{ + real, imag, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns the TopK values in the array in sorted order. This is a combination +// +// of MakeUnique and TopKUnique. The returned top-K will have its lower bits +// replaced by iota, thus it will be close to the original value but not exactly +// the same. The running time is proportional to the product of K and the input +// size. NaNs are never returned. Subnormal numbers are flushed to zero. +func TopKWithUnique(scope *Scope, input tf.Output, k int64) (topk tf.Output, topk_indices tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"k": k} + opspec := tf.OpSpec{ + Type: "TopKWithUnique", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// Checks whether a tree ensemble has been initialized. +// +// Arguments: +// +// tree_ensemble_handle: Handle to the tree ensemble resource. +// +// Returns output boolean on whether it is initialized or not. +func IsBoostedTreesEnsembleInitialized(scope *Scope, tree_ensemble_handle tf.Output) (is_initialized tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "IsBoostedTreesEnsembleInitialized", + Input: []tf.Input{ + tree_ensemble_handle, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Converts a `RaggedTensor` into a `SparseTensor` with the same values. +// +// input=ragged.from_nested_row_splits(rt_dense_values, rt_nested_splits) +// output=SparseTensor(indices=sparse_indices, values=sparse_values, +// +// dense_shape=sparse_dense_shape) +// +// Arguments: +// +// rt_nested_splits: The `row_splits` for the `RaggedTensor`. +// rt_dense_values: The `flat_values` for the `RaggedTensor`. +// +// Returns: +// +// sparse_indices: The indices for the `SparseTensor`. +// sparse_values: The values of the `SparseTensor`. +// sparse_dense_shape: `sparse_dense_shape` is a tight bounding box of the input `RaggedTensor`. +func RaggedTensorToSparse(scope *Scope, rt_nested_splits []tf.Output, rt_dense_values tf.Output) (sparse_indices tf.Output, sparse_values tf.Output, sparse_dense_shape tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "RaggedTensorToSparse", + Input: []tf.Input{ + tf.OutputList(rt_nested_splits), rt_dense_values, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// Creates a dataset that takes a Bernoulli sample of the contents of another dataset. +// +// There is no transformation in the `tf.data` Python API for creating this dataset. +// Instead, it is created as a result of the `filter_with_random_uniform_fusion` +// static optimization. Whether this optimization is performed is determined by the +// `experimental_optimization.filter_with_random_uniform_fusion` option of +// `tf.data.Options`. +// +// Arguments: +// +// rate: A scalar representing the sample rate. Each element of `input_dataset` is +// +// retained with this probability, independent of all other elements. +// +// seed: A scalar representing seed of random number generator. +// seed2: A scalar representing seed2 of random number generator. +func SamplingDataset(scope *Scope, input_dataset tf.Output, rate tf.Output, seed tf.Output, seed2 tf.Output, output_types []tf.DataType, output_shapes []tf.Shape) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + opspec := tf.OpSpec{ + Type: "SamplingDataset", + Input: []tf.Input{ + input_dataset, rate, seed, seed2, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Creates a Tensor by indexing into the TensorList. +// +// Each row in the produced Tensor corresponds to the element in the TensorList +// specified by the given index (see `tf.gather`). +// +// input_handle: The input tensor list. +// indices: The indices used to index into the list. +// values: The tensor. +func TensorListGather(scope *Scope, input_handle tf.Output, indices tf.Output, element_shape tf.Output, element_dtype tf.DataType) (values tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"element_dtype": element_dtype} + opspec := tf.OpSpec{ + Type: "TensorListGather", + Input: []tf.Input{ + input_handle, indices, element_shape, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// SparseMatrixTransposeAttr is an optional argument to SparseMatrixTranspose. +type SparseMatrixTransposeAttr func(optionalAttr) + +// SparseMatrixTransposeConjugate sets the optional conjugate attribute to value. +// +// value: Indicates whether `input` should be conjugated. +// If not specified, defaults to false +func SparseMatrixTransposeConjugate(value bool) SparseMatrixTransposeAttr { + return func(m optionalAttr) { + m["conjugate"] = value + } +} + +// Transposes the inner (matrix) dimensions of a CSRSparseMatrix. +// +// Transposes the inner (matrix) dimensions of a SparseMatrix and optionally +// conjugates its values. +// +// Arguments: +// +// input: A CSRSparseMatrix. +// +// Returns A CSRSparseMatrix. +func SparseMatrixTranspose(scope *Scope, input tf.Output, type_ tf.DataType, optional ...SparseMatrixTransposeAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"type": type_} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "SparseMatrixTranspose", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Decode web-safe base64-encoded strings. +// +// Input may or may not have padding at the end. See EncodeBase64 for padding. +// Web-safe means that input must use - and _ instead of + and /. +// +// Arguments: +// +// input: Base64 strings to decode. +// +// Returns Decoded strings. +func DecodeBase64(scope *Scope, input tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "DecodeBase64", + Input: []tf.Input{ + input, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// CudnnRNNV2Attr is an optional argument to CudnnRNNV2. +type CudnnRNNV2Attr func(optionalAttr) + +// CudnnRNNV2RnnMode sets the optional rnn_mode attribute to value. +// If not specified, defaults to "lstm" +func CudnnRNNV2RnnMode(value string) CudnnRNNV2Attr { + return func(m optionalAttr) { + m["rnn_mode"] = value + } +} + +// CudnnRNNV2InputMode sets the optional input_mode attribute to value. +// If not specified, defaults to "linear_input" +func CudnnRNNV2InputMode(value string) CudnnRNNV2Attr { + return func(m optionalAttr) { + m["input_mode"] = value + } +} + +// CudnnRNNV2Direction sets the optional direction attribute to value. +// If not specified, defaults to "unidirectional" +func CudnnRNNV2Direction(value string) CudnnRNNV2Attr { + return func(m optionalAttr) { + m["direction"] = value + } +} + +// CudnnRNNV2Dropout sets the optional dropout attribute to value. +// If not specified, defaults to 0 +func CudnnRNNV2Dropout(value float32) CudnnRNNV2Attr { + return func(m optionalAttr) { + m["dropout"] = value + } +} + +// CudnnRNNV2Seed sets the optional seed attribute to value. +// If not specified, defaults to 0 +func CudnnRNNV2Seed(value int64) CudnnRNNV2Attr { + return func(m optionalAttr) { + m["seed"] = value + } +} + +// CudnnRNNV2Seed2 sets the optional seed2 attribute to value. +// If not specified, defaults to 0 +func CudnnRNNV2Seed2(value int64) CudnnRNNV2Attr { + return func(m optionalAttr) { + m["seed2"] = value + } +} + +// CudnnRNNV2IsTraining sets the optional is_training attribute to value. +// If not specified, defaults to true +func CudnnRNNV2IsTraining(value bool) CudnnRNNV2Attr { + return func(m optionalAttr) { + m["is_training"] = value + } +} + +// A RNN backed by cuDNN. +// +// Computes the RNN from the input and initial states, with respect to the params +// buffer. Produces one extra output "host_reserved" than CudnnRNN. +// +// rnn_mode: Indicates the type of the RNN model. +// input_mode: Indicates whether there is a linear projection between the input and +// +// the actual computation before the first layer. 'skip_input' is only allowed +// when input_size == num_units; 'auto_select' implies 'skip_input' when +// input_size == num_units; otherwise, it implies 'linear_input'. +// +// direction: Indicates whether a bidirectional model will be used. Should be +// +// "unidirectional" or "bidirectional". +// +// dropout: Dropout probability. When set to 0., dropout is disabled. +// seed: The 1st part of a seed to initialize dropout. +// seed2: The 2nd part of a seed to initialize dropout. +// input: A 3-D tensor with the shape of [seq_length, batch_size, input_size]. +// input_h: A 3-D tensor with the shape of [num_layer * dir, batch_size, +// +// num_units]. +// +// input_c: For LSTM, a 3-D tensor with the shape of +// +// [num_layer * dir, batch, num_units]. For other models, it is ignored. +// +// params: A 1-D tensor that contains the weights and biases in an opaque layout. +// +// The size must be created through CudnnRNNParamsSize, and initialized +// separately. Note that they might not be compatible across different +// generations. So it is a good idea to save and restore +// +// output: A 3-D tensor with the shape of [seq_length, batch_size, +// +// dir * num_units]. +// +// output_h: The same shape has input_h. +// output_c: The same shape as input_c for LSTM. An empty tensor for other models. +// is_training: Indicates whether this operation is used for inference or +// +// training. +// +// reserve_space: An opaque tensor that can be used in backprop calculation. It +// +// is only produced if is_training is true. +// +// host_reserved: An opaque tensor that can be used in backprop calculation. It is +// +// only produced if is_training is true. It is output on host memory rather than +// device memory. +func CudnnRNNV2(scope *Scope, input tf.Output, input_h tf.Output, input_c tf.Output, params tf.Output, optional ...CudnnRNNV2Attr) (output tf.Output, output_h tf.Output, output_c tf.Output, reserve_space tf.Output, host_reserved tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "CudnnRNNV2", + Input: []tf.Input{ + input, input_h, input_c, params, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2), op.Output(3), op.Output(4) +} + +// ProdAttr is an optional argument to Prod. +type ProdAttr func(optionalAttr) + +// ProdKeepDims sets the optional keep_dims attribute to value. +// +// value: If true, retain reduced dimensions with length 1. +// If not specified, defaults to false +func ProdKeepDims(value bool) ProdAttr { + return func(m optionalAttr) { + m["keep_dims"] = value + } +} + +// Computes the product of elements across dimensions of a tensor. +// +// Reduces `input` along the dimensions given in `axis`. Unless +// `keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in +// `axis`. If `keep_dims` is true, the reduced dimensions are +// retained with length 1. +// +// Arguments: +// +// input: The tensor to reduce. +// axis: The dimensions to reduce. Must be in the range +// +// `[-rank(input), rank(input))`. +// +// Returns The reduced tensor. +func Prod(scope *Scope, input tf.Output, axis tf.Output, optional ...ProdAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Prod", + Input: []tf.Input{ + input, axis, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// RegisterDatasetAttr is an optional argument to RegisterDataset. +type RegisterDatasetAttr func(optionalAttr) + +// RegisterDatasetElementSpec sets the optional element_spec attribute to value. +// If not specified, defaults to "" +func RegisterDatasetElementSpec(value string) RegisterDatasetAttr { + return func(m optionalAttr) { + m["element_spec"] = value + } +} + +// RegisterDatasetMetadata sets the optional metadata attribute to value. +// If not specified, defaults to "" +func RegisterDatasetMetadata(value string) RegisterDatasetAttr { + return func(m optionalAttr) { + m["metadata"] = value + } +} + +// Registers a dataset with the tf.data service. +func RegisterDataset(scope *Scope, dataset tf.Output, address tf.Output, protocol tf.Output, external_state_policy int64, optional ...RegisterDatasetAttr) (dataset_id tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"external_state_policy": external_state_policy} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "RegisterDataset", + Input: []tf.Input{ + dataset, address, protocol, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// FakeQuantWithMinMaxArgsGradientAttr is an optional argument to FakeQuantWithMinMaxArgsGradient. +type FakeQuantWithMinMaxArgsGradientAttr func(optionalAttr) + +// FakeQuantWithMinMaxArgsGradientMin sets the optional min attribute to value. +// If not specified, defaults to -6 +func FakeQuantWithMinMaxArgsGradientMin(value float32) FakeQuantWithMinMaxArgsGradientAttr { + return func(m optionalAttr) { + m["min"] = value + } +} + +// FakeQuantWithMinMaxArgsGradientMax sets the optional max attribute to value. +// If not specified, defaults to 6 +func FakeQuantWithMinMaxArgsGradientMax(value float32) FakeQuantWithMinMaxArgsGradientAttr { + return func(m optionalAttr) { + m["max"] = value + } +} + +// FakeQuantWithMinMaxArgsGradientNumBits sets the optional num_bits attribute to value. +// If not specified, defaults to 8 +func FakeQuantWithMinMaxArgsGradientNumBits(value int64) FakeQuantWithMinMaxArgsGradientAttr { + return func(m optionalAttr) { + m["num_bits"] = value + } +} + +// FakeQuantWithMinMaxArgsGradientNarrowRange sets the optional narrow_range attribute to value. +// If not specified, defaults to false +func FakeQuantWithMinMaxArgsGradientNarrowRange(value bool) FakeQuantWithMinMaxArgsGradientAttr { + return func(m optionalAttr) { + m["narrow_range"] = value + } +} + +// Compute gradients for a FakeQuantWithMinMaxArgs operation. +// +// Arguments: +// +// gradients: Backpropagated gradients above the FakeQuantWithMinMaxArgs operation. +// inputs: Values passed as inputs to the FakeQuantWithMinMaxArgs operation. +// +// Returns Backpropagated gradients below the FakeQuantWithMinMaxArgs operation: +// `gradients * (inputs >= min && inputs <= max)`. +func FakeQuantWithMinMaxArgsGradient(scope *Scope, gradients tf.Output, inputs tf.Output, optional ...FakeQuantWithMinMaxArgsGradientAttr) (backprops tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "FakeQuantWithMinMaxArgsGradient", + Input: []tf.Input{ + gradients, inputs, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Removes keys and its associated values from a table. +// +// The tensor `keys` must of the same type as the keys of the table. Keys not +// already in the table are silently ignored. +// +// Arguments: +// +// table_handle: Handle to the table. +// keys: Any shape. Keys of the elements to remove. +// +// Returns the created operation. +func LookupTableRemoveV2(scope *Scope, table_handle tf.Output, keys tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "LookupTableRemoveV2", + Input: []tf.Input{ + table_handle, keys, + }, + } + return scope.AddOperation(opspec) +} + +// SparseReduceSumSparseAttr is an optional argument to SparseReduceSumSparse. +type SparseReduceSumSparseAttr func(optionalAttr) + +// SparseReduceSumSparseKeepDims sets the optional keep_dims attribute to value. +// +// value: If true, retain reduced dimensions with length 1. +// If not specified, defaults to false +func SparseReduceSumSparseKeepDims(value bool) SparseReduceSumSparseAttr { + return func(m optionalAttr) { + m["keep_dims"] = value + } +} + +// Computes the sum of elements across dimensions of a SparseTensor. +// +// This Op takes a SparseTensor and is the sparse counterpart to +// `tf.reduce_sum()`. In contrast to SparseReduceSum, this Op returns a +// SparseTensor. +// +// Reduces `sp_input` along the dimensions given in `reduction_axes`. Unless +// `keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in +// `reduction_axes`. If `keep_dims` is true, the reduced dimensions are retained +// with length 1. +// +// If `reduction_axes` has no entries, all dimensions are reduced, and a tensor +// with a single element is returned. Additionally, the axes can be negative, +// which are interpreted according to the indexing rules in Python. +// +// Arguments: +// +// input_indices: 2-D. `N x R` matrix with the indices of non-empty values in a +// +// SparseTensor, possibly not in canonical ordering. +// +// input_values: 1-D. `N` non-empty values corresponding to `input_indices`. +// input_shape: 1-D. Shape of the input SparseTensor. +// reduction_axes: 1-D. Length-`K` vector containing the reduction axes. +func SparseReduceSumSparse(scope *Scope, input_indices tf.Output, input_values tf.Output, input_shape tf.Output, reduction_axes tf.Output, optional ...SparseReduceSumSparseAttr) (output_indices tf.Output, output_values tf.Output, output_shape tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "SparseReduceSumSparse", + Input: []tf.Input{ + input_indices, input_values, input_shape, reduction_axes, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// Generates fingerprint values. +// +// Generates fingerprint values of `data`. +// +// Fingerprint op considers the first dimension of `data` as the batch dimension, +// and `output[i]` contains the fingerprint value generated from contents in +// `data[i, ...]` for all `i`. +// +// Fingerprint op writes fingerprint values as byte arrays. For example, the +// default method `farmhash64` generates a 64-bit fingerprint value at a time. +// This 8-byte value is written out as an `uint8` array of size 8, in little-endian +// order. +// +// For example, suppose that `data` has data type `DT_INT32` and shape (2, 3, 4), +// and that the fingerprint method is `farmhash64`. In this case, the output shape +// is (2, 8), where 2 is the batch dimension size of `data`, and 8 is the size of +// each fingerprint value in bytes. `output[0, :]` is generated from 12 integers in +// `data[0, :, :]` and similarly `output[1, :]` is generated from other 12 integers +// in `data[1, :, :]`. +// +// Note that this op fingerprints the raw underlying buffer, and it does not +// fingerprint Tensor's metadata such as data type and/or shape. For example, the +// fingerprint values are invariant under reshapes and bitcasts as long as the +// batch dimension remain the same: +// +// ``` +// Fingerprint(data) == Fingerprint(Reshape(data, ...)) +// Fingerprint(data) == Fingerprint(Bitcast(data, ...)) +// ``` +// +// For string data, one should expect `Fingerprint(data) != +// Fingerprint(ReduceJoin(data))` in general. +// +// Arguments: +// +// data: Must have rank 1 or higher. +// method: Fingerprint method used by this op. Currently available method is +// +// `farmhash::fingerprint64`. +// +// Returns A two-dimensional `Tensor` of type `tf.uint8`. The first dimension equals to +// `data`'s first dimension, and the second dimension size depends on the +// fingerprint algorithm. +func Fingerprint(scope *Scope, data tf.Output, method tf.Output) (fingerprint tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Fingerprint", + Input: []tf.Input{ + data, method, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Inverse 3D fast Fourier transform. +// +// Computes the inverse 3-dimensional discrete Fourier transform over the +// inner-most 3 dimensions of `input`. +// +// Arguments: +// +// input: A complex tensor. +// +// Returns A complex tensor of the same shape as `input`. The inner-most 3 +// +// dimensions of `input` are replaced with their inverse 3D Fourier transform. +// +// @compatibility(numpy) +// Equivalent to np.fft.ifftn with 3 dimensions. +// @end_compatibility +func IFFT3D(scope *Scope, input tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "IFFT3D", + Input: []tf.Input{ + input, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// RFFT2DAttr is an optional argument to RFFT2D. +type RFFT2DAttr func(optionalAttr) + +// RFFT2DTcomplex sets the optional Tcomplex attribute to value. +// If not specified, defaults to DT_COMPLEX64 +func RFFT2DTcomplex(value tf.DataType) RFFT2DAttr { + return func(m optionalAttr) { + m["Tcomplex"] = value + } +} + +// 2D real-valued fast Fourier transform. +// +// Computes the 2-dimensional discrete Fourier transform of a real-valued signal +// over the inner-most 2 dimensions of `input`. +// +// Since the DFT of a real signal is Hermitian-symmetric, `RFFT2D` only returns the +// `fft_length / 2 + 1` unique components of the FFT for the inner-most dimension +// of `output`: the zero-frequency term, followed by the `fft_length / 2` +// positive-frequency terms. +// +// Along each axis `RFFT2D` is computed on, if `fft_length` is smaller than the +// corresponding dimension of `input`, the dimension is cropped. If it is larger, +// the dimension is padded with zeros. +// +// Arguments: +// +// input: A float32 tensor. +// fft_length: An int32 tensor of shape [2]. The FFT length for each dimension. +// +// Returns A complex64 tensor of the same rank as `input`. The inner-most 2 +// +// dimensions of `input` are replaced with their 2D Fourier transform. The +// inner-most dimension contains `fft_length / 2 + 1` unique frequency +// components. +// +// @compatibility(numpy) +// Equivalent to np.fft.rfft2 +// @end_compatibility +func RFFT2D(scope *Scope, input tf.Output, fft_length tf.Output, optional ...RFFT2DAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "RFFT2D", + Input: []tf.Input{ + input, fft_length, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// A container for an iterator resource. +// +// Returns: +// +// handle: A handle to the iterator that can be passed to a "MakeIterator" or +// +// "IteratorGetNext" op. In contrast to Iterator, AnonymousIterator prevents +// resource sharing by name, and does not keep a reference to the resource +// container. +// +// deleter: A variant deleter that should be passed into the op that deletes the iterator. +func AnonymousIteratorV2(scope *Scope, output_types []tf.DataType, output_shapes []tf.Shape) (handle tf.Output, deleter tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + opspec := tf.OpSpec{ + Type: "AnonymousIteratorV2", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// Creates a dataset that overrides the maximum intra-op parallelism. +// +// Arguments: +// +// max_intra_op_parallelism: Identifies the maximum intra-op parallelism to use. +func MaxIntraOpParallelismDataset(scope *Scope, input_dataset tf.Output, max_intra_op_parallelism tf.Output, output_types []tf.DataType, output_shapes []tf.Shape) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + opspec := tf.OpSpec{ + Type: "MaxIntraOpParallelismDataset", + Input: []tf.Input{ + input_dataset, max_intra_op_parallelism, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// AllCandidateSamplerAttr is an optional argument to AllCandidateSampler. +type AllCandidateSamplerAttr func(optionalAttr) + +// AllCandidateSamplerSeed sets the optional seed attribute to value. +// +// value: If either seed or seed2 are set to be non-zero, the random number +// generator is seeded by the given seed. Otherwise, it is seeded by a +// random seed. +// If not specified, defaults to 0 +func AllCandidateSamplerSeed(value int64) AllCandidateSamplerAttr { + return func(m optionalAttr) { + m["seed"] = value + } +} + +// AllCandidateSamplerSeed2 sets the optional seed2 attribute to value. +// +// value: An second seed to avoid seed collision. +// If not specified, defaults to 0 +func AllCandidateSamplerSeed2(value int64) AllCandidateSamplerAttr { + return func(m optionalAttr) { + m["seed2"] = value + } +} + +// Generates labels for candidate sampling with a learned unigram distribution. +// +// See explanations of candidate sampling and the data formats at +// go/candidate-sampling. +// +// For each batch, this op picks a single set of sampled candidate labels. +// +// The advantages of sampling candidates per-batch are simplicity and the +// possibility of efficient dense matrix multiplication. The disadvantage is that +// the sampled candidates must be chosen independently of the context and of the +// true labels. +// +// Arguments: +// +// true_classes: A batch_size * num_true matrix, in which each row contains the +// +// IDs of the num_true target_classes in the corresponding original label. +// +// num_true: Number of true labels per context. +// num_sampled: Number of candidates to produce. +// unique: If unique is true, we sample with rejection, so that all sampled +// +// candidates in a batch are unique. This requires some approximation to +// estimate the post-rejection sampling probabilities. +// +// Returns: +// +// sampled_candidates: A vector of length num_sampled, in which each element is +// +// the ID of a sampled candidate. +// +// true_expected_count: A batch_size * num_true matrix, representing +// +// the number of times each candidate is expected to occur in a batch +// of sampled candidates. If unique=true, then this is a probability. +// +// sampled_expected_count: A vector of length num_sampled, for each sampled +// +// candidate representing the number of times the candidate is expected +// to occur in a batch of sampled candidates. If unique=true, then this is a +// probability. +func AllCandidateSampler(scope *Scope, true_classes tf.Output, num_true int64, num_sampled int64, unique bool, optional ...AllCandidateSamplerAttr) (sampled_candidates tf.Output, true_expected_count tf.Output, sampled_expected_count tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_true": num_true, "num_sampled": num_sampled, "unique": unique} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "AllCandidateSampler", + Input: []tf.Input{ + true_classes, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// ApproximateEqualAttr is an optional argument to ApproximateEqual. +type ApproximateEqualAttr func(optionalAttr) + +// ApproximateEqualTolerance sets the optional tolerance attribute to value. +// If not specified, defaults to 1e-05 +func ApproximateEqualTolerance(value float32) ApproximateEqualAttr { + return func(m optionalAttr) { + m["tolerance"] = value + } +} + +// Returns the truth value of abs(x-y) < tolerance element-wise. +func ApproximateEqual(scope *Scope, x tf.Output, y tf.Output, optional ...ApproximateEqualAttr) (z tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ApproximateEqual", + Input: []tf.Input{ + x, y, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Advance the counter of a counter-based RNG. +// +// The state of the RNG after +// `rng_read_and_skip(n)` will be the same as that after `uniform([n])` +// (or any other distribution). The actual increment added to the +// counter is an unspecified implementation choice. +// +// Arguments: +// +// resource: The handle of the resource variable that stores the state of the RNG. +// alg: The RNG algorithm. +// delta: The amount of advancement. +// +// Returns The old value of the resource variable, before incrementing. Since state size is algorithm-dependent, this output will be right-padded with zeros to reach shape int64[3] (the current maximal state size among algorithms). +func RngReadAndSkip(scope *Scope, resource tf.Output, alg tf.Output, delta tf.Output) (value tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "RngReadAndSkip", + Input: []tf.Input{ + resource, alg, delta, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// An Op to permute tensors across replicated TPU instances. +// +// Each instance supplies its own input. +// +// For example, suppose there are 4 TPU instances: `[A, B, C, D]`. Passing +// source_target_pairs=`[[0,1],[1,2],[2,3],[3,0]]` gets the outputs: +// `[D, A, B, C]`. +// +// Arguments: +// +// input: The local input to be permuted. Currently only supports float and +// +// bfloat16. +// +// source_target_pairs: A tensor with shape [num_pairs, 2]. +// +// Returns The permuted input. +func CollectivePermute(scope *Scope, input tf.Output, source_target_pairs tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "CollectivePermute", + Input: []tf.Input{ + input, source_target_pairs, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// QuantizedMatMulWithBiasAndReluAndRequantizeAttr is an optional argument to QuantizedMatMulWithBiasAndReluAndRequantize. +type QuantizedMatMulWithBiasAndReluAndRequantizeAttr func(optionalAttr) + +// QuantizedMatMulWithBiasAndReluAndRequantizeToutput sets the optional Toutput attribute to value. +// If not specified, defaults to DT_QUINT8 +func QuantizedMatMulWithBiasAndReluAndRequantizeToutput(value tf.DataType) QuantizedMatMulWithBiasAndReluAndRequantizeAttr { + return func(m optionalAttr) { + m["Toutput"] = value + } +} + +// QuantizedMatMulWithBiasAndReluAndRequantizeTransposeA sets the optional transpose_a attribute to value. +// +// value: If true, `a` is transposed before multiplication. +// If not specified, defaults to false +func QuantizedMatMulWithBiasAndReluAndRequantizeTransposeA(value bool) QuantizedMatMulWithBiasAndReluAndRequantizeAttr { + return func(m optionalAttr) { + m["transpose_a"] = value + } +} + +// QuantizedMatMulWithBiasAndReluAndRequantizeTransposeB sets the optional transpose_b attribute to value. +// +// value: If true, `b` is transposed before multiplication. +// If not specified, defaults to false +func QuantizedMatMulWithBiasAndReluAndRequantizeTransposeB(value bool) QuantizedMatMulWithBiasAndReluAndRequantizeAttr { + return func(m optionalAttr) { + m["transpose_b"] = value + } +} + +// QuantizedMatMulWithBiasAndReluAndRequantizeInputQuantMode sets the optional input_quant_mode attribute to value. +// +// value: Input data quantization mode. Either MIN_FIRST(default) or SCALED. +// If not specified, defaults to "MIN_FIRST" +func QuantizedMatMulWithBiasAndReluAndRequantizeInputQuantMode(value string) QuantizedMatMulWithBiasAndReluAndRequantizeAttr { + return func(m optionalAttr) { + m["input_quant_mode"] = value + } +} + +// Perform a quantized matrix multiplication of `a` by the matrix `b` with bias +// add and relu and requantize fusion. +// +// The inputs must be two-dimensional matrices and 1D bias vector. And the inner +// dimension of `a` (after being transposed if `transpose_a` is non-zero) must +// match the outer dimension of `b` (after being transposed if `transposed_b` is +// non-zero). Then do broadcast add operation with bias values on the matrix +// multiplication result. The bias size must match inner dimension of `b`. Then do +// relu activation to get non-negative result. Then do requantize operation to get +// final uint8 result. +// +// Arguments: +// +// a: A matrix to be multiplied. Must be a two-dimensional tensor of type `quint8`. +// b: A matrix to be multiplied and must be a two-dimensional tensor of type `qint8`. +// bias: A 1D bias tensor with size matching with inner dimension of `b` (after being +// +// transposed if `transposed_b` is non-zero). +// +// min_a: The float value that the lowest quantized `a` value represents. +// max_a: The float value that the highest quantized `a` value represents. +// min_b: The float value that the lowest quantized `b` value represents. +// max_b: The float value that the highest quantized `b` value represents. +// min_freezed_output: The float value that the highest quantized output value after requantize. +// +// Returns: +// +// out +// min_out: The float value that the lowest quantized output value represents. +// max_out: The float value that the highest quantized output value represents. +func QuantizedMatMulWithBiasAndReluAndRequantize(scope *Scope, a tf.Output, b tf.Output, bias tf.Output, min_a tf.Output, max_a tf.Output, min_b tf.Output, max_b tf.Output, min_freezed_output tf.Output, max_freezed_output tf.Output, optional ...QuantizedMatMulWithBiasAndReluAndRequantizeAttr) (out tf.Output, min_out tf.Output, max_out tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "QuantizedMatMulWithBiasAndReluAndRequantize", + Input: []tf.Input{ + a, b, bias, min_a, max_a, min_b, max_b, min_freezed_output, max_freezed_output, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// Create a dense tensor from a ragged tensor, possibly altering its shape. +// +// The `ragged_to_dense` op creates a dense tensor from a list of row partition +// tensors, a value vector, and default values. If the shape is unspecified, the +// minimal shape required to contain all the elements in the ragged tensor (the +// natural shape) will be used. If some dimensions are left unspecified, then the +// size of the natural shape is used in that dimension. +// +// The default_value will be broadcast to the output shape. After that, the values +// from the ragged tensor overwrite the default values. Note that the default_value +// must have less dimensions than the value. +// +// The row partition tensors are in the order of the dimensions. +// At present, the types can be: +// - "ROW_SPLITS": the row_splits tensor from the ragged tensor. +// - "VALUE_ROWIDS": the value_rowids tensor from the ragged tensor. +// - "FIRST_DIM_SIZE": if value_rowids is used for the first dimension, then it +// is preceded by "FIRST_DIM_SIZE". +// +// Arguments: +// +// shape: The desired shape of the the output tensor. If left unspecified (empty), +// +// the minimal shape required to contain all the elements in the ragged tensor +// (the natural shape) will be used. If some dimensions are left unspecified, then +// the size of the natural shape is used in that dimension. +// +// Note that dense dimensions cannot be modified by the shape argument. Trying to +// change the size of a dense dimension will cause the op to fail. +// Examples: +// natural shape: [4, 5, 6] +// shape: -1 +// output shape: [4, 5, 6] +// +// natural shape: [4, 5, 6] +// shape: [3, -1, 2] +// output shape: [3, 5, 2] +// +// natural shape: [4, 5, 6] +// shape: [3, 7, 2] +// output shape: [3, 7, 2] +// +// values: A 1D tensor representing the values of the ragged tensor. +// default_value: The default_value when the shape is larger than the ragged tensor. The +// +// default_value is broadcast until it is the shape of the output tensor, and +// then overwritten by values in the ragged tensor. The default value must be +// compatible with this broadcast operation, and must have fewer dimensions than +// the value tensor. +// +// row_partition_types: The types of the row partition tensors. At present, these can be: +// - "ROW_SPLITS": the row_splits tensor from the ragged tensor. +// - "VALUE_ROWIDS": the value_rowids tensor from the ragged tensor. +// - "FIRST_DIM_SIZE": if value_rowids is used for the first dimension, then it +// is preceeded by "FIRST_DIM_SIZE". +// +// The tensors are in the order of the dimensions. +// +// Returns The resulting dense tensor. +func RaggedTensorToTensor(scope *Scope, shape tf.Output, values tf.Output, default_value tf.Output, row_partition_tensors []tf.Output, row_partition_types []string) (result tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"row_partition_types": row_partition_types} + opspec := tf.OpSpec{ + Type: "RaggedTensorToTensor", + Input: []tf.Input{ + shape, values, default_value, tf.OutputList(row_partition_tensors), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes rectified linear 6: `min(max(features, 0), 6)`. +func Relu6(scope *Scope, features tf.Output) (activations tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Relu6", + Input: []tf.Input{ + features, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Extract `patches` from `images` and put them in the "depth" output dimension. +// +// Arguments: +// +// images: 4-D Tensor with shape `[batch, in_rows, in_cols, depth]`. +// ksizes: The size of the sliding window for each dimension of `images`. +// strides: How far the centers of two consecutive patches are in +// +// the images. Must be: `[1, stride_rows, stride_cols, 1]`. +// +// rates: Must be: `[1, rate_rows, rate_cols, 1]`. This is the +// +// input stride, specifying how far two consecutive patch samples are in the +// input. Equivalent to extracting patches with +// `patch_sizes_eff = patch_sizes + (patch_sizes - 1) * (rates - 1)`, followed by +// subsampling them spatially by a factor of `rates`. This is equivalent to +// `rate` in dilated (a.k.a. Atrous) convolutions. +// +// padding: The type of padding algorithm to use. +// +// Returns 4-D Tensor with shape `[batch, out_rows, out_cols, ksize_rows * +// ksize_cols * depth]` containing image patches with size +// `ksize_rows x ksize_cols x depth` vectorized in the "depth" dimension. Note +// `out_rows` and `out_cols` are the dimensions of the output patches. +func ExtractImagePatches(scope *Scope, images tf.Output, ksizes []int64, strides []int64, rates []int64, padding string) (patches tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"ksizes": ksizes, "strides": strides, "rates": rates, "padding": padding} + opspec := tf.OpSpec{ + Type: "ExtractImagePatches", + Input: []tf.Input{ + images, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// UnbatchAttr is an optional argument to Unbatch. +type UnbatchAttr func(optionalAttr) + +// UnbatchContainer sets the optional container attribute to value. +// If not specified, defaults to "" +func UnbatchContainer(value string) UnbatchAttr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// UnbatchSharedName sets the optional shared_name attribute to value. +// If not specified, defaults to "" +func UnbatchSharedName(value string) UnbatchAttr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// Reverses the operation of Batch for a single output Tensor. +// +// An instance of Unbatch either receives an empty batched_tensor, in which case it +// asynchronously waits until the values become available from a concurrently +// running instance of Unbatch with the same container and shared_name, or receives +// a non-empty batched_tensor in which case it finalizes all other concurrently +// running instances and outputs its own element from the batch. +// +// batched_tensor: The possibly transformed output of Batch. The size of the first +// +// dimension should remain unchanged by the transformations for the operation to +// work. +// +// batch_index: The matching batch_index obtained from Batch. +// id: The id scalar emitted by Batch. +// unbatched_tensor: The Tensor corresponding to this execution. +// timeout_micros: Maximum amount of time (in microseconds) to wait to receive the +// +// batched input tensor associated with a given invocation of the op. +// +// container: Container to control resource sharing. +// shared_name: Instances of Unbatch with the same container and shared_name are +// +// assumed to possibly belong to the same batch. If left empty, the op name will +// be used as the shared name. +func Unbatch(scope *Scope, batched_tensor tf.Output, batch_index tf.Output, id tf.Output, timeout_micros int64, optional ...UnbatchAttr) (unbatched_tensor tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"timeout_micros": timeout_micros} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Unbatch", + Input: []tf.Input{ + batched_tensor, batch_index, id, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Generate a glob pattern matching all sharded file names. +func ShardedFilespec(scope *Scope, basename tf.Output, num_shards tf.Output) (filename tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "ShardedFilespec", + Input: []tf.Input{ + basename, num_shards, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// SparseCountSparseOutputAttr is an optional argument to SparseCountSparseOutput. +type SparseCountSparseOutputAttr func(optionalAttr) + +// SparseCountSparseOutputMinlength sets the optional minlength attribute to value. +// +// value: Minimum value to count. Can be set to -1 for no minimum. +// If not specified, defaults to -1 +// +// REQUIRES: value >= -1 +func SparseCountSparseOutputMinlength(value int64) SparseCountSparseOutputAttr { + return func(m optionalAttr) { + m["minlength"] = value + } +} + +// SparseCountSparseOutputMaxlength sets the optional maxlength attribute to value. +// +// value: Maximum value to count. Can be set to -1 for no maximum. +// If not specified, defaults to -1 +// +// REQUIRES: value >= -1 +func SparseCountSparseOutputMaxlength(value int64) SparseCountSparseOutputAttr { + return func(m optionalAttr) { + m["maxlength"] = value + } +} + +// Performs sparse-output bin counting for a sparse tensor input. +// +// Counts the number of times each value occurs in the input. +// +// Arguments: +// +// indices: Tensor containing the indices of the sparse tensor to count. +// values: Tensor containing values of the sparse tensor to count. +// dense_shape: Tensor containing the dense shape of the sparse tensor to count. +// weights: A Tensor of the same shape as indices containing per-index weight values. +// +// May also be the empty tensor if no weights are used. +// +// binary_output: Whether to output the number of occurrences of each value or 1. +// +// Returns: +// +// output_indices: Indices tensor for the resulting sparse tensor object. +// output_values: Values tensor for the resulting sparse tensor object. +// output_dense_shape: Shape tensor for the resulting sparse tensor object. +func SparseCountSparseOutput(scope *Scope, indices tf.Output, values tf.Output, dense_shape tf.Output, weights tf.Output, binary_output bool, optional ...SparseCountSparseOutputAttr) (output_indices tf.Output, output_values tf.Output, output_dense_shape tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"binary_output": binary_output} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "SparseCountSparseOutput", + Input: []tf.Input{ + indices, values, dense_shape, weights, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// Creates an all-zeros CSRSparseMatrix with shape `dense_shape`. +// +// Arguments: +// +// dense_shape: The desired matrix shape. +// +// Returns An empty CSR matrix with shape `dense_shape`. +func SparseMatrixZeros(scope *Scope, dense_shape tf.Output, type_ tf.DataType) (sparse_matrix tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"type": type_} + opspec := tf.OpSpec{ + Type: "SparseMatrixZeros", + Input: []tf.Input{ + dense_shape, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ImagAttr is an optional argument to Imag. +type ImagAttr func(optionalAttr) + +// ImagTout sets the optional Tout attribute to value. +// If not specified, defaults to DT_FLOAT +func ImagTout(value tf.DataType) ImagAttr { + return func(m optionalAttr) { + m["Tout"] = value + } +} + +// Returns the imaginary part of a complex number. +// +// Given a tensor `input` of complex numbers, this operation returns a tensor of +// type `float` that is the imaginary part of each element in `input`. All +// elements in `input` must be complex numbers of the form \\(a + bj\\), where *a* +// is the real part and *b* is the imaginary part returned by this operation. +// +// For example: +// +// ``` +// # tensor 'input' is [-2.25 + 4.75j, 3.25 + 5.75j] +// tf.imag(input) ==> [4.75, 5.75] +// ``` +func Imag(scope *Scope, input tf.Output, optional ...ImagAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Imag", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Decode the frame(s) of a GIF-encoded image to a uint8 tensor. +// +// GIF images with frame or transparency compression are not supported. +// On Linux and MacOS systems, convert animated GIFs from compressed to +// uncompressed by running: +// +// convert $src.gif -coalesce $dst.gif +// +// This op also supports decoding JPEGs and PNGs, though it is cleaner to use +// `tf.io.decode_image`. +// +// Arguments: +// +// contents: 0-D. The GIF-encoded image. +// +// Returns 4-D with shape `[num_frames, height, width, 3]`. RGB channel order. +func DecodeGif(scope *Scope, contents tf.Output) (image tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "DecodeGif", + Input: []tf.Input{ + contents, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Conv3DBackpropFilterV2Attr is an optional argument to Conv3DBackpropFilterV2. +type Conv3DBackpropFilterV2Attr func(optionalAttr) + +// Conv3DBackpropFilterV2DataFormat sets the optional data_format attribute to value. +// +// value: The data format of the input and output data. With the +// default format "NDHWC", the data is stored in the order of: +// +// [batch, in_depth, in_height, in_width, in_channels]. +// +// Alternatively, the format could be "NCDHW", the data storage order is: +// +// [batch, in_channels, in_depth, in_height, in_width]. +// +// If not specified, defaults to "NDHWC" +func Conv3DBackpropFilterV2DataFormat(value string) Conv3DBackpropFilterV2Attr { + return func(m optionalAttr) { + m["data_format"] = value + } +} + +// Conv3DBackpropFilterV2Dilations sets the optional dilations attribute to value. +// +// value: 1-D tensor of length 5. The dilation factor for each dimension of +// `input`. If set to k > 1, there will be k-1 skipped cells between each +// filter element on that dimension. The dimension order is determined by the +// value of `data_format`, see above for details. Dilations in the batch and +// depth dimensions must be 1. +// If not specified, defaults to +func Conv3DBackpropFilterV2Dilations(value []int64) Conv3DBackpropFilterV2Attr { + return func(m optionalAttr) { + m["dilations"] = value + } +} + +// Computes the gradients of 3-D convolution with respect to the filter. +// +// Arguments: +// +// input: Shape `[batch, depth, rows, cols, in_channels]`. +// filter_sizes: An integer vector representing the tensor shape of `filter`, +// +// where `filter` is a 5-D +// `[filter_depth, filter_height, filter_width, in_channels, out_channels]` +// tensor. +// +// out_backprop: Backprop signal of shape `[batch, out_depth, out_rows, out_cols, +// +// out_channels]`. +// +// strides: 1-D tensor of length 5. The stride of the sliding window for each +// +// dimension of `input`. Must have `strides[0] = strides[4] = 1`. +// +// padding: The type of padding algorithm to use. +func Conv3DBackpropFilterV2(scope *Scope, input tf.Output, filter_sizes tf.Output, out_backprop tf.Output, strides []int64, padding string, optional ...Conv3DBackpropFilterV2Attr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"strides": strides, "padding": padding} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Conv3DBackpropFilterV2", + Input: []tf.Input{ + input, filter_sizes, out_backprop, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// CudnnRNNBackpropV3Attr is an optional argument to CudnnRNNBackpropV3. +type CudnnRNNBackpropV3Attr func(optionalAttr) + +// CudnnRNNBackpropV3RnnMode sets the optional rnn_mode attribute to value. +// If not specified, defaults to "lstm" +func CudnnRNNBackpropV3RnnMode(value string) CudnnRNNBackpropV3Attr { + return func(m optionalAttr) { + m["rnn_mode"] = value + } +} + +// CudnnRNNBackpropV3InputMode sets the optional input_mode attribute to value. +// If not specified, defaults to "linear_input" +func CudnnRNNBackpropV3InputMode(value string) CudnnRNNBackpropV3Attr { + return func(m optionalAttr) { + m["input_mode"] = value + } +} + +// CudnnRNNBackpropV3Direction sets the optional direction attribute to value. +// If not specified, defaults to "unidirectional" +func CudnnRNNBackpropV3Direction(value string) CudnnRNNBackpropV3Attr { + return func(m optionalAttr) { + m["direction"] = value + } +} + +// CudnnRNNBackpropV3Dropout sets the optional dropout attribute to value. +// If not specified, defaults to 0 +func CudnnRNNBackpropV3Dropout(value float32) CudnnRNNBackpropV3Attr { + return func(m optionalAttr) { + m["dropout"] = value + } +} + +// CudnnRNNBackpropV3Seed sets the optional seed attribute to value. +// If not specified, defaults to 0 +func CudnnRNNBackpropV3Seed(value int64) CudnnRNNBackpropV3Attr { + return func(m optionalAttr) { + m["seed"] = value + } +} + +// CudnnRNNBackpropV3Seed2 sets the optional seed2 attribute to value. +// If not specified, defaults to 0 +func CudnnRNNBackpropV3Seed2(value int64) CudnnRNNBackpropV3Attr { + return func(m optionalAttr) { + m["seed2"] = value + } +} + +// CudnnRNNBackpropV3NumProj sets the optional num_proj attribute to value. +// If not specified, defaults to 0 +func CudnnRNNBackpropV3NumProj(value int64) CudnnRNNBackpropV3Attr { + return func(m optionalAttr) { + m["num_proj"] = value + } +} + +// CudnnRNNBackpropV3TimeMajor sets the optional time_major attribute to value. +// If not specified, defaults to true +func CudnnRNNBackpropV3TimeMajor(value bool) CudnnRNNBackpropV3Attr { + return func(m optionalAttr) { + m["time_major"] = value + } +} + +// Backprop step of CudnnRNNV3. +// +// Compute the backprop of both data and weights in a RNN. Takes an extra +// +// "sequence_lengths" input than CudnnRNNBackprop. +// +// rnn_mode: Indicates the type of the RNN model. +// input_mode: Indicates whether there is a linear projection between the input and +// +// the actual computation before the first layer. 'skip_input' is only allowed +// when input_size == num_units; 'auto_select' implies 'skip_input' when +// input_size == num_units; otherwise, it implies 'linear_input'. +// +// direction: Indicates whether a bidirectional model will be used. Should be +// +// "unidirectional" or "bidirectional". +// +// dropout: Dropout probability. When set to 0., dropout is disabled. +// seed: The 1st part of a seed to initialize dropout. +// seed2: The 2nd part of a seed to initialize dropout. +// input: If time_major is true, this is a 3-D tensor with the shape of +// +// [seq_length, batch_size, input_size]. If time_major is false, the shape is +// [batch_size, seq_length, input_size]. +// +// input_h: If time_major is true, this is a 3-D tensor with the shape of +// +// [num_layer * dir, batch_size, num_units]. If time_major is false, the shape +// is [batch_size, num_layer * dir, num_units]. +// +// input_c: For LSTM, a 3-D tensor with the shape of +// +// [num_layer * dir, batch, num_units]. For other models, it is ignored. +// +// params: A 1-D tensor that contains the weights and biases in an opaque layout. +// +// The size must be created through CudnnRNNParamsSize, and initialized +// separately. Note that they might not be compatible across different +// generations. So it is a good idea to save and restore +// +// sequence_lengths: a vector of lengths of each input sequence. +// output: If time_major is true, this is a 3-D tensor with the shape of +// +// [seq_length, batch_size, dir * num_units]. If time_major is false, the +// shape is [batch_size, seq_length, dir * num_units]. +// +// output_h: The same shape has input_h. +// output_c: The same shape as input_c for LSTM. An empty tensor for other models. +// output_backprop: A 3-D tensor with the same shape as output in the forward pass. +// output_h_backprop: A 3-D tensor with the same shape as output_h in the forward +// +// pass. +// +// output_c_backprop: A 3-D tensor with the same shape as output_c in the forward +// +// pass. +// +// time_major: Indicates whether the input/output format is time major or batch +// +// major. +// +// reserve_space: The same reserve_space produced in the forward operation. +// input_backprop: The backprop to input in the forward pass. Has the same shape +// +// as input. +// +// input_h_backprop: The backprop to input_h in the forward pass. Has the same +// +// shape as input_h. +// +// input_c_backprop: The backprop to input_c in the forward pass. Has the same +// +// shape as input_c. +// +// params_backprop: The backprop to the params buffer in the forward pass. Has the +// +// same shape as params. +func CudnnRNNBackpropV3(scope *Scope, input tf.Output, input_h tf.Output, input_c tf.Output, params tf.Output, sequence_lengths tf.Output, output tf.Output, output_h tf.Output, output_c tf.Output, output_backprop tf.Output, output_h_backprop tf.Output, output_c_backprop tf.Output, reserve_space tf.Output, host_reserved tf.Output, optional ...CudnnRNNBackpropV3Attr) (input_backprop tf.Output, input_h_backprop tf.Output, input_c_backprop tf.Output, params_backprop tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "CudnnRNNBackpropV3", + Input: []tf.Input{ + input, input_h, input_c, params, sequence_lengths, output, output_h, output_c, output_backprop, output_h_backprop, output_c_backprop, reserve_space, host_reserved, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2), op.Output(3) +} + +// Creates a dataset that passes a sliding window over `input_dataset`. +// +// Arguments: +// +// window_size: A scalar representing the number of elements in the +// +// sliding window. +// +// window_shift: A scalar representing the steps moving the sliding window +// +// forward in one iteration. It must be positive. +// +// window_stride: A scalar representing the stride of the input elements of the sliding window. +// +// It must be positive. +func ExperimentalSlidingWindowDataset(scope *Scope, input_dataset tf.Output, window_size tf.Output, window_shift tf.Output, window_stride tf.Output, output_types []tf.DataType, output_shapes []tf.Shape) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + opspec := tf.OpSpec{ + Type: "ExperimentalSlidingWindowDataset", + Input: []tf.Input{ + input_dataset, window_size, window_shift, window_stride, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// TensorScatterAddAttr is an optional argument to TensorScatterAdd. +type TensorScatterAddAttr func(optionalAttr) + +// TensorScatterAddBadIndicesPolicy sets the optional bad_indices_policy attribute to value. +// If not specified, defaults to "" +func TensorScatterAddBadIndicesPolicy(value string) TensorScatterAddAttr { + return func(m optionalAttr) { + m["bad_indices_policy"] = value + } +} + +// Adds sparse `updates` to an existing tensor according to `indices`. +// +// This operation creates a new tensor by adding sparse `updates` to the passed +// in `tensor`. +// This operation is very similar to `tf.scatter_nd_add`, except that the updates +// are added onto an existing tensor (as opposed to a variable). If the memory +// for the existing tensor cannot be re-used, a copy is made and updated. +// +// `indices` is an integer tensor containing indices into a new tensor of shape +// `tensor.shape`. The last dimension of `indices` can be at most the rank of +// `tensor.shape`: +// +// indices.shape[-1] <= tensor.shape.rank +// +// The last dimension of `indices` corresponds to indices into elements +// (if `indices.shape[-1] = tensor.shape.rank`) or slices +// (if `indices.shape[-1] < tensor.shape.rank`) along dimension +// `indices.shape[-1]` of `tensor.shape`. `updates` is a tensor with shape +// +// indices.shape[:-1] + tensor.shape[indices.shape[-1]:] +// +// The simplest form of tensor_scatter_add is to add individual elements to a +// tensor by index. For example, say we want to add 4 elements in a rank-1 +// tensor with 8 elements. +// +// In Python, this scatter add operation would look like this: +// +// ```python +// +// indices = tf.constant([[4], [3], [1], [7]]) +// updates = tf.constant([9, 10, 11, 12]) +// tensor = tf.ones([8], dtype=tf.int32) +// updated = tf.tensor_scatter_nd_add(tensor, indices, updates) +// print(updated) +// +// ``` +// +// The resulting tensor would look like this: +// +// [1, 12, 1, 11, 10, 1, 1, 13] +// +// We can also, insert entire slices of a higher rank tensor all at once. For +// example, if we wanted to insert two slices in the first dimension of a +// rank-3 tensor with two matrices of new values. +// +// In Python, this scatter add operation would look like this: +// +// ```python +// +// indices = tf.constant([[0], [2]]) +// updates = tf.constant([[[5, 5, 5, 5], [6, 6, 6, 6], +// [7, 7, 7, 7], [8, 8, 8, 8]], +// [[5, 5, 5, 5], [6, 6, 6, 6], +// [7, 7, 7, 7], [8, 8, 8, 8]]]) +// tensor = tf.ones([4, 4, 4],dtype=tf.int32) +// updated = tf.tensor_scatter_nd_add(tensor, indices, updates) +// print(updated) +// +// ``` +// +// The resulting tensor would look like this: +// +// [[[6, 6, 6, 6], [7, 7, 7, 7], [8, 8, 8, 8], [9, 9, 9, 9]], +// [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]], +// [[6, 6, 6, 6], [7, 7, 7, 7], [8, 8, 8, 8], [9, 9, 9, 9]], +// [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]] +// +// Note that on CPU, if an out of bound index is found, an error is returned. +// On GPU, if an out of bound index is found, the index is ignored. +// +// Arguments: +// +// tensor: Tensor to copy/update. +// indices: Index tensor. +// updates: Updates to scatter into output. +// +// Returns A new tensor copied from tensor and updates added according to the indices. +func TensorScatterAdd(scope *Scope, tensor tf.Output, indices tf.Output, updates tf.Output, optional ...TensorScatterAddAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "TensorScatterAdd", + Input: []tf.Input{ + tensor, indices, updates, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// DepthwiseConv2dNativeAttr is an optional argument to DepthwiseConv2dNative. +type DepthwiseConv2dNativeAttr func(optionalAttr) + +// DepthwiseConv2dNativeExplicitPaddings sets the optional explicit_paddings attribute to value. +// If not specified, defaults to <> +func DepthwiseConv2dNativeExplicitPaddings(value []int64) DepthwiseConv2dNativeAttr { + return func(m optionalAttr) { + m["explicit_paddings"] = value + } +} + +// DepthwiseConv2dNativeDataFormat sets the optional data_format attribute to value. +// +// value: Specify the data format of the input and output data. With the +// default format "NHWC", the data is stored in the order of: +// +// [batch, height, width, channels]. +// +// Alternatively, the format could be "NCHW", the data storage order of: +// +// [batch, channels, height, width]. +// +// If not specified, defaults to "NHWC" +func DepthwiseConv2dNativeDataFormat(value string) DepthwiseConv2dNativeAttr { + return func(m optionalAttr) { + m["data_format"] = value + } +} + +// DepthwiseConv2dNativeDilations sets the optional dilations attribute to value. +// +// value: 1-D tensor of length 4. The dilation factor for each dimension of +// `input`. If set to k > 1, there will be k-1 skipped cells between each filter +// element on that dimension. The dimension order is determined by the value of +// `data_format`, see above for details. Dilations in the batch and depth +// dimensions must be 1. +// If not specified, defaults to +func DepthwiseConv2dNativeDilations(value []int64) DepthwiseConv2dNativeAttr { + return func(m optionalAttr) { + m["dilations"] = value + } +} + +// Computes a 2-D depthwise convolution given 4-D `input` and `filter` tensors. +// +// Given an input tensor of shape `[batch, in_height, in_width, in_channels]` +// and a filter / kernel tensor of shape +// `[filter_height, filter_width, in_channels, channel_multiplier]`, containing +// `in_channels` convolutional filters of depth 1, `depthwise_conv2d` applies +// a different filter to each input channel (expanding from 1 channel to +// `channel_multiplier` channels for each), then concatenates the results +// together. Thus, the output has `in_channels * channel_multiplier` channels. +// +// ``` +// for k in 0..in_channels-1 +// +// for q in 0..channel_multiplier-1 +// output[b, i, j, k * channel_multiplier + q] = +// sum_{di, dj} input[b, strides[1] * i + di, strides[2] * j + dj, k] * +// filter[di, dj, k, q] +// +// ``` +// +// Must have `strides[0] = strides[3] = 1`. For the most common case of the same +// horizontal and vertices strides, `strides = [1, stride, stride, 1]`. +// +// Arguments: +// +// strides: 1-D of length 4. The stride of the sliding window for each dimension +// +// of `input`. +// +// padding: The type of padding algorithm to use. +func DepthwiseConv2dNative(scope *Scope, input tf.Output, filter tf.Output, strides []int64, padding string, optional ...DepthwiseConv2dNativeAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"strides": strides, "padding": padding} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "DepthwiseConv2dNative", + Input: []tf.Input{ + input, filter, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Enqueue a Tensor on the computation outfeed. +// +// Arguments: +// +// input: A tensor that will be inserted into the outfeed queue. +// +// Returns the created operation. +func OutfeedEnqueue(scope *Scope, input tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "OutfeedEnqueue", + Input: []tf.Input{ + input, + }, + } + return scope.AddOperation(opspec) +} + +// BatchMatMulAttr is an optional argument to BatchMatMul. +type BatchMatMulAttr func(optionalAttr) + +// BatchMatMulAdjX sets the optional adj_x attribute to value. +// +// value: If `True`, adjoint the slices of `x`. Defaults to `False`. +// If not specified, defaults to false +func BatchMatMulAdjX(value bool) BatchMatMulAttr { + return func(m optionalAttr) { + m["adj_x"] = value + } +} + +// BatchMatMulAdjY sets the optional adj_y attribute to value. +// +// value: If `True`, adjoint the slices of `y`. Defaults to `False`. +// If not specified, defaults to false +func BatchMatMulAdjY(value bool) BatchMatMulAttr { + return func(m optionalAttr) { + m["adj_y"] = value + } +} + +// BatchMatMulGradX sets the optional grad_x attribute to value. +// If not specified, defaults to false +func BatchMatMulGradX(value bool) BatchMatMulAttr { + return func(m optionalAttr) { + m["grad_x"] = value + } +} + +// BatchMatMulGradY sets the optional grad_y attribute to value. +// If not specified, defaults to false +func BatchMatMulGradY(value bool) BatchMatMulAttr { + return func(m optionalAttr) { + m["grad_y"] = value + } +} + +// Multiplies slices of two tensors in batches. +// +// Multiplies all slices of `Tensor` `x` and `y` (each slice can be +// viewed as an element of a batch), and arranges the individual results +// in a single output tensor of the same batch size. Each of the +// individual slices can optionally be adjointed (to adjoint a matrix +// means to transpose and conjugate it) before multiplication by setting +// the `adj_x` or `adj_y` flag to `True`, which are by default `False`. +// +// The input tensors `x` and `y` are 2-D or higher with shape `[..., r_x, c_x]` +// and `[..., r_y, c_y]`. +// +// The output tensor is 2-D or higher with shape `[..., r_o, c_o]`, where: +// +// r_o = c_x if adj_x else r_x +// c_o = r_y if adj_y else c_y +// +// It is computed as: +// +// output[..., :, :] = matrix(x[..., :, :]) * matrix(y[..., :, :]) +// +// Arguments: +// +// x: 2-D or higher with shape `[..., r_x, c_x]`. +// y: 2-D or higher with shape `[..., r_y, c_y]`. +// +// Returns 3-D or higher with shape `[..., r_o, c_o]` +func BatchMatMul(scope *Scope, x tf.Output, y tf.Output, optional ...BatchMatMulAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "BatchMatMul", + Input: []tf.Input{ + x, y, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Return the index of device the op runs. +// +// Given a list of device names, this operation returns the index of the device +// this op runs. The length of the list is returned in two cases: +// (1) Device does not exist in the given device list. +// (2) It is in XLA compilation. +func DeviceIndex(scope *Scope, device_names []string) (index tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"device_names": device_names} + opspec := tf.OpSpec{ + Type: "DeviceIndex", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// SparseToSparseSetOperationAttr is an optional argument to SparseToSparseSetOperation. +type SparseToSparseSetOperationAttr func(optionalAttr) + +// SparseToSparseSetOperationValidateIndices sets the optional validate_indices attribute to value. +// If not specified, defaults to true +func SparseToSparseSetOperationValidateIndices(value bool) SparseToSparseSetOperationAttr { + return func(m optionalAttr) { + m["validate_indices"] = value + } +} + +// Applies set operation along last dimension of 2 `SparseTensor` inputs. +// +// See SetOperationOp::SetOperationFromContext for values of `set_operation`. +// +// If `validate_indices` is `True`, `SparseToSparseSetOperation` validates the +// order and range of `set1` and `set2` indices. +// +// Input `set1` is a `SparseTensor` represented by `set1_indices`, `set1_values`, +// and `set1_shape`. For `set1` ranked `n`, 1st `n-1` dimensions must be the same +// as `set2`. Dimension `n` contains values in a set, duplicates are allowed but +// ignored. +// +// Input `set2` is a `SparseTensor` represented by `set2_indices`, `set2_values`, +// and `set2_shape`. For `set2` ranked `n`, 1st `n-1` dimensions must be the same +// as `set1`. Dimension `n` contains values in a set, duplicates are allowed but +// ignored. +// +// If `validate_indices` is `True`, this op validates the order and range of `set1` +// and `set2` indices. +// +// Output `result` is a `SparseTensor` represented by `result_indices`, +// `result_values`, and `result_shape`. For `set1` and `set2` ranked `n`, this +// has rank `n` and the same 1st `n-1` dimensions as `set1` and `set2`. The `nth` +// dimension contains the result of `set_operation` applied to the corresponding +// `[0...n-1]` dimension of `set`. +// +// Arguments: +// +// set1_indices: 2D `Tensor`, indices of a `SparseTensor`. Must be in row-major +// +// order. +// +// set1_values: 1D `Tensor`, values of a `SparseTensor`. Must be in row-major +// +// order. +// +// set1_shape: 1D `Tensor`, shape of a `SparseTensor`. `set1_shape[0...n-1]` must +// +// be the same as `set2_shape[0...n-1]`, `set1_shape[n]` is the +// max set size across `0...n-1` dimensions. +// +// set2_indices: 2D `Tensor`, indices of a `SparseTensor`. Must be in row-major +// +// order. +// +// set2_values: 1D `Tensor`, values of a `SparseTensor`. Must be in row-major +// +// order. +// +// set2_shape: 1D `Tensor`, shape of a `SparseTensor`. `set2_shape[0...n-1]` must +// +// be the same as `set1_shape[0...n-1]`, `set2_shape[n]` is the +// max set size across `0...n-1` dimensions. +// +// Returns: +// +// result_indices: 2D indices of a `SparseTensor`. +// result_values: 1D values of a `SparseTensor`. +// result_shape: 1D `Tensor` shape of a `SparseTensor`. `result_shape[0...n-1]` is +// +// the same as the 1st `n-1` dimensions of `set1` and `set2`, `result_shape[n]` +// is the max result set size across all `0...n-1` dimensions. +func SparseToSparseSetOperation(scope *Scope, set1_indices tf.Output, set1_values tf.Output, set1_shape tf.Output, set2_indices tf.Output, set2_values tf.Output, set2_shape tf.Output, set_operation string, optional ...SparseToSparseSetOperationAttr) (result_indices tf.Output, result_values tf.Output, result_shape tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"set_operation": set_operation} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "SparseToSparseSetOperation", + Input: []tf.Input{ + set1_indices, set1_values, set1_shape, set2_indices, set2_values, set2_shape, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// MeanAttr is an optional argument to Mean. +type MeanAttr func(optionalAttr) + +// MeanKeepDims sets the optional keep_dims attribute to value. +// +// value: If true, retain reduced dimensions with length 1. +// If not specified, defaults to false +func MeanKeepDims(value bool) MeanAttr { + return func(m optionalAttr) { + m["keep_dims"] = value + } +} + +// Computes the mean of elements across dimensions of a tensor. +// +// Reduces `input` along the dimensions given in `axis`. Unless +// `keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in +// `axis`. If `keep_dims` is true, the reduced dimensions are +// retained with length 1. +// +// Arguments: +// +// input: The tensor to reduce. +// axis: The dimensions to reduce. Must be in the range +// +// `[-rank(input), rank(input))`. +// +// Returns The reduced tensor. +func Mean(scope *Scope, input tf.Output, axis tf.Output, optional ...MeanAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Mean", + Input: []tf.Input{ + input, axis, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// RaggedTensorFromVariantAttr is an optional argument to RaggedTensorFromVariant. +type RaggedTensorFromVariantAttr func(optionalAttr) + +// RaggedTensorFromVariantTsplits sets the optional Tsplits attribute to value. +// If not specified, defaults to DT_INT64 +func RaggedTensorFromVariantTsplits(value tf.DataType) RaggedTensorFromVariantAttr { + return func(m optionalAttr) { + m["Tsplits"] = value + } +} + +// Decodes a `variant` Tensor into a `RaggedTensor`. +// +// Decodes the given `variant` Tensor and returns a `RaggedTensor`. The input +// could be a scalar, meaning it encodes a single `RaggedTensor` with ragged_rank +// `output_ragged_rank`. It could also have an arbitrary rank, in which case each +// element is decoded into a `RaggedTensor` with ragged_rank `input_ragged_rank` +// and these are then stacked according to the input shape to output a single +// `RaggedTensor` with ragged_rank `output_ragged_rank`. Each `variant` element in +// the input Tensor is decoded by retrieving from the element a 1-D `variant` +// Tensor with `input_ragged_rank + 1` Tensors, corresponding to the splits and +// values of the decoded `RaggedTensor`. If `input_ragged_rank` is -1, then it is +// inferred as `output_ragged_rank` - `rank(encoded_ragged)`. See +// `RaggedTensorToVariant` for the corresponding encoding logic. +// +// Arguments: +// +// encoded_ragged: A `variant` Tensor containing encoded `RaggedTensor`s. +// input_ragged_rank: The ragged rank of each encoded `RaggedTensor` component in the input. If set to +// +// -1, this is inferred as `output_ragged_rank` - `rank(encoded_ragged)` +// +// output_ragged_rank: The expected ragged rank of the output `RaggedTensor`. The following must hold: +// +// `output_ragged_rank = rank(encoded_ragged) + input_ragged_rank`. +// +// Returns: +// +// output_nested_splits: A list of one or more Tensors representing the splits of the output +// +// `RaggedTensor`. +// +// output_dense_values: A Tensor representing the values of the output `RaggedTensor`. +func RaggedTensorFromVariant(scope *Scope, encoded_ragged tf.Output, input_ragged_rank int64, output_ragged_rank int64, Tvalues tf.DataType, optional ...RaggedTensorFromVariantAttr) (output_nested_splits []tf.Output, output_dense_values tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"input_ragged_rank": input_ragged_rank, "output_ragged_rank": output_ragged_rank, "Tvalues": Tvalues} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "RaggedTensorFromVariant", + Input: []tf.Input{ + encoded_ragged, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if output_nested_splits, idx, err = makeOutputList(op, idx, "output_nested_splits"); err != nil { + scope.UpdateErr("RaggedTensorFromVariant", err) + return + } + output_dense_values = op.Output(idx) + return output_nested_splits, output_dense_values +} + +// Writes a serialized proto summary. +// +// Writes `tensor`, a serialized proto at `step` using summary `writer`. +// +// Returns the created operation. +func WriteRawProtoSummary(scope *Scope, writer tf.Output, step tf.Output, tensor tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "WriteRawProtoSummary", + Input: []tf.Input{ + writer, step, tensor, + }, + } + return scope.AddOperation(opspec) +} + +// LoadTPUEmbeddingRMSPropParametersAttr is an optional argument to LoadTPUEmbeddingRMSPropParameters. +type LoadTPUEmbeddingRMSPropParametersAttr func(optionalAttr) + +// LoadTPUEmbeddingRMSPropParametersTableId sets the optional table_id attribute to value. +// If not specified, defaults to -1 +func LoadTPUEmbeddingRMSPropParametersTableId(value int64) LoadTPUEmbeddingRMSPropParametersAttr { + return func(m optionalAttr) { + m["table_id"] = value + } +} + +// LoadTPUEmbeddingRMSPropParametersTableName sets the optional table_name attribute to value. +// If not specified, defaults to "" +func LoadTPUEmbeddingRMSPropParametersTableName(value string) LoadTPUEmbeddingRMSPropParametersAttr { + return func(m optionalAttr) { + m["table_name"] = value + } +} + +// LoadTPUEmbeddingRMSPropParametersConfig sets the optional config attribute to value. +// If not specified, defaults to "" +func LoadTPUEmbeddingRMSPropParametersConfig(value string) LoadTPUEmbeddingRMSPropParametersAttr { + return func(m optionalAttr) { + m["config"] = value + } +} + +// Load RMSProp embedding parameters. +// +// An op that loads optimization parameters into HBM for embedding. Must be +// preceded by a ConfigureTPUEmbeddingHost op that sets up the correct +// embedding table configuration. For example, this op is used to install +// parameters that are loaded from a checkpoint before a training loop is +// executed. +// +// Arguments: +// +// parameters: Value of parameters used in the RMSProp optimization algorithm. +// ms: Value of ms used in the RMSProp optimization algorithm. +// mom: Value of mom used in the RMSProp optimization algorithm. +// +// Returns the created operation. +func LoadTPUEmbeddingRMSPropParameters(scope *Scope, parameters tf.Output, ms tf.Output, mom tf.Output, num_shards int64, shard_id int64, optional ...LoadTPUEmbeddingRMSPropParametersAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_shards": num_shards, "shard_id": shard_id} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "LoadTPUEmbeddingRMSPropParameters", + Input: []tf.Input{ + parameters, ms, mom, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// RetrieveTPUEmbeddingProximalAdagradParametersAttr is an optional argument to RetrieveTPUEmbeddingProximalAdagradParameters. +type RetrieveTPUEmbeddingProximalAdagradParametersAttr func(optionalAttr) + +// RetrieveTPUEmbeddingProximalAdagradParametersTableId sets the optional table_id attribute to value. +// If not specified, defaults to -1 +func RetrieveTPUEmbeddingProximalAdagradParametersTableId(value int64) RetrieveTPUEmbeddingProximalAdagradParametersAttr { + return func(m optionalAttr) { + m["table_id"] = value + } +} + +// RetrieveTPUEmbeddingProximalAdagradParametersTableName sets the optional table_name attribute to value. +// If not specified, defaults to "" +func RetrieveTPUEmbeddingProximalAdagradParametersTableName(value string) RetrieveTPUEmbeddingProximalAdagradParametersAttr { + return func(m optionalAttr) { + m["table_name"] = value + } +} + +// RetrieveTPUEmbeddingProximalAdagradParametersConfig sets the optional config attribute to value. +// If not specified, defaults to "" +func RetrieveTPUEmbeddingProximalAdagradParametersConfig(value string) RetrieveTPUEmbeddingProximalAdagradParametersAttr { + return func(m optionalAttr) { + m["config"] = value + } +} + +// Retrieve proximal Adagrad embedding parameters. +// +// An op that retrieves optimization parameters from embedding to host +// memory. Must be preceded by a ConfigureTPUEmbeddingHost op that sets up +// the correct embedding table configuration. For example, this op is +// used to retrieve updated parameters before saving a checkpoint. +// +// Returns: +// +// parameters: Parameter parameters updated by the proximal Adagrad optimization algorithm. +// accumulators: Parameter accumulators updated by the proximal Adagrad optimization algorithm. +func RetrieveTPUEmbeddingProximalAdagradParameters(scope *Scope, num_shards int64, shard_id int64, optional ...RetrieveTPUEmbeddingProximalAdagradParametersAttr) (parameters tf.Output, accumulators tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_shards": num_shards, "shard_id": shard_id} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "RetrieveTPUEmbeddingProximalAdagradParameters", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// MatrixTriangularSolveAttr is an optional argument to MatrixTriangularSolve. +type MatrixTriangularSolveAttr func(optionalAttr) + +// MatrixTriangularSolveLower sets the optional lower attribute to value. +// +// value: Boolean indicating whether the innermost matrices in `matrix` are +// lower or upper triangular. +// If not specified, defaults to true +func MatrixTriangularSolveLower(value bool) MatrixTriangularSolveAttr { + return func(m optionalAttr) { + m["lower"] = value + } +} + +// MatrixTriangularSolveAdjoint sets the optional adjoint attribute to value. +// +// value: Boolean indicating whether to solve with `matrix` or its (block-wise) +// +// adjoint. +// +// @compatibility(numpy) +// Equivalent to scipy.linalg.solve_triangular +// @end_compatibility +// If not specified, defaults to false +func MatrixTriangularSolveAdjoint(value bool) MatrixTriangularSolveAttr { + return func(m optionalAttr) { + m["adjoint"] = value + } +} + +// Solves systems of linear equations with upper or lower triangular matrices by backsubstitution. +// +// `matrix` is a tensor of shape `[..., M, M]` whose inner-most 2 dimensions form +// square matrices. If `lower` is `True` then the strictly upper triangular part +// of each inner-most matrix is assumed to be zero and not accessed. +// If `lower` is False then the strictly lower triangular part of each inner-most +// matrix is assumed to be zero and not accessed. +// `rhs` is a tensor of shape `[..., M, N]`. +// +// The output is a tensor of shape `[..., M, N]`. If `adjoint` is +// `True` then the innermost matrices in `output` satisfy matrix equations +// `matrix[..., :, :] * output[..., :, :] = rhs[..., :, :]`. +// If `adjoint` is `False` then the strictly then the innermost matrices in +// `output` satisfy matrix equations +// `adjoint(matrix[..., i, k]) * output[..., k, j] = rhs[..., i, j]`. +// +// Note, the batch shapes for the inputs only need to broadcast. +// +// Example: +// ```python +// +// a = tf.constant([[3, 0, 0, 0], +// +// [2, 1, 0, 0], +// [1, 0, 1, 0], +// [1, 1, 1, 1]], dtype=tf.float32) +// +// b = tf.constant([[4], +// +// [2], +// [4], +// [2]], dtype=tf.float32) +// +// x = tf.linalg.triangular_solve(a, b, lower=True) +// x +// # +// +// # in python3 one can use `a@x` +// tf.matmul(a, x) +// # +// ``` +// +// Arguments: +// +// matrix: Shape is `[..., M, M]`. +// rhs: Shape is `[..., M, K]`. +// +// Returns Shape is `[..., M, K]`. +func MatrixTriangularSolve(scope *Scope, matrix tf.Output, rhs tf.Output, optional ...MatrixTriangularSolveAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "MatrixTriangularSolve", + Input: []tf.Input{ + matrix, rhs, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// MaxPoolWithArgmaxAttr is an optional argument to MaxPoolWithArgmax. +type MaxPoolWithArgmaxAttr func(optionalAttr) + +// MaxPoolWithArgmaxTargmax sets the optional Targmax attribute to value. +// If not specified, defaults to DT_INT64 +func MaxPoolWithArgmaxTargmax(value tf.DataType) MaxPoolWithArgmaxAttr { + return func(m optionalAttr) { + m["Targmax"] = value + } +} + +// MaxPoolWithArgmaxIncludeBatchInIndex sets the optional include_batch_in_index attribute to value. +// +// value: Whether to include batch dimension in flattened index of `argmax`. +// If not specified, defaults to false +func MaxPoolWithArgmaxIncludeBatchInIndex(value bool) MaxPoolWithArgmaxAttr { + return func(m optionalAttr) { + m["include_batch_in_index"] = value + } +} + +// Performs max pooling on the input and outputs both max values and indices. +// +// The indices in `argmax` are flattened, so that a maximum value at position +// `[b, y, x, c]` becomes flattened index: +// `(y * width + x) * channels + c` if `include_batch_in_index` is False; +// `((b * height + y) * width + x) * channels + c` if `include_batch_in_index` is True. +// +// The indices returned are always in `[0, height) x [0, width)` before flattening, +// even if padding is involved and the mathematically correct answer is outside +// (either negative or too large). This is a bug, but fixing it is difficult to do +// in a safe backwards compatible way, especially due to flattening. +// +// Arguments: +// +// input: 4-D with shape `[batch, height, width, channels]`. Input to pool over. +// ksize: The size of the window for each dimension of the input tensor. +// strides: The stride of the sliding window for each dimension of the +// +// input tensor. +// +// padding: The type of padding algorithm to use. +// +// Returns: +// +// output: The max pooled output tensor. +// argmax: 4-D. The flattened indices of the max values chosen for each output. +func MaxPoolWithArgmax(scope *Scope, input tf.Output, ksize []int64, strides []int64, padding string, optional ...MaxPoolWithArgmaxAttr) (output tf.Output, argmax tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"ksize": ksize, "strides": strides, "padding": padding} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "MaxPoolWithArgmax", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// Adds sparse updates to the variable referenced by `resource`. +// +// This operation computes +// +// # Scalar indices +// ref[indices, ...] += updates[...] +// +// # Vector indices (for each i) +// ref[indices[i], ...] += updates[i, ...] +// +// # High rank indices (for each i, ..., j) +// ref[indices[i, ..., j], ...] += updates[i, ..., j, ...] +// +// Duplicate entries are handled correctly: if multiple `indices` reference +// the same location, their contributions add. +// +// Requires `updates.shape = indices.shape + ref.shape[1:]` or `updates.shape = []`. +// +//
+// +//
+// +// Arguments: +// +// resource: Should be from a `Variable` node. +// indices: A tensor of indices into the first dimension of `ref`. +// updates: A tensor of updated values to add to `ref`. +// +// Returns the created operation. +func ResourceScatterAdd(scope *Scope, resource tf.Output, indices tf.Output, updates tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "ResourceScatterAdd", + Input: []tf.Input{ + resource, indices, updates, + }, + } + return scope.AddOperation(opspec) +} + +// SqueezeAttr is an optional argument to Squeeze. +type SqueezeAttr func(optionalAttr) + +// SqueezeAxis sets the optional axis attribute to value. +// +// value: If specified, only squeezes the dimensions listed. The dimension +// index starts at 0. It is an error to squeeze a dimension that is not 1. Must +// be in the range `[-rank(input), rank(input))`. +// If not specified, defaults to <> +// +// REQUIRES: len(value) >= 0 +func SqueezeAxis(value []int64) SqueezeAttr { + return func(m optionalAttr) { + m["squeeze_dims"] = value + } +} + +// Removes dimensions of size 1 from the shape of a tensor. +// +// Given a tensor `input`, this operation returns a tensor of the same type with +// all dimensions of size 1 removed. If you don't want to remove all size 1 +// dimensions, you can remove specific size 1 dimensions by specifying +// `axis`. +// +// For example: +// +// ``` +// # 't' is a tensor of shape [1, 2, 1, 3, 1, 1] +// shape(squeeze(t)) ==> [2, 3] +// ``` +// +// Or, to remove specific size 1 dimensions: +// +// ``` +// # 't' is a tensor of shape [1, 2, 1, 3, 1, 1] +// shape(squeeze(t, [2, 4])) ==> [1, 2, 3, 1] +// ``` +// +// Arguments: +// +// input: The `input` to squeeze. +// +// Returns Contains the same data as `input`, but has one or more dimensions of +// size 1 removed. +func Squeeze(scope *Scope, input tf.Output, optional ...SqueezeAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Squeeze", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Aggregates the summary of accumulated stats for the batch. +// +// The summary stats contains gradients and hessians accumulated for each node, bucket and dimension id. +// +// Arguments: +// +// node_ids: int32; Rank 1 Tensor containing node ids for each example, shape [batch_size]. +// gradients: float32; Rank 2 Tensor (shape=[batch_size, logits_dimension]) with gradients for each example. +// hessians: float32; Rank 2 Tensor (shape=[batch_size, hessian_dimension]) with hessians for each example. +// feature_indices: int32; Rank 2 indices of feature sparse Tensors (shape=[number of sparse entries, 2]). +// +// Number of sparse entries across all instances from the batch. The first value is +// the index of the instance, the second is dimension of the feature. The second axis +// can only have 2 values, i.e., the input dense version of Tensor can only be matrix. +// +// feature_values: int32; Rank 1 values of feature sparse Tensors (shape=[number of sparse entries]). +// +// Number of sparse entries across all instances from the batch. The first value is +// the index of the instance, the second is dimension of the feature. +// +// feature_shape: int32; Rank 1 dense shape of feature sparse Tensors (shape=[2]). +// +// The first axis can only have 2 values, [batch_size, feature_dimension]. +// +// max_splits: int; the maximum number of splits possible in the whole tree. +// num_buckets: int; equals to the maximum possible value of bucketized feature + 1. +// +// Returns: +// +// stats_summary_indices: int32; Rank 2 indices of summary sparse Tensors (shape=[number of non zero statistics, 4]) +// +// The second axis can only be 4 including node id, feature dimension, bucket id, and statistics_dimension. +// statistics_dimension = logits_dimension + hessian_dimension. +// +// stats_summary_values: output Rank 1 Tensor (shape=[number of non zero statistics]) +// stats_summary_shape: output Rank 1 Tensor (shape=[4]) +// +// The tensor has following 4 values: [max_splits, feature_dimension, num_buckets, statistics_dimension], +// where statistics_dimension = gradient_dimension + hessian_dimension. gradient_dimension +// is the same as label_dimension, i.e., the output space. hessian_dimension can be the same +// as logits dimension when diagonal hessian is used, or label_dimension^2 when full +// hessian is used. +func BoostedTreesSparseAggregateStats(scope *Scope, node_ids tf.Output, gradients tf.Output, hessians tf.Output, feature_indices tf.Output, feature_values tf.Output, feature_shape tf.Output, max_splits int64, num_buckets int64) (stats_summary_indices tf.Output, stats_summary_values tf.Output, stats_summary_shape tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"max_splits": max_splits, "num_buckets": num_buckets} + opspec := tf.OpSpec{ + Type: "BoostedTreesSparseAggregateStats", + Input: []tf.Input{ + node_ids, gradients, hessians, feature_indices, feature_values, feature_shape, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// ResourceApplyAdagradAttr is an optional argument to ResourceApplyAdagrad. +type ResourceApplyAdagradAttr func(optionalAttr) + +// ResourceApplyAdagradUseLocking sets the optional use_locking attribute to value. +// +// value: If `True`, updating of the var and accum tensors will be protected +// by a lock; otherwise the behavior is undefined, but may exhibit less +// contention. +// If not specified, defaults to false +func ResourceApplyAdagradUseLocking(value bool) ResourceApplyAdagradAttr { + return func(m optionalAttr) { + m["use_locking"] = value + } +} + +// ResourceApplyAdagradUpdateSlots sets the optional update_slots attribute to value. +// If not specified, defaults to true +func ResourceApplyAdagradUpdateSlots(value bool) ResourceApplyAdagradAttr { + return func(m optionalAttr) { + m["update_slots"] = value + } +} + +// Update '*var' according to the adagrad scheme. +// +// accum += grad * grad +// var -= lr * grad * (1 / sqrt(accum)) +// +// Arguments: +// +// var_: Should be from a Variable(). +// accum: Should be from a Variable(). +// lr: Scaling factor. Must be a scalar. +// grad: The gradient. +// +// Returns the created operation. +func ResourceApplyAdagrad(scope *Scope, var_ tf.Output, accum tf.Output, lr tf.Output, grad tf.Output, optional ...ResourceApplyAdagradAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ResourceApplyAdagrad", + Input: []tf.Input{ + var_, accum, lr, grad, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// Returns the next record (key, value pair) produced by a Reader. +// +// Will dequeue from the input queue if necessary (e.g. when the +// Reader needs to start reading from a new file since it has finished +// with the previous file). +// +// Arguments: +// +// reader_handle: Handle to a Reader. +// queue_handle: Handle to a Queue, with string work items. +// +// Returns: +// +// key: A scalar. +// value: A scalar. +func ReaderReadV2(scope *Scope, reader_handle tf.Output, queue_handle tf.Output) (key tf.Output, value tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "ReaderReadV2", + Input: []tf.Input{ + reader_handle, queue_handle, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// Computes the matrix logarithm of one or more square matrices: +// +// \\(log(exp(A)) = A\\) +// +// This op is only defined for complex matrices. If A is positive-definite and +// real, then casting to a complex matrix, taking the logarithm and casting back +// to a real matrix will give the correct result. +// +// This function computes the matrix logarithm using the Schur-Parlett algorithm. +// Details of the algorithm can be found in Section 11.6.2 of: +// Nicholas J. Higham, Functions of Matrices: Theory and Computation, SIAM 2008. +// ISBN 978-0-898716-46-7. +// +// The input is a tensor of shape `[..., M, M]` whose inner-most 2 dimensions +// form square matrices. The output is a tensor of the same shape as the input +// containing the exponential for all input submatrices `[..., :, :]`. +// +// Arguments: +// +// input: Shape is `[..., M, M]`. +// +// Returns Shape is `[..., M, M]`. +// +// @compatibility(scipy) +// Equivalent to scipy.linalg.logm +// @end_compatibility +func MatrixLogarithm(scope *Scope, input tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "MatrixLogarithm", + Input: []tf.Input{ + input, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ResourceSparseApplyCenteredRMSPropAttr is an optional argument to ResourceSparseApplyCenteredRMSProp. +type ResourceSparseApplyCenteredRMSPropAttr func(optionalAttr) + +// ResourceSparseApplyCenteredRMSPropUseLocking sets the optional use_locking attribute to value. +// +// value: If `True`, updating of the var, mg, ms, and mom tensors is +// protected by a lock; otherwise the behavior is undefined, but may exhibit less +// contention. +// If not specified, defaults to false +func ResourceSparseApplyCenteredRMSPropUseLocking(value bool) ResourceSparseApplyCenteredRMSPropAttr { + return func(m optionalAttr) { + m["use_locking"] = value + } +} + +// Update '*var' according to the centered RMSProp algorithm. +// +// The centered RMSProp algorithm uses an estimate of the centered second moment +// (i.e., the variance) for normalization, as opposed to regular RMSProp, which +// uses the (uncentered) second moment. This often helps with training, but is +// slightly more expensive in terms of computation and memory. +// +// Note that in dense implementation of this algorithm, mg, ms, and mom will +// update even if the grad is zero, but in this sparse implementation, mg, ms, +// and mom will not update in iterations during which the grad is zero. +// +// mean_square = decay * mean_square + (1-decay) * gradient ** 2 +// mean_grad = decay * mean_grad + (1-decay) * gradient +// Delta = learning_rate * gradient / sqrt(mean_square + epsilon - mean_grad ** 2) +// +// ms <- rho * ms_{t-1} + (1-rho) * grad * grad +// mom <- momentum * mom_{t-1} + lr * grad / sqrt(ms + epsilon) +// var <- var - mom +// +// Arguments: +// +// var_: Should be from a Variable(). +// mg: Should be from a Variable(). +// ms: Should be from a Variable(). +// mom: Should be from a Variable(). +// lr: Scaling factor. Must be a scalar. +// rho: Decay rate. Must be a scalar. +// +// epsilon: Ridge term. Must be a scalar. +// grad: The gradient. +// indices: A vector of indices into the first dimension of var, ms and mom. +// +// Returns the created operation. +func ResourceSparseApplyCenteredRMSProp(scope *Scope, var_ tf.Output, mg tf.Output, ms tf.Output, mom tf.Output, lr tf.Output, rho tf.Output, momentum tf.Output, epsilon tf.Output, grad tf.Output, indices tf.Output, optional ...ResourceSparseApplyCenteredRMSPropAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ResourceSparseApplyCenteredRMSProp", + Input: []tf.Input{ + var_, mg, ms, mom, lr, rho, momentum, epsilon, grad, indices, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// FusedBatchNormGradAttr is an optional argument to FusedBatchNormGrad. +type FusedBatchNormGradAttr func(optionalAttr) + +// FusedBatchNormGradEpsilon sets the optional epsilon attribute to value. +// +// value: A small float number added to the variance of x. +// If not specified, defaults to 0.0001 +func FusedBatchNormGradEpsilon(value float32) FusedBatchNormGradAttr { + return func(m optionalAttr) { + m["epsilon"] = value + } +} + +// FusedBatchNormGradDataFormat sets the optional data_format attribute to value. +// +// value: The data format for y_backprop, x, x_backprop. +// Either "NHWC" (default) or "NCHW". +// If not specified, defaults to "NHWC" +func FusedBatchNormGradDataFormat(value string) FusedBatchNormGradAttr { + return func(m optionalAttr) { + m["data_format"] = value + } +} + +// FusedBatchNormGradIsTraining sets the optional is_training attribute to value. +// +// value: A bool value to indicate the operation is for training (default) +// or inference. +// If not specified, defaults to true +func FusedBatchNormGradIsTraining(value bool) FusedBatchNormGradAttr { + return func(m optionalAttr) { + m["is_training"] = value + } +} + +// Gradient for batch normalization. +// +// Note that the size of 4D Tensors are defined by either "NHWC" or "NCHW". +// The size of 1D Tensors matches the dimension C of the 4D Tensors. +// +// Arguments: +// +// y_backprop: A 4D Tensor for the gradient with respect to y. +// x: A 4D Tensor for input data. +// scale: A 1D Tensor for scaling factor, to scale the normalized x. +// reserve_space_1: When is_training is True, a 1D Tensor for the computed batch +// +// mean to be reused in gradient computation. When is_training is +// False, a 1D Tensor for the population mean to be reused in both +// 1st and 2nd order gradient computation. +// +// reserve_space_2: When is_training is True, a 1D Tensor for the computed batch +// +// variance (inverted variance in the cuDNN case) to be reused in +// gradient computation. When is_training is False, a 1D Tensor +// for the population variance to be reused in both 1st and 2nd +// order gradient computation. +// +// Returns: +// +// x_backprop: A 4D Tensor for the gradient with respect to x. +// scale_backprop: A 1D Tensor for the gradient with respect to scale. +// offset_backprop: A 1D Tensor for the gradient with respect to offset. +// reserve_space_3: Unused placeholder to match the mean input in FusedBatchNorm. +// reserve_space_4: Unused placeholder to match the variance input +// +// in FusedBatchNorm. +func FusedBatchNormGrad(scope *Scope, y_backprop tf.Output, x tf.Output, scale tf.Output, reserve_space_1 tf.Output, reserve_space_2 tf.Output, optional ...FusedBatchNormGradAttr) (x_backprop tf.Output, scale_backprop tf.Output, offset_backprop tf.Output, reserve_space_3 tf.Output, reserve_space_4 tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "FusedBatchNormGrad", + Input: []tf.Input{ + y_backprop, x, scale, reserve_space_1, reserve_space_2, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2), op.Output(3), op.Output(4) +} + +// EnqueueTPUEmbeddingSparseTensorBatchAttr is an optional argument to EnqueueTPUEmbeddingSparseTensorBatch. +type EnqueueTPUEmbeddingSparseTensorBatchAttr func(optionalAttr) + +// EnqueueTPUEmbeddingSparseTensorBatchDeviceOrdinal sets the optional device_ordinal attribute to value. +// +// value: The TPU device to use. Should be >= 0 and less than the number +// of TPU cores in the task on which the node is placed. +// If not specified, defaults to -1 +func EnqueueTPUEmbeddingSparseTensorBatchDeviceOrdinal(value int64) EnqueueTPUEmbeddingSparseTensorBatchAttr { + return func(m optionalAttr) { + m["device_ordinal"] = value + } +} + +// EnqueueTPUEmbeddingSparseTensorBatchCombiners sets the optional combiners attribute to value. +// +// value: A list of string scalars, one for each embedding table that specify +// how to normalize the embedding activations after weighted summation. +// Supported combiners are 'mean', 'sum', or 'sqrtn'. It is invalid to have +// the sum of the weights be 0 for 'mean' or the sum of the squared weights be +// 0 for 'sqrtn'. If combiners isn't passed, the default is to use 'sum' for +// all tables. +// If not specified, defaults to <> +func EnqueueTPUEmbeddingSparseTensorBatchCombiners(value []string) EnqueueTPUEmbeddingSparseTensorBatchAttr { + return func(m optionalAttr) { + m["combiners"] = value + } +} + +// EnqueueTPUEmbeddingSparseTensorBatchMaxSequenceLengths sets the optional max_sequence_lengths attribute to value. +// If not specified, defaults to <> +func EnqueueTPUEmbeddingSparseTensorBatchMaxSequenceLengths(value []int64) EnqueueTPUEmbeddingSparseTensorBatchAttr { + return func(m optionalAttr) { + m["max_sequence_lengths"] = value + } +} + +// EnqueueTPUEmbeddingSparseTensorBatchNumFeatures sets the optional num_features attribute to value. +// If not specified, defaults to <> +func EnqueueTPUEmbeddingSparseTensorBatchNumFeatures(value []int64) EnqueueTPUEmbeddingSparseTensorBatchAttr { + return func(m optionalAttr) { + m["num_features"] = value + } +} + +// Eases the porting of code that uses tf.nn.embedding_lookup_sparse(). +// +// sample_indices[i], embedding_indices[i] and aggregation_weights[i] correspond +// to the ith feature. table_ids[i] indicates which embedding table to look up ith +// feature. +// +// The tensors at corresponding positions in the three input lists (sample_indices, +// embedding_indices and aggregation_weights) must have the same shape, i.e. rank 1 +// with dim_size() equal to the total number of lookups into the table described by +// the corresponding feature. +// +// Arguments: +// +// sample_indices: A list of rank 1 Tensors specifying the training example to +// +// which the corresponding embedding_indices and aggregation_weights values +// belong. It corresponds to sp_ids.indices[:,0] in embedding_lookup_sparse(). +// +// embedding_indices: A list of rank 1 Tensors, indices into the embedding tables. +// +// It corresponds to sp_ids.values in embedding_lookup_sparse(). +// +// aggregation_weights: A list of rank 1 Tensors containing per training example +// +// aggregation weights. It corresponds to sp_weights.values in +// embedding_lookup_sparse(). +// +// mode_override: A string input that overrides the mode specified in the +// +// TPUEmbeddingConfiguration. Supported values are {'unspecified', 'inference', +// 'training', 'backward_pass_only'}. When set to 'unspecified', the mode set +// in TPUEmbeddingConfiguration is used, otherwise mode_override is used. +// +// table_ids: A list of integers specifying the identifier of the embedding table +// +// (offset of TableDescriptor in the TPUEmbeddingConfiguration) to lookup the +// corresponding input. The ith input is looked up using table_ids[i]. The size +// of the table_ids list must be equal to that of sample_indices, +// embedding_indices and aggregation_weights. +// +// Returns the created operation. +func EnqueueTPUEmbeddingSparseTensorBatch(scope *Scope, sample_indices []tf.Output, embedding_indices []tf.Output, aggregation_weights []tf.Output, mode_override tf.Output, table_ids []int64, optional ...EnqueueTPUEmbeddingSparseTensorBatchAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"table_ids": table_ids} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "EnqueueTPUEmbeddingSparseTensorBatch", + Input: []tf.Input{ + tf.OutputList(sample_indices), tf.OutputList(embedding_indices), tf.OutputList(aggregation_weights), mode_override, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// Returns a batched matrix tensor with new batched diagonal values. +// +// Given `input` and `diagonal`, this operation returns a tensor with the +// same shape and values as `input`, except for the main diagonal of the +// innermost matrices. These will be overwritten by the values in `diagonal`. +// +// The output is computed as follows: +// +// Assume `input` has `k+1` dimensions `[I, J, K, ..., M, N]` and `diagonal` has +// `k` dimensions `[I, J, K, ..., min(M, N)]`. Then the output is a +// tensor of rank `k+1` with dimensions `[I, J, K, ..., M, N]` where: +// +// - `output[i, j, k, ..., m, n] = diagonal[i, j, k, ..., n]` for `m == n`. +// - `output[i, j, k, ..., m, n] = input[i, j, k, ..., m, n]` for `m != n`. +// +// Arguments: +// +// input: Rank `k+1`, where `k >= 1`. +// diagonal: Rank `k`, where `k >= 1`. +// +// Returns Rank `k+1`, with `output.shape = input.shape`. +func MatrixSetDiag(scope *Scope, input tf.Output, diagonal tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "MatrixSetDiag", + Input: []tf.Input{ + input, diagonal, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes the minimum along segments of a tensor. +// +// Read +// [the section on segmentation](https://tensorflow.org/api_docs/python/tf/math#Segmentation) +// for an explanation of segments. +// +// This operator is similar to the unsorted segment sum operator found +// [(here)](../../../api_docs/python/math_ops.md#UnsortedSegmentSum). +// Instead of computing the sum over segments, it computes the minimum such that: +// +// \\(output_i = \min_{j...} data_[j...]\\) where min is over tuples `j...` such +// that `segment_ids[j...] == i`. +// +// If the minimum is empty for a given segment ID `i`, it outputs the largest +// possible value for the specific numeric type, +// `output[i] = numeric_limits::max()`. +// +// For example: +// +// ``` python +// c = tf.constant([[1,2,3,4], [5,6,7,8], [4,3,2,1]]) +// tf.unsorted_segment_min(c, tf.constant([0, 1, 0]), num_segments=2) +// # ==> [[ 1, 2, 2, 1], +// # [5, 6, 7, 8]] +// ``` +// +// If the given segment ID `i` is negative, then the corresponding value is +// dropped, and will not be included in the result. +// +// Arguments: +// +// segment_ids: A tensor whose shape is a prefix of `data.shape`. +// +// Returns Has same shape as data, except for the first `segment_ids.rank` +// dimensions, which are replaced with a single dimension which has size +// `num_segments`. +func UnsortedSegmentMin(scope *Scope, data tf.Output, segment_ids tf.Output, num_segments tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "UnsortedSegmentMin", + Input: []tf.Input{ + data, segment_ids, num_segments, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Checks whether a quantile stream has been initialized. +// +// An Op that checks if quantile stream resource is initialized. +// +// Arguments: +// +// quantile_stream_resource_handle: resource; The reference to quantile stream resource handle. +// +// Returns bool; True if the resource is initialized, False otherwise. +func IsBoostedTreesQuantileStreamResourceInitialized(scope *Scope, quantile_stream_resource_handle tf.Output) (is_initialized tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "IsBoostedTreesQuantileStreamResourceInitialized", + Input: []tf.Input{ + quantile_stream_resource_handle, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// DataFormatDimMapAttr is an optional argument to DataFormatDimMap. +type DataFormatDimMapAttr func(optionalAttr) + +// DataFormatDimMapSrcFormat sets the optional src_format attribute to value. +// +// value: source data format. +// If not specified, defaults to "NHWC" +func DataFormatDimMapSrcFormat(value string) DataFormatDimMapAttr { + return func(m optionalAttr) { + m["src_format"] = value + } +} + +// DataFormatDimMapDstFormat sets the optional dst_format attribute to value. +// +// value: destination data format. +// If not specified, defaults to "NCHW" +func DataFormatDimMapDstFormat(value string) DataFormatDimMapAttr { + return func(m optionalAttr) { + m["dst_format"] = value + } +} + +// Returns the dimension index in the destination data format given the one in +// +// the source data format. +// +// Arguments: +// +// x: A Tensor with each element as a dimension index in source data format. +// +// Must be in the range [-4, 4). +// +// Returns A Tensor with each element as a dimension index in destination data format. +func DataFormatDimMap(scope *Scope, x tf.Output, optional ...DataFormatDimMapAttr) (y tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "DataFormatDimMap", + Input: []tf.Input{ + x, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// StatelessRandomUniformAttr is an optional argument to StatelessRandomUniform. +type StatelessRandomUniformAttr func(optionalAttr) + +// StatelessRandomUniformDtype sets the optional dtype attribute to value. +// +// value: The type of the output. +// If not specified, defaults to DT_FLOAT +func StatelessRandomUniformDtype(value tf.DataType) StatelessRandomUniformAttr { + return func(m optionalAttr) { + m["dtype"] = value + } +} + +// Outputs deterministic pseudorandom random values from a uniform distribution. +// +// The generated values follow a uniform distribution in the range `[0, 1)`. The +// lower bound 0 is included in the range, while the upper bound 1 is excluded. +// +// The outputs are a deterministic function of `shape` and `seed`. +// +// Arguments: +// +// shape: The shape of the output tensor. +// seed: 2 seeds (shape [2]). +// +// Returns Random values with specified shape. +func StatelessRandomUniform(scope *Scope, shape tf.Output, seed tf.Output, optional ...StatelessRandomUniformAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "StatelessRandomUniform", + Input: []tf.Input{ + shape, seed, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// WriteImageSummaryAttr is an optional argument to WriteImageSummary. +type WriteImageSummaryAttr func(optionalAttr) + +// WriteImageSummaryMaxImages sets the optional max_images attribute to value. +// If not specified, defaults to 3 +// +// REQUIRES: value >= 1 +func WriteImageSummaryMaxImages(value int64) WriteImageSummaryAttr { + return func(m optionalAttr) { + m["max_images"] = value + } +} + +// Writes an image summary. +// +// Writes image `tensor` at `step` with `tag` using summary `writer`. +// `tensor` is image with shape [height, width, channels]. +// +// Returns the created operation. +func WriteImageSummary(scope *Scope, writer tf.Output, step tf.Output, tag tf.Output, tensor tf.Output, bad_color tf.Output, optional ...WriteImageSummaryAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "WriteImageSummary", + Input: []tf.Input{ + writer, step, tag, tensor, bad_color, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// OrderedMapClearAttr is an optional argument to OrderedMapClear. +type OrderedMapClearAttr func(optionalAttr) + +// OrderedMapClearCapacity sets the optional capacity attribute to value. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func OrderedMapClearCapacity(value int64) OrderedMapClearAttr { + return func(m optionalAttr) { + m["capacity"] = value + } +} + +// OrderedMapClearMemoryLimit sets the optional memory_limit attribute to value. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func OrderedMapClearMemoryLimit(value int64) OrderedMapClearAttr { + return func(m optionalAttr) { + m["memory_limit"] = value + } +} + +// OrderedMapClearContainer sets the optional container attribute to value. +// If not specified, defaults to "" +func OrderedMapClearContainer(value string) OrderedMapClearAttr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// OrderedMapClearSharedName sets the optional shared_name attribute to value. +// If not specified, defaults to "" +func OrderedMapClearSharedName(value string) OrderedMapClearAttr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// Op removes all elements in the underlying container. +// +// Returns the created operation. +func OrderedMapClear(scope *Scope, dtypes []tf.DataType, optional ...OrderedMapClearAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtypes": dtypes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "OrderedMapClear", + + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// LoadTPUEmbeddingAdagradParametersAttr is an optional argument to LoadTPUEmbeddingAdagradParameters. +type LoadTPUEmbeddingAdagradParametersAttr func(optionalAttr) + +// LoadTPUEmbeddingAdagradParametersTableId sets the optional table_id attribute to value. +// If not specified, defaults to -1 +func LoadTPUEmbeddingAdagradParametersTableId(value int64) LoadTPUEmbeddingAdagradParametersAttr { + return func(m optionalAttr) { + m["table_id"] = value + } +} + +// LoadTPUEmbeddingAdagradParametersTableName sets the optional table_name attribute to value. +// If not specified, defaults to "" +func LoadTPUEmbeddingAdagradParametersTableName(value string) LoadTPUEmbeddingAdagradParametersAttr { + return func(m optionalAttr) { + m["table_name"] = value + } +} + +// LoadTPUEmbeddingAdagradParametersConfig sets the optional config attribute to value. +// If not specified, defaults to "" +func LoadTPUEmbeddingAdagradParametersConfig(value string) LoadTPUEmbeddingAdagradParametersAttr { + return func(m optionalAttr) { + m["config"] = value + } +} + +// Load Adagrad embedding parameters. +// +// An op that loads optimization parameters into HBM for embedding. Must be +// preceded by a ConfigureTPUEmbeddingHost op that sets up the correct +// embedding table configuration. For example, this op is used to install +// parameters that are loaded from a checkpoint before a training loop is +// executed. +// +// Arguments: +// +// parameters: Value of parameters used in the Adagrad optimization algorithm. +// accumulators: Value of accumulators used in the Adagrad optimization algorithm. +// +// Returns the created operation. +func LoadTPUEmbeddingAdagradParameters(scope *Scope, parameters tf.Output, accumulators tf.Output, num_shards int64, shard_id int64, optional ...LoadTPUEmbeddingAdagradParametersAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_shards": num_shards, "shard_id": shard_id} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "LoadTPUEmbeddingAdagradParameters", + Input: []tf.Input{ + parameters, accumulators, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// Returns x / y element-wise. +// +// *NOTE*: `Div` supports broadcasting. More about broadcasting +// [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) +func Div(scope *Scope, x tf.Output, y tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Div", + Input: []tf.Input{ + x, y, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// A container for an iterator resource. +// +// Arguments: +// +// multi_device_iterator: A handle to the multi device iterator to delete. +// iterators: A list of iterator handles (unused). This is added so that automatic control dependencies get added during function tracing that ensure this op runs after all the dependent iterators are deleted. +// deleter: A variant deleter. +// +// Returns the created operation. +func DeleteMultiDeviceIterator(scope *Scope, multi_device_iterator tf.Output, iterators []tf.Output, deleter tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "DeleteMultiDeviceIterator", + Input: []tf.Input{ + multi_device_iterator, tf.OutputList(iterators), deleter, + }, + } + return scope.AddOperation(opspec) +} + +// ResizeBicubicGradAttr is an optional argument to ResizeBicubicGrad. +type ResizeBicubicGradAttr func(optionalAttr) + +// ResizeBicubicGradAlignCorners sets the optional align_corners attribute to value. +// +// value: If true, the centers of the 4 corner pixels of the input and grad tensors are +// aligned. Defaults to false. +// If not specified, defaults to false +func ResizeBicubicGradAlignCorners(value bool) ResizeBicubicGradAttr { + return func(m optionalAttr) { + m["align_corners"] = value + } +} + +// ResizeBicubicGradHalfPixelCenters sets the optional half_pixel_centers attribute to value. +// If not specified, defaults to false +func ResizeBicubicGradHalfPixelCenters(value bool) ResizeBicubicGradAttr { + return func(m optionalAttr) { + m["half_pixel_centers"] = value + } +} + +// Computes the gradient of bicubic interpolation. +// +// Arguments: +// +// grads: 4-D with shape `[batch, height, width, channels]`. +// original_image: 4-D with shape `[batch, orig_height, orig_width, channels]`, +// +// The image tensor that was resized. +// +// Returns 4-D with shape `[batch, orig_height, orig_width, channels]`. +// Gradients with respect to the input image. Input image must have been +// float or double. +func ResizeBicubicGrad(scope *Scope, grads tf.Output, original_image tf.Output, optional ...ResizeBicubicGradAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ResizeBicubicGrad", + Input: []tf.Input{ + grads, original_image, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// CudnnRNNAttr is an optional argument to CudnnRNN. +type CudnnRNNAttr func(optionalAttr) + +// CudnnRNNRnnMode sets the optional rnn_mode attribute to value. +// If not specified, defaults to "lstm" +func CudnnRNNRnnMode(value string) CudnnRNNAttr { + return func(m optionalAttr) { + m["rnn_mode"] = value + } +} + +// CudnnRNNInputMode sets the optional input_mode attribute to value. +// If not specified, defaults to "linear_input" +func CudnnRNNInputMode(value string) CudnnRNNAttr { + return func(m optionalAttr) { + m["input_mode"] = value + } +} + +// CudnnRNNDirection sets the optional direction attribute to value. +// If not specified, defaults to "unidirectional" +func CudnnRNNDirection(value string) CudnnRNNAttr { + return func(m optionalAttr) { + m["direction"] = value + } +} + +// CudnnRNNDropout sets the optional dropout attribute to value. +// If not specified, defaults to 0 +func CudnnRNNDropout(value float32) CudnnRNNAttr { + return func(m optionalAttr) { + m["dropout"] = value + } +} + +// CudnnRNNSeed sets the optional seed attribute to value. +// If not specified, defaults to 0 +func CudnnRNNSeed(value int64) CudnnRNNAttr { + return func(m optionalAttr) { + m["seed"] = value + } +} + +// CudnnRNNSeed2 sets the optional seed2 attribute to value. +// If not specified, defaults to 0 +func CudnnRNNSeed2(value int64) CudnnRNNAttr { + return func(m optionalAttr) { + m["seed2"] = value + } +} + +// CudnnRNNIsTraining sets the optional is_training attribute to value. +// If not specified, defaults to true +func CudnnRNNIsTraining(value bool) CudnnRNNAttr { + return func(m optionalAttr) { + m["is_training"] = value + } +} + +// A RNN backed by cuDNN. +// +// Computes the RNN from the input and initial states, with respect to the params +// buffer. +// +// rnn_mode: Indicates the type of the RNN model. +// input_mode: Indicate whether there is a linear projection between the input and +// +// the actual computation before the first layer. 'skip_input' is only allowed +// when input_size == num_units; 'auto_select' implies 'skip_input' when +// input_size == num_units; otherwise, it implies 'linear_input'. +// +// direction: Indicates whether a bidirectional model will be used. Should be +// +// "unidirectional" or "bidirectional". +// +// dropout: Dropout probability. When set to 0., dropout is disabled. +// seed: The 1st part of a seed to initialize dropout. +// seed2: The 2nd part of a seed to initialize dropout. +// input: A 3-D tensor with the shape of [seq_length, batch_size, input_size]. +// input_h: A 3-D tensor with the shape of [num_layer * dir, batch_size, +// +// num_units]. +// +// input_c: For LSTM, a 3-D tensor with the shape of +// +// [num_layer * dir, batch, num_units]. For other models, it is ignored. +// +// params: A 1-D tensor that contains the weights and biases in an opaque layout. +// +// The size must be created through CudnnRNNParamsSize, and initialized +// separately. Note that they might not be compatible across different +// generations. So it is a good idea to save and restore +// +// output: A 3-D tensor with the shape of [seq_length, batch_size, +// +// dir * num_units]. +// +// output_h: The same shape has input_h. +// output_c: The same shape as input_c for LSTM. An empty tensor for other models. +// is_training: Indicates whether this operation is used for inference or +// +// training. +// +// reserve_space: An opaque tensor that can be used in backprop calculation. It +// +// is only produced if is_training is false. +func CudnnRNN(scope *Scope, input tf.Output, input_h tf.Output, input_c tf.Output, params tf.Output, optional ...CudnnRNNAttr) (output tf.Output, output_h tf.Output, output_c tf.Output, reserve_space tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "CudnnRNN", + Input: []tf.Input{ + input, input_h, input_c, params, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2), op.Output(3) +} + +// ExperimentalThreadPoolHandleAttr is an optional argument to ExperimentalThreadPoolHandle. +type ExperimentalThreadPoolHandleAttr func(optionalAttr) + +// ExperimentalThreadPoolHandleMaxIntraOpParallelism sets the optional max_intra_op_parallelism attribute to value. +// +// value: The maximum degree of parallelism to use within operations that execute on this +// threadpool. +// If not specified, defaults to 1 +func ExperimentalThreadPoolHandleMaxIntraOpParallelism(value int64) ExperimentalThreadPoolHandleAttr { + return func(m optionalAttr) { + m["max_intra_op_parallelism"] = value + } +} + +// ExperimentalThreadPoolHandleContainer sets the optional container attribute to value. +// If not specified, defaults to "" +func ExperimentalThreadPoolHandleContainer(value string) ExperimentalThreadPoolHandleAttr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// ExperimentalThreadPoolHandleSharedName sets the optional shared_name attribute to value. +// If not specified, defaults to "" +func ExperimentalThreadPoolHandleSharedName(value string) ExperimentalThreadPoolHandleAttr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// Creates a dataset that uses a custom thread pool to compute `input_dataset`. +// +// Arguments: +// +// num_threads: The number of threads in the thread pool. +// display_name: A human-readable name for the threads that may be visible in some +// +// visualizations. +// threadpool. +// +// Returns A resource that can be consumed by one or more ExperimentalThreadPoolDataset +// ops. +func ExperimentalThreadPoolHandle(scope *Scope, num_threads int64, display_name string, optional ...ExperimentalThreadPoolHandleAttr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_threads": num_threads, "display_name": display_name} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ExperimentalThreadPoolHandle", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Inserts a dimension of 1 into a tensor's shape. +// +// Given a tensor `input`, this operation inserts a dimension of 1 at the +// dimension index `axis` of `input`'s shape. The dimension index `axis` starts at +// zero; if you specify a negative number for `axis` it is counted backward from +// the end. +// +// This operation is useful if you want to add a batch dimension to a single +// element. For example, if you have a single image of shape `[height, width, +// channels]`, you can make it a batch of 1 image with `expand_dims(image, 0)`, +// which will make the shape `[1, height, width, channels]`. +// +// Other examples: +// +// ``` +// # 't' is a tensor of shape [2] +// shape(expand_dims(t, 0)) ==> [1, 2] +// shape(expand_dims(t, 1)) ==> [2, 1] +// shape(expand_dims(t, -1)) ==> [2, 1] +// +// # 't2' is a tensor of shape [2, 3, 5] +// shape(expand_dims(t2, 0)) ==> [1, 2, 3, 5] +// shape(expand_dims(t2, 2)) ==> [2, 3, 1, 5] +// shape(expand_dims(t2, 3)) ==> [2, 3, 5, 1] +// ``` +// +// This operation requires that: +// +// `-1-input.dims() <= dim <= input.dims()` +// +// This operation is related to `squeeze()`, which removes dimensions of +// size 1. +// +// Arguments: +// +// axis: 0-D (scalar). Specifies the dimension index at which to +// +// expand the shape of `input`. Must be in the range +// `[-rank(input) - 1, rank(input)]`. +// +// Returns Contains the same data as `input`, but its shape has an additional +// dimension of size 1 added. +func ExpandDims(scope *Scope, input tf.Output, axis tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "ExpandDims", + Input: []tf.Input{ + input, axis, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Receives the named tensor from another XLA computation. Wraps the XLA Recv +// +// operator documented at +// +// https://www.tensorflow.org/performance/xla/operation_semantics#recv . +// +// Arguments: +// +// dtype: The type of the tensor. +// tensor_name: A string key that identifies the channel. +// shape: The shape of the tensor. +// +// Returns The tensor to receive. +func XlaRecv(scope *Scope, dtype tf.DataType, tensor_name string, shape tf.Shape) (tensor tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtype": dtype, "tensor_name": tensor_name, "shape": shape} + opspec := tf.OpSpec{ + Type: "XlaRecv", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Selects num_to_sample rows of input using the KMeans++ criterion. +// +// Rows of points are assumed to be input points. One row is selected at random. +// Subsequent rows are sampled with probability proportional to the squared L2 +// distance from the nearest row selected thus far till num_to_sample rows have +// been sampled. +// +// Arguments: +// +// points: Matrix of shape (n, d). Rows are assumed to be input points. +// num_to_sample: Scalar. The number of rows to sample. This value must not be larger than n. +// seed: Scalar. Seed for initializing the random number generator. +// num_retries_per_sample: Scalar. For each row that is sampled, this parameter +// +// specifies the number of additional points to draw from the current +// distribution before selecting the best. If a negative value is specified, a +// heuristic is used to sample O(log(num_to_sample)) additional points. +// +// Returns Matrix of shape (num_to_sample, d). The sampled rows. +func KmeansPlusPlusInitialization(scope *Scope, points tf.Output, num_to_sample tf.Output, seed tf.Output, num_retries_per_sample tf.Output) (samples tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "KmeansPlusPlusInitialization", + Input: []tf.Input{ + points, num_to_sample, seed, num_retries_per_sample, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Reduces sparse updates into the variable referenced by `resource` using the `max` operation. +// +// This operation computes +// +// # Scalar indices +// ref[indices, ...] = max(ref[indices, ...], updates[...]) +// +// # Vector indices (for each i) +// ref[indices[i], ...] = max(ref[indices[i], ...], updates[i, ...]) +// +// # High rank indices (for each i, ..., j) +// ref[indices[i, ..., j], ...] = max(ref[indices[i, ..., j], ...], updates[i, ..., j, ...]) +// +// Duplicate entries are handled correctly: if multiple `indices` reference +// the same location, their contributions are combined. +// +// Requires `updates.shape = indices.shape + ref.shape[1:]` or `updates.shape = []`. +// +//
+// +//
+// +// Arguments: +// +// resource: Should be from a `Variable` node. +// indices: A tensor of indices into the first dimension of `ref`. +// updates: A tensor of updated values to add to `ref`. +// +// Returns the created operation. +func ResourceScatterMax(scope *Scope, resource tf.Output, indices tf.Output, updates tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "ResourceScatterMax", + Input: []tf.Input{ + resource, indices, updates, + }, + } + return scope.AddOperation(opspec) +} + +// MutexV2Attr is an optional argument to MutexV2. +type MutexV2Attr func(optionalAttr) + +// MutexV2Container sets the optional container attribute to value. +// +// value: If non-empty, this variable is placed in the given container. +// Otherwise, a default container is used. +// If not specified, defaults to "" +func MutexV2Container(value string) MutexV2Attr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// MutexV2SharedName sets the optional shared_name attribute to value. +// +// value: If non-empty, this variable is named in the given bucket +// with this shared_name. Otherwise, the node name is used instead. +// If not specified, defaults to "" +func MutexV2SharedName(value string) MutexV2Attr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// Creates a Mutex resource that can be locked by `MutexLock`. +// +// Returns The mutex resource. +func MutexV2(scope *Scope, optional ...MutexV2Attr) (resource tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "MutexV2", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Reshapes a SparseTensor to represent values in a new dense shape. +// +// This operation has the same semantics as reshape on the represented dense +// tensor. The `input_indices` are recomputed based on the requested `new_shape`. +// +// If one component of `new_shape` is the special value -1, the size of that +// dimension is computed so that the total dense size remains constant. At +// most one component of `new_shape` can be -1. The number of dense elements +// implied by `new_shape` must be the same as the number of dense elements +// originally implied by `input_shape`. +// +// Reshaping does not affect the order of values in the SparseTensor. +// +// If the input tensor has rank `R_in` and `N` non-empty values, and `new_shape` +// has length `R_out`, then `input_indices` has shape `[N, R_in]`, +// `input_shape` has length `R_in`, `output_indices` has shape `[N, R_out]`, and +// `output_shape` has length `R_out`. +// +// Arguments: +// +// input_indices: 2-D. `N x R_in` matrix with the indices of non-empty values in a +// +// SparseTensor. +// +// input_shape: 1-D. `R_in` vector with the input SparseTensor's dense shape. +// new_shape: 1-D. `R_out` vector with the requested new dense shape. +// +// Returns: +// +// output_indices: 2-D. `N x R_out` matrix with the updated indices of non-empty +// +// values in the output SparseTensor. +// +// output_shape: 1-D. `R_out` vector with the full dense shape of the output +// +// SparseTensor. This is the same as `new_shape` but with any -1 dimensions +// filled in. +func SparseReshape(scope *Scope, input_indices tf.Output, input_shape tf.Output, new_shape tf.Output) (output_indices tf.Output, output_shape tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "SparseReshape", + Input: []tf.Input{ + input_indices, input_shape, new_shape, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// Gets the next output from the given iterator . +func IteratorGetNext(scope *Scope, iterator tf.Output, output_types []tf.DataType, output_shapes []tf.Shape) (components []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + opspec := tf.OpSpec{ + Type: "IteratorGetNext", + Input: []tf.Input{ + iterator, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if components, idx, err = makeOutputList(op, idx, "components"); err != nil { + scope.UpdateErr("IteratorGetNext", err) + return + } + return components +} + +// Operator that connects the output of an XLA computation to other consumer graph nodes. +func XlaClusterOutput(scope *Scope, input tf.Output) (outputs tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "XlaClusterOutput", + Input: []tf.Input{ + input, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns a list of tensors with the same shapes and contents as the input +// +// tensors. +// +// This op can be used to override the gradient for complicated functions. For +// example, suppose y = f(x) and we wish to apply a custom function g for backprop +// such that dx = g(dy). In Python, +// +// ```python +// with tf.get_default_graph().gradient_override_map( +// +// {'IdentityN': 'OverrideGradientWithG'}): +// y, _ = identity_n([f(x), x]) +// +// @tf.RegisterGradient('OverrideGradientWithG') +// def ApplyG(op, dy, _): +// +// return [None, g(dy)] # Do not backprop to f(x). +// +// ``` +func IdentityN(scope *Scope, input []tf.Output) (output []tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "IdentityN", + Input: []tf.Input{ + tf.OutputList(input), + }, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if output, idx, err = makeOutputList(op, idx, "output"); err != nil { + scope.UpdateErr("IdentityN", err) + return + } + return output +} + +// Computes the number of elements in the given queue. +// +// Arguments: +// +// handle: The handle to a queue. +// +// Returns The number of elements in the given queue. +func QueueSizeV2(scope *Scope, handle tf.Output) (size tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "QueueSizeV2", + Input: []tf.Input{ + handle, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ResourceScatterNdAddAttr is an optional argument to ResourceScatterNdAdd. +type ResourceScatterNdAddAttr func(optionalAttr) + +// ResourceScatterNdAddUseLocking sets the optional use_locking attribute to value. +// +// value: An optional bool. Defaults to True. If True, the assignment will +// be protected by a lock; otherwise the behavior is undefined, +// but may exhibit less contention. +// If not specified, defaults to true +func ResourceScatterNdAddUseLocking(value bool) ResourceScatterNdAddAttr { + return func(m optionalAttr) { + m["use_locking"] = value + } +} + +// ResourceScatterNdAddBadIndicesPolicy sets the optional bad_indices_policy attribute to value. +// If not specified, defaults to "" +func ResourceScatterNdAddBadIndicesPolicy(value string) ResourceScatterNdAddAttr { + return func(m optionalAttr) { + m["bad_indices_policy"] = value + } +} + +// Applies sparse addition to individual values or slices in a Variable. +// +// `ref` is a `Tensor` with rank `P` and `indices` is a `Tensor` of rank `Q`. +// +// `indices` must be integer tensor, containing indices into `ref`. +// It must be shape `[d_0, ..., d_{Q-2}, K]` where `0 < K <= P`. +// +// The innermost dimension of `indices` (with length `K`) corresponds to +// indices into elements (if `K = P`) or slices (if `K < P`) along the `K`th +// dimension of `ref`. +// +// `updates` is `Tensor` of rank `Q-1+P-K` with shape: +// +// ``` +// [d_0, ..., d_{Q-2}, ref.shape[K], ..., ref.shape[P-1]] +// ``` +// +// For example, say we want to add 4 scattered elements to a rank-1 tensor to +// 8 elements. In Python, that addition would look like this: +// +// ```python +// ref = tf.Variable([1, 2, 3, 4, 5, 6, 7, 8], use_resource=True) +// indices = tf.constant([[4], [3], [1], [7]]) +// updates = tf.constant([9, 10, 11, 12]) +// add = tf.scatter_nd_add(ref, indices, updates) +// with tf.Session() as sess: +// +// print sess.run(add) +// +// ``` +// +// The resulting update to ref would look like this: +// +// [1, 13, 3, 14, 14, 6, 7, 20] +// +// See `tf.scatter_nd` for more details about how to make updates to +// slices. +// +// Arguments: +// +// ref: A resource handle. Must be from a VarHandleOp. +// indices: A Tensor. Must be one of the following types: int32, int64. +// +// A tensor of indices into ref. +// +// updates: A Tensor. Must have the same type as ref. A tensor of +// +// values to add to ref. +// +// Returns the created operation. +func ResourceScatterNdAdd(scope *Scope, ref tf.Output, indices tf.Output, updates tf.Output, optional ...ResourceScatterNdAddAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ResourceScatterNdAdd", + Input: []tf.Input{ + ref, indices, updates, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// QueueDequeueManyV2Attr is an optional argument to QueueDequeueManyV2. +type QueueDequeueManyV2Attr func(optionalAttr) + +// QueueDequeueManyV2TimeoutMs sets the optional timeout_ms attribute to value. +// +// value: If the queue has fewer than n elements, this operation +// will block for up to timeout_ms milliseconds. +// Note: This option is not supported yet. +// If not specified, defaults to -1 +func QueueDequeueManyV2TimeoutMs(value int64) QueueDequeueManyV2Attr { + return func(m optionalAttr) { + m["timeout_ms"] = value + } +} + +// Dequeues `n` tuples of one or more tensors from the given queue. +// +// If the queue is closed and there are fewer than `n` elements, then an +// OutOfRange error is returned. +// +// This operation concatenates queue-element component tensors along the +// 0th dimension to make a single component tensor. All of the components +// in the dequeued tuple will have size `n` in the 0th dimension. +// +// This operation has `k` outputs, where `k` is the number of components in +// the tuples stored in the given queue, and output `i` is the ith +// component of the dequeued tuple. +// +// N.B. If the queue is empty, this operation will block until `n` elements +// have been dequeued (or 'timeout_ms' elapses, if specified). +// +// Arguments: +// +// handle: The handle to a queue. +// n: The number of tuples to dequeue. +// component_types: The type of each component in a tuple. +// +// Returns One or more tensors that were dequeued as a tuple. +func QueueDequeueManyV2(scope *Scope, handle tf.Output, n tf.Output, component_types []tf.DataType, optional ...QueueDequeueManyV2Attr) (components []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"component_types": component_types} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "QueueDequeueManyV2", + Input: []tf.Input{ + handle, n, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if components, idx, err = makeOutputList(op, idx, "components"); err != nil { + scope.UpdateErr("QueueDequeueManyV2", err) + return + } + return components +} + +// DebugIdentityV2Attr is an optional argument to DebugIdentityV2. +type DebugIdentityV2Attr func(optionalAttr) + +// DebugIdentityV2TfdbgContextId sets the optional tfdbg_context_id attribute to value. +// +// value: A tfdbg-generated ID for the context that the op belongs to, +// +// e.g., a concrete compiled tf.function. +// +// If not specified, defaults to "" +func DebugIdentityV2TfdbgContextId(value string) DebugIdentityV2Attr { + return func(m optionalAttr) { + m["tfdbg_context_id"] = value + } +} + +// DebugIdentityV2OpName sets the optional op_name attribute to value. +// +// value: Optional. Name of the op that the debug op is concerned with. +// +// Used only for single-tensor trace. +// +// If not specified, defaults to "" +func DebugIdentityV2OpName(value string) DebugIdentityV2Attr { + return func(m optionalAttr) { + m["op_name"] = value + } +} + +// DebugIdentityV2OutputSlot sets the optional output_slot attribute to value. +// +// value: Optional. Output slot index of the tensor that the debug op +// +// is concerned with. Used only for single-tensor trace. +// +// If not specified, defaults to -1 +func DebugIdentityV2OutputSlot(value int64) DebugIdentityV2Attr { + return func(m optionalAttr) { + m["output_slot"] = value + } +} + +// DebugIdentityV2TensorDebugMode sets the optional tensor_debug_mode attribute to value. +// +// value: TensorDebugMode enum value. See debug_event.proto for details. +// If not specified, defaults to -1 +func DebugIdentityV2TensorDebugMode(value int64) DebugIdentityV2Attr { + return func(m optionalAttr) { + m["tensor_debug_mode"] = value + } +} + +// DebugIdentityV2DebugUrls sets the optional debug_urls attribute to value. +// +// value: List of URLs to debug targets, e.g., file:///foo/tfdbg_dump. +// If not specified, defaults to <> +func DebugIdentityV2DebugUrls(value []string) DebugIdentityV2Attr { + return func(m optionalAttr) { + m["debug_urls"] = value + } +} + +// DebugIdentityV2CircularBufferSize sets the optional circular_buffer_size attribute to value. +// If not specified, defaults to 1000 +func DebugIdentityV2CircularBufferSize(value int64) DebugIdentityV2Attr { + return func(m optionalAttr) { + m["circular_buffer_size"] = value + } +} + +// DebugIdentityV2TfdbgRunId sets the optional tfdbg_run_id attribute to value. +// If not specified, defaults to "" +func DebugIdentityV2TfdbgRunId(value string) DebugIdentityV2Attr { + return func(m optionalAttr) { + m["tfdbg_run_id"] = value + } +} + +// Debug Identity V2 Op. +// +// Provides an identity mapping from input to output, while writing the content of +// the input tensor by calling DebugEventsWriter. +// +// The semantics of the input tensor depends on tensor_debug_mode. In typical +// usage, the input tensor comes directly from the user computation only when +// graph_debug_mode is FULL_TENSOR (see protobuf/debug_event.proto for a +// list of all the possible values of graph_debug_mode). For the other debug modes, +// the input tensor should be produced by an additional op or subgraph that +// computes summary information about one or more tensors. +// +// Arguments: +// +// input: Input tensor, non-Reference type +func DebugIdentityV2(scope *Scope, input tf.Output, optional ...DebugIdentityV2Attr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "DebugIdentityV2", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Reduces `input` from `num_devices` using `reduction` to a single device. +// +// Reduces `input` from `num_devices` using `reduction` to a single device. +// +// The graph should be constructed so that all inputs have a valid device +// assignment, and the op itself is assigned one of these devices. +// +// input: The input to the reduction. +// data: the value of the reduction across all `num_devices` devices. +// reduction: the reduction operation to perform. +func NcclReduce(scope *Scope, input []tf.Output, reduction string) (data tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"reduction": reduction} + opspec := tf.OpSpec{ + Type: "NcclReduce", + Input: []tf.Input{ + tf.OutputList(input), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// BiasAddAttr is an optional argument to BiasAdd. +type BiasAddAttr func(optionalAttr) + +// BiasAddDataFormat sets the optional data_format attribute to value. +// +// value: Specify the data format of the input and output data. With the +// default format "NHWC", the bias tensor will be added to the last dimension +// of the value tensor. +// Alternatively, the format could be "NCHW", the data storage order of: +// +// [batch, in_channels, in_height, in_width]. +// +// The tensor will be added to "in_channels", the third-to-the-last +// +// dimension. +// +// If not specified, defaults to "NHWC" +func BiasAddDataFormat(value string) BiasAddAttr { + return func(m optionalAttr) { + m["data_format"] = value + } +} + +// Adds `bias` to `value`. +// +// This is a special case of `tf.add` where `bias` is restricted to be 1-D. +// Broadcasting is supported, so `value` may have any number of dimensions. +// +// Arguments: +// +// value: Any number of dimensions. +// bias: 1-D with size the last dimension of `value`. +// +// Returns Broadcasted sum of `value` and `bias`. +func BiasAdd(scope *Scope, value tf.Output, bias tf.Output, optional ...BiasAddAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "BiasAdd", + Input: []tf.Input{ + value, bias, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns the diagonal part of the tensor. +// +// This operation returns a tensor with the `diagonal` part +// of the `input`. The `diagonal` part is computed as follows: +// +// Assume `input` has dimensions `[D1,..., Dk, D1,..., Dk]`, then the output is a +// tensor of rank `k` with dimensions `[D1,..., Dk]` where: +// +// `diagonal[i1,..., ik] = input[i1, ..., ik, i1,..., ik]`. +// +// For example: +// +// ``` +// # 'input' is [[1, 0, 0, 0] +// +// [0, 2, 0, 0] +// [0, 0, 3, 0] +// [0, 0, 0, 4]] +// +// tf.diag_part(input) ==> [1, 2, 3, 4] +// ``` +// +// Arguments: +// +// input: Rank k tensor where k is even and not zero. +// +// Returns The extracted diagonal. +func DiagPart(scope *Scope, input tf.Output) (diagonal tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "DiagPart", + Input: []tf.Input{ + input, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Slice a `SparseTensor` based on the `start` and `size`. +// +// For example, if the input is +// +// input_tensor = shape = [2, 7] +// [ a d e ] +// [b c ] +// +// Graphically the output tensors are: +// +// sparse_slice([0, 0], [2, 4]) = shape = [2, 4] +// [ a ] +// [b c ] +// +// sparse_slice([0, 4], [2, 3]) = shape = [2, 3] +// [ d e ] +// [ ] +// +// Arguments: +// +// indices: 2-D tensor represents the indices of the sparse tensor. +// values: 1-D tensor represents the values of the sparse tensor. +// shape: 1-D. tensor represents the shape of the sparse tensor. +// start: 1-D. tensor represents the start of the slice. +// size: 1-D. tensor represents the size of the slice. +// +// output indices: A list of 1-D tensors represents the indices of the output +// sparse tensors. +// +// Returns: +// +// output_indices +// output_values: A list of 1-D tensors represents the values of the output sparse +// +// tensors. +// +// output_shape: A list of 1-D tensors represents the shape of the output sparse +// +// tensors. +func SparseSlice(scope *Scope, indices tf.Output, values tf.Output, shape tf.Output, start tf.Output, size tf.Output) (output_indices tf.Output, output_values tf.Output, output_shape tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "SparseSlice", + Input: []tf.Input{ + indices, values, shape, start, size, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// Calculates gains for each feature and returns the best possible split information for the feature. +// +// The split information is the best threshold (bucket id), gains and left/right node contributions per node for each feature. +// +// It is possible that not all nodes can be split on each feature. Hence, the list of possible nodes can differ between the features. Therefore, we return `node_ids_list` for each feature, containing the list of nodes that this feature can be used to split. +// +// In this manner, the output is the best split per features and per node, so that it needs to be combined later to produce the best split for each node (among all possible features). +// +// The length of output lists are all of the same length, `num_features`. +// The output shapes are compatible in a way that the first dimension of all tensors of all lists are the same and equal to the number of possible split nodes for each feature. +// +// Arguments: +// +// node_id_range: A Rank 1 tensor (shape=[2]) to specify the range [first, last) of node ids to process within `stats_summary_list`. The nodes are iterated between the two nodes specified by the tensor, as like `for node_id in range(node_id_range[0], node_id_range[1])` (Note that the last index node_id_range[1] is exclusive). +// stats_summary_list: A list of Rank 3 tensor (#shape=[max_splits, bucket, 2]) for accumulated stats summary (gradient/hessian) per node per buckets for each feature. The first dimension of the tensor is the maximum number of splits, and thus not all elements of it will be used, but only the indexes specified by node_ids will be used. +// l1: l1 regularization factor on leaf weights, per instance based. +// l2: l2 regularization factor on leaf weights, per instance based. +// tree_complexity: adjustment to the gain, per leaf based. +// min_node_weight: minimum avg of hessians in a node before required for the node to be considered for splitting. +// max_splits: the number of nodes that can be split in the whole tree. Used as a dimension of output tensors. +// +// Returns: +// +// node_ids_list: An output list of Rank 1 tensors indicating possible split node ids for each feature. The length of the list is num_features, but each tensor has different size as each feature provides different possible nodes. See above for details like shapes and sizes. +// gains_list: An output list of Rank 1 tensors indicating the best gains for each feature to split for certain nodes. See above for details like shapes and sizes. +// thresholds_list: An output list of Rank 1 tensors indicating the bucket id to compare with (as a threshold) for split in each node. See above for details like shapes and sizes. +// left_node_contribs_list: A list of Rank 2 tensors indicating the contribution of the left nodes when branching from parent nodes (given by the tensor element in the output node_ids_list) to the left direction by the given threshold for each feature. This value will be used to make the left node value by adding to the parent node value. Second dimension size is 1 for 1-dimensional logits, but would be larger for multi-class problems. See above for details like shapes and sizes. +// right_node_contribs_list: A list of Rank 2 tensors, with the same shape/conditions as left_node_contribs_list, but just that the value is for the right node. +func BoostedTreesCalculateBestGainsPerFeature(scope *Scope, node_id_range tf.Output, stats_summary_list []tf.Output, l1 tf.Output, l2 tf.Output, tree_complexity tf.Output, min_node_weight tf.Output, max_splits int64) (node_ids_list []tf.Output, gains_list []tf.Output, thresholds_list []tf.Output, left_node_contribs_list []tf.Output, right_node_contribs_list []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"max_splits": max_splits} + opspec := tf.OpSpec{ + Type: "BoostedTreesCalculateBestGainsPerFeature", + Input: []tf.Input{ + node_id_range, tf.OutputList(stats_summary_list), l1, l2, tree_complexity, min_node_weight, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if node_ids_list, idx, err = makeOutputList(op, idx, "node_ids_list"); err != nil { + scope.UpdateErr("BoostedTreesCalculateBestGainsPerFeature", err) + return + } + if gains_list, idx, err = makeOutputList(op, idx, "gains_list"); err != nil { + scope.UpdateErr("BoostedTreesCalculateBestGainsPerFeature", err) + return + } + if thresholds_list, idx, err = makeOutputList(op, idx, "thresholds_list"); err != nil { + scope.UpdateErr("BoostedTreesCalculateBestGainsPerFeature", err) + return + } + if left_node_contribs_list, idx, err = makeOutputList(op, idx, "left_node_contribs_list"); err != nil { + scope.UpdateErr("BoostedTreesCalculateBestGainsPerFeature", err) + return + } + if right_node_contribs_list, idx, err = makeOutputList(op, idx, "right_node_contribs_list"); err != nil { + scope.UpdateErr("BoostedTreesCalculateBestGainsPerFeature", err) + return + } + return node_ids_list, gains_list, thresholds_list, left_node_contribs_list, right_node_contribs_list +} + +// Outputs deterministic pseudorandom random integers from a uniform distribution. +// +// The generated values follow a uniform distribution in the range `[minval, maxval)`. +// +// The outputs are a deterministic function of `shape`, `seed`, `minval`, and `maxval`. +// +// Arguments: +// +// shape: The shape of the output tensor. +// seed: 2 seeds (shape [2]). +// minval: Minimum value (inclusive, scalar). +// maxval: Maximum value (exclusive, scalar). +// +// Returns Random values with specified shape. +func StatelessRandomUniformInt(scope *Scope, shape tf.Output, seed tf.Output, minval tf.Output, maxval tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "StatelessRandomUniformInt", + Input: []tf.Input{ + shape, seed, minval, maxval, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Creates ngrams from ragged string data. +// +// This op accepts a ragged tensor with 1 ragged dimension containing only +// strings and outputs a ragged tensor with 1 ragged dimension containing ngrams +// of that string, joined along the innermost axis. +// +// Arguments: +// +// data: The values tensor of the ragged string tensor to make ngrams out of. Must be a +// +// 1D string tensor. +// +// data_splits: The splits tensor of the ragged string tensor to make ngrams out of. +// separator: The string to append between elements of the token. Use "" for no separator. +// ngram_widths: The sizes of the ngrams to create. +// left_pad: The string to use to pad the left side of the ngram sequence. Only used if +// +// pad_width != 0. +// +// right_pad: The string to use to pad the right side of the ngram sequence. Only used if +// +// pad_width != 0. +// +// pad_width: The number of padding elements to add to each side of each +// +// sequence. Note that padding will never be greater than 'ngram_widths'-1 +// regardless of this value. If `pad_width=-1`, then add `max(ngram_widths)-1` +// elements. +// +// Returns: +// +// ngrams: The values tensor of the output ngrams ragged tensor. +// ngrams_splits: The splits tensor of the output ngrams ragged tensor. +func StringNGrams(scope *Scope, data tf.Output, data_splits tf.Output, separator string, ngram_widths []int64, left_pad string, right_pad string, pad_width int64, preserve_short_sequences bool) (ngrams tf.Output, ngrams_splits tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"separator": separator, "ngram_widths": ngram_widths, "left_pad": left_pad, "right_pad": right_pad, "pad_width": pad_width, "preserve_short_sequences": preserve_short_sequences} + opspec := tf.OpSpec{ + Type: "StringNGrams", + Input: []tf.Input{ + data, data_splits, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// AutoShardDatasetAttr is an optional argument to AutoShardDataset. +type AutoShardDatasetAttr func(optionalAttr) + +// AutoShardDatasetAutoShardPolicy sets the optional auto_shard_policy attribute to value. +// If not specified, defaults to 0 +func AutoShardDatasetAutoShardPolicy(value int64) AutoShardDatasetAttr { + return func(m optionalAttr) { + m["auto_shard_policy"] = value + } +} + +// AutoShardDatasetNumReplicas sets the optional num_replicas attribute to value. +// If not specified, defaults to 0 +func AutoShardDatasetNumReplicas(value int64) AutoShardDatasetAttr { + return func(m optionalAttr) { + m["num_replicas"] = value + } +} + +// Creates a dataset that shards the input dataset. +// +// Creates a dataset that shards the input dataset by num_workers, returning a +// sharded dataset for the index-th worker. This attempts to automatically shard +// a dataset by examining the Dataset graph and inserting a shard op before the +// inputs to a reader Dataset (e.g. CSVDataset, TFRecordDataset). +// +// This dataset will throw a NotFound error if we cannot shard the dataset +// automatically. +// +// Arguments: +// +// input_dataset: A variant tensor representing the input dataset. +// num_workers: A scalar representing the number of workers to distribute this dataset across. +// index: A scalar representing the index of the current worker out of num_workers. +func AutoShardDataset(scope *Scope, input_dataset tf.Output, num_workers tf.Output, index tf.Output, output_types []tf.DataType, output_shapes []tf.Shape, optional ...AutoShardDatasetAttr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "AutoShardDataset", + Input: []tf.Input{ + input_dataset, num_workers, index, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Calculates the gradient of the SparseMatrixSoftmax op. +// +// Arguments: +// +// softmax: A CSRSparseMatrix. +// grad_softmax: The gradient of `softmax`. +// +// Returns The output gradient. +func SparseMatrixSoftmaxGrad(scope *Scope, softmax tf.Output, grad_softmax tf.Output, type_ tf.DataType) (gradient tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"type": type_} + opspec := tf.OpSpec{ + Type: "SparseMatrixSoftmaxGrad", + Input: []tf.Input{ + softmax, grad_softmax, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// QuantizedReluXAttr is an optional argument to QuantizedReluX. +type QuantizedReluXAttr func(optionalAttr) + +// QuantizedReluXOutType sets the optional out_type attribute to value. +// If not specified, defaults to DT_QUINT8 +func QuantizedReluXOutType(value tf.DataType) QuantizedReluXAttr { + return func(m optionalAttr) { + m["out_type"] = value + } +} + +// Computes Quantized Rectified Linear X: `min(max(features, 0), max_value)` +// +// Arguments: +// +// min_features: The float value that the lowest quantized value represents. +// max_features: The float value that the highest quantized value represents. +// +// Returns: +// +// activations: Has the same output shape as "features". +// min_activations: The float value that the lowest quantized value represents. +// max_activations: The float value that the highest quantized value represents. +func QuantizedReluX(scope *Scope, features tf.Output, max_value tf.Output, min_features tf.Output, max_features tf.Output, optional ...QuantizedReluXAttr) (activations tf.Output, min_activations tf.Output, max_activations tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "QuantizedReluX", + Input: []tf.Input{ + features, max_value, min_features, max_features, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// StringFormatAttr is an optional argument to StringFormat. +type StringFormatAttr func(optionalAttr) + +// StringFormatTemplate sets the optional template attribute to value. +// +// value: A string, the template to format tensor summaries into. +// If not specified, defaults to "%s" +func StringFormatTemplate(value string) StringFormatAttr { + return func(m optionalAttr) { + m["template"] = value + } +} + +// StringFormatPlaceholder sets the optional placeholder attribute to value. +// +// value: A string, at each placeholder in the template a subsequent tensor summary will be inserted. +// If not specified, defaults to "%s" +func StringFormatPlaceholder(value string) StringFormatAttr { + return func(m optionalAttr) { + m["placeholder"] = value + } +} + +// StringFormatSummarize sets the optional summarize attribute to value. +// +// value: When formatting the tensor summaries print the first and last summarize entries of each tensor dimension. +// If not specified, defaults to 3 +func StringFormatSummarize(value int64) StringFormatAttr { + return func(m optionalAttr) { + m["summarize"] = value + } +} + +// Formats a string template using a list of tensors. +// +// Formats a string template using a list of tensors, pretty-printing tensor summaries. +// +// Arguments: +// +// inputs: The list of tensors to format into the placeholder string. +// +// Returns = The resulting string scalar. +func StringFormat(scope *Scope, inputs []tf.Output, optional ...StringFormatAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "StringFormat", + Input: []tf.Input{ + tf.OutputList(inputs), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Determine the script codes of a given tensor of Unicode integer code points. +// +// This operation converts Unicode code points to script codes corresponding to +// each code point. Script codes correspond to International Components for +// Unicode (ICU) UScriptCode values. +// +// See +// [ICU project docs](http://icu-project.org/apiref/icu4c/uscript_8h.html) +// for more details on script codes. +// +// For an example, see the unicode strings guide on [unicode scripts] +// (https://www.tensorflow.org/tutorials/load_data/unicode#representing_unicode). +// +// Returns -1 (USCRIPT_INVALID_CODE) for invalid codepoints. Output shape will +// match input shape. +// +// Examples: +// +// >>> tf.strings.unicode_script([1, 31, 38]) +// +// +// Arguments: +// +// input: A Tensor of int32 Unicode code points. +// +// Returns A Tensor of int32 script codes corresponding to each input code point. +func UnicodeScript(scope *Scope, input tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "UnicodeScript", + Input: []tf.Input{ + input, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns the truth value of x AND y element-wise. +// +// *NOTE*: `LogicalAnd` supports broadcasting. More about broadcasting +// [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) +func LogicalAnd(scope *Scope, x tf.Output, y tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "LogicalAnd", + Input: []tf.Input{ + x, y, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// UnicodeTranscodeAttr is an optional argument to UnicodeTranscode. +type UnicodeTranscodeAttr func(optionalAttr) + +// UnicodeTranscodeErrors sets the optional errors attribute to value. +// +// value: Error handling policy when there is invalid formatting found in the input. +// The value of 'strict' will cause the operation to produce a InvalidArgument +// error on any invalid input formatting. A value of 'replace' (the default) will +// cause the operation to replace any invalid formatting in the input with the +// `replacement_char` codepoint. A value of 'ignore' will cause the operation to +// skip any invalid formatting in the input and produce no corresponding output +// character. +// If not specified, defaults to "replace" +func UnicodeTranscodeErrors(value string) UnicodeTranscodeAttr { + return func(m optionalAttr) { + m["errors"] = value + } +} + +// UnicodeTranscodeReplacementChar sets the optional replacement_char attribute to value. +// +// value: The replacement character codepoint to be used in place of any invalid +// formatting in the input when `errors='replace'`. Any valid unicode codepoint may +// be used. The default value is the default unicode replacement character is +// 0xFFFD or U+65533.) +// +// Note that for UTF-8, passing a replacement character expressible in 1 byte, such +// as ' ', will preserve string alignment to the source since invalid bytes will be +// replaced with a 1-byte replacement. For UTF-16-BE and UTF-16-LE, any 1 or 2 byte +// replacement character will preserve byte alignment to the source. +// If not specified, defaults to 65533 +func UnicodeTranscodeReplacementChar(value int64) UnicodeTranscodeAttr { + return func(m optionalAttr) { + m["replacement_char"] = value + } +} + +// UnicodeTranscodeReplaceControlCharacters sets the optional replace_control_characters attribute to value. +// +// value: Whether to replace the C0 control characters (00-1F) with the +// `replacement_char`. Default is false. +// If not specified, defaults to false +func UnicodeTranscodeReplaceControlCharacters(value bool) UnicodeTranscodeAttr { + return func(m optionalAttr) { + m["replace_control_characters"] = value + } +} + +// Transcode the input text from a source encoding to a destination encoding. +// +// The input is a string tensor of any shape. The output is a string tensor of +// the same shape containing the transcoded strings. Output strings are always +// valid unicode. If the input contains invalid encoding positions, the +// `errors` attribute sets the policy for how to deal with them. If the default +// error-handling policy is used, invalid formatting will be substituted in the +// output by the `replacement_char`. If the errors policy is to `ignore`, any +// invalid encoding positions in the input are skipped and not included in the +// output. If it set to `strict` then any invalid formatting will result in an +// InvalidArgument error. +// +// This operation can be used with `output_encoding = input_encoding` to enforce +// correct formatting for inputs even if they are already in the desired encoding. +// +// If the input is prefixed by a Byte Order Mark needed to determine encoding +// (e.g. if the encoding is UTF-16 and the BOM indicates big-endian), then that +// BOM will be consumed and not emitted into the output. If the input encoding +// is marked with an explicit endianness (e.g. UTF-16-BE), then the BOM is +// interpreted as a non-breaking-space and is preserved in the output (including +// always for UTF-8). +// +// The end result is that if the input is marked as an explicit endianness the +// transcoding is faithful to all codepoints in the source. If it is not marked +// with an explicit endianness, the BOM is not considered part of the string itself +// but as metadata, and so is not preserved in the output. +// +// Examples: +// +// >>> tf.strings.unicode_transcode(["Hello", "TensorFlow", "2.x"], "UTF-8", "UTF-16-BE") +// +// +// >>> tf.strings.unicode_transcode(["A", "B", "C"], "US ASCII", "UTF-8").numpy() +// array([b'A', b'B', b'C'], dtype=object) +// +// Arguments: +// +// input: The text to be processed. Can have any shape. +// input_encoding: Text encoding of the input strings. This is any of the encodings supported +// +// by ICU ucnv algorithmic converters. Examples: `"UTF-16", "US ASCII", "UTF-8"`. +// +// output_encoding: The unicode encoding to use in the output. Must be one of +// +// `"UTF-8", "UTF-16-BE", "UTF-32-BE"`. Multi-byte encodings will be big-endian. +// +// Returns A string tensor containing unicode text encoded using `output_encoding`. +func UnicodeTranscode(scope *Scope, input tf.Output, input_encoding string, output_encoding string, optional ...UnicodeTranscodeAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"input_encoding": input_encoding, "output_encoding": output_encoding} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "UnicodeTranscode", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// UnpackAttr is an optional argument to Unpack. +type UnpackAttr func(optionalAttr) + +// UnpackAxis sets the optional axis attribute to value. +// +// value: Dimension along which to unpack. Negative values wrap around, so the +// valid range is `[-R, R)`. +// If not specified, defaults to 0 +func UnpackAxis(value int64) UnpackAttr { + return func(m optionalAttr) { + m["axis"] = value + } +} + +// Unpacks a given dimension of a rank-`R` tensor into `num` rank-`(R-1)` tensors. +// +// Unpacks `num` tensors from `value` by chipping it along the `axis` dimension. +// For example, given a tensor of shape `(A, B, C, D)`; +// +// If `axis == 0` then the i'th tensor in `output` is the slice `value[i, :, :, :]` +// +// and each tensor in `output` will have shape `(B, C, D)`. (Note that the +// dimension unpacked along is gone, unlike `split`). +// +// If `axis == 1` then the i'th tensor in `output` is the slice `value[:, i, :, :]` +// +// and each tensor in `output` will have shape `(A, C, D)`. +// +// Etc. +// +// This is the opposite of `pack`. +// +// Arguments: +// +// value: 1-D or higher, with `axis` dimension size equal to `num`. +// +// Returns The list of tensors unpacked from `value`. +func Unpack(scope *Scope, value tf.Output, num int64, optional ...UnpackAttr) (output []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num": num} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Unpack", + Input: []tf.Input{ + value, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if output, idx, err = makeOutputList(op, idx, "output"); err != nil { + scope.UpdateErr("Unpack", err) + return + } + return output +} + +// Returns x + y element-wise. +// +// *NOTE*: `Add` supports broadcasting. `AddN` does not. More about broadcasting +// [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) +func AddV2(scope *Scope, x tf.Output, y tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "AddV2", + Input: []tf.Input{ + x, y, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes the product along segments of a tensor. +// +// Read +// [the section on segmentation](https://tensorflow.org/api_docs/python/tf/math#Segmentation) +// for an explanation of segments. +// +// Computes a tensor such that +// \\(output_i = \prod_j data_j\\) where the product is over `j` such +// that `segment_ids[j] == i`. +// +// If the product is empty for a given segment ID `i`, `output[i] = 1`. +// +//
+// +//
+// +// For example: +// +// ``` +// c = tf.constant([[1,2,3,4], [4, 3, 2, 1], [5,6,7,8]]) +// tf.segment_prod(c, tf.constant([0, 0, 1])) +// # ==> [[4, 6, 6, 4], +// # [5, 6, 7, 8]] +// ``` +// +// Arguments: +// +// segment_ids: A 1-D tensor whose size is equal to the size of `data`'s +// +// first dimension. Values should be sorted and can be repeated. +// +// Returns Has same shape as data, except for dimension 0 which +// has size `k`, the number of segments. +func SegmentProd(scope *Scope, data tf.Output, segment_ids tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "SegmentProd", + Input: []tf.Input{ + data, segment_ids, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ResourceSparseApplyAdagradAttr is an optional argument to ResourceSparseApplyAdagrad. +type ResourceSparseApplyAdagradAttr func(optionalAttr) + +// ResourceSparseApplyAdagradUseLocking sets the optional use_locking attribute to value. +// +// value: If `True`, updating of the var and accum tensors will be protected +// by a lock; otherwise the behavior is undefined, but may exhibit less +// contention. +// If not specified, defaults to false +func ResourceSparseApplyAdagradUseLocking(value bool) ResourceSparseApplyAdagradAttr { + return func(m optionalAttr) { + m["use_locking"] = value + } +} + +// ResourceSparseApplyAdagradUpdateSlots sets the optional update_slots attribute to value. +// If not specified, defaults to true +func ResourceSparseApplyAdagradUpdateSlots(value bool) ResourceSparseApplyAdagradAttr { + return func(m optionalAttr) { + m["update_slots"] = value + } +} + +// Update relevant entries in '*var' and '*accum' according to the adagrad scheme. +// +// That is for rows we have grad for, we update var and accum as follows: +// accum += grad * grad +// var -= lr * grad * (1 / sqrt(accum)) +// +// Arguments: +// +// var_: Should be from a Variable(). +// accum: Should be from a Variable(). +// lr: Learning rate. Must be a scalar. +// grad: The gradient. +// indices: A vector of indices into the first dimension of var and accum. +// +// Returns the created operation. +func ResourceSparseApplyAdagrad(scope *Scope, var_ tf.Output, accum tf.Output, lr tf.Output, grad tf.Output, indices tf.Output, optional ...ResourceSparseApplyAdagradAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ResourceSparseApplyAdagrad", + Input: []tf.Input{ + var_, accum, lr, grad, indices, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// CollectiveReduceV2Attr is an optional argument to CollectiveReduceV2. +type CollectiveReduceV2Attr func(optionalAttr) + +// CollectiveReduceV2CommunicationHint sets the optional communication_hint attribute to value. +// If not specified, defaults to "auto" +func CollectiveReduceV2CommunicationHint(value string) CollectiveReduceV2Attr { + return func(m optionalAttr) { + m["communication_hint"] = value + } +} + +// CollectiveReduceV2TimeoutSeconds sets the optional timeout_seconds attribute to value. +// If not specified, defaults to 0 +func CollectiveReduceV2TimeoutSeconds(value float32) CollectiveReduceV2Attr { + return func(m optionalAttr) { + m["timeout_seconds"] = value + } +} + +// CollectiveReduceV2IsStateless sets the optional is_stateless attribute to value. +// If not specified, defaults to false +func CollectiveReduceV2IsStateless(value bool) CollectiveReduceV2Attr { + return func(m optionalAttr) { + m["is_stateless"] = value + } +} + +// CollectiveReduceV2MaxSubdivsPerDevice sets the optional max_subdivs_per_device attribute to value. +// If not specified, defaults to -1 +func CollectiveReduceV2MaxSubdivsPerDevice(value int64) CollectiveReduceV2Attr { + return func(m optionalAttr) { + m["max_subdivs_per_device"] = value + } +} + +// Mutually reduces multiple tensors of identical type and shape. +func CollectiveReduceV2(scope *Scope, input tf.Output, group_size tf.Output, group_key tf.Output, instance_key tf.Output, ordering_token []tf.Output, merge_op string, final_op string, optional ...CollectiveReduceV2Attr) (data tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"merge_op": merge_op, "final_op": final_op} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "CollectiveReduceV2", + Input: []tf.Input{ + input, group_size, group_key, instance_key, tf.OutputList(ordering_token), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// RaggedBincountAttr is an optional argument to RaggedBincount. +type RaggedBincountAttr func(optionalAttr) + +// RaggedBincountBinaryOutput sets the optional binary_output attribute to value. +// +// value: bool; Whether the kernel should count the appearance or number of occurrences. +// If not specified, defaults to false +func RaggedBincountBinaryOutput(value bool) RaggedBincountAttr { + return func(m optionalAttr) { + m["binary_output"] = value + } +} + +// Counts the number of occurrences of each value in an integer array. +// +// Outputs a vector with length `size` and the same dtype as `weights`. If +// `weights` are empty, then index `i` stores the number of times the value `i` is +// counted in `arr`. If `weights` are non-empty, then index `i` stores the sum of +// the value in `weights` at each index where the corresponding value in `arr` is +// `i`. +// +// Values in `arr` outside of the range [0, size) are ignored. +// +// Arguments: +// +// splits: 1D int64 `Tensor`. +// values: 2D int `Tensor`. +// size: non-negative int scalar `Tensor`. +// weights: is an int32, int64, float32, or float64 `Tensor` with the same +// +// shape as `input`, or a length-0 `Tensor`, in which case it acts as all weights +// equal to 1. +// +// Returns 1D `Tensor` with length equal to `size` or 2D `Tensor` with [batch_size, `size`]. +// The counts or summed weights for each value in the range [0, size). +func RaggedBincount(scope *Scope, splits tf.Output, values tf.Output, size tf.Output, weights tf.Output, optional ...RaggedBincountAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "RaggedBincount", + Input: []tf.Input{ + splits, values, size, weights, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Gets the next output from the given iterator as an Optional variant. +func IteratorGetNextAsOptional(scope *Scope, iterator tf.Output, output_types []tf.DataType, output_shapes []tf.Shape) (optional tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + opspec := tf.OpSpec{ + Type: "IteratorGetNextAsOptional", + Input: []tf.Input{ + iterator, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Wraps the XLA CustomCall operator +// +// documented at https://www.tensorflow.org/xla/operation_semantics#customcall. +// +// Arguments: +// +// args: A list of `Tensor` with possibly different types. +// target_name: Name of the function. A call instruction will be emitted which +// +// targets this symbol name. +// +// backend_config: String, used to encode serialized metadata to the backend. +// dtype: Output tensor data type. +// shape: Output tensor shape. +func XlaCustomCall(scope *Scope, args []tf.Output, target_name string, backend_config string, dtype tf.DataType, shape tf.Shape) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"target_name": target_name, "backend_config": backend_config, "dtype": dtype, "shape": shape} + opspec := tf.OpSpec{ + Type: "XlaCustomCall", + Input: []tf.Input{ + tf.OutputList(args), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// OptimizeDatasetV2Attr is an optional argument to OptimizeDatasetV2. +type OptimizeDatasetV2Attr func(optionalAttr) + +// OptimizeDatasetV2OptimizationConfigs sets the optional optimization_configs attribute to value. +// If not specified, defaults to <> +func OptimizeDatasetV2OptimizationConfigs(value []string) OptimizeDatasetV2Attr { + return func(m optionalAttr) { + m["optimization_configs"] = value + } +} + +// Creates a dataset by applying related optimizations to `input_dataset`. +// +// Creates a dataset by applying related optimizations to `input_dataset`. +// +// Arguments: +// +// input_dataset: A variant tensor representing the input dataset. +// optimizations_enabled: A `tf.string` vector `tf.Tensor` identifying user enabled optimizations. +// optimizations_disabled: A `tf.string` vector `tf.Tensor` identifying user disabled optimizations. +// optimizations_default: A `tf.string` vector `tf.Tensor` identifying optimizations by default. +func OptimizeDatasetV2(scope *Scope, input_dataset tf.Output, optimizations_enabled tf.Output, optimizations_disabled tf.Output, optimizations_default tf.Output, output_types []tf.DataType, output_shapes []tf.Shape, optional ...OptimizeDatasetV2Attr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "OptimizeDatasetV2", + Input: []tf.Input{ + input_dataset, optimizations_enabled, optimizations_disabled, optimizations_default, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ExtractGlimpseV2Attr is an optional argument to ExtractGlimpseV2. +type ExtractGlimpseV2Attr func(optionalAttr) + +// ExtractGlimpseV2Centered sets the optional centered attribute to value. +// +// value: indicates if the offset coordinates are centered relative to +// the image, in which case the (0, 0) offset is relative to the center +// of the input images. If false, the (0,0) offset corresponds to the +// upper left corner of the input images. +// If not specified, defaults to true +func ExtractGlimpseV2Centered(value bool) ExtractGlimpseV2Attr { + return func(m optionalAttr) { + m["centered"] = value + } +} + +// ExtractGlimpseV2Normalized sets the optional normalized attribute to value. +// +// value: indicates if the offset coordinates are normalized. +// If not specified, defaults to true +func ExtractGlimpseV2Normalized(value bool) ExtractGlimpseV2Attr { + return func(m optionalAttr) { + m["normalized"] = value + } +} + +// ExtractGlimpseV2UniformNoise sets the optional uniform_noise attribute to value. +// +// value: indicates if the noise should be generated using a +// uniform distribution or a Gaussian distribution. +// If not specified, defaults to true +func ExtractGlimpseV2UniformNoise(value bool) ExtractGlimpseV2Attr { + return func(m optionalAttr) { + m["uniform_noise"] = value + } +} + +// ExtractGlimpseV2Noise sets the optional noise attribute to value. +// +// value: indicates if the noise should `uniform`, `gaussian`, or +// `zero`. The default is `uniform` which means the the noise type +// will be decided by `uniform_noise`. +// If not specified, defaults to "uniform" +func ExtractGlimpseV2Noise(value string) ExtractGlimpseV2Attr { + return func(m optionalAttr) { + m["noise"] = value + } +} + +// Extracts a glimpse from the input tensor. +// +// Returns a set of windows called glimpses extracted at location +// `offsets` from the input tensor. If the windows only partially +// overlaps the inputs, the non overlapping areas will be filled with +// random noise. +// +// The result is a 4-D tensor of shape `[batch_size, glimpse_height, +// glimpse_width, channels]`. The channels and batch dimensions are the +// same as that of the input tensor. The height and width of the output +// windows are specified in the `size` parameter. +// +// The argument `normalized` and `centered` controls how the windows are built: +// +// - If the coordinates are normalized but not centered, 0.0 and 1.0 +// correspond to the minimum and maximum of each height and width +// dimension. +// - If the coordinates are both normalized and centered, they range from +// -1.0 to 1.0. The coordinates (-1.0, -1.0) correspond to the upper +// left corner, the lower right corner is located at (1.0, 1.0) and the +// center is at (0, 0). +// - If the coordinates are not normalized they are interpreted as +// numbers of pixels. +// +// Arguments: +// +// input: A 4-D float tensor of shape `[batch_size, height, width, channels]`. +// size: A 1-D tensor of 2 elements containing the size of the glimpses +// +// to extract. The glimpse height must be specified first, following +// by the glimpse width. +// +// offsets: A 2-D integer tensor of shape `[batch_size, 2]` containing +// +// the y, x locations of the center of each window. +// +// Returns A tensor representing the glimpses `[batch_size, +// glimpse_height, glimpse_width, channels]`. +func ExtractGlimpseV2(scope *Scope, input tf.Output, size tf.Output, offsets tf.Output, optional ...ExtractGlimpseV2Attr) (glimpse tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ExtractGlimpseV2", + Input: []tf.Input{ + input, size, offsets, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Deprecated. Use TensorArrayGradV3 +// +// DEPRECATED at GraphDef version 26: Use TensorArrayGradV3 +func TensorArrayGradV2(scope *Scope, handle tf.Output, flow_in tf.Output, source string) (grad_handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"source": source} + opspec := tf.OpSpec{ + Type: "TensorArrayGradV2", + Input: []tf.Input{ + handle, flow_in, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes the trignometric inverse sine of x element-wise. +// +// The `tf.math.asin` operation returns the inverse of `tf.math.sin`, such that +// if `y = tf.math.sin(x)` then, `x = tf.math.asin(y)`. +// +// **Note**: The output of `tf.math.asin` will lie within the invertible range +// of sine, i.e [-pi/2, pi/2]. +// +// For example: +// +// ```python +// # Note: [1.047, 0.785] ~= [(pi/3), (pi/4)] +// x = tf.constant([1.047, 0.785]) +// y = tf.math.sin(x) # [0.8659266, 0.7068252] +// +// tf.math.asin(y) # [1.047, 0.785] = x +// ``` +func Asin(scope *Scope, x tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Asin", + Input: []tf.Input{ + x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// BatchToSpace for 4-D tensors of type T. +// +// This is a legacy version of the more general BatchToSpaceND. +// +// Rearranges (permutes) data from batch into blocks of spatial data, followed by +// cropping. This is the reverse transformation of SpaceToBatch. More specifically, +// this op outputs a copy of the input tensor where values from the `batch` +// dimension are moved in spatial blocks to the `height` and `width` dimensions, +// followed by cropping along the `height` and `width` dimensions. +// +// Arguments: +// +// input: 4-D tensor with shape +// +// `[batch*block_size*block_size, height_pad/block_size, width_pad/block_size, +// +// depth]`. Note that the batch size of the input tensor must be divisible by +// +// `block_size * block_size`. +// +// crops: 2-D tensor of non-negative integers with shape `[2, 2]`. It specifies +// +// how many elements to crop from the intermediate result across the spatial +// dimensions as follows: +// +// crops = [[crop_top, crop_bottom], [crop_left, crop_right]] +// +// Returns 4-D with shape `[batch, height, width, depth]`, where: +// +// height = height_pad - crop_top - crop_bottom +// width = width_pad - crop_left - crop_right +// +// The attr `block_size` must be greater than one. It indicates the block size. +// +// Some examples: +// +// (1) For the following input of shape `[4, 1, 1, 1]` and block_size of 2: +// +// ``` +// [[[[1]]], [[[2]]], [[[3]]], [[[4]]]] +// ``` +// +// The output tensor has shape `[1, 2, 2, 1]` and value: +// +// ``` +// x = [[[[1], [2]], [[3], [4]]]] +// ``` +// +// (2) For the following input of shape `[4, 1, 1, 3]` and block_size of 2: +// +// ``` +// [[[[1, 2, 3]]], [[[4, 5, 6]]], [[[7, 8, 9]]], [[[10, 11, 12]]]] +// ``` +// +// The output tensor has shape `[1, 2, 2, 3]` and value: +// +// ``` +// x = [[[[1, 2, 3], [4, 5, 6]], +// +// [[7, 8, 9], [10, 11, 12]]]] +// +// ``` +// +// (3) For the following input of shape `[4, 2, 2, 1]` and block_size of 2: +// +// ``` +// x = [[[[1], [3]], [[9], [11]]], +// +// [[[2], [4]], [[10], [12]]], +// [[[5], [7]], [[13], [15]]], +// [[[6], [8]], [[14], [16]]]] +// +// ``` +// +// The output tensor has shape `[1, 4, 4, 1]` and value: +// +// ``` +// x = [[[[1], [2], [3], [4]], +// +// [[5], [6], [7], [8]], +// [[9], [10], [11], [12]], +// [[13], [14], [15], [16]]]] +// +// ``` +// +// (4) For the following input of shape `[8, 1, 2, 1]` and block_size of 2: +// +// ``` +// x = [[[[1], [3]]], [[[9], [11]]], [[[2], [4]]], [[[10], [12]]], +// +// [[[5], [7]]], [[[13], [15]]], [[[6], [8]]], [[[14], [16]]]] +// +// ``` +// +// The output tensor has shape `[2, 2, 4, 1]` and value: +// +// ``` +// x = [[[[1], [3]], [[5], [7]]], +// +// [[[2], [4]], [[10], [12]]], +// [[[5], [7]], [[13], [15]]], +// [[[6], [8]], [[14], [16]]]] +// +// ``` +func BatchToSpace(scope *Scope, input tf.Output, crops tf.Output, block_size int64) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"block_size": block_size} + opspec := tf.OpSpec{ + Type: "BatchToSpace", + Input: []tf.Input{ + input, crops, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// MfccAttr is an optional argument to Mfcc. +type MfccAttr func(optionalAttr) + +// MfccUpperFrequencyLimit sets the optional upper_frequency_limit attribute to value. +// +// value: The highest frequency to use when calculating the +// ceptstrum. +// If not specified, defaults to 4000 +func MfccUpperFrequencyLimit(value float32) MfccAttr { + return func(m optionalAttr) { + m["upper_frequency_limit"] = value + } +} + +// MfccLowerFrequencyLimit sets the optional lower_frequency_limit attribute to value. +// +// value: The lowest frequency to use when calculating the +// ceptstrum. +// If not specified, defaults to 20 +func MfccLowerFrequencyLimit(value float32) MfccAttr { + return func(m optionalAttr) { + m["lower_frequency_limit"] = value + } +} + +// MfccFilterbankChannelCount sets the optional filterbank_channel_count attribute to value. +// +// value: Resolution of the Mel bank used internally. +// If not specified, defaults to 40 +func MfccFilterbankChannelCount(value int64) MfccAttr { + return func(m optionalAttr) { + m["filterbank_channel_count"] = value + } +} + +// MfccDctCoefficientCount sets the optional dct_coefficient_count attribute to value. +// +// value: How many output channels to produce per time slice. +// If not specified, defaults to 13 +func MfccDctCoefficientCount(value int64) MfccAttr { + return func(m optionalAttr) { + m["dct_coefficient_count"] = value + } +} + +// Transforms a spectrogram into a form that's useful for speech recognition. +// +// Mel Frequency Cepstral Coefficients are a way of representing audio data that's +// been effective as an input feature for machine learning. They are created by +// taking the spectrum of a spectrogram (a 'cepstrum'), and discarding some of the +// higher frequencies that are less significant to the human ear. They have a long +// history in the speech recognition world, and https://en.wikipedia.org/wiki/Mel-frequency_cepstrum +// is a good resource to learn more. +// +// Arguments: +// +// spectrogram: Typically produced by the Spectrogram op, with magnitude_squared +// +// set to true. +// +// sample_rate: How many samples per second the source audio used. +func Mfcc(scope *Scope, spectrogram tf.Output, sample_rate tf.Output, optional ...MfccAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Mfcc", + Input: []tf.Input{ + spectrogram, sample_rate, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Gather ragged slices from `params` axis `0` according to `indices`. +// +// Outputs a `RaggedTensor` output composed from `output_dense_values` and +// `output_nested_splits`, such that: +// +// ```python +// output.shape = indices.shape + params.shape[1:] +// output.ragged_rank = indices.shape.ndims + params.ragged_rank +// output[i...j, d0...dn] = params[indices[i...j], d0...dn] +// ``` +// +// where +// +// - `params = +// ragged.from_nested_row_splits(params_dense_values, params_nested_splits)` +// provides the values that should be gathered. +// - `indices` ia a dense tensor with dtype `int32` or `int64`, indicating which +// values should be gathered. +// - `output = +// ragged.from_nested_row_splits(output_dense_values, output_nested_splits)` +// is the output tensor. +// +// (Note: This c++ op is used to implement the higher-level python +// `tf.ragged.gather` op, which also supports ragged indices.) +// +// Arguments: +// +// params_nested_splits: The `nested_row_splits` tensors that define the row-partitioning for the +// +// `params` RaggedTensor input. +// +// params_dense_values: The `flat_values` for the `params` RaggedTensor. There was a terminology change +// +// at the python level from dense_values to flat_values, so dense_values is the +// deprecated name. +// +// indices: Indices in the outermost dimension of `params` of the values that should be +// +// gathered. +// +// OUTPUT_RAGGED_RANK: The ragged rank of the output RaggedTensor. `output_nested_splits` will contain +// +// this number of `row_splits` tensors. This value should equal +// `indices.shape.ndims + params.ragged_rank - 1`. +// +// Returns: +// +// output_nested_splits: The `nested_row_splits` tensors that define the row-partitioning for the +// +// returned RaggedTensor. +// +// output_dense_values: The `flat_values` for the returned RaggedTensor. +func RaggedGather(scope *Scope, params_nested_splits []tf.Output, params_dense_values tf.Output, indices tf.Output, OUTPUT_RAGGED_RANK int64) (output_nested_splits []tf.Output, output_dense_values tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"OUTPUT_RAGGED_RANK": OUTPUT_RAGGED_RANK} + opspec := tf.OpSpec{ + Type: "RaggedGather", + Input: []tf.Input{ + tf.OutputList(params_nested_splits), params_dense_values, indices, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if output_nested_splits, idx, err = makeOutputList(op, idx, "output_nested_splits"); err != nil { + scope.UpdateErr("RaggedGather", err) + return + } + output_dense_values = op.Output(idx) + return output_nested_splits, output_dense_values +} + +// Reads the value of a variable. +// +// The tensor returned by this operation is immutable. +// +// The value returned by this operation is guaranteed to be influenced by all the +// writes on which this operation depends directly or indirectly, and to not be +// influenced by any of the writes which depend directly or indirectly on this +// operation. +// +// Arguments: +// +// resource: handle to the resource in which to store the variable. +// dtype: the dtype of the value. +func ReadVariableOp(scope *Scope, resource tf.Output, dtype tf.DataType) (value tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtype": dtype} + opspec := tf.OpSpec{ + Type: "ReadVariableOp", + Input: []tf.Input{ + resource, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Wraps the XLA OptimizationBarrier operator. +// +// Documented at https://www.tensorflow.org/xla/operation_semantics#optimizationbarrier. +// +// Arguments: +// +// input: A Tuple of Arrays of any type. +func XlaOptimizationBarrier(scope *Scope, input []tf.Output) (output []tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "XlaOptimizationBarrier", + Input: []tf.Input{ + tf.OutputList(input), + }, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if output, idx, err = makeOutputList(op, idx, "output"); err != nil { + scope.UpdateErr("XlaOptimizationBarrier", err) + return + } + return output +} + +// DenseToDenseSetOperationAttr is an optional argument to DenseToDenseSetOperation. +type DenseToDenseSetOperationAttr func(optionalAttr) + +// DenseToDenseSetOperationValidateIndices sets the optional validate_indices attribute to value. +// If not specified, defaults to true +func DenseToDenseSetOperationValidateIndices(value bool) DenseToDenseSetOperationAttr { + return func(m optionalAttr) { + m["validate_indices"] = value + } +} + +// Applies set operation along last dimension of 2 `Tensor` inputs. +// +// See SetOperationOp::SetOperationFromContext for values of `set_operation`. +// +// Output `result` is a `SparseTensor` represented by `result_indices`, +// `result_values`, and `result_shape`. For `set1` and `set2` ranked `n`, this +// has rank `n` and the same 1st `n-1` dimensions as `set1` and `set2`. The `nth` +// dimension contains the result of `set_operation` applied to the corresponding +// `[0...n-1]` dimension of `set`. +// +// Arguments: +// +// set1: `Tensor` with rank `n`. 1st `n-1` dimensions must be the same as `set2`. +// +// Dimension `n` contains values in a set, duplicates are allowed but ignored. +// +// set2: `Tensor` with rank `n`. 1st `n-1` dimensions must be the same as `set1`. +// +// Dimension `n` contains values in a set, duplicates are allowed but ignored. +// +// Returns: +// +// result_indices: 2D indices of a `SparseTensor`. +// result_values: 1D values of a `SparseTensor`. +// result_shape: 1D `Tensor` shape of a `SparseTensor`. `result_shape[0...n-1]` is +// +// the same as the 1st `n-1` dimensions of `set1` and `set2`, `result_shape[n]` +// is the max result set size across all `0...n-1` dimensions. +func DenseToDenseSetOperation(scope *Scope, set1 tf.Output, set2 tf.Output, set_operation string, optional ...DenseToDenseSetOperationAttr) (result_indices tf.Output, result_values tf.Output, result_shape tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"set_operation": set_operation} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "DenseToDenseSetOperation", + Input: []tf.Input{ + set1, set2, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// Creates a dataset that batches input elements into a SparseTensor. +// +// Arguments: +// +// input_dataset: A handle to an input dataset. Must have a single component. +// batch_size: A scalar representing the number of elements to accumulate in a +// +// batch. +// +// row_shape: A vector representing the dense shape of each row in the produced +// +// SparseTensor. The shape may be partially specified, using `-1` to indicate +// that a particular dimension should use the maximum size of all batch elements. +func ExperimentalDenseToSparseBatchDataset(scope *Scope, input_dataset tf.Output, batch_size tf.Output, row_shape tf.Output, output_types []tf.DataType, output_shapes []tf.Shape) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + opspec := tf.OpSpec{ + Type: "ExperimentalDenseToSparseBatchDataset", + Input: []tf.Input{ + input_dataset, batch_size, row_shape, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// UnicodeDecodeWithOffsetsAttr is an optional argument to UnicodeDecodeWithOffsets. +type UnicodeDecodeWithOffsetsAttr func(optionalAttr) + +// UnicodeDecodeWithOffsetsErrors sets the optional errors attribute to value. +// +// value: Error handling policy when there is invalid formatting found in the input. +// The value of 'strict' will cause the operation to produce a InvalidArgument +// error on any invalid input formatting. A value of 'replace' (the default) will +// cause the operation to replace any invalid formatting in the input with the +// `replacement_char` codepoint. A value of 'ignore' will cause the operation to +// skip any invalid formatting in the input and produce no corresponding output +// character. +// If not specified, defaults to "replace" +func UnicodeDecodeWithOffsetsErrors(value string) UnicodeDecodeWithOffsetsAttr { + return func(m optionalAttr) { + m["errors"] = value + } +} + +// UnicodeDecodeWithOffsetsReplacementChar sets the optional replacement_char attribute to value. +// +// value: The replacement character codepoint to be used in place of any invalid +// formatting in the input when `errors='replace'`. Any valid unicode codepoint may +// be used. The default value is the default unicode replacement character is +// 0xFFFD or U+65533.) +// If not specified, defaults to 65533 +func UnicodeDecodeWithOffsetsReplacementChar(value int64) UnicodeDecodeWithOffsetsAttr { + return func(m optionalAttr) { + m["replacement_char"] = value + } +} + +// UnicodeDecodeWithOffsetsReplaceControlCharacters sets the optional replace_control_characters attribute to value. +// +// value: Whether to replace the C0 control characters (00-1F) with the +// `replacement_char`. Default is false. +// If not specified, defaults to false +func UnicodeDecodeWithOffsetsReplaceControlCharacters(value bool) UnicodeDecodeWithOffsetsAttr { + return func(m optionalAttr) { + m["replace_control_characters"] = value + } +} + +// UnicodeDecodeWithOffsetsTsplits sets the optional Tsplits attribute to value. +// If not specified, defaults to DT_INT64 +func UnicodeDecodeWithOffsetsTsplits(value tf.DataType) UnicodeDecodeWithOffsetsAttr { + return func(m optionalAttr) { + m["Tsplits"] = value + } +} + +// Decodes each string in `input` into a sequence of Unicode code points. +// +// The character codepoints for all strings are returned using a single vector +// `char_values`, with strings expanded to characters in row-major order. +// Similarly, the character start byte offsets are returned using a single vector +// `char_to_byte_starts`, with strings expanded in row-major order. +// +// The `row_splits` tensor indicates where the codepoints and start offsets for +// each input string begin and end within the `char_values` and +// `char_to_byte_starts` tensors. In particular, the values for the `i`th +// string (in row-major order) are stored in the slice +// `[row_splits[i]:row_splits[i+1]]`. Thus: +// +// - `char_values[row_splits[i]+j]` is the Unicode codepoint for the `j`th +// character in the `i`th string (in row-major order). +// - `char_to_bytes_starts[row_splits[i]+j]` is the start byte offset for the `j`th +// character in the `i`th string (in row-major order). +// - `row_splits[i+1] - row_splits[i]` is the number of characters in the `i`th +// string (in row-major order). +// +// Arguments: +// +// input: The text to be decoded. Can have any shape. Note that the output is flattened +// +// to a vector of char values. +// +// input_encoding: Text encoding of the input strings. This is any of the encodings supported +// +// by ICU ucnv algorithmic converters. Examples: `"UTF-16", "US ASCII", "UTF-8"`. +// +// Returns: +// +// row_splits: A 1D int32 tensor containing the row splits. +// char_values: A 1D int32 Tensor containing the decoded codepoints. +// char_to_byte_starts: A 1D int32 Tensor containing the byte index in the input string where each +// +// character in `char_values` starts. +func UnicodeDecodeWithOffsets(scope *Scope, input tf.Output, input_encoding string, optional ...UnicodeDecodeWithOffsetsAttr) (row_splits tf.Output, char_values tf.Output, char_to_byte_starts tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"input_encoding": input_encoding} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "UnicodeDecodeWithOffsets", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// Computes numerical negative value element-wise. +// +// I.e., \\(y = -x\\). +func Neg(scope *Scope, x tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Neg", + Input: []tf.Input{ + x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// MaxPoolGradGradV2Attr is an optional argument to MaxPoolGradGradV2. +type MaxPoolGradGradV2Attr func(optionalAttr) + +// MaxPoolGradGradV2DataFormat sets the optional data_format attribute to value. +// +// value: Specify the data format of the input and output data. With the +// default format "NHWC", the data is stored in the order of: +// +// [batch, in_height, in_width, in_channels]. +// +// Alternatively, the format could be "NCHW", the data storage order of: +// +// [batch, in_channels, in_height, in_width]. +// +// If not specified, defaults to "NHWC" +func MaxPoolGradGradV2DataFormat(value string) MaxPoolGradGradV2Attr { + return func(m optionalAttr) { + m["data_format"] = value + } +} + +// Computes second-order gradients of the maxpooling function. +// +// Arguments: +// +// orig_input: The original input tensor. +// orig_output: The original output tensor. +// grad: 4-D. Gradients of gradients w.r.t. the input of `max_pool`. +// ksize: The size of the window for each dimension of the input tensor. +// strides: The stride of the sliding window for each dimension of the +// +// input tensor. +// +// padding: The type of padding algorithm to use. +// +// Returns Gradients of gradients w.r.t. the input to `max_pool`. +func MaxPoolGradGradV2(scope *Scope, orig_input tf.Output, orig_output tf.Output, grad tf.Output, ksize tf.Output, strides tf.Output, padding string, optional ...MaxPoolGradGradV2Attr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"padding": padding} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "MaxPoolGradGradV2", + Input: []tf.Input{ + orig_input, orig_output, grad, ksize, strides, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// EnqueueTPUEmbeddingRaggedTensorBatchAttr is an optional argument to EnqueueTPUEmbeddingRaggedTensorBatch. +type EnqueueTPUEmbeddingRaggedTensorBatchAttr func(optionalAttr) + +// EnqueueTPUEmbeddingRaggedTensorBatchDeviceOrdinal sets the optional device_ordinal attribute to value. +// +// value: The TPU device to use. Should be >= 0 and less than the number +// of TPU cores in the task on which the node is placed. +// If not specified, defaults to -1 +func EnqueueTPUEmbeddingRaggedTensorBatchDeviceOrdinal(value int64) EnqueueTPUEmbeddingRaggedTensorBatchAttr { + return func(m optionalAttr) { + m["device_ordinal"] = value + } +} + +// EnqueueTPUEmbeddingRaggedTensorBatchCombiners sets the optional combiners attribute to value. +// +// value: A list of string scalars, one for each embedding table that specify +// how to normalize the embedding activations after weighted summation. +// Supported combiners are 'mean', 'sum', or 'sqrtn'. It is invalid to have +// the sum of the weights be 0 for 'mean' or the sum of the squared weights be +// 0 for 'sqrtn'. If combiners isn't passed, the default is to use 'sum' for +// all tables. +// If not specified, defaults to <> +func EnqueueTPUEmbeddingRaggedTensorBatchCombiners(value []string) EnqueueTPUEmbeddingRaggedTensorBatchAttr { + return func(m optionalAttr) { + m["combiners"] = value + } +} + +// EnqueueTPUEmbeddingRaggedTensorBatchMaxSequenceLengths sets the optional max_sequence_lengths attribute to value. +// If not specified, defaults to <> +func EnqueueTPUEmbeddingRaggedTensorBatchMaxSequenceLengths(value []int64) EnqueueTPUEmbeddingRaggedTensorBatchAttr { + return func(m optionalAttr) { + m["max_sequence_lengths"] = value + } +} + +// EnqueueTPUEmbeddingRaggedTensorBatchNumFeatures sets the optional num_features attribute to value. +// If not specified, defaults to <> +func EnqueueTPUEmbeddingRaggedTensorBatchNumFeatures(value []int64) EnqueueTPUEmbeddingRaggedTensorBatchAttr { + return func(m optionalAttr) { + m["num_features"] = value + } +} + +// Eases the porting of code that uses tf.nn.embedding_lookup(). +// +// sample_splits[i], embedding_indices[i] and aggregation_weights[i] correspond +// to the ith feature. table_ids[i] indicates which embedding table to look up ith +// feature. +// +// The tensors at corresponding positions in two of the input lists, +// embedding_indices and aggregation_weights, must have the same shape, i.e. rank 1 +// with dim_size() equal to the total number of lookups into the table described by +// the corresponding feature. +// +// Arguments: +// +// sample_splits: A list of rank 1 Tensors specifying the break points for splitting +// +// embedding_indices and aggregation_weights into rows. +// It corresponds to ids.row_splits in embedding_lookup(), when ids is a +// RaggedTensor. +// +// embedding_indices: A list of rank 1 Tensors, indices into the embedding tables. +// +// It corresponds to ids.values in embedding_lookup(), when ids is a RaggedTensor. +// +// aggregation_weights: A list of rank 1 Tensors containing per training example +// +// aggregation weights. It corresponds to the values field of a RaggedTensor +// with the same row_splits as ids in embedding_lookup(), when ids is a +// RaggedTensor. +// +// mode_override: A string input that overrides the mode specified in the +// +// TPUEmbeddingConfiguration. Supported values are {'unspecified', 'inference', +// 'training', 'backward_pass_only'}. When set to 'unspecified', the mode set +// in TPUEmbeddingConfiguration is used, otherwise mode_override is used. +// +// table_ids: A list of integers specifying the identifier of the embedding table +// +// (offset of TableDescriptor in the TPUEmbeddingConfiguration) to lookup the +// corresponding input. The ith input is looked up using table_ids[i]. The size +// of the table_ids list must be equal to that of sample_indices, +// embedding_indices and aggregation_weights. +// +// Returns the created operation. +func EnqueueTPUEmbeddingRaggedTensorBatch(scope *Scope, sample_splits []tf.Output, embedding_indices []tf.Output, aggregation_weights []tf.Output, mode_override tf.Output, table_ids []int64, optional ...EnqueueTPUEmbeddingRaggedTensorBatchAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"table_ids": table_ids} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "EnqueueTPUEmbeddingRaggedTensorBatch", + Input: []tf.Input{ + tf.OutputList(sample_splits), tf.OutputList(embedding_indices), tf.OutputList(aggregation_weights), mode_override, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// Strip leading and trailing whitespaces from the Tensor. +// +// Arguments: +// +// input: A string `Tensor` of any shape. +// +// Returns A string `Tensor` of the same shape as the input. +// +// Examples: +// +// >>> tf.strings.strip(["\nTensorFlow", " The python library "]).numpy() +// array([b'TensorFlow', b'The python library'], dtype=object) +func StringStrip(scope *Scope, input tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "StringStrip", + Input: []tf.Input{ + input, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Merges summaries. +// +// This op creates a +// [`Summary`](https://www.tensorflow.org/code/tensorflow/core/framework/summary.proto) +// protocol buffer that contains the union of all the values in the input +// summaries. +// +// When the Op is run, it reports an `InvalidArgument` error if multiple values +// in the summaries to merge use the same tag. +// +// Arguments: +// +// inputs: Can be of any shape. Each must contain serialized `Summary` protocol +// +// buffers. +// +// Returns Scalar. Serialized `Summary` protocol buffer. +func MergeSummary(scope *Scope, inputs []tf.Output) (summary tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "MergeSummary", + Input: []tf.Input{ + tf.OutputList(inputs), + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// SumAttr is an optional argument to Sum. +type SumAttr func(optionalAttr) + +// SumKeepDims sets the optional keep_dims attribute to value. +// +// value: If true, retain reduced dimensions with length 1. +// If not specified, defaults to false +func SumKeepDims(value bool) SumAttr { + return func(m optionalAttr) { + m["keep_dims"] = value + } +} + +// Computes the sum of elements across dimensions of a tensor. +// +// Reduces `input` along the dimensions given in `axis`. Unless +// `keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in +// `axis`. If `keep_dims` is true, the reduced dimensions are +// retained with length 1. +// +// Arguments: +// +// input: The tensor to reduce. +// axis: The dimensions to reduce. Must be in the range +// +// `[-rank(input), rank(input))`. +// +// Returns The reduced tensor. +func Sum(scope *Scope, input tf.Output, axis tf.Output, optional ...SumAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Sum", + Input: []tf.Input{ + input, axis, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// OrderedMapUnstageAttr is an optional argument to OrderedMapUnstage. +type OrderedMapUnstageAttr func(optionalAttr) + +// OrderedMapUnstageCapacity sets the optional capacity attribute to value. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func OrderedMapUnstageCapacity(value int64) OrderedMapUnstageAttr { + return func(m optionalAttr) { + m["capacity"] = value + } +} + +// OrderedMapUnstageMemoryLimit sets the optional memory_limit attribute to value. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func OrderedMapUnstageMemoryLimit(value int64) OrderedMapUnstageAttr { + return func(m optionalAttr) { + m["memory_limit"] = value + } +} + +// OrderedMapUnstageContainer sets the optional container attribute to value. +// If not specified, defaults to "" +func OrderedMapUnstageContainer(value string) OrderedMapUnstageAttr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// OrderedMapUnstageSharedName sets the optional shared_name attribute to value. +// If not specified, defaults to "" +func OrderedMapUnstageSharedName(value string) OrderedMapUnstageAttr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// Op removes and returns the values associated with the key +// +// from the underlying container. If the underlying container +// does not contain this key, the op will block until it does. +func OrderedMapUnstage(scope *Scope, key tf.Output, indices tf.Output, dtypes []tf.DataType, optional ...OrderedMapUnstageAttr) (values []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtypes": dtypes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "OrderedMapUnstage", + Input: []tf.Input{ + key, indices, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if values, idx, err = makeOutputList(op, idx, "values"); err != nil { + scope.UpdateErr("OrderedMapUnstage", err) + return + } + return values +} + +// IteratorFromStringHandleAttr is an optional argument to IteratorFromStringHandle. +type IteratorFromStringHandleAttr func(optionalAttr) + +// IteratorFromStringHandleOutputTypes sets the optional output_types attribute to value. +// +// value: If specified, defines the type of each tuple component in an +// element produced by the resulting iterator. +// If not specified, defaults to <> +// +// REQUIRES: len(value) >= 0 +func IteratorFromStringHandleOutputTypes(value []tf.DataType) IteratorFromStringHandleAttr { + return func(m optionalAttr) { + m["output_types"] = value + } +} + +// IteratorFromStringHandleOutputShapes sets the optional output_shapes attribute to value. +// +// value: If specified, defines the shape of each tuple component in an +// element produced by the resulting iterator. +// If not specified, defaults to <> +// +// REQUIRES: len(value) >= 0 +func IteratorFromStringHandleOutputShapes(value []tf.Shape) IteratorFromStringHandleAttr { + return func(m optionalAttr) { + m["output_shapes"] = value + } +} + +// Converts the given string representing a handle to an iterator to a resource. +// +// Arguments: +// +// string_handle: A string representation of the given handle. +// +// Returns A handle to an iterator resource. +func IteratorFromStringHandle(scope *Scope, string_handle tf.Output, optional ...IteratorFromStringHandleAttr) (resource_handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "IteratorFromStringHandle", + Input: []tf.Input{ + string_handle, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// StatelessTruncatedNormalAttr is an optional argument to StatelessTruncatedNormal. +type StatelessTruncatedNormalAttr func(optionalAttr) + +// StatelessTruncatedNormalDtype sets the optional dtype attribute to value. +// +// value: The type of the output. +// If not specified, defaults to DT_FLOAT +func StatelessTruncatedNormalDtype(value tf.DataType) StatelessTruncatedNormalAttr { + return func(m optionalAttr) { + m["dtype"] = value + } +} + +// Outputs deterministic pseudorandom values from a truncated normal distribution. +// +// The generated values follow a normal distribution with mean 0 and standard +// deviation 1, except that values whose magnitude is more than 2 standard +// deviations from the mean are dropped and re-picked. +// +// The outputs are a deterministic function of `shape` and `seed`. +// +// Arguments: +// +// shape: The shape of the output tensor. +// seed: 2 seeds (shape [2]). +// +// Returns Random values with specified shape. +func StatelessTruncatedNormal(scope *Scope, shape tf.Output, seed tf.Output, optional ...StatelessTruncatedNormalAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "StatelessTruncatedNormal", + Input: []tf.Input{ + shape, seed, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// StringToNumberAttr is an optional argument to StringToNumber. +type StringToNumberAttr func(optionalAttr) + +// StringToNumberOutType sets the optional out_type attribute to value. +// +// value: The numeric type to interpret each string in `string_tensor` as. +// If not specified, defaults to DT_FLOAT +func StringToNumberOutType(value tf.DataType) StringToNumberAttr { + return func(m optionalAttr) { + m["out_type"] = value + } +} + +// Converts each string in the input Tensor to the specified numeric type. +// +// (Note that int32 overflow results in an error while float overflow +// results in a rounded value.) +// +// Example: +// +// >>> strings = ["5.0", "3.0", "7.0"] +// >>> tf.strings.to_number(strings) +// +// +// Returns A Tensor of the same shape as the input `string_tensor`. +func StringToNumber(scope *Scope, string_tensor tf.Output, optional ...StringToNumberAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "StringToNumber", + Input: []tf.Input{ + string_tensor, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// QuantizeV2Attr is an optional argument to QuantizeV2. +type QuantizeV2Attr func(optionalAttr) + +// QuantizeV2Mode sets the optional mode attribute to value. +// If not specified, defaults to "MIN_COMBINED" +func QuantizeV2Mode(value string) QuantizeV2Attr { + return func(m optionalAttr) { + m["mode"] = value + } +} + +// QuantizeV2RoundMode sets the optional round_mode attribute to value. +// If not specified, defaults to "HALF_AWAY_FROM_ZERO" +func QuantizeV2RoundMode(value string) QuantizeV2Attr { + return func(m optionalAttr) { + m["round_mode"] = value + } +} + +// QuantizeV2NarrowRange sets the optional narrow_range attribute to value. +// If not specified, defaults to false +func QuantizeV2NarrowRange(value bool) QuantizeV2Attr { + return func(m optionalAttr) { + m["narrow_range"] = value + } +} + +// QuantizeV2Axis sets the optional axis attribute to value. +// If not specified, defaults to -1 +func QuantizeV2Axis(value int64) QuantizeV2Attr { + return func(m optionalAttr) { + m["axis"] = value + } +} + +// QuantizeV2EnsureMinimumRange sets the optional ensure_minimum_range attribute to value. +// If not specified, defaults to 0.01 +func QuantizeV2EnsureMinimumRange(value float32) QuantizeV2Attr { + return func(m optionalAttr) { + m["ensure_minimum_range"] = value + } +} + +// Quantize the 'input' tensor of type float to 'output' tensor of type 'T'. +// +// [min_range, max_range] are scalar floats that specify the range for +// the 'input' data. The 'mode' attribute controls exactly which calculations are +// used to convert the float values to their quantized equivalents. The +// 'round_mode' attribute controls which rounding tie-breaking algorithm is used +// when rounding float values to their quantized equivalents. +// +// In 'MIN_COMBINED' mode, each value of the tensor will undergo the following: +// +// ``` +// out[i] = (in[i] - min_range) * range(T) / (max_range - min_range) +// if T == qint8: out[i] -= (range(T) + 1) / 2.0 +// ``` +// +// here `range(T) = numeric_limits::max() - numeric_limits::min()` +// +// *MIN_COMBINED Mode Example* +// +// Assume the input is type float and has a possible range of [0.0, 6.0] and the +// output type is quint8 ([0, 255]). The min_range and max_range values should be +// specified as 0.0 and 6.0. Quantizing from float to quint8 will multiply each +// value of the input by 255/6 and cast to quint8. +// +// If the output type was qint8 ([-128, 127]), the operation will additionally +// subtract each value by 128 prior to casting, so that the range of values aligns +// with the range of qint8. +// +// If the mode is 'MIN_FIRST', then this approach is used: +// +// ``` +// num_discrete_values = 1 << (# of bits in T) +// range_adjust = num_discrete_values / (num_discrete_values - 1) +// range = (range_max - range_min) * range_adjust +// range_scale = num_discrete_values / range +// quantized = round(input * range_scale) - round(range_min * range_scale) + +// +// numeric_limits::min() +// +// quantized = max(quantized, numeric_limits::min()) +// quantized = min(quantized, numeric_limits::max()) +// ``` +// +// The biggest difference between this and MIN_COMBINED is that the minimum range +// is rounded first, before it's subtracted from the rounded value. With +// MIN_COMBINED, a small bias is introduced where repeated iterations of quantizing +// and dequantizing will introduce a larger and larger error. +// +// *SCALED mode Example* +// +// `SCALED` mode matches the quantization approach used in +// `QuantizeAndDequantize{V2|V3}`. +// +// If the mode is `SCALED`, the quantization is performed by multiplying each +// input value by a scaling_factor. +// The scaling_factor is determined from `min_range` and `max_range` to be as large +// as possible such that the range from `min_range` to `max_range` is representable +// within values of type T. +// +// ```c++ +// +// const int min_T = std::numeric_limits::min(); +// const int max_T = std::numeric_limits::max(); +// const float max_float = std::numeric_limits::max(); +// +// const float scale_factor_from_min_side = +// (min_T * min_range > 0) ? min_T / min_range : max_float; +// const float scale_factor_from_max_side = +// (max_T * max_range > 0) ? max_T / max_range : max_float; +// +// const float scale_factor = std::min(scale_factor_from_min_side, +// scale_factor_from_max_side); +// +// ``` +// +// We next use the scale_factor to adjust min_range and max_range as follows: +// +// ```c++ +// +// min_range = min_T / scale_factor; +// max_range = max_T / scale_factor; +// +// ``` +// +// e.g. if T = qint8, and initially min_range = -10, and max_range = 9, we would +// compare -128/-10.0 = 12.8 to 127/9.0 = 14.11, and set scaling_factor = 12.8 +// In this case, min_range would remain -10, but max_range would be adjusted to +// 127 / 12.8 = 9.921875 +// +// So we will quantize input values in the range (-10, 9.921875) to (-128, 127). +// +// The input tensor can now be quantized by clipping values to the range +// `min_range` to `max_range`, then multiplying by scale_factor as follows: +// +// ```c++ +// result = round(min(max_range, max(min_range, input)) * scale_factor) +// ``` +// +// The adjusted `min_range` and `max_range` are returned as outputs 2 and 3 of +// this operation. These outputs should be used as the range for any further +// calculations. +// +// *narrow_range (bool) attribute* +// +// If true, we do not use the minimum quantized value. +// i.e. for int8 the quantized output, it would be restricted to the range +// -127..127 instead of the full -128..127 range. +// This is provided for compatibility with certain inference backends. +// (Only applies to SCALED mode) +// +// *axis (int) attribute* +// +// An optional `axis` attribute can specify a dimension index of the input tensor, +// such that quantization ranges will be calculated and applied separately for each +// slice of the tensor along that dimension. This is useful for per-channel +// quantization. +// +// If axis is specified, min_range and max_range +// +// if `axis`=None, per-tensor quantization is performed as normal. +// +// *ensure_minimum_range (float) attribute* +// +// Ensures the minimum quantization range is at least this value. +// The legacy default value for this is 0.01, but it is strongly suggested to +// set it to 0 for new uses. +// +// Arguments: +// +// min_range: The minimum value of the quantization range. This value may be adjusted by the +// +// op depending on other parameters. The adjusted value is written to `output_min`. +// If the `axis` attribute is specified, this must be a 1-D tensor whose size +// matches the `axis` dimension of the input and output tensors. +// +// max_range: The maximum value of the quantization range. This value may be adjusted by the +// +// op depending on other parameters. The adjusted value is written to `output_max`. +// If the `axis` attribute is specified, this must be a 1-D tensor whose size +// matches the `axis` dimension of the input and output tensors. +// +// Returns: +// +// output: The quantized data produced from the float input. +// output_min: The final quantization range minimum, used to clip input values before scaling +// +// and rounding them to quantized values. +// If the `axis` attribute is specified, this will be a 1-D tensor whose size +// matches the `axis` dimension of the input and output tensors. +// +// output_max: The final quantization range maximum, used to clip input values before scaling +// +// and rounding them to quantized values. +// If the `axis` attribute is specified, this will be a 1-D tensor whose size +// matches the `axis` dimension of the input and output tensors. +func QuantizeV2(scope *Scope, input tf.Output, min_range tf.Output, max_range tf.Output, T tf.DataType, optional ...QuantizeV2Attr) (output tf.Output, output_min tf.Output, output_max tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"T": T} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "QuantizeV2", + Input: []tf.Input{ + input, min_range, max_range, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// Computes the absolute value of a tensor. +// +// Given a tensor `x`, this operation returns a tensor containing the absolute +// value of each element in `x`. For example, if x is an input element and y is +// an output element, this operation computes \\(y = |x|\\). +func Abs(scope *Scope, x tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Abs", + Input: []tf.Input{ + x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// RetrieveTPUEmbeddingFTRLParametersAttr is an optional argument to RetrieveTPUEmbeddingFTRLParameters. +type RetrieveTPUEmbeddingFTRLParametersAttr func(optionalAttr) + +// RetrieveTPUEmbeddingFTRLParametersTableId sets the optional table_id attribute to value. +// If not specified, defaults to -1 +func RetrieveTPUEmbeddingFTRLParametersTableId(value int64) RetrieveTPUEmbeddingFTRLParametersAttr { + return func(m optionalAttr) { + m["table_id"] = value + } +} + +// RetrieveTPUEmbeddingFTRLParametersTableName sets the optional table_name attribute to value. +// If not specified, defaults to "" +func RetrieveTPUEmbeddingFTRLParametersTableName(value string) RetrieveTPUEmbeddingFTRLParametersAttr { + return func(m optionalAttr) { + m["table_name"] = value + } +} + +// RetrieveTPUEmbeddingFTRLParametersConfig sets the optional config attribute to value. +// If not specified, defaults to "" +func RetrieveTPUEmbeddingFTRLParametersConfig(value string) RetrieveTPUEmbeddingFTRLParametersAttr { + return func(m optionalAttr) { + m["config"] = value + } +} + +// Retrieve FTRL embedding parameters. +// +// An op that retrieves optimization parameters from embedding to host +// memory. Must be preceded by a ConfigureTPUEmbeddingHost op that sets up +// the correct embedding table configuration. For example, this op is +// used to retrieve updated parameters before saving a checkpoint. +// +// Returns: +// +// parameters: Parameter parameters updated by the FTRL optimization algorithm. +// accumulators: Parameter accumulators updated by the FTRL optimization algorithm. +// linears: Parameter linears updated by the FTRL optimization algorithm. +func RetrieveTPUEmbeddingFTRLParameters(scope *Scope, num_shards int64, shard_id int64, optional ...RetrieveTPUEmbeddingFTRLParametersAttr) (parameters tf.Output, accumulators tf.Output, linears tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_shards": num_shards, "shard_id": shard_id} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "RetrieveTPUEmbeddingFTRLParameters", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// A placeholder op for a value that will be fed into the computation. +// +// DEPRECATED at GraphDef version 23: Placeholder now behaves the same as PlaceholderV2. +// +// N.B. This operation will fail with an error if it is executed. It is +// intended as a way to represent a value that will always be fed, and to +// provide attrs that enable the fed value to be checked at runtime. +// +// Arguments: +// +// dtype: The type of elements in the tensor. +// shape: The shape of the tensor. The shape can be any partially-specified +// +// shape. To be unconstrained, pass in a shape with unknown rank. +// +// Returns A placeholder tensor that must be replaced using the feed mechanism. +func PlaceholderV2(scope *Scope, dtype tf.DataType, shape tf.Shape) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtype": dtype, "shape": shape} + opspec := tf.OpSpec{ + Type: "PlaceholderV2", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// A container for an iterator resource. +// +// Returns A handle to the iterator that can be passed to a "MakeIterator" or +// "IteratorGetNext" op. In contrast to Iterator, AnonymousIterator prevents +// resource sharing by name, and does not keep a reference to the resource +// container. +func AnonymousIterator(scope *Scope, output_types []tf.DataType, output_shapes []tf.Shape) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + opspec := tf.OpSpec{ + Type: "AnonymousIterator", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// CropAndResizeAttr is an optional argument to CropAndResize. +type CropAndResizeAttr func(optionalAttr) + +// CropAndResizeMethod sets the optional method attribute to value. +// +// value: A string specifying the sampling method for resizing. It can be either +// `"bilinear"` or `"nearest"` and default to `"bilinear"`. Currently two sampling +// methods are supported: Bilinear and Nearest Neighbor. +// If not specified, defaults to "bilinear" +func CropAndResizeMethod(value string) CropAndResizeAttr { + return func(m optionalAttr) { + m["method"] = value + } +} + +// CropAndResizeExtrapolationValue sets the optional extrapolation_value attribute to value. +// +// value: Value used for extrapolation, when applicable. +// If not specified, defaults to 0 +func CropAndResizeExtrapolationValue(value float32) CropAndResizeAttr { + return func(m optionalAttr) { + m["extrapolation_value"] = value + } +} + +// Extracts crops from the input image tensor and resizes them. +// +// Extracts crops from the input image tensor and resizes them using bilinear +// sampling or nearest neighbor sampling (possibly with aspect ratio change) to a +// common output size specified by `crop_size`. This is more general than the +// `crop_to_bounding_box` op which extracts a fixed size slice from the input image +// and does not allow resizing or aspect ratio change. +// +// Returns a tensor with `crops` from the input `image` at positions defined at the +// bounding box locations in `boxes`. The cropped boxes are all resized (with +// bilinear or nearest neighbor interpolation) to a fixed +// `size = [crop_height, crop_width]`. The result is a 4-D tensor +// `[num_boxes, crop_height, crop_width, depth]`. The resizing is corner aligned. +// In particular, if `boxes = [[0, 0, 1, 1]]`, the method will give identical +// results to using `tf.image.resize_bilinear()` or +// `tf.image.resize_nearest_neighbor()`(depends on the `method` argument) with +// `align_corners=True`. +// +// Arguments: +// +// image: A 4-D tensor of shape `[batch, image_height, image_width, depth]`. +// +// Both `image_height` and `image_width` need to be positive. +// +// boxes: A 2-D tensor of shape `[num_boxes, 4]`. The `i`-th row of the tensor +// +// specifies the coordinates of a box in the `box_ind[i]` image and is specified +// in normalized coordinates `[y1, x1, y2, x2]`. A normalized coordinate value of +// `y` is mapped to the image coordinate at `y * (image_height - 1)`, so as the +// `[0, 1]` interval of normalized image height is mapped to +// `[0, image_height - 1]` in image height coordinates. We do allow `y1` > `y2`, in +// which case the sampled crop is an up-down flipped version of the original +// image. The width dimension is treated similarly. Normalized coordinates +// outside the `[0, 1]` range are allowed, in which case we use +// `extrapolation_value` to extrapolate the input image values. +// +// box_ind: A 1-D tensor of shape `[num_boxes]` with int32 values in `[0, batch)`. +// +// The value of `box_ind[i]` specifies the image that the `i`-th box refers to. +// +// crop_size: A 1-D tensor of 2 elements, `size = [crop_height, crop_width]`. All +// +// cropped image patches are resized to this size. The aspect ratio of the image +// content is not preserved. Both `crop_height` and `crop_width` need to be +// positive. +// +// Returns A 4-D tensor of shape `[num_boxes, crop_height, crop_width, depth]`. +func CropAndResize(scope *Scope, image tf.Output, boxes tf.Output, box_ind tf.Output, crop_size tf.Output, optional ...CropAndResizeAttr) (crops tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "CropAndResize", + Input: []tf.Input{ + image, boxes, box_ind, crop_size, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns element-wise remainder of division. This emulates C semantics in that +// +// the result here is consistent with a truncating divide. E.g. `truncate(x / y) * +// y + truncate_mod(x, y) = x`. +// +// *NOTE*: `TruncateMod` supports broadcasting. More about broadcasting +// [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) +func TruncateMod(scope *Scope, x tf.Output, y tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "TruncateMod", + Input: []tf.Input{ + x, y, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes rectified linear gradients for a Relu operation. +// +// Arguments: +// +// gradients: The backpropagated gradients to the corresponding Relu operation. +// features: The features passed as input to the corresponding Relu operation, OR +// +// the outputs of that operation (both work equivalently). +// +// Returns `gradients * (features > 0)`. +func ReluGrad(scope *Scope, gradients tf.Output, features tf.Output) (backprops tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "ReluGrad", + Input: []tf.Input{ + gradients, features, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns true if and only if the given Optional variant has a value. +func OptionalHasValue(scope *Scope, optional tf.Output) (has_value tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "OptionalHasValue", + Input: []tf.Input{ + optional, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// TextLineDatasetAttr is an optional argument to TextLineDataset. +type TextLineDatasetAttr func(optionalAttr) + +// TextLineDatasetMetadata sets the optional metadata attribute to value. +// If not specified, defaults to "" +func TextLineDatasetMetadata(value string) TextLineDatasetAttr { + return func(m optionalAttr) { + m["metadata"] = value + } +} + +// Creates a dataset that emits the lines of one or more text files. +// +// Arguments: +// +// filenames: A scalar or a vector containing the name(s) of the file(s) to be +// +// read. +// +// compression_type: A scalar containing either (i) the empty string (no +// +// compression), (ii) "ZLIB", or (iii) "GZIP". +// +// buffer_size: A scalar containing the number of bytes to buffer. +func TextLineDataset(scope *Scope, filenames tf.Output, compression_type tf.Output, buffer_size tf.Output, optional ...TextLineDatasetAttr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "TextLineDataset", + Input: []tf.Input{ + filenames, compression_type, buffer_size, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ReverseSequenceAttr is an optional argument to ReverseSequence. +type ReverseSequenceAttr func(optionalAttr) + +// ReverseSequenceBatchDim sets the optional batch_dim attribute to value. +// +// value: The dimension along which reversal is performed. +// If not specified, defaults to 0 +func ReverseSequenceBatchDim(value int64) ReverseSequenceAttr { + return func(m optionalAttr) { + m["batch_dim"] = value + } +} + +// Reverses variable length slices. +// +// This op first slices `input` along the dimension `batch_dim`, and for each +// slice `i`, reverses the first `seq_lengths[i]` elements along +// the dimension `seq_dim`. +// +// The elements of `seq_lengths` must obey `seq_lengths[i] <= input.dims[seq_dim]`, +// and `seq_lengths` must be a vector of length `input.dims[batch_dim]`. +// +// The output slice `i` along dimension `batch_dim` is then given by input +// slice `i`, with the first `seq_lengths[i]` slices along dimension +// `seq_dim` reversed. +// +// For example: +// +// ``` +// # Given this: +// batch_dim = 0 +// seq_dim = 1 +// input.dims = (4, 8, ...) +// seq_lengths = [7, 2, 3, 5] +// +// # then slices of input are reversed on seq_dim, but only up to seq_lengths: +// output[0, 0:7, :, ...] = input[0, 7:0:-1, :, ...] +// output[1, 0:2, :, ...] = input[1, 2:0:-1, :, ...] +// output[2, 0:3, :, ...] = input[2, 3:0:-1, :, ...] +// output[3, 0:5, :, ...] = input[3, 5:0:-1, :, ...] +// +// # while entries past seq_lens are copied through: +// output[0, 7:, :, ...] = input[0, 7:, :, ...] +// output[1, 2:, :, ...] = input[1, 2:, :, ...] +// output[2, 3:, :, ...] = input[2, 3:, :, ...] +// output[3, 2:, :, ...] = input[3, 2:, :, ...] +// ``` +// +// In contrast, if: +// +// ``` +// # Given this: +// batch_dim = 2 +// seq_dim = 0 +// input.dims = (8, ?, 4, ...) +// seq_lengths = [7, 2, 3, 5] +// +// # then slices of input are reversed on seq_dim, but only up to seq_lengths: +// output[0:7, :, 0, :, ...] = input[7:0:-1, :, 0, :, ...] +// output[0:2, :, 1, :, ...] = input[2:0:-1, :, 1, :, ...] +// output[0:3, :, 2, :, ...] = input[3:0:-1, :, 2, :, ...] +// output[0:5, :, 3, :, ...] = input[5:0:-1, :, 3, :, ...] +// +// # while entries past seq_lens are copied through: +// output[7:, :, 0, :, ...] = input[7:, :, 0, :, ...] +// output[2:, :, 1, :, ...] = input[2:, :, 1, :, ...] +// output[3:, :, 2, :, ...] = input[3:, :, 2, :, ...] +// output[2:, :, 3, :, ...] = input[2:, :, 3, :, ...] +// ``` +// +// Arguments: +// +// input: The input to reverse. +// seq_lengths: 1-D with length `input.dims(batch_dim)` and +// +// `max(seq_lengths) <= input.dims(seq_dim)` +// +// seq_dim: The dimension which is partially reversed. +// +// Returns The partially reversed input. It has the same shape as `input`. +func ReverseSequence(scope *Scope, input tf.Output, seq_lengths tf.Output, seq_dim int64, optional ...ReverseSequenceAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"seq_dim": seq_dim} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ReverseSequence", + Input: []tf.Input{ + input, seq_lengths, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// The gradient operator for the SparseAdd op. +// +// The SparseAdd op calculates A + B, where A, B, and the sum are all represented +// as `SparseTensor` objects. This op takes in the upstream gradient w.r.t. +// non-empty values of the sum, and outputs the gradients w.r.t. the non-empty +// values of A and B. +// +// Arguments: +// +// backprop_val_grad: 1-D with shape `[nnz(sum)]`. The gradient with respect to +// +// the non-empty values of the sum. +// +// a_indices: 2-D. The `indices` of the `SparseTensor` A, size `[nnz(A), ndims]`. +// b_indices: 2-D. The `indices` of the `SparseTensor` B, size `[nnz(B), ndims]`. +// sum_indices: 2-D. The `indices` of the sum `SparseTensor`, size +// +// `[nnz(sum), ndims]`. +// +// Returns: +// +// a_val_grad: 1-D with shape `[nnz(A)]`. The gradient with respect to the +// +// non-empty values of A. +// +// b_val_grad: 1-D with shape `[nnz(B)]`. The gradient with respect to the +// +// non-empty values of B. +func SparseAddGrad(scope *Scope, backprop_val_grad tf.Output, a_indices tf.Output, b_indices tf.Output, sum_indices tf.Output) (a_val_grad tf.Output, b_val_grad tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "SparseAddGrad", + Input: []tf.Input{ + backprop_val_grad, a_indices, b_indices, sum_indices, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// Split the data from the input value into TensorArray elements. +// +// Assuming that `lengths` takes on values +// +// ```(n0, n1, ..., n(T-1))``` +// +// and that `value` has shape +// +// ```(n0 + n1 + ... + n(T-1) x d0 x d1 x ...)```, +// +// this splits values into a TensorArray with T tensors. +// +// TensorArray index t will be the subtensor of values with starting position +// +// ```(n0 + n1 + ... + n(t-1), 0, 0, ...)``` +// +// and having size +// +// ```nt x d0 x d1 x ...``` +// +// Arguments: +// +// handle: The handle to a TensorArray. +// value: The concatenated tensor to write to the TensorArray. +// lengths: The vector of lengths, how to split the rows of value into the +// +// TensorArray. +// +// flow_in: A float scalar that enforces proper chaining of operations. +// +// Returns A float scalar that enforces proper chaining of operations. +func TensorArraySplitV3(scope *Scope, handle tf.Output, value tf.Output, lengths tf.Output, flow_in tf.Output) (flow_out tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "TensorArraySplitV3", + Input: []tf.Input{ + handle, value, lengths, flow_in, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Updates specified rows 'i' with values 'v'. +// +// Computes `x[i, :] = v; return x`. +// +// Originally this function is mutative however for compilation we make this +// operation create / operate on a copy of `x`. +// +// Arguments: +// +// x: A tensor of type `T`. +// i: A vector. Indices into the left-most dimension of `x`. +// v: A `Tensor` of type T. Same dimension sizes as x except the first dimension, which must be the same as i's size. +// +// Returns A `Tensor` of type T. An alias of `x`. The content of `y` is undefined if there are duplicates in `i`. +func InplaceUpdate(scope *Scope, x tf.Output, i tf.Output, v tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "InplaceUpdate", + Input: []tf.Input{ + x, i, v, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// TensorStridedSliceUpdateAttr is an optional argument to TensorStridedSliceUpdate. +type TensorStridedSliceUpdateAttr func(optionalAttr) + +// TensorStridedSliceUpdateBeginMask sets the optional begin_mask attribute to value. +// If not specified, defaults to 0 +func TensorStridedSliceUpdateBeginMask(value int64) TensorStridedSliceUpdateAttr { + return func(m optionalAttr) { + m["begin_mask"] = value + } +} + +// TensorStridedSliceUpdateEndMask sets the optional end_mask attribute to value. +// If not specified, defaults to 0 +func TensorStridedSliceUpdateEndMask(value int64) TensorStridedSliceUpdateAttr { + return func(m optionalAttr) { + m["end_mask"] = value + } +} + +// TensorStridedSliceUpdateEllipsisMask sets the optional ellipsis_mask attribute to value. +// If not specified, defaults to 0 +func TensorStridedSliceUpdateEllipsisMask(value int64) TensorStridedSliceUpdateAttr { + return func(m optionalAttr) { + m["ellipsis_mask"] = value + } +} + +// TensorStridedSliceUpdateNewAxisMask sets the optional new_axis_mask attribute to value. +// If not specified, defaults to 0 +func TensorStridedSliceUpdateNewAxisMask(value int64) TensorStridedSliceUpdateAttr { + return func(m optionalAttr) { + m["new_axis_mask"] = value + } +} + +// TensorStridedSliceUpdateShrinkAxisMask sets the optional shrink_axis_mask attribute to value. +// If not specified, defaults to 0 +func TensorStridedSliceUpdateShrinkAxisMask(value int64) TensorStridedSliceUpdateAttr { + return func(m optionalAttr) { + m["shrink_axis_mask"] = value + } +} + +// Assign `value` to the sliced l-value reference of `input`. +// +// The values of `value` are assigned to the positions in the tensor `input` that +// are selected by the slice parameters. The slice parameters `begin` `end` +// `strides` etc. work exactly as in `StridedSlice`. +// +// NOTE this op currently does not support broadcasting and so `value`'s shape +// must be exactly the shape produced by the slice of `input`. +func TensorStridedSliceUpdate(scope *Scope, input tf.Output, begin tf.Output, end tf.Output, strides tf.Output, value tf.Output, optional ...TensorStridedSliceUpdateAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "TensorStridedSliceUpdate", + Input: []tf.Input{ + input, begin, end, strides, value, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns the truth value of (x < y) element-wise. +// +// *NOTE*: `Less` supports broadcasting. More about broadcasting +// [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) +// +// Example: +// +// ```python +// x = tf.constant([5, 4, 6]) +// y = tf.constant([5]) +// tf.math.less(x, y) ==> [False, True, False] +// +// x = tf.constant([5, 4, 6]) +// y = tf.constant([5, 6, 7]) +// tf.math.less(x, y) ==> [False, True, True] +// ``` +func Less(scope *Scope, x tf.Output, y tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Less", + Input: []tf.Input{ + x, y, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ResourceScatterNdUpdateAttr is an optional argument to ResourceScatterNdUpdate. +type ResourceScatterNdUpdateAttr func(optionalAttr) + +// ResourceScatterNdUpdateUseLocking sets the optional use_locking attribute to value. +// +// value: An optional bool. Defaults to True. If True, the assignment will +// be protected by a lock; otherwise the behavior is undefined, +// but may exhibit less contention. +// If not specified, defaults to true +func ResourceScatterNdUpdateUseLocking(value bool) ResourceScatterNdUpdateAttr { + return func(m optionalAttr) { + m["use_locking"] = value + } +} + +// ResourceScatterNdUpdateBadIndicesPolicy sets the optional bad_indices_policy attribute to value. +// If not specified, defaults to "" +func ResourceScatterNdUpdateBadIndicesPolicy(value string) ResourceScatterNdUpdateAttr { + return func(m optionalAttr) { + m["bad_indices_policy"] = value + } +} + +// Applies sparse `updates` to individual values or slices within a given +// +// variable according to `indices`. +// +// `ref` is a `Tensor` with rank `P` and `indices` is a `Tensor` of rank `Q`. +// +// `indices` must be integer tensor, containing indices into `ref`. +// It must be shape `[d_0, ..., d_{Q-2}, K]` where `0 < K <= P`. +// +// The innermost dimension of `indices` (with length `K`) corresponds to +// indices into elements (if `K = P`) or slices (if `K < P`) along the `K`th +// dimension of `ref`. +// +// `updates` is `Tensor` of rank `Q-1+P-K` with shape: +// +// ``` +// [d_0, ..., d_{Q-2}, ref.shape[K], ..., ref.shape[P-1]]. +// ``` +// +// For example, say we want to update 4 scattered elements to a rank-1 tensor to +// 8 elements. In Python, that update would look like this: +// +// ```python +// +// ref = tf.Variable([1, 2, 3, 4, 5, 6, 7, 8]) +// indices = tf.constant([[4], [3], [1] ,[7]]) +// updates = tf.constant([9, 10, 11, 12]) +// update = tf.scatter_nd_update(ref, indices, updates) +// with tf.Session() as sess: +// print sess.run(update) +// +// ``` +// +// The resulting update to ref would look like this: +// +// [1, 11, 3, 10, 9, 6, 7, 12] +// +// See `tf.scatter_nd` for more details about how to make updates to +// slices. +// +// Arguments: +// +// ref: A resource handle. Must be from a VarHandleOp. +// indices: A Tensor. Must be one of the following types: int32, int64. +// +// A tensor of indices into ref. +// +// updates: A Tensor. Must have the same type as ref. A tensor of updated +// +// values to add to ref. +// +// Returns the created operation. +func ResourceScatterNdUpdate(scope *Scope, ref tf.Output, indices tf.Output, updates tf.Output, optional ...ResourceScatterNdUpdateAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ResourceScatterNdUpdate", + Input: []tf.Input{ + ref, indices, updates, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// XlaSpmdFullToShardShapeAttr is an optional argument to XlaSpmdFullToShardShape. +type XlaSpmdFullToShardShapeAttr func(optionalAttr) + +// XlaSpmdFullToShardShapeDim sets the optional dim attribute to value. +// If not specified, defaults to -1 +func XlaSpmdFullToShardShapeDim(value int64) XlaSpmdFullToShardShapeAttr { + return func(m optionalAttr) { + m["dim"] = value + } +} + +// XlaSpmdFullToShardShapeUnspecifiedDims sets the optional unspecified_dims attribute to value. +// If not specified, defaults to <> +func XlaSpmdFullToShardShapeUnspecifiedDims(value []int64) XlaSpmdFullToShardShapeAttr { + return func(m optionalAttr) { + m["unspecified_dims"] = value + } +} + +// An op used by XLA SPMD partitioner to switch from automatic partitioning to +// +// manual partitioning. It annotates the input (full-shape, to be automatically +// partitioned) with the same sharding used by manual partitioning, and outputs a +// shard-shaped tensor to be consumed by later manually-partitioned ops. If the +// shape is not evenly partitionable, the padding region will be masked with 0s. +// The conversion can happen partially in subgroups, by specifying the dim +// attribute, where only that dim will be converted. +func XlaSpmdFullToShardShape(scope *Scope, input tf.Output, manual_sharding string, optional ...XlaSpmdFullToShardShapeAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"manual_sharding": manual_sharding} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "XlaSpmdFullToShardShape", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Runs multiple additive regression ensemble predictors on input instances and +// +// computes the logits. It is designed to be used during prediction. +// It traverses all the trees and calculates the final score for each instance. +// +// Arguments: +// +// bucketized_features: A list of rank 1 Tensors containing bucket id for each +// +// feature. +// +// logits_dimension: scalar, dimension of the logits, to be used for partial logits +// +// shape. +// +// Returns Output rank 2 Tensor containing logits for each example. +func BoostedTreesPredict(scope *Scope, tree_ensemble_handle tf.Output, bucketized_features []tf.Output, logits_dimension int64) (logits tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"logits_dimension": logits_dimension} + opspec := tf.OpSpec{ + Type: "BoostedTreesPredict", + Input: []tf.Input{ + tree_ensemble_handle, tf.OutputList(bucketized_features), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Constructs an Optional variant from a tuple of tensors. +func OptionalFromValue(scope *Scope, components []tf.Output) (optional tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "OptionalFromValue", + Input: []tf.Input{ + tf.OutputList(components), + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Gives a guarantee to the TF runtime that the input tensor is a constant. +// +// The runtime is then free to make optimizations based on this. +// +// Only accepts value typed tensors as inputs and rejects resource variable handles +// as input. +// +// Returns the input tensor without modification. +func GuaranteeConst(scope *Scope, input tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "GuaranteeConst", + Input: []tf.Input{ + input, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// StackPushV2Attr is an optional argument to StackPushV2. +type StackPushV2Attr func(optionalAttr) + +// StackPushV2SwapMemory sets the optional swap_memory attribute to value. +// +// value: Swap `elem` to CPU. Default to false. +// If not specified, defaults to false +func StackPushV2SwapMemory(value bool) StackPushV2Attr { + return func(m optionalAttr) { + m["swap_memory"] = value + } +} + +// Push an element onto the stack. +// +// Arguments: +// +// handle: The handle to a stack. +// elem: The tensor to be pushed onto the stack. +// +// Returns The same tensor as the input 'elem'. +func StackPushV2(scope *Scope, handle tf.Output, elem tf.Output, optional ...StackPushV2Attr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "StackPushV2", + Input: []tf.Input{ + handle, elem, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// CacheDatasetAttr is an optional argument to CacheDataset. +type CacheDatasetAttr func(optionalAttr) + +// CacheDatasetMetadata sets the optional metadata attribute to value. +// If not specified, defaults to "" +func CacheDatasetMetadata(value string) CacheDatasetAttr { + return func(m optionalAttr) { + m["metadata"] = value + } +} + +// Creates a dataset that caches elements from `input_dataset`. +// +// A CacheDataset will iterate over the input_dataset, and store tensors. If the +// cache already exists, the cache will be used. If the cache is inappropriate +// (e.g. cannot be opened, contains tensors of the wrong shape / size), an error +// will the returned when used. +// +// Arguments: +// +// filename: A path on the filesystem where we should cache the dataset. Note: this +// +// will be a directory. +func CacheDataset(scope *Scope, input_dataset tf.Output, filename tf.Output, output_types []tf.DataType, output_shapes []tf.Shape, optional ...CacheDatasetAttr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "CacheDataset", + Input: []tf.Input{ + input_dataset, filename, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Batch normalization. +// +// DEPRECATED at GraphDef version 9: Use tf.nn.batch_normalization() +// +// This op is deprecated. Prefer `tf.nn.batch_normalization`. +// +// Arguments: +// +// t: A 4D input Tensor. +// m: A 1D mean Tensor with size matching the last dimension of t. +// +// This is the first output from tf.nn.moments, +// or a saved moving average thereof. +// +// v: A 1D variance Tensor with size matching the last dimension of t. +// +// This is the second output from tf.nn.moments, +// or a saved moving average thereof. +// +// beta: A 1D beta Tensor with size matching the last dimension of t. +// +// An offset to be added to the normalized tensor. +// +// gamma: A 1D gamma Tensor with size matching the last dimension of t. +// +// If "scale_after_normalization" is true, this tensor will be multiplied +// with the normalized tensor. +// +// variance_epsilon: A small float number to avoid dividing by 0. +// scale_after_normalization: A bool indicating whether the resulted tensor +// +// needs to be multiplied with gamma. +func BatchNormWithGlobalNormalization(scope *Scope, t tf.Output, m tf.Output, v tf.Output, beta tf.Output, gamma tf.Output, variance_epsilon float32, scale_after_normalization bool) (result tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"variance_epsilon": variance_epsilon, "scale_after_normalization": scale_after_normalization} + opspec := tf.OpSpec{ + Type: "BatchNormWithGlobalNormalization", + Input: []tf.Input{ + t, m, v, beta, gamma, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// BoostedTreesUpdateEnsembleV2Attr is an optional argument to BoostedTreesUpdateEnsembleV2. +type BoostedTreesUpdateEnsembleV2Attr func(optionalAttr) + +// BoostedTreesUpdateEnsembleV2LogitsDimension sets the optional logits_dimension attribute to value. +// +// value: scalar, dimension of the logits +// If not specified, defaults to 1 +func BoostedTreesUpdateEnsembleV2LogitsDimension(value int64) BoostedTreesUpdateEnsembleV2Attr { + return func(m optionalAttr) { + m["logits_dimension"] = value + } +} + +// Updates the tree ensemble by adding a layer to the last tree being grown +// +// or by starting a new tree. +// +// Arguments: +// +// tree_ensemble_handle: Handle to the ensemble variable. +// feature_ids: Rank 1 tensor with ids for each feature. This is the real id of +// +// the feature that will be used in the split. +// +// dimension_ids: List of rank 1 tensors representing the dimension in each feature. +// node_ids: List of rank 1 tensors representing the nodes for which this feature +// +// has a split. +// +// gains: List of rank 1 tensors representing the gains for each of the feature's +// +// split. +// +// thresholds: List of rank 1 tensors representing the thesholds for each of the +// +// feature's split. +// +// left_node_contribs: List of rank 2 tensors with left leaf contribs for each of +// +// the feature's splits. Will be added to the previous node values to constitute +// the values of the left nodes. +// +// right_node_contribs: List of rank 2 tensors with right leaf contribs for each +// +// of the feature's splits. Will be added to the previous node values to constitute +// the values of the right nodes. +// +// split_types: List of rank 1 tensors representing the split type for each feature. +// max_depth: Max depth of the tree to build. +// learning_rate: shrinkage const for each new tree. +// pruning_mode: 0-No pruning, 1-Pre-pruning, 2-Post-pruning. +// +// Returns the created operation. +func BoostedTreesUpdateEnsembleV2(scope *Scope, tree_ensemble_handle tf.Output, feature_ids []tf.Output, dimension_ids []tf.Output, node_ids []tf.Output, gains []tf.Output, thresholds []tf.Output, left_node_contribs []tf.Output, right_node_contribs []tf.Output, split_types []tf.Output, max_depth tf.Output, learning_rate tf.Output, pruning_mode tf.Output, optional ...BoostedTreesUpdateEnsembleV2Attr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "BoostedTreesUpdateEnsembleV2", + Input: []tf.Input{ + tree_ensemble_handle, tf.OutputList(feature_ids), tf.OutputList(dimension_ids), tf.OutputList(node_ids), tf.OutputList(gains), tf.OutputList(thresholds), tf.OutputList(left_node_contribs), tf.OutputList(right_node_contribs), tf.OutputList(split_types), max_depth, learning_rate, pruning_mode, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// Returns element-wise remainder of division. This emulates C semantics in that +// +// the result here is consistent with a truncating divide. E.g. +// `tf.truncatediv(x, y) * y + truncate_mod(x, y) = x`. +// +// *NOTE*: `Mod` supports broadcasting. More about broadcasting +// [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) +func Mod(scope *Scope, x tf.Output, y tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Mod", + Input: []tf.Input{ + x, y, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns x - y element-wise. +// +// *NOTE*: `Subtract` supports broadcasting. More about broadcasting +// [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) +func Sub(scope *Scope, x tf.Output, y tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Sub", + Input: []tf.Input{ + x, y, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// FractionalAvgPoolGradAttr is an optional argument to FractionalAvgPoolGrad. +type FractionalAvgPoolGradAttr func(optionalAttr) + +// FractionalAvgPoolGradOverlapping sets the optional overlapping attribute to value. +// +// value: When set to True, it means when pooling, the values at the boundary +// of adjacent pooling cells are used by both cells. For example: +// +// `index 0 1 2 3 4` +// +// `value 20 5 16 3 7` +// +// If the pooling sequence is [0, 2, 4], then 16, at index 2 will be used twice. +// The result would be [41/3, 26/3] for fractional avg pooling. +// If not specified, defaults to false +func FractionalAvgPoolGradOverlapping(value bool) FractionalAvgPoolGradAttr { + return func(m optionalAttr) { + m["overlapping"] = value + } +} + +// Computes gradient of the FractionalAvgPool function. +// +// Unlike FractionalMaxPoolGrad, we don't need to find arg_max for +// FractionalAvgPoolGrad, we just need to evenly back-propagate each element of +// out_backprop to those indices that form the same pooling cell. Therefore, we +// just need to know the shape of original input tensor, instead of the whole +// tensor. +// +// Arguments: +// +// orig_input_tensor_shape: Original input tensor shape for `fractional_avg_pool` +// out_backprop: 4-D with shape `[batch, height, width, channels]`. Gradients +// +// w.r.t. the output of `fractional_avg_pool`. +// +// row_pooling_sequence: row pooling sequence, form pooling region with +// +// col_pooling_sequence. +// +// col_pooling_sequence: column pooling sequence, form pooling region with +// +// row_pooling sequence. +// +// Returns 4-D. Gradients w.r.t. the input of `fractional_avg_pool`. +func FractionalAvgPoolGrad(scope *Scope, orig_input_tensor_shape tf.Output, out_backprop tf.Output, row_pooling_sequence tf.Output, col_pooling_sequence tf.Output, optional ...FractionalAvgPoolGradAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "FractionalAvgPoolGrad", + Input: []tf.Input{ + orig_input_tensor_shape, out_backprop, row_pooling_sequence, col_pooling_sequence, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Adds two `SparseTensor` objects to produce another `SparseTensor`. +// +// The input `SparseTensor` objects' indices are assumed ordered in standard +// lexicographic order. If this is not the case, before this step run +// `SparseReorder` to restore index ordering. +// +// By default, if two values sum to zero at some index, the output `SparseTensor` +// would still include that particular location in its index, storing a zero in the +// corresponding value slot. To override this, callers can specify `thresh`, +// indicating that if the sum has a magnitude strictly smaller than `thresh`, its +// corresponding value and index would then not be included. In particular, +// `thresh == 0` (default) means everything is kept and actual thresholding happens +// only for a positive value. +// +// In the following shapes, `nnz` is the count after taking `thresh` into account. +// +// Arguments: +// +// a_indices: 2-D. The `indices` of the first `SparseTensor`, size `[nnz, ndims]` Matrix. +// a_values: 1-D. The `values` of the first `SparseTensor`, size `[nnz]` Vector. +// a_shape: 1-D. The `shape` of the first `SparseTensor`, size `[ndims]` Vector. +// b_indices: 2-D. The `indices` of the second `SparseTensor`, size `[nnz, ndims]` Matrix. +// b_values: 1-D. The `values` of the second `SparseTensor`, size `[nnz]` Vector. +// b_shape: 1-D. The `shape` of the second `SparseTensor`, size `[ndims]` Vector. +// thresh: 0-D. The magnitude threshold that determines if an output value/index +// +// pair takes space. +func SparseAdd(scope *Scope, a_indices tf.Output, a_values tf.Output, a_shape tf.Output, b_indices tf.Output, b_values tf.Output, b_shape tf.Output, thresh tf.Output) (sum_indices tf.Output, sum_values tf.Output, sum_shape tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "SparseAdd", + Input: []tf.Input{ + a_indices, a_values, a_shape, b_indices, b_values, b_shape, thresh, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// Returns the element-wise min of two SparseTensors. +// +// Assumes the two SparseTensors have the same shape, i.e., no broadcasting. +// +// Arguments: +// +// a_indices: 2-D. `N x R` matrix with the indices of non-empty values in a +// +// SparseTensor, in the canonical lexicographic ordering. +// +// a_values: 1-D. `N` non-empty values corresponding to `a_indices`. +// a_shape: 1-D. Shape of the input SparseTensor. +// b_indices: counterpart to `a_indices` for the other operand. +// b_values: counterpart to `a_values` for the other operand; must be of the same dtype. +// b_shape: counterpart to `a_shape` for the other operand; the two shapes must be equal. +// +// Returns: +// +// output_indices: 2-D. The indices of the output SparseTensor. +// output_values: 1-D. The values of the output SparseTensor. +func SparseSparseMinimum(scope *Scope, a_indices tf.Output, a_values tf.Output, a_shape tf.Output, b_indices tf.Output, b_values tf.Output, b_shape tf.Output) (output_indices tf.Output, output_values tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "SparseSparseMinimum", + Input: []tf.Input{ + a_indices, a_values, a_shape, b_indices, b_values, b_shape, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// Replica ID. +func XlaReplicaId(scope *Scope) (id tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "XlaReplicaId", + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// An op which supports basic einsum op with 2 inputs and 1 output. +// +// This op has better TPU performance since it doesn't have explicitly reshape and +// transpose operations as tf.einsum does. +func XlaEinsum(scope *Scope, a tf.Output, b tf.Output, equation string) (product tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"equation": equation} + opspec := tf.OpSpec{ + Type: "XlaEinsum", + Input: []tf.Input{ + a, b, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes acos of x element-wise. +// +// Provided an input tensor, the `tf.math.acos` operation returns the inverse cosine of each element of the tensor. If `y = tf.math.cos(x)` then, `x = tf.math.acos(y)`. +// +// Input range is `[-1, 1]` and the output has a range of `[0, pi]`. +func Acos(scope *Scope, x tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Acos", + Input: []tf.Input{ + x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes the eigen decomposition of a batch of self-adjoint matrices +// +// (Note: Only real inputs are supported). +// +// Computes the eigenvalues and eigenvectors of the innermost N-by-N matrices in +// tensor such that tensor[...,:,:] * v[..., :,i] = e[..., i] * v[...,:,i], for +// i=0...N-1. +// +// Arguments: +// +// a: the input tensor. +// lower: a boolean specifies whether the calculation is done with the lower +// +// triangular part or the upper triangular part. +// +// max_iter: maximum number of sweep update, i.e., the whole lower triangular +// +// part or upper triangular part based on parameter lower. Heuristically, it has +// been argued that approximately logN sweeps are needed in practice (Ref: Golub & +// van Loan "Matrix Computation"). +// +// epsilon: the tolerance ratio. +// +// Returns: +// +// w: The eigenvalues in ascending order, each repeated according to its +// +// multiplicity. +// +// v: The column v[..., :, i] is the normalized eigenvector corresponding to the +// +// eigenvalue w[..., i]. +func XlaSelfAdjointEig(scope *Scope, a tf.Output, lower bool, max_iter int64, epsilon float32) (w tf.Output, v tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"lower": lower, "max_iter": max_iter, "epsilon": epsilon} + opspec := tf.OpSpec{ + Type: "XlaSelfAdjointEig", + Input: []tf.Input{ + a, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// TensorDatasetAttr is an optional argument to TensorDataset. +type TensorDatasetAttr func(optionalAttr) + +// TensorDatasetMetadata sets the optional metadata attribute to value. +// If not specified, defaults to "" +func TensorDatasetMetadata(value string) TensorDatasetAttr { + return func(m optionalAttr) { + m["metadata"] = value + } +} + +// Creates a dataset that emits `components` as a tuple of tensors once. +func TensorDataset(scope *Scope, components []tf.Output, output_shapes []tf.Shape, optional ...TensorDatasetAttr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_shapes": output_shapes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "TensorDataset", + Input: []tf.Input{ + tf.OutputList(components), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns the complex conjugate of a complex number. +// +// Given a tensor `input` of complex numbers, this operation returns a tensor of +// complex numbers that are the complex conjugate of each element in `input`. The +// complex numbers in `input` must be of the form \\(a + bj\\), where *a* is the +// real part and *b* is the imaginary part. +// +// The complex conjugate returned by this operation is of the form \\(a - bj\\). +// +// For example: +// +// ``` +// # tensor 'input' is [-2.25 + 4.75j, 3.25 + 5.75j] +// tf.conj(input) ==> [-2.25 - 4.75j, 3.25 - 5.75j] +// ``` +func Conj(scope *Scope, input tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Conj", + Input: []tf.Input{ + input, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes the reverse mode backpropagated gradient of the Cholesky algorithm. +// +// For an explanation see "Differentiation of the Cholesky algorithm" by +// Iain Murray http://arxiv.org/abs/1602.07527. +// +// Arguments: +// +// l: Output of batch Cholesky algorithm l = cholesky(A). Shape is `[..., M, M]`. +// +// Algorithm depends only on lower triangular part of the innermost matrices of +// this tensor. +// +// grad: df/dl where f is some scalar function. Shape is `[..., M, M]`. +// +// Algorithm depends only on lower triangular part of the innermost matrices of +// this tensor. +// +// Returns Symmetrized version of df/dA . Shape is `[..., M, M]` +func CholeskyGrad(scope *Scope, l tf.Output, grad tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "CholeskyGrad", + Input: []tf.Input{ + l, grad, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// LRNGradAttr is an optional argument to LRNGrad. +type LRNGradAttr func(optionalAttr) + +// LRNGradDepthRadius sets the optional depth_radius attribute to value. +// +// value: A depth radius. +// If not specified, defaults to 5 +func LRNGradDepthRadius(value int64) LRNGradAttr { + return func(m optionalAttr) { + m["depth_radius"] = value + } +} + +// LRNGradBias sets the optional bias attribute to value. +// +// value: An offset (usually > 0 to avoid dividing by 0). +// If not specified, defaults to 1 +func LRNGradBias(value float32) LRNGradAttr { + return func(m optionalAttr) { + m["bias"] = value + } +} + +// LRNGradAlpha sets the optional alpha attribute to value. +// +// value: A scale factor, usually positive. +// If not specified, defaults to 1 +func LRNGradAlpha(value float32) LRNGradAttr { + return func(m optionalAttr) { + m["alpha"] = value + } +} + +// LRNGradBeta sets the optional beta attribute to value. +// +// value: An exponent. +// If not specified, defaults to 0.5 +func LRNGradBeta(value float32) LRNGradAttr { + return func(m optionalAttr) { + m["beta"] = value + } +} + +// Gradients for Local Response Normalization. +// +// Arguments: +// +// input_grads: 4-D with shape `[batch, height, width, channels]`. +// input_image: 4-D with shape `[batch, height, width, channels]`. +// output_image: 4-D with shape `[batch, height, width, channels]`. +// +// Returns The gradients for LRN. +func LRNGrad(scope *Scope, input_grads tf.Output, input_image tf.Output, output_image tf.Output, optional ...LRNGradAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "LRNGrad", + Input: []tf.Input{ + input_grads, input_image, output_image, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// A TPU core selector Op. +// +// This Op produces a set of TPU cores (for warm-up) or a single TPU core +// (for regular inference) to execute the TPU program on. The output is +// consumed by TPUPartitionedCall. +// +// Returns A vector 1 or more TPU cores. +func TPUOrdinalSelector(scope *Scope) (device_ordinals tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "TPUOrdinalSelector", + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// StatelessRandomUniformV2Attr is an optional argument to StatelessRandomUniformV2. +type StatelessRandomUniformV2Attr func(optionalAttr) + +// StatelessRandomUniformV2Dtype sets the optional dtype attribute to value. +// +// value: The type of the output. +// If not specified, defaults to DT_FLOAT +func StatelessRandomUniformV2Dtype(value tf.DataType) StatelessRandomUniformV2Attr { + return func(m optionalAttr) { + m["dtype"] = value + } +} + +// Outputs deterministic pseudorandom random values from a uniform distribution. +// +// The generated values follow a uniform distribution in the range `[0, 1)`. The +// lower bound 0 is included in the range, while the upper bound 1 is excluded. +// +// The outputs are a deterministic function of `shape`, `key`, `counter` and `alg`. +// +// Arguments: +// +// shape: The shape of the output tensor. +// key: Key for the counter-based RNG algorithm (shape uint64[1]). +// counter: Initial counter for the counter-based RNG algorithm (shape uint64[2] or uint64[1] depending on the algorithm). If a larger vector is given, only the needed portion on the left (i.e. [:N]) will be used. +// alg: The RNG algorithm (shape int32[]). +// +// Returns Random values with specified shape. +func StatelessRandomUniformV2(scope *Scope, shape tf.Output, key tf.Output, counter tf.Output, alg tf.Output, optional ...StatelessRandomUniformV2Attr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "StatelessRandomUniformV2", + Input: []tf.Input{ + shape, key, counter, alg, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Records the latency of producing `input_dataset` elements in a StatsAggregator. +func LatencyStatsDataset(scope *Scope, input_dataset tf.Output, tag tf.Output, output_types []tf.DataType, output_shapes []tf.Shape) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + opspec := tf.OpSpec{ + Type: "LatencyStatsDataset", + Input: []tf.Input{ + input_dataset, tag, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Compute the regularized incomplete beta integral \\(I_x(a, b)\\). +// +// The regularized incomplete beta integral is defined as: +// +// \\(I_x(a, b) = \frac{B(x; a, b)}{B(a, b)}\\) +// +// where +// +// \\(B(x; a, b) = \int_0^x t^{a-1} (1 - t)^{b-1} dt\\) +// +// is the incomplete beta function and \\(B(a, b)\\) is the *complete* +// beta function. +func Betainc(scope *Scope, a tf.Output, b tf.Output, x tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Betainc", + Input: []tf.Input{ + a, b, x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// StringSplitV2Attr is an optional argument to StringSplitV2. +type StringSplitV2Attr func(optionalAttr) + +// StringSplitV2Maxsplit sets the optional maxsplit attribute to value. +// +// value: An `int`. If `maxsplit > 0`, limit of the split of the result. +// If not specified, defaults to -1 +func StringSplitV2Maxsplit(value int64) StringSplitV2Attr { + return func(m optionalAttr) { + m["maxsplit"] = value + } +} + +// Split elements of `source` based on `sep` into a `SparseTensor`. +// +// Let N be the size of source (typically N will be the batch size). Split each +// element of `source` based on `sep` and return a `SparseTensor` +// containing the split tokens. Empty tokens are ignored. +// +// For example, N = 2, source[0] is 'hello world' and source[1] is 'a b c', +// then the output will be +// ``` +// st.indices = [0, 0; +// +// 0, 1; +// 1, 0; +// 1, 1; +// 1, 2] +// +// st.shape = [2, 3] +// st.values = ['hello', 'world', 'a', 'b', 'c'] +// ``` +// +// If `sep` is given, consecutive delimiters are not grouped together and are +// deemed to delimit empty strings. For example, source of `"1<>2<><>3"` and +// sep of `"<>"` returns `["1", "2", "", "3"]`. If `sep` is None or an empty +// string, consecutive whitespace are regarded as a single separator, and the +// result will contain no empty strings at the startor end if the string has +// leading or trailing whitespace. +// +// Note that the above mentioned behavior matches python's str.split. +// +// Arguments: +// +// input: `1-D` string `Tensor`, the strings to split. +// sep: `0-D` string `Tensor`, the delimiter character. +func StringSplitV2(scope *Scope, input tf.Output, sep tf.Output, optional ...StringSplitV2Attr) (indices tf.Output, values tf.Output, shape tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "StringSplitV2", + Input: []tf.Input{ + input, sep, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// Wraps the XLA Sort operator, documented at +// +// https://www.tensorflow.org/performance/xla/operation_semantics#sort +// +// . +// +// Sorts a tensor. Currently only sorts in ascending order are supported. +// +// Arguments: +// +// input: A `Tensor` of type T. +// +// Returns A `Tensor` of type T. +func XlaSort(scope *Scope, input tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "XlaSort", + Input: []tf.Input{ + input, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Reverses specific dimensions of a tensor. +// +// NOTE `tf.reverse` has now changed behavior in preparation for 1.0. +// `tf.reverse_v2` is currently an alias that will be deprecated before TF 1.0. +// +// Given a `tensor`, and a `int32` tensor `axis` representing the set of +// dimensions of `tensor` to reverse. This operation reverses each dimension +// `i` for which there exists `j` s.t. `axis[j] == i`. +// +// `tensor` can have up to 8 dimensions. The number of dimensions specified +// in `axis` may be 0 or more entries. If an index is specified more than +// once, a InvalidArgument error is raised. +// +// For example: +// +// ``` +// # tensor 't' is [[[[ 0, 1, 2, 3], +// # [ 4, 5, 6, 7], +// # [ 8, 9, 10, 11]], +// # [[12, 13, 14, 15], +// # [16, 17, 18, 19], +// # [20, 21, 22, 23]]]] +// # tensor 't' shape is [1, 2, 3, 4] +// +// # 'dims' is [3] or 'dims' is [-1] +// reverse(t, dims) ==> [[[[ 3, 2, 1, 0], +// +// [ 7, 6, 5, 4], +// [ 11, 10, 9, 8]], +// [[15, 14, 13, 12], +// [19, 18, 17, 16], +// [23, 22, 21, 20]]]] +// +// # 'dims' is '[1]' (or 'dims' is '[-3]') +// reverse(t, dims) ==> [[[[12, 13, 14, 15], +// +// [16, 17, 18, 19], +// [20, 21, 22, 23] +// [[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11]]]] +// +// # 'dims' is '[2]' (or 'dims' is '[-2]') +// reverse(t, dims) ==> [[[[8, 9, 10, 11], +// +// [4, 5, 6, 7], +// [0, 1, 2, 3]] +// [[20, 21, 22, 23], +// [16, 17, 18, 19], +// [12, 13, 14, 15]]]] +// +// ``` +// +// Arguments: +// +// tensor: Up to 8-D. +// axis: 1-D. The indices of the dimensions to reverse. Must be in the range +// +// `[-rank(tensor), rank(tensor))`. +// +// Returns The same shape as `tensor`. +func ReverseV2(scope *Scope, tensor tf.Output, axis tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "ReverseV2", + Input: []tf.Input{ + tensor, axis, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// AbortAttr is an optional argument to Abort. +type AbortAttr func(optionalAttr) + +// AbortErrorMsg sets the optional error_msg attribute to value. +// +// value: A string which is the message associated with the exception. +// If not specified, defaults to "" +func AbortErrorMsg(value string) AbortAttr { + return func(m optionalAttr) { + m["error_msg"] = value + } +} + +// AbortExitWithoutError sets the optional exit_without_error attribute to value. +// If not specified, defaults to false +func AbortExitWithoutError(value bool) AbortAttr { + return func(m optionalAttr) { + m["exit_without_error"] = value + } +} + +// Raise a exception to abort the process when called. +// +// If exit_without_error is true, the process will exit normally, +// otherwise it will exit with a SIGABORT signal. +// +// Returns nothing but an exception. +// +// Returns the created operation. +func Abort(scope *Scope, optional ...AbortAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Abort", + + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// Checks a tensor for NaN and Inf values. +// +// When run, reports an `InvalidArgument` error if `tensor` has any values +// that are not a number (NaN) or infinity (Inf). Otherwise, passes `tensor` as-is. +// +// Arguments: +// +// message: Prefix of the error message. +func CheckNumerics(scope *Scope, tensor tf.Output, message string) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"message": message} + opspec := tf.OpSpec{ + Type: "CheckNumerics", + Input: []tf.Input{ + tensor, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Emits an HLO `CustomCall` operation with multiple outputs. +// +// As opposed to `XlaCustomCall`, this operation supports multiple outputs. +// +// See `CustomCall` specification at +// +// https://tensorflow.org/xla/operation_semantics#customcall, +// +// and `mhlo.custom_call` specification at +// +// https://tensorflow.org/mlir/hlo_ops#mhlocustom_call_mlirmhlocustomcallop. +// +// Arguments: +// +// operands: A sequence of tensors with possibly different types. +// call_target_name: Name of the user function. The function signature must conform +// +// to version 3 of the API, see `API_VERSION_STATUS_RETURNING_UNIFIED`. All +// operands and results assumed to be in the default layout. +// +// backend_config: A string that encodes a metadata for the backend. +// has_side_effect: Indicates whether the custom call has side effects. +// result_dtypes: Types of all results. +// result_shapes: Shapes of all results. +func XlaCustomCallV2(scope *Scope, operands []tf.Output, call_target_name string, backend_config string, has_side_effect bool, result_dtypes []tf.DataType, result_shapes []tf.Shape) (results []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"call_target_name": call_target_name, "backend_config": backend_config, "has_side_effect": has_side_effect, "result_dtypes": result_dtypes, "result_shapes": result_shapes} + opspec := tf.OpSpec{ + Type: "XlaCustomCallV2", + Input: []tf.Input{ + tf.OutputList(operands), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if results, idx, err = makeOutputList(op, idx, "results"); err != nil { + scope.UpdateErr("XlaCustomCallV2", err) + return + } + return results +} + +// ResourceApplyFtrlV2Attr is an optional argument to ResourceApplyFtrlV2. +type ResourceApplyFtrlV2Attr func(optionalAttr) + +// ResourceApplyFtrlV2UseLocking sets the optional use_locking attribute to value. +// +// value: If `True`, updating of the var and accum tensors will be protected +// by a lock; otherwise the behavior is undefined, but may exhibit less +// contention. +// If not specified, defaults to false +func ResourceApplyFtrlV2UseLocking(value bool) ResourceApplyFtrlV2Attr { + return func(m optionalAttr) { + m["use_locking"] = value + } +} + +// ResourceApplyFtrlV2MultiplyLinearByLr sets the optional multiply_linear_by_lr attribute to value. +// If not specified, defaults to false +func ResourceApplyFtrlV2MultiplyLinearByLr(value bool) ResourceApplyFtrlV2Attr { + return func(m optionalAttr) { + m["multiply_linear_by_lr"] = value + } +} + +// Update '*var' according to the Ftrl-proximal scheme. +// +// grad_with_shrinkage = grad + 2 * l2_shrinkage * var +// accum_new = accum + grad_with_shrinkage * grad_with_shrinkage +// linear += grad_with_shrinkage + +// +// (accum_new^(-lr_power) - accum^(-lr_power)) / lr * var +// +// quadratic = 1.0 / (accum_new^(lr_power) * lr) + 2 * l2 +// var = (sign(linear) * l1 - linear) / quadratic if |linear| > l1 else 0.0 +// accum = accum_new +// +// Arguments: +// +// var_: Should be from a Variable(). +// accum: Should be from a Variable(). +// linear: Should be from a Variable(). +// grad: The gradient. +// lr: Scaling factor. Must be a scalar. +// l1: L1 regularization. Must be a scalar. +// l2: L2 shrinkage regularization. Must be a scalar. +// +// lr_power: Scaling factor. Must be a scalar. +// +// Returns the created operation. +func ResourceApplyFtrlV2(scope *Scope, var_ tf.Output, accum tf.Output, linear tf.Output, grad tf.Output, lr tf.Output, l1 tf.Output, l2 tf.Output, l2_shrinkage tf.Output, lr_power tf.Output, optional ...ResourceApplyFtrlV2Attr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ResourceApplyFtrlV2", + Input: []tf.Input{ + var_, accum, linear, grad, lr, l1, l2, l2_shrinkage, lr_power, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// Computes offsets of concat inputs within its output. +// +// For example: +// +// ``` +// # 'x' is [2, 2, 7] +// # 'y' is [2, 3, 7] +// # 'z' is [2, 5, 7] +// concat_offset(2, [x, y, z]) => [0, 0, 0], [0, 2, 0], [0, 5, 0] +// ``` +// +// This is typically used by gradient computations for a concat operation. +// +// Arguments: +// +// concat_dim: The dimension along which to concatenate. +// shape: The `N` int32 vectors representing shape of tensors being concatenated. +// +// Returns The `N` int32 vectors representing the starting offset +// of input tensors within the concatenated output. +func ConcatOffset(scope *Scope, concat_dim tf.Output, shape []tf.Output) (offset []tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "ConcatOffset", + Input: []tf.Input{ + concat_dim, tf.OutputList(shape), + }, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if offset, idx, err = makeOutputList(op, idx, "offset"); err != nil { + scope.UpdateErr("ConcatOffset", err) + return + } + return offset +} + +// DatasetToGraphV2Attr is an optional argument to DatasetToGraphV2. +type DatasetToGraphV2Attr func(optionalAttr) + +// DatasetToGraphV2ExternalStatePolicy sets the optional external_state_policy attribute to value. +// If not specified, defaults to 0 +func DatasetToGraphV2ExternalStatePolicy(value int64) DatasetToGraphV2Attr { + return func(m optionalAttr) { + m["external_state_policy"] = value + } +} + +// DatasetToGraphV2StripDeviceAssignment sets the optional strip_device_assignment attribute to value. +// If not specified, defaults to false +func DatasetToGraphV2StripDeviceAssignment(value bool) DatasetToGraphV2Attr { + return func(m optionalAttr) { + m["strip_device_assignment"] = value + } +} + +// Returns a serialized GraphDef representing `input_dataset`. +// +// Returns a graph representation for `input_dataset`. +// +// Arguments: +// +// input_dataset: A variant tensor representing the dataset to return the graph representation for. +// +// Returns The graph representation of the dataset (as serialized GraphDef). +func DatasetToGraphV2(scope *Scope, input_dataset tf.Output, optional ...DatasetToGraphV2Attr) (graph tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "DatasetToGraphV2", + Input: []tf.Input{ + input_dataset, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// DirectedInterleaveDatasetAttr is an optional argument to DirectedInterleaveDataset. +type DirectedInterleaveDatasetAttr func(optionalAttr) + +// DirectedInterleaveDatasetStopOnEmptyDataset sets the optional stop_on_empty_dataset attribute to value. +// If not specified, defaults to false +func DirectedInterleaveDatasetStopOnEmptyDataset(value bool) DirectedInterleaveDatasetAttr { + return func(m optionalAttr) { + m["stop_on_empty_dataset"] = value + } +} + +// A substitute for `InterleaveDataset` on a fixed list of `N` datasets. +// +// Arguments: +// +// selector_input_dataset: A dataset of scalar `DT_INT64` elements that determines which of the +// +// `N` data inputs should produce the next output element. +// +// data_input_datasets: `N` datasets with the same type that will be interleaved according to +// +// the values of `selector_input_dataset`. +func DirectedInterleaveDataset(scope *Scope, selector_input_dataset tf.Output, data_input_datasets []tf.Output, output_types []tf.DataType, output_shapes []tf.Shape, optional ...DirectedInterleaveDatasetAttr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "DirectedInterleaveDataset", + Input: []tf.Input{ + selector_input_dataset, tf.OutputList(data_input_datasets), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes the matrix square root of one or more square matrices: +// +// matmul(sqrtm(A), sqrtm(A)) = A +// +// The input matrix should be invertible. If the input matrix is real, it should +// have no eigenvalues which are real and negative (pairs of complex conjugate +// eigenvalues are allowed). +// +// The matrix square root is computed by first reducing the matrix to +// quasi-triangular form with the real Schur decomposition. The square root +// of the quasi-triangular matrix is then computed directly. Details of +// the algorithm can be found in: Nicholas J. Higham, "Computing real +// square roots of a real matrix", Linear Algebra Appl., 1987. +// +// The input is a tensor of shape `[..., M, M]` whose inner-most 2 dimensions +// form square matrices. The output is a tensor of the same shape as the input +// containing the matrix square root for all input submatrices `[..., :, :]`. +// +// Arguments: +// +// input: Shape is `[..., M, M]`. +// +// Returns Shape is `[..., M, M]`. +// +// @compatibility(scipy) +// Equivalent to scipy.linalg.sqrtm +// @end_compatibility +func MatrixSquareRoot(scope *Scope, input tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "MatrixSquareRoot", + Input: []tf.Input{ + input, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns which elements of x are finite. +// +// @compatibility(numpy) +// Equivalent to np.isfinite +// @end_compatibility +// +// Example: +// +// ```python +// x = tf.constant([5.0, 4.8, 6.8, np.inf, np.nan]) +// tf.math.is_finite(x) ==> [True, True, True, False, False] +// ``` +func IsFinite(scope *Scope, x tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "IsFinite", + Input: []tf.Input{ + x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Scatter the data from the input value into specific TensorArray elements. +// +// `indices` must be a vector, its length must match the first dim of `value`. +// +// Arguments: +// +// handle: The handle to a TensorArray. +// indices: The locations at which to write the tensor elements. +// value: The concatenated tensor to write to the TensorArray. +// flow_in: A float scalar that enforces proper chaining of operations. +// +// Returns A float scalar that enforces proper chaining of operations. +func TensorArrayScatterV3(scope *Scope, handle tf.Output, indices tf.Output, value tf.Output, flow_in tf.Output) (flow_out tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "TensorArrayScatterV3", + Input: []tf.Input{ + handle, indices, value, flow_in, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Gradient op for `MirrorPad` op. This op folds a mirror-padded tensor. +// +// This operation folds the padded areas of `input` by `MirrorPad` according to the +// `paddings` you specify. `paddings` must be the same as `paddings` argument +// given to the corresponding `MirrorPad` op. +// +// The folded size of each dimension D of the output is: +// +// `input.dim_size(D) - paddings(D, 0) - paddings(D, 1)` +// +// For example: +// +// ``` +// # 't' is [[1, 2, 3], [4, 5, 6], [7, 8, 9]]. +// # 'paddings' is [[0, 1]], [0, 1]]. +// # 'mode' is SYMMETRIC. +// # rank of 't' is 2. +// pad(t, paddings) ==> [[ 1, 5] +// +// [11, 28]] +// +// ``` +// +// Arguments: +// +// input: The input tensor to be folded. +// paddings: A two-column matrix specifying the padding sizes. The number of +// +// rows must be the same as the rank of `input`. +// +// mode: The mode used in the `MirrorPad` op. +// +// Returns The folded tensor. +func MirrorPadGrad(scope *Scope, input tf.Output, paddings tf.Output, mode string) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"mode": mode} + opspec := tf.OpSpec{ + Type: "MirrorPadGrad", + Input: []tf.Input{ + input, paddings, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns x * y element-wise. Returns zero if y is zero, even if x if infinite or NaN. +// +// *NOTE*: `MulNoNan` supports broadcasting. More about broadcasting +// [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) +func MulNoNan(scope *Scope, x tf.Output, y tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "MulNoNan", + Input: []tf.Input{ + x, y, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// MaxPoolV2Attr is an optional argument to MaxPoolV2. +type MaxPoolV2Attr func(optionalAttr) + +// MaxPoolV2DataFormat sets the optional data_format attribute to value. +// +// value: Specify the data format of the input and output data. With the +// default format "NHWC", the data is stored in the order of: +// +// [batch, in_height, in_width, in_channels]. +// +// Alternatively, the format could be "NCHW", the data storage order of: +// +// [batch, in_channels, in_height, in_width]. +// +// If not specified, defaults to "NHWC" +func MaxPoolV2DataFormat(value string) MaxPoolV2Attr { + return func(m optionalAttr) { + m["data_format"] = value + } +} + +// Performs max pooling on the input. +// +// Arguments: +// +// input: 4-D input to pool over. +// ksize: The size of the window for each dimension of the input tensor. +// strides: The stride of the sliding window for each dimension of the +// +// input tensor. +// +// padding: The type of padding algorithm to use. +// +// Returns The max pooled output tensor. +func MaxPoolV2(scope *Scope, input tf.Output, ksize tf.Output, strides tf.Output, padding string, optional ...MaxPoolV2Attr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"padding": padding} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "MaxPoolV2", + Input: []tf.Input{ + input, ksize, strides, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// UnstageAttr is an optional argument to Unstage. +type UnstageAttr func(optionalAttr) + +// UnstageCapacity sets the optional capacity attribute to value. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func UnstageCapacity(value int64) UnstageAttr { + return func(m optionalAttr) { + m["capacity"] = value + } +} + +// UnstageMemoryLimit sets the optional memory_limit attribute to value. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func UnstageMemoryLimit(value int64) UnstageAttr { + return func(m optionalAttr) { + m["memory_limit"] = value + } +} + +// UnstageContainer sets the optional container attribute to value. +// If not specified, defaults to "" +func UnstageContainer(value string) UnstageAttr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// UnstageSharedName sets the optional shared_name attribute to value. +// If not specified, defaults to "" +func UnstageSharedName(value string) UnstageAttr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// Op is similar to a lightweight Dequeue. +// +// The basic functionality is similar to dequeue with many fewer +// capabilities and options. This Op is optimized for performance. +func Unstage(scope *Scope, dtypes []tf.DataType, optional ...UnstageAttr) (values []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtypes": dtypes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Unstage", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if values, idx, err = makeOutputList(op, idx, "values"); err != nil { + scope.UpdateErr("Unstage", err) + return + } + return values +} + +// SdcaOptimizerV2Attr is an optional argument to SdcaOptimizerV2. +type SdcaOptimizerV2Attr func(optionalAttr) + +// SdcaOptimizerV2Adaptive sets the optional adaptive attribute to value. +// +// value: Whether to use Adaptive SDCA for the inner loop. +// If not specified, defaults to true +func SdcaOptimizerV2Adaptive(value bool) SdcaOptimizerV2Attr { + return func(m optionalAttr) { + m["adaptive"] = value + } +} + +// Distributed version of Stochastic Dual Coordinate Ascent (SDCA) optimizer for +// +// linear models with L1 + L2 regularization. As global optimization objective is +// strongly-convex, the optimizer optimizes the dual objective at each step. The +// optimizer applies each update one example at a time. Examples are sampled +// uniformly, and the optimizer is learning rate free and enjoys linear convergence +// rate. +// +// [Proximal Stochastic Dual Coordinate Ascent](http://arxiv.org/pdf/1211.2717v1.pdf).
+// Shai Shalev-Shwartz, Tong Zhang. 2012 +// +// $$Loss Objective = \sum f_{i} (wx_{i}) + (l2 / 2) * |w|^2 + l1 * |w|$$ +// +// [Adding vs. Averaging in Distributed Primal-Dual Optimization](http://arxiv.org/abs/1502.03508).
+// Chenxin Ma, Virginia Smith, Martin Jaggi, Michael I. Jordan, +// Peter Richtarik, Martin Takac. 2015 +// +// [Stochastic Dual Coordinate Ascent with Adaptive Probabilities](https://arxiv.org/abs/1502.08053).
+// Dominik Csiba, Zheng Qu, Peter Richtarik. 2015 +// +// Arguments: +// +// sparse_example_indices: a list of vectors which contain example indices. +// sparse_feature_indices: a list of vectors which contain feature indices. +// sparse_feature_values: a list of vectors which contains feature value +// +// associated with each feature group. +// +// dense_features: a list of matrices which contains the dense feature values. +// example_weights: a vector which contains the weight associated with each +// +// example. +// +// example_labels: a vector which contains the label/target associated with each +// +// example. +// +// sparse_indices: a list of vectors where each value is the indices which has +// +// corresponding weights in sparse_weights. This field maybe omitted for the +// dense approach. +// +// sparse_weights: a list of vectors where each value is the weight associated with +// +// a sparse feature group. +// +// dense_weights: a list of vectors where the values are the weights associated +// +// with a dense feature group. +// +// example_state_data: a list of vectors containing the example state data. +// loss_type: Type of the primal loss. Currently SdcaSolver supports logistic, +// +// squared and hinge losses. +// +// l1: Symmetric l1 regularization strength. +// l2: Symmetric l2 regularization strength. +// num_loss_partitions: Number of partitions of the global loss function. +// num_inner_iterations: Number of iterations per mini-batch. +// +// Returns: +// +// out_example_state_data: a list of vectors containing the updated example state +// +// data. +// +// out_delta_sparse_weights: a list of vectors where each value is the delta +// +// weights associated with a sparse feature group. +// +// out_delta_dense_weights: a list of vectors where the values are the delta +// +// weights associated with a dense feature group. +func SdcaOptimizerV2(scope *Scope, sparse_example_indices []tf.Output, sparse_feature_indices []tf.Output, sparse_feature_values []tf.Output, dense_features []tf.Output, example_weights tf.Output, example_labels tf.Output, sparse_indices []tf.Output, sparse_weights []tf.Output, dense_weights []tf.Output, example_state_data tf.Output, loss_type string, l1 float32, l2 float32, num_loss_partitions int64, num_inner_iterations int64, optional ...SdcaOptimizerV2Attr) (out_example_state_data tf.Output, out_delta_sparse_weights []tf.Output, out_delta_dense_weights []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"loss_type": loss_type, "l1": l1, "l2": l2, "num_loss_partitions": num_loss_partitions, "num_inner_iterations": num_inner_iterations} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "SdcaOptimizerV2", + Input: []tf.Input{ + tf.OutputList(sparse_example_indices), tf.OutputList(sparse_feature_indices), tf.OutputList(sparse_feature_values), tf.OutputList(dense_features), example_weights, example_labels, tf.OutputList(sparse_indices), tf.OutputList(sparse_weights), tf.OutputList(dense_weights), example_state_data, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + out_example_state_data = op.Output(idx) + if out_delta_sparse_weights, idx, err = makeOutputList(op, idx, "out_delta_sparse_weights"); err != nil { + scope.UpdateErr("SdcaOptimizerV2", err) + return + } + if out_delta_dense_weights, idx, err = makeOutputList(op, idx, "out_delta_dense_weights"); err != nil { + scope.UpdateErr("SdcaOptimizerV2", err) + return + } + return out_example_state_data, out_delta_sparse_weights, out_delta_dense_weights +} + +// MatrixSetDiagV3Attr is an optional argument to MatrixSetDiagV3. +type MatrixSetDiagV3Attr func(optionalAttr) + +// MatrixSetDiagV3Align sets the optional align attribute to value. +// +// value: Some diagonals are shorter than `max_diag_len` and need to be padded. `align` is +// a string specifying how superdiagonals and subdiagonals should be aligned, +// respectively. There are four possible alignments: "RIGHT_LEFT" (default), +// "LEFT_RIGHT", "LEFT_LEFT", and "RIGHT_RIGHT". "RIGHT_LEFT" aligns superdiagonals +// to the right (left-pads the row) and subdiagonals to the left (right-pads the +// row). It is the packing format LAPACK uses. cuSPARSE uses "LEFT_RIGHT", which is +// the opposite alignment. +// If not specified, defaults to "RIGHT_LEFT" +func MatrixSetDiagV3Align(value string) MatrixSetDiagV3Attr { + return func(m optionalAttr) { + m["align"] = value + } +} + +// Returns a batched matrix tensor with new batched diagonal values. +// +// Given `input` and `diagonal`, this operation returns a tensor with the +// same shape and values as `input`, except for the specified diagonals of the +// innermost matrices. These will be overwritten by the values in `diagonal`. +// +// `input` has `r+1` dimensions `[I, J, ..., L, M, N]`. When `k` is scalar or +// `k[0] == k[1]`, `diagonal` has `r` dimensions `[I, J, ..., L, max_diag_len]`. +// Otherwise, it has `r+1` dimensions `[I, J, ..., L, num_diags, max_diag_len]`. +// `num_diags` is the number of diagonals, `num_diags = k[1] - k[0] + 1`. +// `max_diag_len` is the longest diagonal in the range `[k[0], k[1]]`, +// `max_diag_len = min(M + min(k[1], 0), N + min(-k[0], 0))` +// +// The output is a tensor of rank `k+1` with dimensions `[I, J, ..., L, M, N]`. +// If `k` is scalar or `k[0] == k[1]`: +// +// ``` +// output[i, j, ..., l, m, n] +// +// = diagonal[i, j, ..., l, n-max(k[1], 0)] ; if n - m == k[1] +// input[i, j, ..., l, m, n] ; otherwise +// +// ``` +// +// Otherwise, +// +// ``` +// output[i, j, ..., l, m, n] +// +// = diagonal[i, j, ..., l, diag_index, index_in_diag] ; if k[0] <= d <= k[1] +// input[i, j, ..., l, m, n] ; otherwise +// +// ``` +// where `d = n - m`, `diag_index = k[1] - d`, and +// `index_in_diag = n - max(d, 0) + offset`. +// +// `offset` is zero except when the alignment of the diagonal is to the right. +// ``` +// offset = max_diag_len - diag_len(d) ; if (`align` in {RIGHT_LEFT, RIGHT_RIGHT} +// +// and `d >= 0`) or +// (`align` in {LEFT_RIGHT, RIGHT_RIGHT} +// and `d <= 0`) +// 0 ; otherwise +// +// ``` +// where `diag_len(d) = min(cols - max(d, 0), rows + min(d, 0))`. +// +// For example: +// +// ``` +// # The main diagonal. +// input = np.array([[[7, 7, 7, 7], # Input shape: (2, 3, 4) +// +// [7, 7, 7, 7], +// [7, 7, 7, 7]], +// [[7, 7, 7, 7], +// [7, 7, 7, 7], +// [7, 7, 7, 7]]]) +// +// diagonal = np.array([[1, 2, 3], # Diagonal shape: (2, 3) +// +// [4, 5, 6]]) +// +// tf.matrix_set_diag(input, diagonal) +// +// ==> [[[1, 7, 7, 7], # Output shape: (2, 3, 4) +// [7, 2, 7, 7], +// [7, 7, 3, 7]], +// [[4, 7, 7, 7], +// [7, 5, 7, 7], +// [7, 7, 6, 7]]] +// +// # A superdiagonal (per batch). +// tf.matrix_set_diag(input, diagonal, k = 1) +// +// ==> [[[7, 1, 7, 7], # Output shape: (2, 3, 4) +// [7, 7, 2, 7], +// [7, 7, 7, 3]], +// [[7, 4, 7, 7], +// [7, 7, 5, 7], +// [7, 7, 7, 6]]] +// +// # A band of diagonals. +// diagonals = np.array([[[0, 9, 1], # Diagonal shape: (2, 4, 3) +// +// [6, 5, 8], +// [1, 2, 3], +// [4, 5, 0]], +// [[0, 1, 2], +// [5, 6, 4], +// [6, 1, 2], +// [3, 4, 0]]]) +// +// tf.matrix_set_diag(input, diagonals, k = (-1, 2)) +// +// ==> [[[1, 6, 9, 7], # Output shape: (2, 3, 4) +// [4, 2, 5, 1], +// [7, 5, 3, 8]], +// [[6, 5, 1, 7], +// [3, 1, 6, 2], +// [7, 4, 2, 4]]] +// +// # LEFT_RIGHT alignment. +// diagonals = np.array([[[9, 1, 0], # Diagonal shape: (2, 4, 3) +// +// [6, 5, 8], +// [1, 2, 3], +// [0, 4, 5]], +// [[1, 2, 0], +// [5, 6, 4], +// [6, 1, 2], +// [0, 3, 4]]]) +// +// tf.matrix_set_diag(input, diagonals, k = (-1, 2), align="LEFT_RIGHT") +// +// ==> [[[1, 6, 9, 7], # Output shape: (2, 3, 4) +// [4, 2, 5, 1], +// [7, 5, 3, 8]], +// [[6, 5, 1, 7], +// [3, 1, 6, 2], +// [7, 4, 2, 4]]] +// +// ``` +// +// Arguments: +// +// input: Rank `r+1`, where `r >= 1`. +// diagonal: Rank `r` when `k` is an integer or `k[0] == k[1]`. Otherwise, it has rank `r+1`. +// +// `k >= 1`. +// +// k: Diagonal offset(s). Positive value means superdiagonal, 0 refers to the main +// +// diagonal, and negative value means subdiagonals. `k` can be a single integer +// (for a single diagonal) or a pair of integers specifying the low and high ends +// of a matrix band. `k[0]` must not be larger than `k[1]`. +// +// Returns Rank `r+1`, with `output.shape = input.shape`. +func MatrixSetDiagV3(scope *Scope, input tf.Output, diagonal tf.Output, k tf.Output, optional ...MatrixSetDiagV3Attr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "MatrixSetDiagV3", + Input: []tf.Input{ + input, diagonal, k, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// A container for an iterator resource. +// +// Returns A handle to the iterator that can be passed to a "MakeIterator" +// or "IteratorGetNext" op. +func Iterator(scope *Scope, shared_name string, container string, output_types []tf.DataType, output_shapes []tf.Shape) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"shared_name": shared_name, "container": container, "output_types": output_types, "output_shapes": output_shapes} + opspec := tf.OpSpec{ + Type: "Iterator", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Multiplies sparse updates into the variable referenced by `resource`. +// +// This operation computes +// +// # Scalar indices +// ref[indices, ...] *= updates[...] +// +// # Vector indices (for each i) +// ref[indices[i], ...] *= updates[i, ...] +// +// # High rank indices (for each i, ..., j) +// ref[indices[i, ..., j], ...] *= updates[i, ..., j, ...] +// +// Duplicate entries are handled correctly: if multiple `indices` reference +// the same location, their contributions multiply. +// +// Requires `updates.shape = indices.shape + ref.shape[1:]` or `updates.shape = []`. +// +//
+// +//
+// +// Arguments: +// +// resource: Should be from a `Variable` node. +// indices: A tensor of indices into the first dimension of `ref`. +// updates: A tensor of updated values to add to `ref`. +// +// Returns the created operation. +func ResourceScatterMul(scope *Scope, resource tf.Output, indices tf.Output, updates tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "ResourceScatterMul", + Input: []tf.Input{ + resource, indices, updates, + }, + } + return scope.AddOperation(opspec) +} + +// QueueEnqueueManyV2Attr is an optional argument to QueueEnqueueManyV2. +type QueueEnqueueManyV2Attr func(optionalAttr) + +// QueueEnqueueManyV2TimeoutMs sets the optional timeout_ms attribute to value. +// +// value: If the queue is too full, this operation will block for up +// to timeout_ms milliseconds. +// Note: This option is not supported yet. +// If not specified, defaults to -1 +func QueueEnqueueManyV2TimeoutMs(value int64) QueueEnqueueManyV2Attr { + return func(m optionalAttr) { + m["timeout_ms"] = value + } +} + +// Enqueues zero or more tuples of one or more tensors in the given queue. +// +// This operation slices each component tensor along the 0th dimension to +// make multiple queue elements. All of the tuple components must have the +// same size in the 0th dimension. +// +// The components input has k elements, which correspond to the components of +// tuples stored in the given queue. +// +// N.B. If the queue is full, this operation will block until the given +// elements have been enqueued (or 'timeout_ms' elapses, if specified). +// +// Arguments: +// +// handle: The handle to a queue. +// components: One or more tensors from which the enqueued tensors should +// +// be taken. +// +// Returns the created operation. +func QueueEnqueueManyV2(scope *Scope, handle tf.Output, components []tf.Output, optional ...QueueEnqueueManyV2Attr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "QueueEnqueueManyV2", + Input: []tf.Input{ + handle, tf.OutputList(components), + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// RecvAttr is an optional argument to Recv. +type RecvAttr func(optionalAttr) + +// RecvClientTerminated sets the optional client_terminated attribute to value. +// +// value: If set to true, this indicates that the node was added +// to the graph as a result of a client-side feed or fetch of Tensor data, +// in which case the corresponding send or recv is expected to be managed +// locally by the caller. +// If not specified, defaults to false +func RecvClientTerminated(value bool) RecvAttr { + return func(m optionalAttr) { + m["client_terminated"] = value + } +} + +// Receives the named tensor from send_device on recv_device. +// +// Arguments: +// +// tensor_name: The name of the tensor to receive. +// send_device: The name of the device sending the tensor. +// send_device_incarnation: The current incarnation of send_device. +// recv_device: The name of the device receiving the tensor. +// +// Returns The tensor to receive. +func Recv(scope *Scope, tensor_type tf.DataType, tensor_name string, send_device string, send_device_incarnation int64, recv_device string, optional ...RecvAttr) (tensor tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"tensor_type": tensor_type, "tensor_name": tensor_name, "send_device": send_device, "send_device_incarnation": send_device_incarnation, "recv_device": recv_device} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Recv", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Converts a SparseTensor to a (possibly batched) CSRSparseMatrix. +// +// Arguments: +// +// indices: SparseTensor indices. +// values: SparseTensor values. +// dense_shape: SparseTensor dense shape. +// +// Returns A (possibly batched) CSRSparseMatrix. +func SparseTensorToCSRSparseMatrix(scope *Scope, indices tf.Output, values tf.Output, dense_shape tf.Output) (sparse_matrix tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "SparseTensorToCSRSparseMatrix", + Input: []tf.Input{ + indices, values, dense_shape, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// TensorArrayV3Attr is an optional argument to TensorArrayV3. +type TensorArrayV3Attr func(optionalAttr) + +// TensorArrayV3ElementShape sets the optional element_shape attribute to value. +// +// value: The expected shape of an element, if known. Used to +// validate the shapes of TensorArray elements. If this shape is not +// fully specified, gathering zero-size TensorArrays is an error. +// If not specified, defaults to +func TensorArrayV3ElementShape(value tf.Shape) TensorArrayV3Attr { + return func(m optionalAttr) { + m["element_shape"] = value + } +} + +// TensorArrayV3DynamicSize sets the optional dynamic_size attribute to value. +// +// value: A boolean that determines whether writes to the TensorArray +// are allowed to grow the size. By default, this is not allowed. +// If not specified, defaults to false +func TensorArrayV3DynamicSize(value bool) TensorArrayV3Attr { + return func(m optionalAttr) { + m["dynamic_size"] = value + } +} + +// TensorArrayV3ClearAfterRead sets the optional clear_after_read attribute to value. +// +// value: If true (default), Tensors in the TensorArray are cleared +// after being read. This disables multiple read semantics but allows early +// release of memory. +// If not specified, defaults to true +func TensorArrayV3ClearAfterRead(value bool) TensorArrayV3Attr { + return func(m optionalAttr) { + m["clear_after_read"] = value + } +} + +// TensorArrayV3IdenticalElementShapes sets the optional identical_element_shapes attribute to value. +// +// value: If true (default is false), then all +// elements in the TensorArray will be expected to have have identical shapes. +// This allows certain behaviors, like dynamically checking for +// consistent shapes on write, and being able to fill in properly +// shaped zero tensors on stack -- even if the element_shape attribute +// is not fully defined. +// If not specified, defaults to false +func TensorArrayV3IdenticalElementShapes(value bool) TensorArrayV3Attr { + return func(m optionalAttr) { + m["identical_element_shapes"] = value + } +} + +// TensorArrayV3TensorArrayName sets the optional tensor_array_name attribute to value. +// +// value: Overrides the name used for the temporary tensor_array +// resource. Default value is the name of the 'TensorArray' op (which +// is guaranteed unique). +// If not specified, defaults to "" +func TensorArrayV3TensorArrayName(value string) TensorArrayV3Attr { + return func(m optionalAttr) { + m["tensor_array_name"] = value + } +} + +// An array of Tensors of given size. +// +// Write data via Write and read via Read or Pack. +// +// Arguments: +// +// size: The size of the array. +// dtype: The type of the elements on the tensor_array. +// +// Returns: +// +// handle: The handle to the TensorArray. +// flow: A scalar used to control gradient flow. +func TensorArrayV3(scope *Scope, size tf.Output, dtype tf.DataType, optional ...TensorArrayV3Attr) (handle tf.Output, flow tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtype": dtype} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "TensorArrayV3", + Input: []tf.Input{ + size, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// Conv2DBackpropInputAttr is an optional argument to Conv2DBackpropInput. +type Conv2DBackpropInputAttr func(optionalAttr) + +// Conv2DBackpropInputUseCudnnOnGpu sets the optional use_cudnn_on_gpu attribute to value. +// If not specified, defaults to true +func Conv2DBackpropInputUseCudnnOnGpu(value bool) Conv2DBackpropInputAttr { + return func(m optionalAttr) { + m["use_cudnn_on_gpu"] = value + } +} + +// Conv2DBackpropInputExplicitPaddings sets the optional explicit_paddings attribute to value. +// +// value: If `padding` is `"EXPLICIT"`, the list of explicit padding amounts. For the ith +// dimension, the amount of padding inserted before and after the dimension is +// `explicit_paddings[2 * i]` and `explicit_paddings[2 * i + 1]`, respectively. If +// `padding` is not `"EXPLICIT"`, `explicit_paddings` must be empty. +// If not specified, defaults to <> +func Conv2DBackpropInputExplicitPaddings(value []int64) Conv2DBackpropInputAttr { + return func(m optionalAttr) { + m["explicit_paddings"] = value + } +} + +// Conv2DBackpropInputDataFormat sets the optional data_format attribute to value. +// +// value: Specify the data format of the input and output data. With the +// default format "NHWC", the data is stored in the order of: +// +// [batch, in_height, in_width, in_channels]. +// +// Alternatively, the format could be "NCHW", the data storage order of: +// +// [batch, in_channels, in_height, in_width]. +// +// If not specified, defaults to "NHWC" +func Conv2DBackpropInputDataFormat(value string) Conv2DBackpropInputAttr { + return func(m optionalAttr) { + m["data_format"] = value + } +} + +// Conv2DBackpropInputDilations sets the optional dilations attribute to value. +// +// value: 1-D tensor of length 4. The dilation factor for each dimension of +// `input`. If set to k > 1, there will be k-1 skipped cells between each filter +// element on that dimension. The dimension order is determined by the value of +// `data_format`, see above for details. Dilations in the batch and depth +// dimensions must be 1. +// If not specified, defaults to +func Conv2DBackpropInputDilations(value []int64) Conv2DBackpropInputAttr { + return func(m optionalAttr) { + m["dilations"] = value + } +} + +// Computes the gradients of convolution with respect to the input. +// +// Arguments: +// +// input_sizes: An integer vector representing the shape of `input`, +// +// where `input` is a 4-D `[batch, height, width, channels]` tensor. +// +// filter: 4-D with shape +// +// `[filter_height, filter_width, in_channels, out_channels]`. +// +// out_backprop: 4-D with shape `[batch, out_height, out_width, out_channels]`. +// +// Gradients w.r.t. the output of the convolution. +// +// strides: The stride of the sliding window for each dimension of the input +// +// of the convolution. Must be in the same order as the dimension specified with +// format. +// +// padding: The type of padding algorithm to use. +// +// Returns 4-D with shape `[batch, in_height, in_width, in_channels]`. Gradient +// w.r.t. the input of the convolution. +func Conv2DBackpropInput(scope *Scope, input_sizes tf.Output, filter tf.Output, out_backprop tf.Output, strides []int64, padding string, optional ...Conv2DBackpropInputAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"strides": strides, "padding": padding} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Conv2DBackpropInput", + Input: []tf.Input{ + input_sizes, filter, out_backprop, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// DecodeImageAttr is an optional argument to DecodeImage. +type DecodeImageAttr func(optionalAttr) + +// DecodeImageChannels sets the optional channels attribute to value. +// +// value: Number of color channels for the decoded image. +// If not specified, defaults to 0 +func DecodeImageChannels(value int64) DecodeImageAttr { + return func(m optionalAttr) { + m["channels"] = value + } +} + +// DecodeImageDtype sets the optional dtype attribute to value. +// +// value: The desired DType of the returned Tensor. +// If not specified, defaults to DT_UINT8 +func DecodeImageDtype(value tf.DataType) DecodeImageAttr { + return func(m optionalAttr) { + m["dtype"] = value + } +} + +// DecodeImageExpandAnimations sets the optional expand_animations attribute to value. +// +// value: Controls the output shape of the returned op. If True, the returned op will +// produce a 3-D tensor for PNG, JPEG, and BMP files; and a 4-D tensor for all +// GIFs, whether animated or not. If, False, the returned op will produce a 3-D +// tensor for all file types and will truncate animated GIFs to the first frame. +// If not specified, defaults to true +func DecodeImageExpandAnimations(value bool) DecodeImageAttr { + return func(m optionalAttr) { + m["expand_animations"] = value + } +} + +// Function for decode_bmp, decode_gif, decode_jpeg, and decode_png. +// +// Detects whether an image is a BMP, GIF, JPEG, or PNG, and performs the +// appropriate operation to convert the input bytes string into a Tensor of type +// dtype. +// +// *NOTE*: decode_gif returns a 4-D array [num_frames, height, width, 3], as +// opposed to decode_bmp, decode_jpeg and decode_png, which return 3-D arrays +// [height, width, num_channels]. Make sure to take this into account when +// constructing your graph if you are intermixing GIF files with BMP, JPEG, and/or +// PNG files. Alternately, set the expand_animations argument of this function to +// False, in which case the op will return 3-dimensional tensors and will truncate +// animated GIF files to the first frame. +// +// *NOTE*: If the first frame of an animated GIF does not occupy the entire +// canvas (maximum frame width x maximum frame height), then it fills the +// unoccupied areas (in the first frame) with zeros (black). For frames after the +// first frame that does not occupy the entire canvas, it uses the previous +// frame to fill the unoccupied areas. +// +// Arguments: +// +// contents: 0-D. The encoded image bytes. +// +// Returns 3-D with shape `[height, width, channels]` or 4-D with shape +// `[frame, height, width, channels]`.. +func DecodeImage(scope *Scope, contents tf.Output, optional ...DecodeImageAttr) (image tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "DecodeImage", + Input: []tf.Input{ + contents, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Shuts down a running distributed TPU system. +// +// The op returns an error if no system is running. +// +// Returns the created operation. +func ShutdownDistributedTPU(scope *Scope) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "ShutdownDistributedTPU", + } + return scope.AddOperation(opspec) +} + +// An op that receives embedding activations on the TPU. +// +// The TPU system performs the embedding lookups and aggregations specified by +// the arguments to TPUEmbeddingEnqueue(Integer/Sparse/SparseTensor)Batch. The +// results of these aggregations are visible to the Tensorflow Graph as the +// outputs of a RecvTPUEmbeddingActivations op. This op returns a list containing +// one Tensor of activations per table specified in the model. There can be at +// most one RecvTPUEmbeddingActivations op in the TPU graph. +// +// Arguments: +// +// num_outputs: The number of output activation tensors, equal to the number of +// +// embedding tables in the model. +// +// config: Serialized TPUEmbeddingConfiguration proto. +// +// Returns A TensorList of embedding activations containing one Tensor per +// embedding table in the model. +func RecvTPUEmbeddingActivations(scope *Scope, num_outputs int64, config string) (outputs []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_outputs": num_outputs, "config": config} + opspec := tf.OpSpec{ + Type: "RecvTPUEmbeddingActivations", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if outputs, idx, err = makeOutputList(op, idx, "outputs"); err != nil { + scope.UpdateErr("RecvTPUEmbeddingActivations", err) + return + } + return outputs +} + +// Wraps the XLA DotGeneral operator, documented at +// +// https://www.tensorflow.org/performance/xla/operation_semantics#dotgeneral +// +// . +// +// Arguments: +// +// lhs: the LHS tensor +// rhs: the RHS tensor +// dimension_numbers: a serialized xla::DotDimensionNumbers proto. +// precision_config: a serialized xla::PrecisionConfig proto. +// preferred_element_type: The type of the tensor. +func XlaDotV2(scope *Scope, lhs tf.Output, rhs tf.Output, dimension_numbers string, precision_config string, preferred_element_type tf.DataType) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dimension_numbers": dimension_numbers, "precision_config": precision_config, "preferred_element_type": preferred_element_type} + opspec := tf.OpSpec{ + Type: "XlaDotV2", + Input: []tf.Input{ + lhs, rhs, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes the Approximate Minimum Degree (AMD) ordering of `input`. +// +// Computes the Approximate Minimum Degree (AMD) ordering for a sparse matrix. +// +// The returned permutation may be used to permute the rows and columns of the +// given sparse matrix. This typically results in permuted sparse matrix's sparse +// Cholesky (or other decompositions) in having fewer zero fill-in compared to +// decomposition of the original matrix. +// +// The input sparse matrix may have rank 2 or rank 3. The output Tensor, +// representing would then have rank 1 or 2 respectively, with the same batch +// shape as the input. +// +// Each component of the input sparse matrix must represent a square symmetric +// matrix; only the lower triangular part of the matrix is read. The values of the +// sparse matrix does not affect the returned permutation, only the sparsity +// pattern of the sparse matrix is used. Hence, a single AMD ordering may be +// reused for the Cholesky decompositions of sparse matrices with the same sparsity +// pattern but with possibly different values. +// +// Each batch component of the output permutation represents a permutation of `N` +// elements, where the input sparse matrix components each have `N` rows. That is, +// the component contains each of the integers `{0, .. N-1}` exactly once. The +// `i`th element represents the row index that the `i`th row maps to. +// +// Usage example: +// +// ```python +// +// from tensorflow.python.ops.linalg.sparse import sparse_csr_matrix_ops +// +// a_indices = np.array([[0, 0], [1, 1], [2, 1], [2, 2], [3, 3]]) +// a_values = np.array([1.0, 2.0, 1.0, 3.0, 4.0], np.float32) +// a_dense_shape = [4, 4] +// +// with tf.Session() as sess: +// # Define (COO format) SparseTensor over Numpy array. +// a_st = tf.sparse.SparseTensor(a_indices, a_values, a_dense_shape) +// +// # Convert SparseTensors to CSR SparseMatrix. +// a_sm = sparse_csr_matrix_ops.sparse_tensor_to_csr_sparse_matrix( +// a_st.indices, a_st.values, a_st.dense_shape) +// +// # Obtain the AMD Ordering for the CSR SparseMatrix. +// ordering_amd = sparse_csr_matrix_ops.sparse_matrix_ordering_amd(sparse_matrix) +// +// ordering_amd_value = sess.run(ordering_amd) +// +// ``` +// +// `ordering_amd_value` stores the AMD ordering: `[1 2 3 0]`. +// +// input: A `CSRSparseMatrix`. +// +// Arguments: +// +// input: A `CSRSparseMatrix`. +// +// Returns The Approximate Minimum Degree (AMD) ordering of `input`. +func SparseMatrixOrderingAMD(scope *Scope, input tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "SparseMatrixOrderingAMD", + Input: []tf.Input{ + input, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ComplexAbsAttr is an optional argument to ComplexAbs. +type ComplexAbsAttr func(optionalAttr) + +// ComplexAbsTout sets the optional Tout attribute to value. +// If not specified, defaults to DT_FLOAT +func ComplexAbsTout(value tf.DataType) ComplexAbsAttr { + return func(m optionalAttr) { + m["Tout"] = value + } +} + +// Computes the complex absolute value of a tensor. +// +// Given a tensor `x` of complex numbers, this operation returns a tensor of type +// `float` or `double` that is the absolute value of each element in `x`. All +// elements in `x` must be complex numbers of the form \\(a + bj\\). The absolute +// value is computed as \\( \sqrt{a^2 + b^2}\\). +func ComplexAbs(scope *Scope, x tf.Output, optional ...ComplexAbsAttr) (y tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ComplexAbs", + Input: []tf.Input{ + x, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Retrieve multiple values from the computation outfeed. Device ordinal is a +// tensor allowing dynamic outfeed. +// +// This operation will block indefinitely until data is available. Output `i` +// corresponds to XLA tuple element `i`. +// +// Arguments: +// +// device_ordinal: An int scalar tensor, representing the TPU device to use. This should be -1 when +// +// the Op is running on a TPU device, and >= 0 when the Op is running on the CPU +// device. +// +// dtypes: The element types of each element in `outputs`. +// shapes: The shapes of each tensor in `outputs`. +// +// Returns A list of tensors that will be read from the outfeed. +func OutfeedDequeueTupleV2(scope *Scope, device_ordinal tf.Output, dtypes []tf.DataType, shapes []tf.Shape) (outputs []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtypes": dtypes, "shapes": shapes} + opspec := tf.OpSpec{ + Type: "OutfeedDequeueTupleV2", + Input: []tf.Input{ + device_ordinal, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if outputs, idx, err = makeOutputList(op, idx, "outputs"); err != nil { + scope.UpdateErr("OutfeedDequeueTupleV2", err) + return + } + return outputs +} + +// Replaces the contents of the table with the specified keys and values. +// +// The tensor `keys` must be of the same type as the keys of the table. +// The tensor `values` must be of the type of the table values. +// +// Arguments: +// +// table_handle: Handle to the table. +// keys: Any shape. Keys to look up. +// values: Values to associate with keys. +// +// Returns the created operation. +func LookupTableImportV2(scope *Scope, table_handle tf.Output, keys tf.Output, values tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "LookupTableImportV2", + Input: []tf.Input{ + table_handle, keys, values, + }, + } + return scope.AddOperation(opspec) +} + +// LoadAndRemapMatrixAttr is an optional argument to LoadAndRemapMatrix. +type LoadAndRemapMatrixAttr func(optionalAttr) + +// LoadAndRemapMatrixMaxRowsInMemory sets the optional max_rows_in_memory attribute to value. +// +// value: The maximum number of rows to load from the checkpoint at +// once. If less than or equal to 0, the entire matrix will be loaded into +// memory. Setting this arg trades increased disk reads for lower memory usage. +// If not specified, defaults to -1 +func LoadAndRemapMatrixMaxRowsInMemory(value int64) LoadAndRemapMatrixAttr { + return func(m optionalAttr) { + m["max_rows_in_memory"] = value + } +} + +// Loads a 2-D (matrix) `Tensor` with name `old_tensor_name` from the checkpoint +// +// at `ckpt_path` and potentially reorders its rows and columns using the +// specified remappings. +// +// Most users should use one of the wrapper initializers (such as +// `tf.contrib.framework.load_and_remap_matrix_initializer`) instead of this +// function directly. +// +// The remappings are 1-D tensors with the following properties: +// +// - `row_remapping` must have exactly `num_rows` entries. Row `i` of the output +// matrix will be initialized from the row corresponding to index +// `row_remapping[i]` in the old `Tensor` from the checkpoint. +// - `col_remapping` must have either 0 entries (indicating that no column +// reordering is needed) or `num_cols` entries. If specified, column `j` of the +// output matrix will be initialized from the column corresponding to index +// `col_remapping[j]` in the old `Tensor` from the checkpoint. +// - A value of -1 in either of the remappings signifies a "missing" entry. In that +// case, values from the `initializing_values` tensor will be used to fill that +// missing row or column. If `row_remapping` has `r` missing entries and +// `col_remapping` has `c` missing entries, then the following condition must be +// true: +// +// `(r * num_cols) + (c * num_rows) - (r * c) == len(initializing_values)` +// +// The remapping tensors can be generated using the GenerateVocabRemapping op. +// +// As an example, with row_remapping = [1, 0, -1], col_remapping = [0, 2, -1], +// initializing_values = [0.5, -0.5, 0.25, -0.25, 42], and w(i, j) representing +// the value from row i, column j of the old tensor in the checkpoint, the output +// matrix will look like the following: +// +// [[w(1, 0), w(1, 2), 0.5], +// +// [w(0, 0), w(0, 2), -0.5], +// [0.25, -0.25, 42]] +// +// Arguments: +// +// ckpt_path: Path to the TensorFlow checkpoint (version 2, `TensorBundle`) from +// +// which the old matrix `Tensor` will be loaded. +// +// old_tensor_name: Name of the 2-D `Tensor` to load from checkpoint. +// row_remapping: An int `Tensor` of row remappings (generally created by +// +// `generate_vocab_remapping`). Even if no row remapping is needed, this must +// still be an index-valued Tensor (e.g. [0, 1, 2, ...]), or a shifted +// index-valued `Tensor` (e.g. [8, 9, 10, ...], for partitioned `Variables`). +// +// col_remapping: An int `Tensor` of column remappings (generally created by +// +// `generate_vocab_remapping`). May be a size-0 `Tensor` if only row remapping +// is to be done (e.g. column ordering is the same). +// +// initializing_values: A float `Tensor` containing values to fill in for cells +// +// in the output matrix that are not loaded from the checkpoint. Length must be +// exactly the same as the number of missing / new cells. +// +// num_rows: Number of rows (length of the 1st dimension) in the output matrix. +// num_cols: Number of columns (length of the 2nd dimension) in the output matrix. +// +// Returns Output matrix containing existing values loaded from the +// checkpoint, and with any missing values filled in from initializing_values. +func LoadAndRemapMatrix(scope *Scope, ckpt_path tf.Output, old_tensor_name tf.Output, row_remapping tf.Output, col_remapping tf.Output, initializing_values tf.Output, num_rows int64, num_cols int64, optional ...LoadAndRemapMatrixAttr) (output_matrix tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_rows": num_rows, "num_cols": num_cols} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "LoadAndRemapMatrix", + Input: []tf.Input{ + ckpt_path, old_tensor_name, row_remapping, col_remapping, initializing_values, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ResourceApplyMomentumAttr is an optional argument to ResourceApplyMomentum. +type ResourceApplyMomentumAttr func(optionalAttr) + +// ResourceApplyMomentumUseLocking sets the optional use_locking attribute to value. +// +// value: If `True`, updating of the var and accum tensors will be protected +// by a lock; otherwise the behavior is undefined, but may exhibit less +// contention. +// If not specified, defaults to false +func ResourceApplyMomentumUseLocking(value bool) ResourceApplyMomentumAttr { + return func(m optionalAttr) { + m["use_locking"] = value + } +} + +// ResourceApplyMomentumUseNesterov sets the optional use_nesterov attribute to value. +// +// value: If `True`, the tensor passed to compute grad will be +// var - lr * momentum * accum, so in the end, the var you get is actually +// var - lr * momentum * accum. +// If not specified, defaults to false +func ResourceApplyMomentumUseNesterov(value bool) ResourceApplyMomentumAttr { + return func(m optionalAttr) { + m["use_nesterov"] = value + } +} + +// Update '*var' according to the momentum scheme. +// +// Set use_nesterov = True if you want to use Nesterov momentum. +// +// accum = accum * momentum + grad +// var -= lr * accum +// +// Arguments: +// +// var_: Should be from a Variable(). +// accum: Should be from a Variable(). +// lr: Scaling factor. Must be a scalar. +// grad: The gradient. +// momentum: Momentum. Must be a scalar. +// +// Returns the created operation. +func ResourceApplyMomentum(scope *Scope, var_ tf.Output, accum tf.Output, lr tf.Output, grad tf.Output, momentum tf.Output, optional ...ResourceApplyMomentumAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ResourceApplyMomentum", + Input: []tf.Input{ + var_, accum, lr, grad, momentum, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// DepthToSpaceAttr is an optional argument to DepthToSpace. +type DepthToSpaceAttr func(optionalAttr) + +// DepthToSpaceDataFormat sets the optional data_format attribute to value. +// If not specified, defaults to "NHWC" +func DepthToSpaceDataFormat(value string) DepthToSpaceAttr { + return func(m optionalAttr) { + m["data_format"] = value + } +} + +// DepthToSpace for tensors of type T. +// +// Rearranges data from depth into blocks of spatial data. +// This is the reverse transformation of SpaceToDepth. More specifically, +// this op outputs a copy of the input tensor where values from the `depth` +// dimension are moved in spatial blocks to the `height` and `width` dimensions. +// The attr `block_size` indicates the input block size and how the data is moved. +// +// - Chunks of data of size `block_size * block_size` from depth are rearranged +// into non-overlapping blocks of size `block_size x block_size` +// - The width the output tensor is `input_depth * block_size`, whereas the +// height is `input_height * block_size`. +// - The Y, X coordinates within each block of the output image are determined +// by the high order component of the input channel index. +// - The depth of the input tensor must be divisible by +// `block_size * block_size`. +// +// The `data_format` attr specifies the layout of the input and output tensors +// with the following options: +// +// "NHWC": `[ batch, height, width, channels ]` +// "NCHW": `[ batch, channels, height, width ]` +// "NCHW_VECT_C": +// `qint8 [ batch, channels / 4, height, width, 4 ]` +// +// It is useful to consider the operation as transforming a 6-D Tensor. +// e.g. for data_format = NHWC, +// +// Each element in the input tensor can be specified via 6 coordinates, +// ordered by decreasing memory layout significance as: +// n,iY,iX,bY,bX,oC (where n=batch index, iX, iY means X or Y coordinates +// within the input image, bX, bY means coordinates +// within the output block, oC means output channels). +// The output would be the input transposed to the following layout: +// n,iY,bY,iX,bX,oC +// +// This operation is useful for resizing the activations between convolutions +// (but keeping all data), e.g. instead of pooling. It is also useful for training +// purely convolutional models. +// +// For example, given an input of shape `[1, 1, 1, 4]`, data_format = "NHWC" and +// block_size = 2: +// +// ``` +// x = [[[[1, 2, 3, 4]]]] +// +// ``` +// +// This operation will output a tensor of shape `[1, 2, 2, 1]`: +// +// ``` +// +// [[[[1], [2]], +// [[3], [4]]]] +// +// ``` +// +// Here, the input has a batch of 1 and each batch element has shape `[1, 1, 4]`, +// the corresponding output will have 2x2 elements and will have a depth of +// 1 channel (1 = `4 / (block_size * block_size)`). +// The output element shape is `[2, 2, 1]`. +// +// For an input tensor with larger depth, here of shape `[1, 1, 1, 12]`, e.g. +// +// ``` +// x = [[[[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]]]] +// ``` +// +// This operation, for block size of 2, will return the following tensor of shape +// `[1, 2, 2, 3]` +// +// ``` +// +// [[[[1, 2, 3], [4, 5, 6]], +// [[7, 8, 9], [10, 11, 12]]]] +// +// ``` +// +// Similarly, for the following input of shape `[1 2 2 4]`, and a block size of 2: +// +// ``` +// x = [[[[1, 2, 3, 4], +// +// [5, 6, 7, 8]], +// [[9, 10, 11, 12], +// [13, 14, 15, 16]]]] +// +// ``` +// +// the operator will return the following tensor of shape `[1 4 4 1]`: +// +// ``` +// x = [[[ [1], [2], [5], [6]], +// +// [ [3], [4], [7], [8]], +// [ [9], [10], [13], [14]], +// [ [11], [12], [15], [16]]]] +// +// ``` +// +// Arguments: +// +// block_size: The size of the spatial block, same as in Space2Depth. +func DepthToSpace(scope *Scope, input tf.Output, block_size int64, optional ...DepthToSpaceAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"block_size": block_size} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "DepthToSpace", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ParseSequenceExampleV2Attr is an optional argument to ParseSequenceExampleV2. +type ParseSequenceExampleV2Attr func(optionalAttr) + +// ParseSequenceExampleV2NcontextSparse sets the optional Ncontext_sparse attribute to value. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func ParseSequenceExampleV2NcontextSparse(value int64) ParseSequenceExampleV2Attr { + return func(m optionalAttr) { + m["Ncontext_sparse"] = value + } +} + +// ParseSequenceExampleV2ContextSparseTypes sets the optional context_sparse_types attribute to value. +// +// value: A list of Ncontext_sparse types; the data types of data in +// each context Feature given in context_sparse_keys. +// Currently the ParseSingleSequenceExample supports DT_FLOAT (FloatList), +// DT_INT64 (Int64List), and DT_STRING (BytesList). +// If not specified, defaults to <> +// +// REQUIRES: len(value) >= 0 +func ParseSequenceExampleV2ContextSparseTypes(value []tf.DataType) ParseSequenceExampleV2Attr { + return func(m optionalAttr) { + m["context_sparse_types"] = value + } +} + +// ParseSequenceExampleV2ContextRaggedValueTypes sets the optional context_ragged_value_types attribute to value. +// +// value: RaggedTensor.value dtypes for the ragged context features. +// If not specified, defaults to <> +// +// REQUIRES: len(value) >= 0 +func ParseSequenceExampleV2ContextRaggedValueTypes(value []tf.DataType) ParseSequenceExampleV2Attr { + return func(m optionalAttr) { + m["context_ragged_value_types"] = value + } +} + +// ParseSequenceExampleV2ContextRaggedSplitTypes sets the optional context_ragged_split_types attribute to value. +// +// value: RaggedTensor.row_split dtypes for the ragged context features. +// If not specified, defaults to <> +// +// REQUIRES: len(value) >= 0 +func ParseSequenceExampleV2ContextRaggedSplitTypes(value []tf.DataType) ParseSequenceExampleV2Attr { + return func(m optionalAttr) { + m["context_ragged_split_types"] = value + } +} + +// ParseSequenceExampleV2ContextDenseShapes sets the optional context_dense_shapes attribute to value. +// +// value: A list of Ncontext_dense shapes; the shapes of data in +// each context Feature given in context_dense_keys. +// The number of elements in the Feature corresponding to context_dense_key[j] +// must always equal context_dense_shapes[j].NumEntries(). +// The shape of context_dense_values[j] will match context_dense_shapes[j]. +// If not specified, defaults to <> +// +// REQUIRES: len(value) >= 0 +func ParseSequenceExampleV2ContextDenseShapes(value []tf.Shape) ParseSequenceExampleV2Attr { + return func(m optionalAttr) { + m["context_dense_shapes"] = value + } +} + +// ParseSequenceExampleV2NfeatureListSparse sets the optional Nfeature_list_sparse attribute to value. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func ParseSequenceExampleV2NfeatureListSparse(value int64) ParseSequenceExampleV2Attr { + return func(m optionalAttr) { + m["Nfeature_list_sparse"] = value + } +} + +// ParseSequenceExampleV2NfeatureListDense sets the optional Nfeature_list_dense attribute to value. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func ParseSequenceExampleV2NfeatureListDense(value int64) ParseSequenceExampleV2Attr { + return func(m optionalAttr) { + m["Nfeature_list_dense"] = value + } +} + +// ParseSequenceExampleV2FeatureListDenseTypes sets the optional feature_list_dense_types attribute to value. +// If not specified, defaults to <> +// +// REQUIRES: len(value) >= 0 +func ParseSequenceExampleV2FeatureListDenseTypes(value []tf.DataType) ParseSequenceExampleV2Attr { + return func(m optionalAttr) { + m["feature_list_dense_types"] = value + } +} + +// ParseSequenceExampleV2FeatureListSparseTypes sets the optional feature_list_sparse_types attribute to value. +// +// value: A list of Nfeature_list_sparse types; the data types +// of data in each FeatureList given in feature_list_sparse_keys. +// Currently the ParseSingleSequenceExample supports DT_FLOAT (FloatList), +// DT_INT64 (Int64List), and DT_STRING (BytesList). +// If not specified, defaults to <> +// +// REQUIRES: len(value) >= 0 +func ParseSequenceExampleV2FeatureListSparseTypes(value []tf.DataType) ParseSequenceExampleV2Attr { + return func(m optionalAttr) { + m["feature_list_sparse_types"] = value + } +} + +// ParseSequenceExampleV2FeatureListRaggedValueTypes sets the optional feature_list_ragged_value_types attribute to value. +// +// value: RaggedTensor.value dtypes for the ragged FeatureList features. +// If not specified, defaults to <> +// +// REQUIRES: len(value) >= 0 +func ParseSequenceExampleV2FeatureListRaggedValueTypes(value []tf.DataType) ParseSequenceExampleV2Attr { + return func(m optionalAttr) { + m["feature_list_ragged_value_types"] = value + } +} + +// ParseSequenceExampleV2FeatureListRaggedSplitTypes sets the optional feature_list_ragged_split_types attribute to value. +// +// value: RaggedTensor.row_split dtypes for the ragged FeatureList features. +// If not specified, defaults to <> +// +// REQUIRES: len(value) >= 0 +func ParseSequenceExampleV2FeatureListRaggedSplitTypes(value []tf.DataType) ParseSequenceExampleV2Attr { + return func(m optionalAttr) { + m["feature_list_ragged_split_types"] = value + } +} + +// ParseSequenceExampleV2FeatureListDenseShapes sets the optional feature_list_dense_shapes attribute to value. +// +// value: A list of Nfeature_list_dense shapes; the shapes of +// data in each FeatureList given in feature_list_dense_keys. +// The shape of each Feature in the FeatureList corresponding to +// feature_list_dense_key[j] must always equal +// feature_list_dense_shapes[j].NumEntries(). +// If not specified, defaults to <> +// +// REQUIRES: len(value) >= 0 +func ParseSequenceExampleV2FeatureListDenseShapes(value []tf.Shape) ParseSequenceExampleV2Attr { + return func(m optionalAttr) { + m["feature_list_dense_shapes"] = value + } +} + +// Transforms a vector of tf.io.SequenceExample protos (as strings) into +// typed tensors. +// +// Arguments: +// +// serialized: A scalar or vector containing binary serialized SequenceExample protos. +// debug_name: A scalar or vector containing the names of the serialized protos. +// +// May contain, for example, table key (descriptive) name for the +// corresponding serialized proto. This is purely useful for debugging +// purposes, and the presence of values here has no effect on the output. +// May also be an empty vector if no name is available. +// +// context_sparse_keys: The keys expected in the Examples' features associated with context_sparse +// +// values. +// +// context_dense_keys: The keys expected in the SequenceExamples' context features associated with +// +// dense values. +// +// context_ragged_keys: The keys expected in the Examples' features associated with context_ragged +// +// values. +// +// feature_list_sparse_keys: The keys expected in the FeatureLists associated with sparse values. +// feature_list_dense_keys: The keys expected in the SequenceExamples' feature_lists associated +// +// with lists of dense values. +// +// feature_list_ragged_keys: The keys expected in the FeatureLists associated with ragged values. +// feature_list_dense_missing_assumed_empty: A vector corresponding 1:1 with feature_list_dense_keys, indicating which +// +// features may be missing from the SequenceExamples. If the associated +// FeatureList is missing, it is treated as empty. +// +// context_dense_defaults: A list of Ncontext_dense Tensors (some may be empty). +// +// context_dense_defaults[j] provides default values +// when the SequenceExample's context map lacks context_dense_key[j]. +// If an empty Tensor is provided for context_dense_defaults[j], +// then the Feature context_dense_keys[j] is required. +// The input type is inferred from context_dense_defaults[j], even when it's +// empty. If context_dense_defaults[j] is not empty, its shape must match +// context_dense_shapes[j]. +func ParseSequenceExampleV2(scope *Scope, serialized tf.Output, debug_name tf.Output, context_sparse_keys tf.Output, context_dense_keys tf.Output, context_ragged_keys tf.Output, feature_list_sparse_keys tf.Output, feature_list_dense_keys tf.Output, feature_list_ragged_keys tf.Output, feature_list_dense_missing_assumed_empty tf.Output, context_dense_defaults []tf.Output, optional ...ParseSequenceExampleV2Attr) (context_sparse_indices []tf.Output, context_sparse_values []tf.Output, context_sparse_shapes []tf.Output, context_dense_values []tf.Output, context_ragged_values []tf.Output, context_ragged_row_splits []tf.Output, feature_list_sparse_indices []tf.Output, feature_list_sparse_values []tf.Output, feature_list_sparse_shapes []tf.Output, feature_list_dense_values []tf.Output, feature_list_dense_lengths []tf.Output, feature_list_ragged_values []tf.Output, feature_list_ragged_outer_splits []tf.Output, feature_list_ragged_inner_splits []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ParseSequenceExampleV2", + Input: []tf.Input{ + serialized, debug_name, context_sparse_keys, context_dense_keys, context_ragged_keys, feature_list_sparse_keys, feature_list_dense_keys, feature_list_ragged_keys, feature_list_dense_missing_assumed_empty, tf.OutputList(context_dense_defaults), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if context_sparse_indices, idx, err = makeOutputList(op, idx, "context_sparse_indices"); err != nil { + scope.UpdateErr("ParseSequenceExampleV2", err) + return + } + if context_sparse_values, idx, err = makeOutputList(op, idx, "context_sparse_values"); err != nil { + scope.UpdateErr("ParseSequenceExampleV2", err) + return + } + if context_sparse_shapes, idx, err = makeOutputList(op, idx, "context_sparse_shapes"); err != nil { + scope.UpdateErr("ParseSequenceExampleV2", err) + return + } + if context_dense_values, idx, err = makeOutputList(op, idx, "context_dense_values"); err != nil { + scope.UpdateErr("ParseSequenceExampleV2", err) + return + } + if context_ragged_values, idx, err = makeOutputList(op, idx, "context_ragged_values"); err != nil { + scope.UpdateErr("ParseSequenceExampleV2", err) + return + } + if context_ragged_row_splits, idx, err = makeOutputList(op, idx, "context_ragged_row_splits"); err != nil { + scope.UpdateErr("ParseSequenceExampleV2", err) + return + } + if feature_list_sparse_indices, idx, err = makeOutputList(op, idx, "feature_list_sparse_indices"); err != nil { + scope.UpdateErr("ParseSequenceExampleV2", err) + return + } + if feature_list_sparse_values, idx, err = makeOutputList(op, idx, "feature_list_sparse_values"); err != nil { + scope.UpdateErr("ParseSequenceExampleV2", err) + return + } + if feature_list_sparse_shapes, idx, err = makeOutputList(op, idx, "feature_list_sparse_shapes"); err != nil { + scope.UpdateErr("ParseSequenceExampleV2", err) + return + } + if feature_list_dense_values, idx, err = makeOutputList(op, idx, "feature_list_dense_values"); err != nil { + scope.UpdateErr("ParseSequenceExampleV2", err) + return + } + if feature_list_dense_lengths, idx, err = makeOutputList(op, idx, "feature_list_dense_lengths"); err != nil { + scope.UpdateErr("ParseSequenceExampleV2", err) + return + } + if feature_list_ragged_values, idx, err = makeOutputList(op, idx, "feature_list_ragged_values"); err != nil { + scope.UpdateErr("ParseSequenceExampleV2", err) + return + } + if feature_list_ragged_outer_splits, idx, err = makeOutputList(op, idx, "feature_list_ragged_outer_splits"); err != nil { + scope.UpdateErr("ParseSequenceExampleV2", err) + return + } + if feature_list_ragged_inner_splits, idx, err = makeOutputList(op, idx, "feature_list_ragged_inner_splits"); err != nil { + scope.UpdateErr("ParseSequenceExampleV2", err) + return + } + return context_sparse_indices, context_sparse_values, context_sparse_shapes, context_dense_values, context_ragged_values, context_ragged_row_splits, feature_list_sparse_indices, feature_list_sparse_values, feature_list_sparse_shapes, feature_list_dense_values, feature_list_dense_lengths, feature_list_ragged_values, feature_list_ragged_outer_splits, feature_list_ragged_inner_splits +} + +// AvgPoolAttr is an optional argument to AvgPool. +type AvgPoolAttr func(optionalAttr) + +// AvgPoolDataFormat sets the optional data_format attribute to value. +// +// value: Specify the data format of the input and output data. With the +// default format "NHWC", the data is stored in the order of: +// +// [batch, in_height, in_width, in_channels]. +// +// Alternatively, the format could be "NCHW", the data storage order of: +// +// [batch, in_channels, in_height, in_width]. +// +// If not specified, defaults to "NHWC" +func AvgPoolDataFormat(value string) AvgPoolAttr { + return func(m optionalAttr) { + m["data_format"] = value + } +} + +// Performs average pooling on the input. +// +// Each entry in `output` is the mean of the corresponding size `ksize` +// window in `value`. +// +// Arguments: +// +// value: 4-D with shape `[batch, height, width, channels]`. +// ksize: The size of the sliding window for each dimension of `value`. +// strides: The stride of the sliding window for each dimension of `value`. +// padding: The type of padding algorithm to use. +// +// Returns The average pooled output tensor. +func AvgPool(scope *Scope, value tf.Output, ksize []int64, strides []int64, padding string, optional ...AvgPoolAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"ksize": ksize, "strides": strides, "padding": padding} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "AvgPool", + Input: []tf.Input{ + value, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Exits the current frame to its parent frame. +// +// Exit makes its input `data` available to the parent frame. +// +// Arguments: +// +// data: The tensor to be made available to the parent frame. +// +// Returns The same tensor as `data`. +func Exit(scope *Scope, data tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Exit", + Input: []tf.Input{ + data, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ResourceSparseApplyKerasMomentumAttr is an optional argument to ResourceSparseApplyKerasMomentum. +type ResourceSparseApplyKerasMomentumAttr func(optionalAttr) + +// ResourceSparseApplyKerasMomentumUseLocking sets the optional use_locking attribute to value. +// +// value: If `True`, updating of the var and accum tensors will be protected +// by a lock; otherwise the behavior is undefined, but may exhibit less +// contention. +// If not specified, defaults to false +func ResourceSparseApplyKerasMomentumUseLocking(value bool) ResourceSparseApplyKerasMomentumAttr { + return func(m optionalAttr) { + m["use_locking"] = value + } +} + +// ResourceSparseApplyKerasMomentumUseNesterov sets the optional use_nesterov attribute to value. +// +// value: If `True`, the tensor passed to compute grad will be +// var + momentum * accum, so in the end, the var you get is actually +// var + momentum * accum. +// If not specified, defaults to false +func ResourceSparseApplyKerasMomentumUseNesterov(value bool) ResourceSparseApplyKerasMomentumAttr { + return func(m optionalAttr) { + m["use_nesterov"] = value + } +} + +// Update relevant entries in '*var' and '*accum' according to the momentum scheme. +// +// Set use_nesterov = True if you want to use Nesterov momentum. +// +// That is for rows we have grad for, we update var and accum as follows: +// +// accum = accum * momentum - lr * grad +// var += accum +// +// Arguments: +// +// var_: Should be from a Variable(). +// accum: Should be from a Variable(). +// lr: Learning rate. Must be a scalar. +// grad: The gradient. +// indices: A vector of indices into the first dimension of var and accum. +// momentum: Momentum. Must be a scalar. +// +// Returns the created operation. +func ResourceSparseApplyKerasMomentum(scope *Scope, var_ tf.Output, accum tf.Output, lr tf.Output, grad tf.Output, indices tf.Output, momentum tf.Output, optional ...ResourceSparseApplyKerasMomentumAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ResourceSparseApplyKerasMomentum", + Input: []tf.Input{ + var_, accum, lr, grad, indices, momentum, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// Produces a string handle for the given MultiDeviceIterator. +// +// Arguments: +// +// multi_device_iterator: A MultiDeviceIterator resource. +// +// Returns A string representing the resource. +func MultiDeviceIteratorToStringHandle(scope *Scope, multi_device_iterator tf.Output) (string_handle tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "MultiDeviceIteratorToStringHandle", + Input: []tf.Input{ + multi_device_iterator, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns whether the given key exists in the map. +// +// input_handle: the input map +// key: the key to check +// has_key: whether the key is already in the map or not +func TensorMapHasKey(scope *Scope, input_handle tf.Output, key tf.Output) (has_key tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "TensorMapHasKey", + Input: []tf.Input{ + input_handle, key, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns element-wise remainder of division. When `x < 0` xor `y < 0` is +// +// true, this follows Python semantics in that the result here is consistent +// with a flooring divide. E.g. `floor(x / y) * y + mod(x, y) = x`. +// +// *NOTE*: `FloorMod` supports broadcasting. More about broadcasting +// [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) +func FloorMod(scope *Scope, x tf.Output, y tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "FloorMod", + Input: []tf.Input{ + x, y, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Reshapes a quantized tensor as per the Reshape op. +// +// ``` +// +// Arguments: +// +// shape: Defines the shape of the output tensor. +// input_min: The minimum value of the input. +// input_max: The maximum value of the input. +// +// Returns: +// +// output +// output_min: This value is copied from input_min. +// output_max: This value is copied from input_max. +func QuantizedReshape(scope *Scope, tensor tf.Output, shape tf.Output, input_min tf.Output, input_max tf.Output) (output tf.Output, output_min tf.Output, output_max tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "QuantizedReshape", + Input: []tf.Input{ + tensor, shape, input_min, input_max, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// JPEG encode input image with provided compression quality. +// +// `image` is a 3-D uint8 Tensor of shape `[height, width, channels]`. +// `quality` is an int32 jpeg compression quality value between 0 and 100. +// +// Arguments: +// +// images: Images to adjust. At least 3-D. +// quality: An int quality to encode to. +// +// Returns 0-D. JPEG-encoded image. +func EncodeJpegVariableQuality(scope *Scope, images tf.Output, quality tf.Output) (contents tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "EncodeJpegVariableQuality", + Input: []tf.Input{ + images, quality, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// SobolSampleAttr is an optional argument to SobolSample. +type SobolSampleAttr func(optionalAttr) + +// SobolSampleDtype sets the optional dtype attribute to value. +// +// value: The type of the sample. One of: `float32` or `float64`. +// If not specified, defaults to DT_FLOAT +func SobolSampleDtype(value tf.DataType) SobolSampleAttr { + return func(m optionalAttr) { + m["dtype"] = value + } +} + +// Generates points from the Sobol sequence. +// +// Creates a Sobol sequence with `num_results` samples. Each sample has dimension +// `dim`. Skips the first `skip` samples. +// +// Arguments: +// +// dim: Positive scalar `Tensor` representing each sample's dimension. +// num_results: Positive scalar `Tensor` of dtype int32. The number of Sobol points to return +// +// in the output. +// +// skip: Positive scalar `Tensor` of dtype int32. The number of initial points of the +// +// Sobol sequence to skip. +// +// Returns `Tensor` of samples from Sobol sequence with `shape` [num_results, dim]. +func SobolSample(scope *Scope, dim tf.Output, num_results tf.Output, skip tf.Output, optional ...SobolSampleAttr) (samples tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "SobolSample", + Input: []tf.Input{ + dim, num_results, skip, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns locations of nonzero / true values in a tensor. +// +// This operation returns the coordinates of true elements in `condition`. The +// coordinates are returned in a 2-D tensor where the first dimension (rows) +// represents the number of true elements, and the second dimension (columns) +// represents the coordinates of the true elements. Keep in mind, the shape of +// the output tensor can vary depending on how many true values there are in +// `condition`. Indices are output in row-major order. +// +// For example: +// +// ``` +// # 'input' tensor is [[True, False] +// # [True, False]] +// # 'input' has two true values, so output has two coordinates. +// # 'input' has rank of 2, so coordinates have two indices. +// where(input) ==> [[0, 0], +// +// [1, 0]] +// +// # `condition` tensor is [[[True, False] +// # [True, False]] +// # [[False, True] +// # [False, True]] +// # [[False, False] +// # [False, True]]] +// # 'input' has 5 true values, so output has 5 coordinates. +// # 'input' has rank of 3, so coordinates have three indices. +// where(input) ==> [[0, 0, 0], +// +// [0, 1, 0], +// [1, 0, 1], +// [1, 1, 1], +// [2, 1, 1]] +// +// # `condition` tensor is [[[1.5, 0.0] +// # [-0.5, 0.0]] +// # [[0.0, 0.25] +// # [0.0, 0.75]] +// # [[0.0, 0.0] +// # [0.0, 0.01]]] +// # 'input' has 5 nonzero values, so output has 5 coordinates. +// # 'input' has rank of 3, so coordinates have three indices. +// where(input) ==> [[0, 0, 0], +// +// [0, 1, 0], +// [1, 0, 1], +// [1, 1, 1], +// [2, 1, 1]] +// +// # `condition` tensor is [[[1.5 + 0.0j, 0.0 + 0.0j] +// # [0.0 + 0.5j, 0.0 + 0.0j]] +// # [[0.0 + 0.0j, 0.25 + 1.5j] +// # [0.0 + 0.0j, 0.75 + 0.0j]] +// # [[0.0 + 0.0j, 0.0 + 0.0j] +// # [0.0 + 0.0j, 0.01 + 0.0j]]] +// # 'input' has 5 nonzero magnitude values, so output has 5 coordinates. +// # 'input' has rank of 3, so coordinates have three indices. +// where(input) ==> [[0, 0, 0], +// +// [0, 1, 0], +// [1, 0, 1], +// [1, 1, 1], +// [2, 1, 1]] +// +// ``` +func Where(scope *Scope, condition tf.Output) (index tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Where", + Input: []tf.Input{ + condition, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// UpperBoundAttr is an optional argument to UpperBound. +type UpperBoundAttr func(optionalAttr) + +// UpperBoundOutType sets the optional out_type attribute to value. +// If not specified, defaults to DT_INT32 +func UpperBoundOutType(value tf.DataType) UpperBoundAttr { + return func(m optionalAttr) { + m["out_type"] = value + } +} + +// Applies upper_bound(sorted_search_values, values) along each row. +// +// Each set of rows with the same index in (sorted_inputs, values) is treated +// independently. The resulting row is the equivalent of calling +// `np.searchsorted(sorted_inputs, values, side='right')`. +// +// The result is not a global index to the entire +// `Tensor`, but rather just the index in the last dimension. +// +// A 2-D example: +// +// sorted_sequence = [[0, 3, 9, 9, 10], +// [1, 2, 3, 4, 5]] +// values = [[2, 4, 9], +// [0, 2, 6]] +// +// result = UpperBound(sorted_sequence, values) +// +// result == [[1, 2, 4], +// [0, 2, 5]] +// +// Arguments: +// +// sorted_inputs: 2-D Tensor where each row is ordered. +// values: 2-D Tensor with the same numbers of rows as `sorted_search_values`. Contains +// +// the values that will be searched for in `sorted_search_values`. +// +// Returns A `Tensor` with the same shape as `values`. It contains the last scalar index +// into the last dimension where values can be inserted without changing the +// ordered property. +func UpperBound(scope *Scope, sorted_inputs tf.Output, values tf.Output, optional ...UpperBoundAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "UpperBound", + Input: []tf.Input{ + sorted_inputs, values, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Deserializes a serialized tree ensemble config and replaces current tree +// +// ensemble. +// +// Arguments: +// +// tree_ensemble_handle: Handle to the tree ensemble. +// stamp_token: Token to use as the new value of the resource stamp. +// tree_ensemble_serialized: Serialized proto of the ensemble. +// +// Returns the created operation. +func BoostedTreesDeserializeEnsemble(scope *Scope, tree_ensemble_handle tf.Output, stamp_token tf.Output, tree_ensemble_serialized tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "BoostedTreesDeserializeEnsemble", + Input: []tf.Input{ + tree_ensemble_handle, stamp_token, tree_ensemble_serialized, + }, + } + return scope.AddOperation(opspec) +} + +// CropAndResizeGradBoxesAttr is an optional argument to CropAndResizeGradBoxes. +type CropAndResizeGradBoxesAttr func(optionalAttr) + +// CropAndResizeGradBoxesMethod sets the optional method attribute to value. +// +// value: A string specifying the interpolation method. Only 'bilinear' is +// supported for now. +// If not specified, defaults to "bilinear" +func CropAndResizeGradBoxesMethod(value string) CropAndResizeGradBoxesAttr { + return func(m optionalAttr) { + m["method"] = value + } +} + +// Computes the gradient of the crop_and_resize op wrt the input boxes tensor. +// +// Arguments: +// +// grads: A 4-D tensor of shape `[num_boxes, crop_height, crop_width, depth]`. +// image: A 4-D tensor of shape `[batch, image_height, image_width, depth]`. +// +// Both `image_height` and `image_width` need to be positive. +// +// boxes: A 2-D tensor of shape `[num_boxes, 4]`. The `i`-th row of the tensor +// +// specifies the coordinates of a box in the `box_ind[i]` image and is specified +// in normalized coordinates `[y1, x1, y2, x2]`. A normalized coordinate value of +// `y` is mapped to the image coordinate at `y * (image_height - 1)`, so as the +// `[0, 1]` interval of normalized image height is mapped to +// `[0, image_height - 1] in image height coordinates. We do allow y1 > y2, in +// which case the sampled crop is an up-down flipped version of the original +// image. The width dimension is treated similarly. Normalized coordinates +// outside the `[0, 1]` range are allowed, in which case we use +// `extrapolation_value` to extrapolate the input image values. +// +// box_ind: A 1-D tensor of shape `[num_boxes]` with int32 values in `[0, batch)`. +// +// The value of `box_ind[i]` specifies the image that the `i`-th box refers to. +// +// Returns A 2-D tensor of shape `[num_boxes, 4]`. +func CropAndResizeGradBoxes(scope *Scope, grads tf.Output, image tf.Output, boxes tf.Output, box_ind tf.Output, optional ...CropAndResizeGradBoxesAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "CropAndResizeGradBoxes", + Input: []tf.Input{ + grads, image, boxes, box_ind, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// TensorSummaryAttr is an optional argument to TensorSummary. +type TensorSummaryAttr func(optionalAttr) + +// TensorSummaryDescription sets the optional description attribute to value. +// +// value: A json-encoded SummaryDescription proto. +// If not specified, defaults to "" +func TensorSummaryDescription(value string) TensorSummaryAttr { + return func(m optionalAttr) { + m["description"] = value + } +} + +// TensorSummaryLabels sets the optional labels attribute to value. +// +// value: An unused list of strings. +// If not specified, defaults to <> +func TensorSummaryLabels(value []string) TensorSummaryAttr { + return func(m optionalAttr) { + m["labels"] = value + } +} + +// TensorSummaryDisplayName sets the optional display_name attribute to value. +// +// value: An unused string. +// If not specified, defaults to "" +func TensorSummaryDisplayName(value string) TensorSummaryAttr { + return func(m optionalAttr) { + m["display_name"] = value + } +} + +// Outputs a `Summary` protocol buffer with a tensor. +// +// This op is being phased out in favor of TensorSummaryV2, which lets callers pass +// a tag as well as a serialized SummaryMetadata proto string that contains +// plugin-specific data. We will keep this op to maintain backwards compatibility. +// +// Arguments: +// +// tensor: A tensor to serialize. +func TensorSummary(scope *Scope, tensor tf.Output, optional ...TensorSummaryAttr) (summary tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "TensorSummary", + Input: []tf.Input{ + tensor, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Counts the number of occurrences of each value in an integer array. +// +// Outputs a vector with length `size` and the same dtype as `weights`. If +// `weights` are empty, then index `i` stores the number of times the value `i` is +// counted in `arr`. If `weights` are non-empty, then index `i` stores the sum of +// the value in `weights` at each index where the corresponding value in `arr` is +// `i`. +// +// Values in `arr` outside of the range [0, size) are ignored. +// +// Arguments: +// +// arr: int32 `Tensor`. +// size: non-negative int32 scalar `Tensor`. +// weights: is an int32, int64, float32, or float64 `Tensor` with the same +// +// shape as `arr`, or a length-0 `Tensor`, in which case it acts as all weights +// equal to 1. +// +// Returns 1D `Tensor` with length equal to `size`. The counts or summed weights for +// each value in the range [0, size). +func Bincount(scope *Scope, arr tf.Output, size tf.Output, weights tf.Output) (bins tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Bincount", + Input: []tf.Input{ + arr, size, weights, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Subtracts sparse updates from the variable referenced by `resource`. +// +// This operation computes +// +// # Scalar indices +// ref[indices, ...] -= updates[...] +// +// # Vector indices (for each i) +// ref[indices[i], ...] -= updates[i, ...] +// +// # High rank indices (for each i, ..., j) +// ref[indices[i, ..., j], ...] -= updates[i, ..., j, ...] +// +// Duplicate entries are handled correctly: if multiple `indices` reference +// the same location, their contributions add. +// +// Requires `updates.shape = indices.shape + ref.shape[1:]` or `updates.shape = []`. +// +//
+// +//
+// +// Arguments: +// +// resource: Should be from a `Variable` node. +// indices: A tensor of indices into the first dimension of `ref`. +// updates: A tensor of updated values to add to `ref`. +// +// Returns the created operation. +func ResourceScatterSub(scope *Scope, resource tf.Output, indices tf.Output, updates tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "ResourceScatterSub", + Input: []tf.Input{ + resource, indices, updates, + }, + } + return scope.AddOperation(opspec) +} + +// Outputs all keys and values in the table. +// +// Arguments: +// +// table_handle: Handle to the table. +// +// Returns: +// +// keys: Vector of all keys present in the table. +// values: Tensor of all values in the table. Indexed in parallel with `keys`. +func LookupTableExportV2(scope *Scope, table_handle tf.Output, Tkeys tf.DataType, Tvalues tf.DataType) (keys tf.Output, values tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"Tkeys": Tkeys, "Tvalues": Tvalues} + opspec := tf.OpSpec{ + Type: "LookupTableExportV2", + Input: []tf.Input{ + table_handle, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// Creates a dataset that uses a custom thread pool to compute `input_dataset`. +// +// Arguments: +// +// thread_pool: A resource produced by the ThreadPoolHandle op. +func ExperimentalThreadPoolDataset(scope *Scope, input_dataset tf.Output, thread_pool tf.Output, output_types []tf.DataType, output_shapes []tf.Shape) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + opspec := tf.OpSpec{ + Type: "ExperimentalThreadPoolDataset", + Input: []tf.Input{ + input_dataset, thread_pool, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// MaxPoolGradGradAttr is an optional argument to MaxPoolGradGrad. +type MaxPoolGradGradAttr func(optionalAttr) + +// MaxPoolGradGradDataFormat sets the optional data_format attribute to value. +// +// value: Specify the data format of the input and output data. With the +// default format "NHWC", the data is stored in the order of: +// +// [batch, in_height, in_width, in_channels]. +// +// Alternatively, the format could be "NCHW", the data storage order of: +// +// [batch, in_channels, in_height, in_width]. +// +// If not specified, defaults to "NHWC" +func MaxPoolGradGradDataFormat(value string) MaxPoolGradGradAttr { + return func(m optionalAttr) { + m["data_format"] = value + } +} + +// Computes second-order gradients of the maxpooling function. +// +// Arguments: +// +// orig_input: The original input tensor. +// orig_output: The original output tensor. +// grad: 4-D. Gradients of gradients w.r.t. the input of `max_pool`. +// ksize: The size of the window for each dimension of the input tensor. +// strides: The stride of the sliding window for each dimension of the +// +// input tensor. +// +// padding: The type of padding algorithm to use. +// +// Returns Gradients of gradients w.r.t. the input to `max_pool`. +func MaxPoolGradGrad(scope *Scope, orig_input tf.Output, orig_output tf.Output, grad tf.Output, ksize []int64, strides []int64, padding string, optional ...MaxPoolGradGradAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"ksize": ksize, "strides": strides, "padding": padding} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "MaxPoolGradGrad", + Input: []tf.Input{ + orig_input, orig_output, grad, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Splits a tensor into `num_split` tensors along one dimension. +// +// Arguments: +// +// value: The tensor to split. +// size_splits: list containing the sizes of each output tensor along the split +// +// dimension. Must sum to the dimension of value along split_dim. +// Can contain one -1 indicating that dimension is to be inferred. +// +// axis: 0-D. The dimension along which to split. Must be in the range +// +// `[-rank(value), rank(value))`. +// +// Returns Tensors whose shape matches that of `value` +// except along `axis`, where their sizes are +// `size_splits[i]`. +func SplitV(scope *Scope, value tf.Output, size_splits tf.Output, axis tf.Output, num_split int64) (output []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_split": num_split} + opspec := tf.OpSpec{ + Type: "SplitV", + Input: []tf.Input{ + value, size_splits, axis, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if output, idx, err = makeOutputList(op, idx, "output"); err != nil { + scope.UpdateErr("SplitV", err) + return + } + return output +} + +// BatchDatasetV2Attr is an optional argument to BatchDatasetV2. +type BatchDatasetV2Attr func(optionalAttr) + +// BatchDatasetV2ParallelCopy sets the optional parallel_copy attribute to value. +// If not specified, defaults to false +func BatchDatasetV2ParallelCopy(value bool) BatchDatasetV2Attr { + return func(m optionalAttr) { + m["parallel_copy"] = value + } +} + +// BatchDatasetV2Metadata sets the optional metadata attribute to value. +// If not specified, defaults to "" +func BatchDatasetV2Metadata(value string) BatchDatasetV2Attr { + return func(m optionalAttr) { + m["metadata"] = value + } +} + +// Creates a dataset that batches `batch_size` elements from `input_dataset`. +// +// Arguments: +// +// batch_size: A scalar representing the number of elements to accumulate in a batch. +// drop_remainder: A scalar representing whether the last batch should be dropped in case its size +// +// is smaller than desired. +func BatchDatasetV2(scope *Scope, input_dataset tf.Output, batch_size tf.Output, drop_remainder tf.Output, output_types []tf.DataType, output_shapes []tf.Shape, optional ...BatchDatasetV2Attr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "BatchDatasetV2", + Input: []tf.Input{ + input_dataset, batch_size, drop_remainder, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Wraps the XLA Pad operator, documented at +// +// https://www.tensorflow.org/performance/xla/operation_semantics#pad +// +// . +// +// Arguments: +// +// input: A `Tensor` of type T. +// padding_value: A scalar `Tensor` of type T. +// padding_low: the padding to apply at the start of each input dimensions. Must +// +// be a compile-time constant 1D tensor of length equal to rank of input. +// +// padding_high: the padding to apply at the end of each input dimension. Must +// +// be a compile-time constant 1D tensor of length equal to rank of input. +// +// padding_interior: the padding to apply between each input element. Must +// +// be a compile-time constant 1D tensor of length equal to rank of input, +// containing only non-negative values. +// +// Returns A `Tensor` of type T. +func XlaPad(scope *Scope, input tf.Output, padding_value tf.Output, padding_low tf.Output, padding_high tf.Output, padding_interior tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "XlaPad", + Input: []tf.Input{ + input, padding_value, padding_low, padding_high, padding_interior, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Creates a dataset that emits the key-value pairs in one or more LMDB files. +// +// The Lightning Memory-Mapped Database Manager, or LMDB, is an embedded binary +// key-value database. This dataset can read the contents of LMDB database files, +// the names of which generally have the `.mdb` suffix. +// +// Each output element consists of a key-value pair represented as a pair of +// scalar string `Tensor`s, where the first `Tensor` contains the key and the +// second `Tensor` contains the value. +// +// LMDB uses different file formats on big- and little-endian machines. +// `LMDBDataset` can only read files in the format of the host machine. +// +// Arguments: +// +// filenames: A scalar or a vector containing the name(s) of the binary file(s) to be +// +// read. +func LMDBDataset(scope *Scope, filenames tf.Output, output_types []tf.DataType, output_shapes []tf.Shape) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + opspec := tf.OpSpec{ + Type: "LMDBDataset", + Input: []tf.Input{ + filenames, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Restore a reader to a previously saved state. +// +// Not all Readers support being restored, so this can produce an +// Unimplemented error. +// +// Arguments: +// +// reader_handle: Handle to a Reader. +// state: Result of a ReaderSerializeState of a Reader with type +// +// matching reader_handle. +// +// Returns the created operation. +func ReaderRestoreStateV2(scope *Scope, reader_handle tf.Output, state tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "ReaderRestoreStateV2", + Input: []tf.Input{ + reader_handle, state, + }, + } + return scope.AddOperation(opspec) +} + +// PrefetchDatasetAttr is an optional argument to PrefetchDataset. +type PrefetchDatasetAttr func(optionalAttr) + +// PrefetchDatasetSlackPeriod sets the optional slack_period attribute to value. +// If not specified, defaults to 0 +func PrefetchDatasetSlackPeriod(value int64) PrefetchDatasetAttr { + return func(m optionalAttr) { + m["slack_period"] = value + } +} + +// PrefetchDatasetLegacyAutotune sets the optional legacy_autotune attribute to value. +// If not specified, defaults to true +func PrefetchDatasetLegacyAutotune(value bool) PrefetchDatasetAttr { + return func(m optionalAttr) { + m["legacy_autotune"] = value + } +} + +// PrefetchDatasetBufferSizeMin sets the optional buffer_size_min attribute to value. +// If not specified, defaults to 0 +func PrefetchDatasetBufferSizeMin(value int64) PrefetchDatasetAttr { + return func(m optionalAttr) { + m["buffer_size_min"] = value + } +} + +// PrefetchDatasetMetadata sets the optional metadata attribute to value. +// If not specified, defaults to "" +func PrefetchDatasetMetadata(value string) PrefetchDatasetAttr { + return func(m optionalAttr) { + m["metadata"] = value + } +} + +// Creates a dataset that asynchronously prefetches elements from `input_dataset`. +// +// Arguments: +// +// buffer_size: The maximum number of elements to buffer in an iterator over +// +// this dataset. +func PrefetchDataset(scope *Scope, input_dataset tf.Output, buffer_size tf.Output, output_types []tf.DataType, output_shapes []tf.Shape, optional ...PrefetchDatasetAttr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "PrefetchDataset", + Input: []tf.Input{ + input_dataset, buffer_size, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// HashTableV2Attr is an optional argument to HashTableV2. +type HashTableV2Attr func(optionalAttr) + +// HashTableV2Container sets the optional container attribute to value. +// +// value: If non-empty, this table is placed in the given container. +// Otherwise, a default container is used. +// If not specified, defaults to "" +func HashTableV2Container(value string) HashTableV2Attr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// HashTableV2SharedName sets the optional shared_name attribute to value. +// +// value: If non-empty, this table is shared under the given name across +// multiple sessions. +// If not specified, defaults to "" +func HashTableV2SharedName(value string) HashTableV2Attr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// HashTableV2UseNodeNameSharing sets the optional use_node_name_sharing attribute to value. +// +// value: If true and shared_name is empty, the table is shared +// using the node name. +// If not specified, defaults to false +func HashTableV2UseNodeNameSharing(value bool) HashTableV2Attr { + return func(m optionalAttr) { + m["use_node_name_sharing"] = value + } +} + +// Creates a non-initialized hash table. +// +// This op creates a hash table, specifying the type of its keys and values. +// Before using the table you will have to initialize it. After initialization the +// table will be immutable. +// +// Arguments: +// +// key_dtype: Type of the table keys. +// value_dtype: Type of the table values. +// +// Returns Handle to a table. +func HashTableV2(scope *Scope, key_dtype tf.DataType, value_dtype tf.DataType, optional ...HashTableV2Attr) (table_handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"key_dtype": key_dtype, "value_dtype": value_dtype} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "HashTableV2", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Pop the element at the top of the stack. +// +// Arguments: +// +// handle: The handle to a stack. +// elem_type: The type of the elem that is popped. +// +// Returns The tensor that is popped from the top of the stack. +func StackPopV2(scope *Scope, handle tf.Output, elem_type tf.DataType) (elem tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"elem_type": elem_type} + opspec := tf.OpSpec{ + Type: "StackPopV2", + Input: []tf.Input{ + handle, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes element-wise population count (a.k.a. popcount, bitsum, bitcount). +// +// For each entry in `x`, calculates the number of `1` (on) bits in the binary +// representation of that entry. +// +// **NOTE**: It is more efficient to first `tf.bitcast` your tensors into +// `int32` or `int64` and perform the bitcount on the result, than to feed in +// 8- or 16-bit inputs and then aggregate the resulting counts. +func PopulationCount(scope *Scope, x tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "PopulationCount", + Input: []tf.Input{ + x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes scaled exponential linear: `scale * alpha * (exp(features) - 1)` +// +// if < 0, `scale * features` otherwise. +// +// To be used together with +// `initializer = tf.variance_scaling_initializer(factor=1.0, mode='FAN_IN')`. +// For correct dropout, use `tf.contrib.nn.alpha_dropout`. +// +// See [Self-Normalizing Neural Networks](https://arxiv.org/abs/1706.02515) +func Selu(scope *Scope, features tf.Output) (activations tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Selu", + Input: []tf.Input{ + features, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// RecordInputAttr is an optional argument to RecordInput. +type RecordInputAttr func(optionalAttr) + +// RecordInputFileRandomSeed sets the optional file_random_seed attribute to value. +// +// value: Random seeds used to produce randomized records. +// If not specified, defaults to 301 +func RecordInputFileRandomSeed(value int64) RecordInputAttr { + return func(m optionalAttr) { + m["file_random_seed"] = value + } +} + +// RecordInputFileShuffleShiftRatio sets the optional file_shuffle_shift_ratio attribute to value. +// +// value: Shifts the list of files after the list is randomly +// shuffled. +// If not specified, defaults to 0 +func RecordInputFileShuffleShiftRatio(value float32) RecordInputAttr { + return func(m optionalAttr) { + m["file_shuffle_shift_ratio"] = value + } +} + +// RecordInputFileBufferSize sets the optional file_buffer_size attribute to value. +// +// value: The randomization shuffling buffer. +// If not specified, defaults to 10000 +func RecordInputFileBufferSize(value int64) RecordInputAttr { + return func(m optionalAttr) { + m["file_buffer_size"] = value + } +} + +// RecordInputFileParallelism sets the optional file_parallelism attribute to value. +// +// value: How many sstables are opened and concurrently iterated over. +// If not specified, defaults to 16 +func RecordInputFileParallelism(value int64) RecordInputAttr { + return func(m optionalAttr) { + m["file_parallelism"] = value + } +} + +// RecordInputBatchSize sets the optional batch_size attribute to value. +// +// value: The batch size. +// If not specified, defaults to 32 +func RecordInputBatchSize(value int64) RecordInputAttr { + return func(m optionalAttr) { + m["batch_size"] = value + } +} + +// RecordInputCompressionType sets the optional compression_type attribute to value. +// +// value: The type of compression for the file. Currently ZLIB and +// GZIP are supported. Defaults to none. +// If not specified, defaults to "" +func RecordInputCompressionType(value string) RecordInputAttr { + return func(m optionalAttr) { + m["compression_type"] = value + } +} + +// Emits randomized records. +// +// Arguments: +// +// file_pattern: Glob pattern for the data files. +// +// Returns A tensor of shape [batch_size]. +func RecordInput(scope *Scope, file_pattern string, optional ...RecordInputAttr) (records tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"file_pattern": file_pattern} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "RecordInput", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// NthElementAttr is an optional argument to NthElement. +type NthElementAttr func(optionalAttr) + +// NthElementReverse sets the optional reverse attribute to value. +// +// value: When set to True, find the nth-largest value in the vector and vice +// versa. +// If not specified, defaults to false +func NthElementReverse(value bool) NthElementAttr { + return func(m optionalAttr) { + m["reverse"] = value + } +} + +// Finds values of the `n`-th order statistic for the last dimension. +// +// If the input is a vector (rank-1), finds the entries which is the nth-smallest +// value in the vector and outputs their values as scalar tensor. +// +// For matrices (resp. higher rank input), computes the entries which is the +// nth-smallest value in each row (resp. vector along the last dimension). Thus, +// +// values.shape = input.shape[:-1] +// +// Arguments: +// +// input: 1-D or higher with last dimension at least `n+1`. +// n: 0-D. Position of sorted vector to select along the last dimension (along +// +// each row for matrices). Valid range of n is `[0, input.shape[:-1])` +// +// Returns The `n`-th order statistic along each last dimensional slice. +func NthElement(scope *Scope, input tf.Output, n tf.Output, optional ...NthElementAttr) (values tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "NthElement", + Input: []tf.Input{ + input, n, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Outputs a `Summary` protocol buffer with a histogram. +// +// The generated +// [`Summary`](https://www.tensorflow.org/code/tensorflow/core/framework/summary.proto) +// has one summary value containing a histogram for `values`. +// +// This op reports an `InvalidArgument` error if any value is not finite. +// +// Arguments: +// +// tag: Scalar. Tag to use for the `Summary.Value`. +// values: Any shape. Values to use to build the histogram. +// +// Returns Scalar. Serialized `Summary` protocol buffer. +func HistogramSummary(scope *Scope, tag tf.Output, values tf.Output) (summary tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "HistogramSummary", + Input: []tf.Input{ + tag, values, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// TPUReplicateMetadataAttr is an optional argument to TPUReplicateMetadata. +type TPUReplicateMetadataAttr func(optionalAttr) + +// TPUReplicateMetadataNumCoresPerReplica sets the optional num_cores_per_replica attribute to value. +// +// value: Number of cores per replica. Used for model parallelism. +// If not specified, defaults to 1 +func TPUReplicateMetadataNumCoresPerReplica(value int64) TPUReplicateMetadataAttr { + return func(m optionalAttr) { + m["num_cores_per_replica"] = value + } +} + +// TPUReplicateMetadataTopology sets the optional topology attribute to value. +// +// value: TopologyProto indicating the topology of the TPU pod slice. +// If not specified, defaults to "" +func TPUReplicateMetadataTopology(value string) TPUReplicateMetadataAttr { + return func(m optionalAttr) { + m["topology"] = value + } +} + +// TPUReplicateMetadataUseTpu sets the optional use_tpu attribute to value. +// +// value: Whether to place the computation on the TPU. +// If not specified, defaults to true +func TPUReplicateMetadataUseTpu(value bool) TPUReplicateMetadataAttr { + return func(m optionalAttr) { + m["use_tpu"] = value + } +} + +// TPUReplicateMetadataDeviceAssignment sets the optional device_assignment attribute to value. +// +// value: The assignment of devices for the computation. +// If not specified, defaults to <> +func TPUReplicateMetadataDeviceAssignment(value []int64) TPUReplicateMetadataAttr { + return func(m optionalAttr) { + m["device_assignment"] = value + } +} + +// TPUReplicateMetadataComputationShape sets the optional computation_shape attribute to value. +// +// value: DEPRECATED. Use num_cores_per_replica instead. +// If not specified, defaults to <> +func TPUReplicateMetadataComputationShape(value []int64) TPUReplicateMetadataAttr { + return func(m optionalAttr) { + m["computation_shape"] = value + } +} + +// TPUReplicateMetadataHostComputeCore sets the optional host_compute_core attribute to value. +// If not specified, defaults to <> +func TPUReplicateMetadataHostComputeCore(value []string) TPUReplicateMetadataAttr { + return func(m optionalAttr) { + m["host_compute_core"] = value + } +} + +// TPUReplicateMetadataPaddingMap sets the optional padding_map attribute to value. +// If not specified, defaults to <> +func TPUReplicateMetadataPaddingMap(value []string) TPUReplicateMetadataAttr { + return func(m optionalAttr) { + m["padding_map"] = value + } +} + +// TPUReplicateMetadataStepMarkerLocation sets the optional step_marker_location attribute to value. +// If not specified, defaults to "STEP_MARK_AT_ENTRY" +func TPUReplicateMetadataStepMarkerLocation(value string) TPUReplicateMetadataAttr { + return func(m optionalAttr) { + m["step_marker_location"] = value + } +} + +// TPUReplicateMetadataAllowSoftPlacement sets the optional allow_soft_placement attribute to value. +// If not specified, defaults to false +func TPUReplicateMetadataAllowSoftPlacement(value bool) TPUReplicateMetadataAttr { + return func(m optionalAttr) { + m["allow_soft_placement"] = value + } +} + +// TPUReplicateMetadataUseSpmdForXlaPartitioning sets the optional use_spmd_for_xla_partitioning attribute to value. +// If not specified, defaults to false +func TPUReplicateMetadataUseSpmdForXlaPartitioning(value bool) TPUReplicateMetadataAttr { + return func(m optionalAttr) { + m["use_spmd_for_xla_partitioning"] = value + } +} + +// TPUReplicateMetadataTpuCompileOptionsProto sets the optional tpu_compile_options_proto attribute to value. +// If not specified, defaults to "" +func TPUReplicateMetadataTpuCompileOptionsProto(value string) TPUReplicateMetadataAttr { + return func(m optionalAttr) { + m["tpu_compile_options_proto"] = value + } +} + +// Metadata indicating how the TPU computation should be replicated. +// +// This operation holds the metadata common to operations of a `tpu.replicate()` computation subgraph. +// +// Arguments: +// +// num_replicas: Number of replicas of the computation +// +// Returns the created operation. +func TPUReplicateMetadata(scope *Scope, num_replicas int64, optional ...TPUReplicateMetadataAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_replicas": num_replicas} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "TPUReplicateMetadata", + + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// Ensures that the tensor's shape matches the expected shape. +// +// Raises an error if the input tensor's shape does not match the specified shape. +// Returns the input tensor otherwise. +// +// Arguments: +// +// input: A tensor, whose shape is to be validated. +// shape: The expected (possibly partially specified) shape of the input tensor. +// +// Returns A tensor with the same shape and contents as the input tensor or value. +func EnsureShape(scope *Scope, input tf.Output, shape tf.Shape) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"shape": shape} + opspec := tf.OpSpec{ + Type: "EnsureShape", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes the trignometric inverse tangent of x element-wise. +// +// The `tf.math.atan` operation returns the inverse of `tf.math.tan`, such that +// if `y = tf.math.tan(x)` then, `x = tf.math.atan(y)`. +// +// **Note**: The output of `tf.math.atan` will lie within the invertible range +// of tan, i.e (-pi/2, pi/2). +// +// For example: +// +// ```python +// # Note: [1.047, 0.785] ~= [(pi/3), (pi/4)] +// x = tf.constant([1.047, 0.785]) +// y = tf.math.tan(x) # [1.731261, 0.99920404] +// +// tf.math.atan(y) # [1.047, 0.785] = x +// ``` +func Atan(scope *Scope, x tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Atan", + Input: []tf.Input{ + x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// FIFOQueueV2Attr is an optional argument to FIFOQueueV2. +type FIFOQueueV2Attr func(optionalAttr) + +// FIFOQueueV2Shapes sets the optional shapes attribute to value. +// +// value: The shape of each component in a value. The length of this attr must +// be either 0 or the same as the length of component_types. If the length of +// this attr is 0, the shapes of queue elements are not constrained, and +// only one element may be dequeued at a time. +// If not specified, defaults to <> +// +// REQUIRES: len(value) >= 0 +func FIFOQueueV2Shapes(value []tf.Shape) FIFOQueueV2Attr { + return func(m optionalAttr) { + m["shapes"] = value + } +} + +// FIFOQueueV2Capacity sets the optional capacity attribute to value. +// +// value: The upper bound on the number of elements in this queue. +// Negative numbers mean no limit. +// If not specified, defaults to -1 +func FIFOQueueV2Capacity(value int64) FIFOQueueV2Attr { + return func(m optionalAttr) { + m["capacity"] = value + } +} + +// FIFOQueueV2Container sets the optional container attribute to value. +// +// value: If non-empty, this queue is placed in the given container. +// Otherwise, a default container is used. +// If not specified, defaults to "" +func FIFOQueueV2Container(value string) FIFOQueueV2Attr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// FIFOQueueV2SharedName sets the optional shared_name attribute to value. +// +// value: If non-empty, this queue will be shared under the given name +// across multiple sessions. +// If not specified, defaults to "" +func FIFOQueueV2SharedName(value string) FIFOQueueV2Attr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// A queue that produces elements in first-in first-out order. +// +// Arguments: +// +// component_types: The type of each component in a value. +// +// Returns The handle to the queue. +func FIFOQueueV2(scope *Scope, component_types []tf.DataType, optional ...FIFOQueueV2Attr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"component_types": component_types} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "FIFOQueueV2", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// 2D fast Fourier transform. +// +// Computes the 2-dimensional discrete Fourier transform over the inner-most +// 2 dimensions of `input`. +// +// Arguments: +// +// input: A complex tensor. +// +// Returns A complex tensor of the same shape as `input`. The inner-most 2 +// +// dimensions of `input` are replaced with their 2D Fourier transform. +// +// @compatibility(numpy) +// Equivalent to np.fft.fft2 +// @end_compatibility +func FFT2D(scope *Scope, input tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "FFT2D", + Input: []tf.Input{ + input, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ReduceJoinAttr is an optional argument to ReduceJoin. +type ReduceJoinAttr func(optionalAttr) + +// ReduceJoinKeepDims sets the optional keep_dims attribute to value. +// +// value: If `True`, retain reduced dimensions with length `1`. +// If not specified, defaults to false +func ReduceJoinKeepDims(value bool) ReduceJoinAttr { + return func(m optionalAttr) { + m["keep_dims"] = value + } +} + +// ReduceJoinSeparator sets the optional separator attribute to value. +// +// value: The separator to use when joining. +// If not specified, defaults to "" +func ReduceJoinSeparator(value string) ReduceJoinAttr { + return func(m optionalAttr) { + m["separator"] = value + } +} + +// Joins a string Tensor across the given dimensions. +// +// Computes the string join across dimensions in the given string Tensor of shape +// `[\\(d_0, d_1, ..., d_{n-1}\\)]`. Returns a new Tensor created by joining the input +// strings with the given separator (default: empty string). Negative indices are +// counted backwards from the end, with `-1` being equivalent to `n - 1`. If +// indices are not specified, joins across all dimensions beginning from `n - 1` +// through `0`. +// +// For example: +// +// ```python +// # tensor `a` is [["a", "b"], ["c", "d"]] +// tf.reduce_join(a, 0) ==> ["ac", "bd"] +// tf.reduce_join(a, 1) ==> ["ab", "cd"] +// tf.reduce_join(a, -2) = tf.reduce_join(a, 0) ==> ["ac", "bd"] +// tf.reduce_join(a, -1) = tf.reduce_join(a, 1) ==> ["ab", "cd"] +// tf.reduce_join(a, 0, keep_dims=True) ==> [["ac", "bd"]] +// tf.reduce_join(a, 1, keep_dims=True) ==> [["ab"], ["cd"]] +// tf.reduce_join(a, 0, separator=".") ==> ["a.c", "b.d"] +// tf.reduce_join(a, [0, 1]) ==> "acbd" +// tf.reduce_join(a, [1, 0]) ==> "abcd" +// tf.reduce_join(a, []) ==> [["a", "b"], ["c", "d"]] +// tf.reduce_join(a) = tf.reduce_join(a, [1, 0]) ==> "abcd" +// ``` +// +// Arguments: +// +// inputs: The input to be joined. All reduced indices must have non-zero size. +// reduction_indices: The dimensions to reduce over. Dimensions are reduced in the +// +// order specified. Omitting `reduction_indices` is equivalent to passing +// `[n-1, n-2, ..., 0]`. Negative indices from `-n` to `-1` are supported. +// +// Returns Has shape equal to that of the input with reduced dimensions removed or +// set to `1` depending on `keep_dims`. +func ReduceJoin(scope *Scope, inputs tf.Output, reduction_indices tf.Output, optional ...ReduceJoinAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ReduceJoin", + Input: []tf.Input{ + inputs, reduction_indices, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Return a slice from 'input'. +// +// The output tensor is a tensor with dimensions described by 'size' +// whose values are extracted from 'input' starting at the offsets in +// 'begin'. +// +// *Requirements*: +// +// 0 <= begin[i] <= begin[i] + size[i] <= Di for i in [0, n) +// +// Arguments: +// +// begin: begin[i] specifies the offset into the 'i'th dimension of +// +// 'input' to slice from. +// +// size: size[i] specifies the number of elements of the 'i'th dimension +// +// of 'input' to slice. If size[i] is -1, all remaining elements in dimension +// i are included in the slice (i.e. this is equivalent to setting +// size[i] = input.dim_size(i) - begin[i]). +func Slice(scope *Scope, input tf.Output, begin tf.Output, size tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Slice", + Input: []tf.Input{ + input, begin, size, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// TopKAttr is an optional argument to TopK. +type TopKAttr func(optionalAttr) + +// TopKSorted sets the optional sorted attribute to value. +// +// value: If true the resulting `k` elements will be sorted by the values in +// descending order. +// If not specified, defaults to true +func TopKSorted(value bool) TopKAttr { + return func(m optionalAttr) { + m["sorted"] = value + } +} + +// Finds values and indices of the `k` largest elements for the last dimension. +// +// DEPRECATED at GraphDef version 7: Use TopKV2 instead +// +// If the input is a vector (rank-1), finds the `k` largest entries in the vector +// and outputs their values and indices as vectors. Thus `values[j]` is the +// `j`-th largest entry in `input`, and its index is `indices[j]`. +// +// For matrices (resp. higher rank input), computes the top `k` entries in each +// row (resp. vector along the last dimension). Thus, +// +// values.shape = indices.shape = input.shape[:-1] + [k] +// +// If two elements are equal, the lower-index element appears first. +// +// If `k` varies dynamically, use `TopKV2` below. +// +// Arguments: +// +// input: 1-D or higher with last dimension at least `k`. +// k: Number of top elements to look for along the last dimension (along each +// +// row for matrices). +// +// Returns: +// +// values: The `k` largest elements along each last dimensional slice. +// indices: The indices of `values` within the last dimension of `input`. +func TopK(scope *Scope, input tf.Output, k int64, optional ...TopKAttr) (values tf.Output, indices tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"k": k} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "TopK", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// Sparse addition of two CSR matrices, C = alpha * A + beta * B. +// +// The gradients of SparseMatrixAdd outputs with respect to alpha and beta are not +// currently defined (TensorFlow will return zeros for these entries). +// +// Arguments: +// +// a: A CSRSparseMatrix. +// b: A CSRSparseMatrix. +// alpha: A constant scalar. +// beta: A constant scalar. +// +// Returns A CSRSparseMatrix. +func SparseMatrixAdd(scope *Scope, a tf.Output, b tf.Output, alpha tf.Output, beta tf.Output) (c tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "SparseMatrixAdd", + Input: []tf.Input{ + a, b, alpha, beta, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// LogUniformCandidateSamplerAttr is an optional argument to LogUniformCandidateSampler. +type LogUniformCandidateSamplerAttr func(optionalAttr) + +// LogUniformCandidateSamplerSeed sets the optional seed attribute to value. +// +// value: If either seed or seed2 are set to be non-zero, the random number +// generator is seeded by the given seed. Otherwise, it is seeded by a +// random seed. +// If not specified, defaults to 0 +func LogUniformCandidateSamplerSeed(value int64) LogUniformCandidateSamplerAttr { + return func(m optionalAttr) { + m["seed"] = value + } +} + +// LogUniformCandidateSamplerSeed2 sets the optional seed2 attribute to value. +// +// value: An second seed to avoid seed collision. +// If not specified, defaults to 0 +func LogUniformCandidateSamplerSeed2(value int64) LogUniformCandidateSamplerAttr { + return func(m optionalAttr) { + m["seed2"] = value + } +} + +// Generates labels for candidate sampling with a log-uniform distribution. +// +// See explanations of candidate sampling and the data formats at +// go/candidate-sampling. +// +// For each batch, this op picks a single set of sampled candidate labels. +// +// The advantages of sampling candidates per-batch are simplicity and the +// possibility of efficient dense matrix multiplication. The disadvantage is that +// the sampled candidates must be chosen independently of the context and of the +// true labels. +// +// Arguments: +// +// true_classes: A batch_size * num_true matrix, in which each row contains the +// +// IDs of the num_true target_classes in the corresponding original label. +// +// num_true: Number of true labels per context. +// num_sampled: Number of candidates to randomly sample. +// unique: If unique is true, we sample with rejection, so that all sampled +// +// candidates in a batch are unique. This requires some approximation to +// estimate the post-rejection sampling probabilities. +// +// range_max: The sampler will sample integers from the interval [0, range_max). +// +// Returns: +// +// sampled_candidates: A vector of length num_sampled, in which each element is +// +// the ID of a sampled candidate. +// +// true_expected_count: A batch_size * num_true matrix, representing +// +// the number of times each candidate is expected to occur in a batch +// of sampled candidates. If unique=true, then this is a probability. +// +// sampled_expected_count: A vector of length num_sampled, for each sampled +// +// candidate representing the number of times the candidate is expected +// to occur in a batch of sampled candidates. If unique=true, then this is a +// probability. +func LogUniformCandidateSampler(scope *Scope, true_classes tf.Output, num_true int64, num_sampled int64, unique bool, range_max int64, optional ...LogUniformCandidateSamplerAttr) (sampled_candidates tf.Output, true_expected_count tf.Output, sampled_expected_count tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_true": num_true, "num_sampled": num_sampled, "unique": unique, "range_max": range_max} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "LogUniformCandidateSampler", + Input: []tf.Input{ + true_classes, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// ExtractGlimpseAttr is an optional argument to ExtractGlimpse. +type ExtractGlimpseAttr func(optionalAttr) + +// ExtractGlimpseCentered sets the optional centered attribute to value. +// +// value: indicates if the offset coordinates are centered relative to +// the image, in which case the (0, 0) offset is relative to the center +// of the input images. If false, the (0,0) offset corresponds to the +// upper left corner of the input images. +// If not specified, defaults to true +func ExtractGlimpseCentered(value bool) ExtractGlimpseAttr { + return func(m optionalAttr) { + m["centered"] = value + } +} + +// ExtractGlimpseNormalized sets the optional normalized attribute to value. +// +// value: indicates if the offset coordinates are normalized. +// If not specified, defaults to true +func ExtractGlimpseNormalized(value bool) ExtractGlimpseAttr { + return func(m optionalAttr) { + m["normalized"] = value + } +} + +// ExtractGlimpseUniformNoise sets the optional uniform_noise attribute to value. +// +// value: indicates if the noise should be generated using a +// uniform distribution or a Gaussian distribution. +// If not specified, defaults to true +func ExtractGlimpseUniformNoise(value bool) ExtractGlimpseAttr { + return func(m optionalAttr) { + m["uniform_noise"] = value + } +} + +// ExtractGlimpseNoise sets the optional noise attribute to value. +// +// value: indicates if the noise should `uniform`, `gaussian`, or +// `zero`. The default is `uniform` which means the the noise type +// will be decided by `uniform_noise`. +// If not specified, defaults to "uniform" +func ExtractGlimpseNoise(value string) ExtractGlimpseAttr { + return func(m optionalAttr) { + m["noise"] = value + } +} + +// Extracts a glimpse from the input tensor. +// +// Returns a set of windows called glimpses extracted at location +// `offsets` from the input tensor. If the windows only partially +// overlaps the inputs, the non overlapping areas will be filled with +// random noise. +// +// The result is a 4-D tensor of shape `[batch_size, glimpse_height, +// glimpse_width, channels]`. The channels and batch dimensions are the +// same as that of the input tensor. The height and width of the output +// windows are specified in the `size` parameter. +// +// The argument `normalized` and `centered` controls how the windows are built: +// +// - If the coordinates are normalized but not centered, 0.0 and 1.0 +// correspond to the minimum and maximum of each height and width +// dimension. +// - If the coordinates are both normalized and centered, they range from +// -1.0 to 1.0. The coordinates (-1.0, -1.0) correspond to the upper +// left corner, the lower right corner is located at (1.0, 1.0) and the +// center is at (0, 0). +// - If the coordinates are not normalized they are interpreted as +// numbers of pixels. +// +// Arguments: +// +// input: A 4-D float tensor of shape `[batch_size, height, width, channels]`. +// size: A 1-D tensor of 2 elements containing the size of the glimpses +// +// to extract. The glimpse height must be specified first, following +// by the glimpse width. +// +// offsets: A 2-D integer tensor of shape `[batch_size, 2]` containing +// +// the y, x locations of the center of each window. +// +// Returns A tensor representing the glimpses `[batch_size, +// glimpse_height, glimpse_width, channels]`. +func ExtractGlimpse(scope *Scope, input tf.Output, size tf.Output, offsets tf.Output, optional ...ExtractGlimpseAttr) (glimpse tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ExtractGlimpse", + Input: []tf.Input{ + input, size, offsets, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns the number of gradients aggregated in the given accumulators. +// +// Arguments: +// +// handle: The handle to an accumulator. +// +// Returns The number of gradients aggregated in the given accumulator. +func ResourceAccumulatorNumAccumulated(scope *Scope, handle tf.Output) (num_accumulated tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "ResourceAccumulatorNumAccumulated", + Input: []tf.Input{ + handle, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Sends the named tensor to another XLA computation. Wraps the XLA Send operator +// +// documented at +// +// https://www.tensorflow.org/performance/xla/operation_semantics#send . +// +// Arguments: +// +// tensor: The tensor to send. +// tensor_name: A string key that identifies the channel. +// +// Returns the created operation. +func XlaSend(scope *Scope, tensor tf.Output, tensor_name string) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"tensor_name": tensor_name} + opspec := tf.OpSpec{ + Type: "XlaSend", + Input: []tf.Input{ + tensor, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// Computes hyperbolic sine of x element-wise. +// +// Given an input tensor, this function computes hyperbolic sine of every +// element in the tensor. Input range is `[-inf,inf]` and output range +// is `[-inf,inf]`. +// +// ```python +// x = tf.constant([-float("inf"), -9, -0.5, 1, 1.2, 2, 10, float("inf")]) +// tf.math.sinh(x) ==> [-inf -4.0515420e+03 -5.2109528e-01 1.1752012e+00 1.5094614e+00 3.6268604e+00 1.1013232e+04 inf] +// ``` +func Sinh(scope *Scope, x tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Sinh", + Input: []tf.Input{ + x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Produces a summary of any statistics recorded by the given statistics manager. +func ExperimentalStatsAggregatorSummary(scope *Scope, iterator tf.Output) (summary tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "ExperimentalStatsAggregatorSummary", + Input: []tf.Input{ + iterator, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// MatrixDiagV3Attr is an optional argument to MatrixDiagV3. +type MatrixDiagV3Attr func(optionalAttr) + +// MatrixDiagV3Align sets the optional align attribute to value. +// +// value: Some diagonals are shorter than `max_diag_len` and need to be padded. `align` is +// a string specifying how superdiagonals and subdiagonals should be aligned, +// respectively. There are four possible alignments: "RIGHT_LEFT" (default), +// "LEFT_RIGHT", "LEFT_LEFT", and "RIGHT_RIGHT". "RIGHT_LEFT" aligns superdiagonals +// to the right (left-pads the row) and subdiagonals to the left (right-pads the +// row). It is the packing format LAPACK uses. cuSPARSE uses "LEFT_RIGHT", which is +// the opposite alignment. +// If not specified, defaults to "RIGHT_LEFT" +func MatrixDiagV3Align(value string) MatrixDiagV3Attr { + return func(m optionalAttr) { + m["align"] = value + } +} + +// Returns a batched diagonal tensor with given batched diagonal values. +// +// Returns a tensor with the contents in `diagonal` as `k[0]`-th to `k[1]`-th +// diagonals of a matrix, with everything else padded with `padding`. `num_rows` +// and `num_cols` specify the dimension of the innermost matrix of the output. If +// both are not specified, the op assumes the innermost matrix is square and infers +// its size from `k` and the innermost dimension of `diagonal`. If only one of them +// is specified, the op assumes the unspecified value is the smallest possible +// based on other criteria. +// +// Let `diagonal` have `r` dimensions `[I, J, ..., L, M, N]`. The output tensor has +// rank `r+1` with shape `[I, J, ..., L, M, num_rows, num_cols]` when only one +// diagonal is given (`k` is an integer or `k[0] == k[1]`). Otherwise, it has rank +// `r` with shape `[I, J, ..., L, num_rows, num_cols]`. +// +// The second innermost dimension of `diagonal` has double meaning. +// When `k` is scalar or `k[0] == k[1]`, `M` is part of the batch size +// [I, J, ..., M], and the output tensor is: +// +// ``` +// output[i, j, ..., l, m, n] +// +// = diagonal[i, j, ..., l, n-max(d_upper, 0)] ; if n - m == d_upper +// padding_value ; otherwise +// +// ``` +// +// Otherwise, `M` is treated as the number of diagonals for the matrix in the +// same batch (`M = k[1]-k[0]+1`), and the output tensor is: +// +// ``` +// output[i, j, ..., l, m, n] +// +// = diagonal[i, j, ..., l, diag_index, index_in_diag] ; if k[0] <= d <= k[1] +// padding_value ; otherwise +// +// ``` +// where `d = n - m`, `diag_index = [k] - d`, and +// `index_in_diag = n - max(d, 0) + offset`. +// +// `offset` is zero except when the alignment of the diagonal is to the right. +// ``` +// offset = max_diag_len - diag_len(d) ; if (`align` in {RIGHT_LEFT, RIGHT_RIGHT} +// +// and `d >= 0`) or +// (`align` in {LEFT_RIGHT, RIGHT_RIGHT} +// and `d <= 0`) +// 0 ; otherwise +// +// ``` +// where `diag_len(d) = min(cols - max(d, 0), rows + min(d, 0))`. +// +// For example: +// +// ``` +// # The main diagonal. +// diagonal = np.array([[1, 2, 3, 4], # Input shape: (2, 4) +// +// [5, 6, 7, 8]]) +// +// tf.matrix_diag(diagonal) ==> [[[1, 0, 0, 0], # Output shape: (2, 4, 4) +// +// [0, 2, 0, 0], +// [0, 0, 3, 0], +// [0, 0, 0, 4]], +// [[5, 0, 0, 0], +// [0, 6, 0, 0], +// [0, 0, 7, 0], +// [0, 0, 0, 8]]] +// +// # A superdiagonal (per batch). +// diagonal = np.array([[1, 2, 3], # Input shape: (2, 3) +// +// [4, 5, 6]]) +// +// tf.matrix_diag(diagonal, k = 1) +// +// ==> [[[0, 1, 0, 0], # Output shape: (2, 4, 4) +// [0, 0, 2, 0], +// [0, 0, 0, 3], +// [0, 0, 0, 0]], +// [[0, 4, 0, 0], +// [0, 0, 5, 0], +// [0, 0, 0, 6], +// [0, 0, 0, 0]]] +// +// # A tridiagonal band (per batch). +// diagonals = np.array([[[0, 8, 9], # Input shape: (2, 2, 3) +// +// [1, 2, 3], +// [4, 5, 0]], +// [[0, 2, 3], +// [6, 7, 9], +// [9, 1, 0]]]) +// +// tf.matrix_diag(diagonals, k = (-1, 1)) +// +// ==> [[[1, 8, 0], # Output shape: (2, 3, 3) +// [4, 2, 9], +// [0, 5, 3]], +// [[6, 2, 0], +// [9, 7, 3], +// [0, 1, 9]]] +// +// # LEFT_RIGHT alignment. +// diagonals = np.array([[[8, 9, 0], # Input shape: (2, 2, 3) +// +// [1, 2, 3], +// [0, 4, 5]], +// [[2, 3, 0], +// [6, 7, 9], +// [0, 9, 1]]]) +// +// tf.matrix_diag(diagonals, k = (-1, 1), align="LEFT_RIGHT") +// +// ==> [[[1, 8, 0], # Output shape: (2, 3, 3) +// [4, 2, 9], +// [0, 5, 3]], +// [[6, 2, 0], +// [9, 7, 3], +// [0, 1, 9]]] +// +// # Rectangular matrix. +// diagonal = np.array([1, 2]) # Input shape: (2) +// tf.matrix_diag(diagonal, k = -1, num_rows = 3, num_cols = 4) +// +// ==> [[0, 0, 0, 0], # Output shape: (3, 4) +// [1, 0, 0, 0], +// [0, 2, 0, 0]] +// +// # Rectangular matrix with inferred num_cols and padding_value = 9. +// tf.matrix_diag(diagonal, k = -1, num_rows = 3, padding_value = 9) +// +// ==> [[9, 9], # Output shape: (3, 2) +// [1, 9], +// [9, 2]] +// +// ``` +// +// Arguments: +// +// diagonal: Rank `r`, where `r >= 1` +// k: Diagonal offset(s). Positive value means superdiagonal, 0 refers to the main +// +// diagonal, and negative value means subdiagonals. `k` can be a single integer +// (for a single diagonal) or a pair of integers specifying the low and high ends +// of a matrix band. `k[0]` must not be larger than `k[1]`. +// +// num_rows: The number of rows of the output matrix. If it is not provided, the op assumes +// +// the output matrix is a square matrix and infers the matrix size from k and the +// innermost dimension of `diagonal`. +// +// num_cols: The number of columns of the output matrix. If it is not provided, the op +// +// assumes the output matrix is a square matrix and infers the matrix size from +// k and the innermost dimension of `diagonal`. +// +// padding_value: The number to fill the area outside the specified diagonal band with. +// +// Default is 0. +// +// Returns Has rank `r+1` when `k` is an integer or `k[0] == k[1]`, rank `r` otherwise. +func MatrixDiagV3(scope *Scope, diagonal tf.Output, k tf.Output, num_rows tf.Output, num_cols tf.Output, padding_value tf.Output, optional ...MatrixDiagV3Attr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "MatrixDiagV3", + Input: []tf.Input{ + diagonal, k, num_rows, num_cols, padding_value, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Converts a (possibly batched) CSRSparesMatrix to a SparseTensor. +// +// Arguments: +// +// sparse_matrix: A (possibly batched) CSRSparseMatrix. +// +// Returns: +// +// indices: SparseTensor indices. +// values: SparseTensor values. +// dense_shape: SparseTensor dense shape. +func CSRSparseMatrixToSparseTensor(scope *Scope, sparse_matrix tf.Output, type_ tf.DataType) (indices tf.Output, values tf.Output, dense_shape tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"type": type_} + opspec := tf.OpSpec{ + Type: "CSRSparseMatrixToSparseTensor", + Input: []tf.Input{ + sparse_matrix, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// QuantizeAndDequantizeV3Attr is an optional argument to QuantizeAndDequantizeV3. +type QuantizeAndDequantizeV3Attr func(optionalAttr) + +// QuantizeAndDequantizeV3SignedInput sets the optional signed_input attribute to value. +// If not specified, defaults to true +func QuantizeAndDequantizeV3SignedInput(value bool) QuantizeAndDequantizeV3Attr { + return func(m optionalAttr) { + m["signed_input"] = value + } +} + +// QuantizeAndDequantizeV3RangeGiven sets the optional range_given attribute to value. +// If not specified, defaults to true +func QuantizeAndDequantizeV3RangeGiven(value bool) QuantizeAndDequantizeV3Attr { + return func(m optionalAttr) { + m["range_given"] = value + } +} + +// QuantizeAndDequantizeV3NarrowRange sets the optional narrow_range attribute to value. +// If not specified, defaults to false +func QuantizeAndDequantizeV3NarrowRange(value bool) QuantizeAndDequantizeV3Attr { + return func(m optionalAttr) { + m["narrow_range"] = value + } +} + +// QuantizeAndDequantizeV3Axis sets the optional axis attribute to value. +// If not specified, defaults to -1 +func QuantizeAndDequantizeV3Axis(value int64) QuantizeAndDequantizeV3Attr { + return func(m optionalAttr) { + m["axis"] = value + } +} + +// Quantizes then dequantizes a tensor. +// +// This is almost identical to QuantizeAndDequantizeV2, except that num_bits is a +// tensor, so its value can change during training. +func QuantizeAndDequantizeV3(scope *Scope, input tf.Output, input_min tf.Output, input_max tf.Output, num_bits tf.Output, optional ...QuantizeAndDequantizeV3Attr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "QuantizeAndDequantizeV3", + Input: []tf.Input{ + input, input_min, input_max, num_bits, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ShardDatasetAttr is an optional argument to ShardDataset. +type ShardDatasetAttr func(optionalAttr) + +// ShardDatasetRequireNonEmpty sets the optional require_non_empty attribute to value. +// If not specified, defaults to false +func ShardDatasetRequireNonEmpty(value bool) ShardDatasetAttr { + return func(m optionalAttr) { + m["require_non_empty"] = value + } +} + +// ShardDatasetMetadata sets the optional metadata attribute to value. +// If not specified, defaults to "" +func ShardDatasetMetadata(value string) ShardDatasetAttr { + return func(m optionalAttr) { + m["metadata"] = value + } +} + +// Creates a `Dataset` that includes only 1/`num_shards` of this dataset. +// +// Arguments: +// +// num_shards: An integer representing the number of shards operating in parallel. +// index: An integer representing the current worker index. +func ShardDataset(scope *Scope, input_dataset tf.Output, num_shards tf.Output, index tf.Output, output_types []tf.DataType, output_shapes []tf.Shape, optional ...ShardDatasetAttr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ShardDataset", + Input: []tf.Input{ + input_dataset, num_shards, index, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ResourceApplyRMSPropAttr is an optional argument to ResourceApplyRMSProp. +type ResourceApplyRMSPropAttr func(optionalAttr) + +// ResourceApplyRMSPropUseLocking sets the optional use_locking attribute to value. +// +// value: If `True`, updating of the var, ms, and mom tensors is protected +// by a lock; otherwise the behavior is undefined, but may exhibit less +// contention. +// If not specified, defaults to false +func ResourceApplyRMSPropUseLocking(value bool) ResourceApplyRMSPropAttr { + return func(m optionalAttr) { + m["use_locking"] = value + } +} + +// Update '*var' according to the RMSProp algorithm. +// +// Note that in dense implementation of this algorithm, ms and mom will +// update even if the grad is zero, but in this sparse implementation, ms +// and mom will not update in iterations during which the grad is zero. +// +// mean_square = decay * mean_square + (1-decay) * gradient ** 2 +// Delta = learning_rate * gradient / sqrt(mean_square + epsilon) +// +// ms <- rho * ms_{t-1} + (1-rho) * grad * grad +// mom <- momentum * mom_{t-1} + lr * grad / sqrt(ms + epsilon) +// var <- var - mom +// +// Arguments: +// +// var_: Should be from a Variable(). +// ms: Should be from a Variable(). +// mom: Should be from a Variable(). +// lr: Scaling factor. Must be a scalar. +// rho: Decay rate. Must be a scalar. +// +// epsilon: Ridge term. Must be a scalar. +// grad: The gradient. +// +// Returns the created operation. +func ResourceApplyRMSProp(scope *Scope, var_ tf.Output, ms tf.Output, mom tf.Output, lr tf.Output, rho tf.Output, momentum tf.Output, epsilon tf.Output, grad tf.Output, optional ...ResourceApplyRMSPropAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ResourceApplyRMSProp", + Input: []tf.Input{ + var_, ms, mom, lr, rho, momentum, epsilon, grad, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// This op is used as a placeholder in If branch functions. It doesn't provide a +// valid output when run, so must either be removed (e.g. replaced with a +// function input) or guaranteed not to be used (e.g. if mirroring an +// intermediate output needed for the gradient computation of the other branch). +// +// Arguments: +// +// dtype: The type of the output. +// shape: The purported shape of the output. This is only used for shape inference; +// the output will not necessarily have this shape. Can be a partial shape. +// +// Returns \"Fake\" output value. This should not be consumed by another op. +func FakeParam(scope *Scope, dtype tf.DataType, shape tf.Shape) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtype": dtype, "shape": shape} + opspec := tf.OpSpec{ + Type: "FakeParam", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// InfeedEnqueueTupleAttr is an optional argument to InfeedEnqueueTuple. +type InfeedEnqueueTupleAttr func(optionalAttr) + +// InfeedEnqueueTupleLayouts sets the optional layouts attribute to value. +// +// value: A vector holding the requested layout in minor-to-major sequence for +// all the tuple shapes, in the order the shapes appear in the "shapes" input. +// The layout elements for a sub-shape can be set to -1, in which case the +// corresponding layout will be computed by the infeed operation. +// If not specified, defaults to <> +func InfeedEnqueueTupleLayouts(value []int64) InfeedEnqueueTupleAttr { + return func(m optionalAttr) { + m["layouts"] = value + } +} + +// InfeedEnqueueTupleDeviceOrdinal sets the optional device_ordinal attribute to value. +// +// value: The TPU device to use. This should be -1 when the Op +// is running on a TPU device, and >= 0 when the Op is running on the CPU +// device. +// If not specified, defaults to -1 +func InfeedEnqueueTupleDeviceOrdinal(value int64) InfeedEnqueueTupleAttr { + return func(m optionalAttr) { + m["device_ordinal"] = value + } +} + +// Feeds multiple Tensor values into the computation as an XLA tuple. +// +// Arguments: +// +// inputs: A list of tensors that will be provided using the infeed mechanism. +// shapes: The shapes of each tensor in `inputs`. +// +// Returns the created operation. +func InfeedEnqueueTuple(scope *Scope, inputs []tf.Output, shapes []tf.Shape, optional ...InfeedEnqueueTupleAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"shapes": shapes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "InfeedEnqueueTuple", + Input: []tf.Input{ + tf.OutputList(inputs), + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// Tensor contraction according to Einstein summation convention. +// +// Implements generalized Tensor contraction and reduction. Each input Tensor must +// have a corresponding input subscript appearing in the comma-separated left-hand +// side of the equation. The right-hand side of the equation consists of the +// output subscript. The input subscripts and the output subscript should consist +// of zero or more named axis labels and at most one ellipsis (`...`). +// +// The named axis labels may be any single character other than those having +// special meaning, namely `,.->`. The behavior of this Op is undefined if it +// receives an ill-formatted equation; since the validation is done at +// graph-building time, we omit format validation checks at runtime. +// +// Note: This Op is *not* intended to be called by the user; instead users should +// call `tf.einsum` directly. It is a hidden Op used by `tf.einsum`. +// +// Operations are applied to the input(s) according to the following rules: +// +// (a) Generalized Diagonals: For input dimensions corresponding to axis labels +// appearing more than once in the same input subscript, we take the +// generalized (`k`-dimensional) diagonal. +// For example, in the equation `iii->i` with input shape `[3, 3, 3]`, the +// generalized diagonal would consist of `3` elements at indices `(0, 0, 0)`, +// `(1, 1, 1)` and `(2, 2, 2)` to create a Tensor of shape `[3]`. +// +// (b) Reduction: Axes corresponding to labels appearing only in one input +// subscript but not in the output subscript are summed over prior to Tensor +// contraction. +// For example, in the equation `ab,bc->b`, the axis labels `a` and `c` are +// the reduction axis labels. +// +// (c) Batch Dimensions: Axes corresponding to labels appearing in each of the +// input subscripts and also in the output subscript make up the batch +// dimensions in Tensor contraction. Unnamed axis labels corresponding to +// ellipsis (`...`) also correspond to batch dimensions. +// For example, for the equation denoting batch matrix multiplication, +// `bij,bjk->bik`, the axis label `b` corresponds to a batch dimension. +// +// (d) Contraction: In case of binary einsum, axes corresponding to labels +// appearing in two different inputs (and not in the output) are contracted +// against each other. +// Considering the batch matrix multiplication equation again +// (`bij,bjk->bik`), the contracted axis label is `j`. +// +// (e) Expand Diagonal: If the output subscripts contain repeated (explicit) axis +// labels, the opposite operation of (a) is applied. For example, in the +// equation `i->iii`, and input shape `[3]`, the output of shape `[3, 3, 3]` +// are all zeros, except for the (generalized) diagonal which is populated +// with values from the input. +// Note: This operation is not supported by `np.einsum` or `tf.einsum`; it is +// provided to enable computing the symbolic gradient of `tf.einsum`. +// +// The output subscripts must contain only labels appearing in at least one of the +// input subscripts. Furthermore, all dimensions mapping to the same axis label +// must be equal. +// +// Any of the input and output subscripts may contain at most a single ellipsis +// (`...`). These ellipsis are mapped against dimensions not corresponding to any +// named axis label. If two inputs contain ellipsis, then they are broadcasted +// according to standard NumPy broadcasting +// [rules](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html). +// +// The broadcasted dimensions are placed in the corresponding location of the +// ellipsis in the output subscript. If the broadcasted dimensions are non-empty +// and the output subscripts do not contain ellipsis, then an InvalidArgument error +// is raised. +// +// @compatibility(numpy) +// Similar to [`numpy.einsum`](https://docs.scipy.org/doc/numpy/reference/generated/numpy.einsum.html). +// +// Comparison with `numpy.einsum`: +// +// - This Op only supports unary and binary forms of `numpy.einsum`. +// - This Op does not support implicit form. (i.e. equations without `->`). +// - This Op also supports repeated indices in the output subscript, which is not +// supported by `numpy.einsum`. +// +// @end_compatibility +// +// Arguments: +// +// inputs: List of 1 or 2 Tensors. +// equation: String describing the Einstein Summation operation; in the format of np.einsum. +// +// Returns Output Tensor with shape depending upon `equation`. +func Einsum(scope *Scope, inputs []tf.Output, equation string) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"equation": equation} + opspec := tf.OpSpec{ + Type: "Einsum", + Input: []tf.Input{ + tf.OutputList(inputs), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// A placeholder op for a value that will be fed into the computation. +// +// Arguments: +// +// dtype: The type of elements in the tensor. +// shape: The shape of the tensor. +// +// Returns A tensor that will be provided using the infeed mechanism. +func InfeedDequeue(scope *Scope, dtype tf.DataType, shape tf.Shape) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtype": dtype, "shape": shape} + opspec := tf.OpSpec{ + Type: "InfeedDequeue", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Flush the quantile summaries from each quantile stream resource. +// +// An op that outputs a list of quantile summaries of a quantile stream resource. +// Each summary Tensor is rank 2, containing summaries (value, weight, min_rank, +// max_rank) for a single feature. +// +// Arguments: +// +// quantile_stream_resource_handle: resource handle referring to a QuantileStreamResource. +func BoostedTreesFlushQuantileSummaries(scope *Scope, quantile_stream_resource_handle tf.Output, num_features int64) (summaries []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_features": num_features} + opspec := tf.OpSpec{ + Type: "BoostedTreesFlushQuantileSummaries", + Input: []tf.Input{ + quantile_stream_resource_handle, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if summaries, idx, err = makeOutputList(op, idx, "summaries"); err != nil { + scope.UpdateErr("BoostedTreesFlushQuantileSummaries", err) + return + } + return summaries +} + +// MapStageAttr is an optional argument to MapStage. +type MapStageAttr func(optionalAttr) + +// MapStageCapacity sets the optional capacity attribute to value. +// +// value: Maximum number of elements in the Staging Area. If > 0, inserts +// on the container will block when the capacity is reached. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func MapStageCapacity(value int64) MapStageAttr { + return func(m optionalAttr) { + m["capacity"] = value + } +} + +// MapStageMemoryLimit sets the optional memory_limit attribute to value. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func MapStageMemoryLimit(value int64) MapStageAttr { + return func(m optionalAttr) { + m["memory_limit"] = value + } +} + +// MapStageContainer sets the optional container attribute to value. +// +// value: If non-empty, this queue is placed in the given container. Otherwise, +// a default container is used. +// If not specified, defaults to "" +func MapStageContainer(value string) MapStageAttr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// MapStageSharedName sets the optional shared_name attribute to value. +// +// value: It is necessary to match this name to the matching Unstage Op. +// If not specified, defaults to "" +func MapStageSharedName(value string) MapStageAttr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// Stage (key, values) in the underlying container which behaves like a hashtable. +// +// Arguments: +// +// key: int64 +// +// values: a list of tensors +// +// dtypes A list of data types that inserted values should adhere to. +// +// Returns the created operation. +func MapStage(scope *Scope, key tf.Output, indices tf.Output, values []tf.Output, dtypes []tf.DataType, optional ...MapStageAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtypes": dtypes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "MapStage", + Input: []tf.Input{ + key, indices, tf.OutputList(values), + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// EncodeProtoAttr is an optional argument to EncodeProto. +type EncodeProtoAttr func(optionalAttr) + +// EncodeProtoDescriptorSource sets the optional descriptor_source attribute to value. +// If not specified, defaults to "local://" +func EncodeProtoDescriptorSource(value string) EncodeProtoAttr { + return func(m optionalAttr) { + m["descriptor_source"] = value + } +} + +// The op serializes protobuf messages provided in the input tensors. +// +// The types of the tensors in `values` must match the schema for the fields +// specified in `field_names`. All the tensors in `values` must have a common +// shape prefix, *batch_shape*. +// +// The `sizes` tensor specifies repeat counts for each field. The repeat count +// (last dimension) of a each tensor in `values` must be greater than or equal +// to corresponding repeat count in `sizes`. +// +// A `message_type` name must be provided to give context for the field names. +// The actual message descriptor can be looked up either in the linked-in +// descriptor pool or a filename provided by the caller using the +// `descriptor_source` attribute. +// +// For the most part, the mapping between Proto field types and TensorFlow dtypes +// is straightforward. However, there are a few special cases: +// +// - A proto field that contains a submessage or group can only be converted +// to `DT_STRING` (the serialized submessage). This is to reduce the complexity +// of the API. The resulting string can be used as input to another instance of +// the decode_proto op. +// +// - TensorFlow lacks support for unsigned integers. The ops represent uint64 +// types as a `DT_INT64` with the same twos-complement bit pattern (the obvious +// way). Unsigned int32 values can be represented exactly by specifying type +// `DT_INT64`, or using twos-complement if the caller specifies `DT_INT32` in +// the `output_types` attribute. +// +// The `descriptor_source` attribute selects the source of protocol +// descriptors to consult when looking up `message_type`. This may be: +// +// - An empty string or "local://", in which case protocol descriptors are +// created for C++ (not Python) proto definitions linked to the binary. +// +// - A file, in which case protocol descriptors are created from the file, +// which is expected to contain a `FileDescriptorSet` serialized as a string. +// NOTE: You can build a `descriptor_source` file using the `--descriptor_set_out` +// and `--include_imports` options to the protocol compiler `protoc`. +// +// - A "bytes://", in which protocol descriptors are created from ``, +// which is expected to be a `FileDescriptorSet` serialized as a string. +// +// Arguments: +// +// sizes: Tensor of int32 with shape `[batch_shape, len(field_names)]`. +// values: List of tensors containing values for the corresponding field. +// field_names: List of strings containing proto field names. +// message_type: Name of the proto message type to decode. +// +// Returns Tensor of serialized protos with shape `batch_shape`. +func EncodeProto(scope *Scope, sizes tf.Output, values []tf.Output, field_names []string, message_type string, optional ...EncodeProtoAttr) (bytes tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"field_names": field_names, "message_type": message_type} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "EncodeProto", + Input: []tf.Input{ + sizes, tf.OutputList(values), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// RaggedCountSparseOutputAttr is an optional argument to RaggedCountSparseOutput. +type RaggedCountSparseOutputAttr func(optionalAttr) + +// RaggedCountSparseOutputMinlength sets the optional minlength attribute to value. +// +// value: Minimum value to count. Can be set to -1 for no minimum. +// If not specified, defaults to -1 +// +// REQUIRES: value >= -1 +func RaggedCountSparseOutputMinlength(value int64) RaggedCountSparseOutputAttr { + return func(m optionalAttr) { + m["minlength"] = value + } +} + +// RaggedCountSparseOutputMaxlength sets the optional maxlength attribute to value. +// +// value: Maximum value to count. Can be set to -1 for no maximum. +// If not specified, defaults to -1 +// +// REQUIRES: value >= -1 +func RaggedCountSparseOutputMaxlength(value int64) RaggedCountSparseOutputAttr { + return func(m optionalAttr) { + m["maxlength"] = value + } +} + +// Performs sparse-output bin counting for a ragged tensor input. +// +// Counts the number of times each value occurs in the input. +// +// Arguments: +// +// splits: Tensor containing the row splits of the ragged tensor to count. +// values: Tensor containing values of the sparse tensor to count. +// weights: A Tensor of the same shape as indices containing per-index weight values. +// +// May also be the empty tensor if no weights are used. +// +// binary_output: Whether to output the number of occurrences of each value or 1. +// +// Returns: +// +// output_indices: Indices tensor for the resulting sparse tensor object. +// output_values: Values tensor for the resulting sparse tensor object. +// output_dense_shape: Shape tensor for the resulting sparse tensor object. +// END +// } +// attr { +// name: "T" +// description: < +// +// +// +// Arguments: +// +// partitions: Any shape. Indices in the range `[0, num_partitions)`. +// num_partitions: The number of partitions to output. +func DynamicPartition(scope *Scope, data tf.Output, partitions tf.Output, num_partitions int64) (outputs []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_partitions": num_partitions} + opspec := tf.OpSpec{ + Type: "DynamicPartition", + Input: []tf.Input{ + data, partitions, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if outputs, idx, err = makeOutputList(op, idx, "outputs"); err != nil { + scope.UpdateErr("DynamicPartition", err) + return + } + return outputs +} + +// Returns the number of records this Reader has produced. +// +// This is the same as the number of ReaderRead executions that have +// succeeded. +// +// Arguments: +// +// reader_handle: Handle to a Reader. +func ReaderNumRecordsProducedV2(scope *Scope, reader_handle tf.Output) (records_produced tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "ReaderNumRecordsProducedV2", + Input: []tf.Input{ + reader_handle, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Makes a new iterator from the given `dataset` and stores it in `iterator`. +// +// This operation may be executed multiple times. Each execution will reset the +// iterator in `iterator` to the first element of `dataset`. +// +// Returns the created operation. +func MakeIterator(scope *Scope, dataset tf.Output, iterator tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "MakeIterator", + Input: []tf.Input{ + dataset, iterator, + }, + } + return scope.AddOperation(opspec) +} + +// StatefulStandardNormalV2Attr is an optional argument to StatefulStandardNormalV2. +type StatefulStandardNormalV2Attr func(optionalAttr) + +// StatefulStandardNormalV2Dtype sets the optional dtype attribute to value. +// +// value: The type of the output. +// If not specified, defaults to DT_FLOAT +func StatefulStandardNormalV2Dtype(value tf.DataType) StatefulStandardNormalV2Attr { + return func(m optionalAttr) { + m["dtype"] = value + } +} + +// Outputs random values from a normal distribution. +// +// The generated values will have mean 0 and standard deviation 1. +// +// Arguments: +// +// resource: The handle of the resource variable that stores the state of the RNG. +// algorithm: The RNG algorithm. +// shape: The shape of the output tensor. +// +// Returns A tensor of the specified shape filled with random normal values. +func StatefulStandardNormalV2(scope *Scope, resource tf.Output, algorithm tf.Output, shape tf.Output, optional ...StatefulStandardNormalV2Attr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "StatefulStandardNormalV2", + Input: []tf.Input{ + resource, algorithm, shape, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// EncodeBase64Attr is an optional argument to EncodeBase64. +type EncodeBase64Attr func(optionalAttr) + +// EncodeBase64Pad sets the optional pad attribute to value. +// +// value: Bool whether padding is applied at the ends. +// If not specified, defaults to false +func EncodeBase64Pad(value bool) EncodeBase64Attr { + return func(m optionalAttr) { + m["pad"] = value + } +} + +// Encode strings into web-safe base64 format. +// +// Refer to the following article for more information on base64 format: +// en.wikipedia.org/wiki/Base64. Base64 strings may have padding with '=' at the +// end so that the encoded has length multiple of 4. See Padding section of the +// link above. +// +// Web-safe means that the encoder uses - and _ instead of + and /. +// +// Arguments: +// +// input: Strings to be encoded. +// +// Returns Input strings encoded in base64. +func EncodeBase64(scope *Scope, input tf.Output, optional ...EncodeBase64Attr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "EncodeBase64", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Creates and returns an empty tensor map. +// +// handle: an empty tensor map +func EmptyTensorMap(scope *Scope) (handle tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "EmptyTensorMap", + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// MaxPool3DGradGradAttr is an optional argument to MaxPool3DGradGrad. +type MaxPool3DGradGradAttr func(optionalAttr) + +// MaxPool3DGradGradDataFormat sets the optional data_format attribute to value. +// +// value: The data format of the input and output data. With the +// default format "NDHWC", the data is stored in the order of: +// +// [batch, in_depth, in_height, in_width, in_channels]. +// +// Alternatively, the format could be "NCDHW", the data storage order is: +// +// [batch, in_channels, in_depth, in_height, in_width]. +// +// If not specified, defaults to "NDHWC" +func MaxPool3DGradGradDataFormat(value string) MaxPool3DGradGradAttr { + return func(m optionalAttr) { + m["data_format"] = value + } +} + +// Computes second-order gradients of the maxpooling function. +// +// Arguments: +// +// orig_input: The original input tensor. +// orig_output: The original output tensor. +// grad: Output backprop of shape `[batch, depth, rows, cols, channels]`. +// ksize: 1-D tensor of length 5. The size of the window for each dimension of +// +// the input tensor. Must have `ksize[0] = ksize[4] = 1`. +// +// strides: 1-D tensor of length 5. The stride of the sliding window for each +// +// dimension of `input`. Must have `strides[0] = strides[4] = 1`. +// +// padding: The type of padding algorithm to use. +// +// Returns Gradients of gradients w.r.t. the input to `max_pool`. +func MaxPool3DGradGrad(scope *Scope, orig_input tf.Output, orig_output tf.Output, grad tf.Output, ksize []int64, strides []int64, padding string, optional ...MaxPool3DGradGradAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"ksize": ksize, "strides": strides, "padding": padding} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "MaxPool3DGradGrad", + Input: []tf.Input{ + orig_input, orig_output, grad, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// RandomGammaAttr is an optional argument to RandomGamma. +type RandomGammaAttr func(optionalAttr) + +// RandomGammaSeed sets the optional seed attribute to value. +// +// value: If either `seed` or `seed2` are set to be non-zero, the random number +// generator is seeded by the given seed. Otherwise, it is seeded by a +// random seed. +// If not specified, defaults to 0 +func RandomGammaSeed(value int64) RandomGammaAttr { + return func(m optionalAttr) { + m["seed"] = value + } +} + +// RandomGammaSeed2 sets the optional seed2 attribute to value. +// +// value: A second seed to avoid seed collision. +// If not specified, defaults to 0 +func RandomGammaSeed2(value int64) RandomGammaAttr { + return func(m optionalAttr) { + m["seed2"] = value + } +} + +// Outputs random values from the Gamma distribution(s) described by alpha. +// +// This op uses the algorithm by Marsaglia et al. to acquire samples via +// transformation-rejection from pairs of uniform and normal random variables. +// See http://dl.acm.org/citation.cfm?id=358414 +// +// Arguments: +// +// shape: 1-D integer tensor. Shape of independent samples to draw from each +// +// distribution described by the shape parameters given in alpha. +// +// alpha: A tensor in which each scalar is a "shape" parameter describing the +// +// associated gamma distribution. +// +// Returns A tensor with shape `shape + shape(alpha)`. Each slice +// `[:, ..., :, i0, i1, ...iN]` contains the samples drawn for +// `alpha[i0, i1, ...iN]`. The dtype of the output matches the dtype of alpha. +func RandomGamma(scope *Scope, shape tf.Output, alpha tf.Output, optional ...RandomGammaAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "RandomGamma", + Input: []tf.Input{ + shape, alpha, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// StatefulStandardNormalAttr is an optional argument to StatefulStandardNormal. +type StatefulStandardNormalAttr func(optionalAttr) + +// StatefulStandardNormalDtype sets the optional dtype attribute to value. +// +// value: The type of the output. +// If not specified, defaults to DT_FLOAT +func StatefulStandardNormalDtype(value tf.DataType) StatefulStandardNormalAttr { + return func(m optionalAttr) { + m["dtype"] = value + } +} + +// Outputs random values from a normal distribution. This op is deprecated in favor of op 'StatefulStandardNormalV2' +// +// DEPRECATED at GraphDef version 29: Use StatefulStandardNormalV2 instead +// +// The generated values will have mean 0 and standard deviation 1. +// +// Arguments: +// +// resource: The handle of the resource variable that stores the state of the RNG. +// shape: The shape of the output tensor. +// +// Returns A tensor of the specified shape filled with random normal values. +func StatefulStandardNormal(scope *Scope, resource tf.Output, shape tf.Output, optional ...StatefulStandardNormalAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "StatefulStandardNormal", + Input: []tf.Input{ + resource, shape, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Output a fact about factorials. +func Fact(scope *Scope) (fact tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Fact", + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// TensorArrayConcatV2Attr is an optional argument to TensorArrayConcatV2. +type TensorArrayConcatV2Attr func(optionalAttr) + +// TensorArrayConcatV2ElementShapeExcept0 sets the optional element_shape_except0 attribute to value. +// If not specified, defaults to +func TensorArrayConcatV2ElementShapeExcept0(value tf.Shape) TensorArrayConcatV2Attr { + return func(m optionalAttr) { + m["element_shape_except0"] = value + } +} + +// Deprecated. Use TensorArrayConcatV3 +func TensorArrayConcatV2(scope *Scope, handle tf.Output, flow_in tf.Output, dtype tf.DataType, optional ...TensorArrayConcatV2Attr) (value tf.Output, lengths tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtype": dtype} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "TensorArrayConcatV2", + Input: []tf.Input{ + handle, flow_in, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// InitializeTableFromTextFileV2Attr is an optional argument to InitializeTableFromTextFileV2. +type InitializeTableFromTextFileV2Attr func(optionalAttr) + +// InitializeTableFromTextFileV2VocabSize sets the optional vocab_size attribute to value. +// +// value: Number of elements of the file, use -1 if unknown. +// If not specified, defaults to -1 +// +// REQUIRES: value >= -1 +func InitializeTableFromTextFileV2VocabSize(value int64) InitializeTableFromTextFileV2Attr { + return func(m optionalAttr) { + m["vocab_size"] = value + } +} + +// InitializeTableFromTextFileV2Delimiter sets the optional delimiter attribute to value. +// +// value: Delimiter to separate fields in a line. +// If not specified, defaults to "\t" +func InitializeTableFromTextFileV2Delimiter(value string) InitializeTableFromTextFileV2Attr { + return func(m optionalAttr) { + m["delimiter"] = value + } +} + +// InitializeTableFromTextFileV2Offset sets the optional offset attribute to value. +// If not specified, defaults to 0 +func InitializeTableFromTextFileV2Offset(value int64) InitializeTableFromTextFileV2Attr { + return func(m optionalAttr) { + m["offset"] = value + } +} + +// Initializes a table from a text file. +// +// It inserts one key-value pair into the table for each line of the file. +// The key and value is extracted from the whole line content, elements from the +// split line based on `delimiter` or the line number (starting from zero). +// Where to extract the key and value from a line is specified by `key_index` and +// `value_index`. +// +// - A value of -1 means use the line number(starting from zero), expects `int64`. +// - A value of -2 means use the whole line content, expects `string`. +// - A value >= 0 means use the index (starting at zero) of the split line based +// on `delimiter`. +// +// Arguments: +// +// table_handle: Handle to a table which will be initialized. +// filename: Filename of a vocabulary text file. +// key_index: Column index in a line to get the table `key` values from. +// value_index: Column index that represents information of a line to get the table +// +// `value` values from. +// +// Returns the created operation. +func InitializeTableFromTextFileV2(scope *Scope, table_handle tf.Output, filename tf.Output, key_index int64, value_index int64, optional ...InitializeTableFromTextFileV2Attr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"key_index": key_index, "value_index": value_index} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "InitializeTableFromTextFileV2", + Input: []tf.Input{ + table_handle, filename, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// Converts each string in the input Tensor to its hash mod by a number of buckets. +// +// The hash function is deterministic on the content of the string within the +// process and will never change. However, it is not suitable for cryptography. +// This function may be used when CPU time is scarce and inputs are trusted or +// unimportant. There is a risk of adversaries constructing inputs that all hash +// to the same bucket. To prevent this problem, use a strong hash function with +// `tf.string_to_hash_bucket_strong`. +// +// Examples: +// +// >>> tf.strings.to_hash_bucket_fast(["Hello", "TensorFlow", "2.x"], 3).numpy() +// array([0, 2, 2]) +// +// Arguments: +// +// input: The strings to assign a hash bucket. +// num_buckets: The number of buckets. +// +// Returns A Tensor of the same shape as the input `string_tensor`. +func StringToHashBucketFast(scope *Scope, input tf.Output, num_buckets int64) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_buckets": num_buckets} + opspec := tf.OpSpec{ + Type: "StringToHashBucketFast", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ResizeBicubicAttr is an optional argument to ResizeBicubic. +type ResizeBicubicAttr func(optionalAttr) + +// ResizeBicubicAlignCorners sets the optional align_corners attribute to value. +// +// value: If true, the centers of the 4 corner pixels of the input and output tensors are +// aligned, preserving the values at the corner pixels. Defaults to false. +// If not specified, defaults to false +func ResizeBicubicAlignCorners(value bool) ResizeBicubicAttr { + return func(m optionalAttr) { + m["align_corners"] = value + } +} + +// ResizeBicubicHalfPixelCenters sets the optional half_pixel_centers attribute to value. +// If not specified, defaults to false +func ResizeBicubicHalfPixelCenters(value bool) ResizeBicubicAttr { + return func(m optionalAttr) { + m["half_pixel_centers"] = value + } +} + +// Resize `images` to `size` using bicubic interpolation. +// +// Input images can be of different types but output images are always float. +// +// Arguments: +// +// images: 4-D with shape `[batch, height, width, channels]`. +// size: = A 1-D int32 Tensor of 2 elements: `new_height, new_width`. The +// +// new size for the images. +// +// Returns 4-D with shape +// `[batch, new_height, new_width, channels]`. +func ResizeBicubic(scope *Scope, images tf.Output, size tf.Output, optional ...ResizeBicubicAttr) (resized_images tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ResizeBicubic", + Input: []tf.Input{ + images, size, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// UniformCandidateSamplerAttr is an optional argument to UniformCandidateSampler. +type UniformCandidateSamplerAttr func(optionalAttr) + +// UniformCandidateSamplerSeed sets the optional seed attribute to value. +// +// value: If either seed or seed2 are set to be non-zero, the random number +// generator is seeded by the given seed. Otherwise, it is seeded by a +// random seed. +// If not specified, defaults to 0 +func UniformCandidateSamplerSeed(value int64) UniformCandidateSamplerAttr { + return func(m optionalAttr) { + m["seed"] = value + } +} + +// UniformCandidateSamplerSeed2 sets the optional seed2 attribute to value. +// +// value: An second seed to avoid seed collision. +// If not specified, defaults to 0 +func UniformCandidateSamplerSeed2(value int64) UniformCandidateSamplerAttr { + return func(m optionalAttr) { + m["seed2"] = value + } +} + +// Generates labels for candidate sampling with a uniform distribution. +// +// See explanations of candidate sampling and the data formats at +// go/candidate-sampling. +// +// For each batch, this op picks a single set of sampled candidate labels. +// +// The advantages of sampling candidates per-batch are simplicity and the +// possibility of efficient dense matrix multiplication. The disadvantage is that +// the sampled candidates must be chosen independently of the context and of the +// true labels. +// +// Arguments: +// +// true_classes: A batch_size * num_true matrix, in which each row contains the +// +// IDs of the num_true target_classes in the corresponding original label. +// +// num_true: Number of true labels per context. +// num_sampled: Number of candidates to randomly sample. +// unique: If unique is true, we sample with rejection, so that all sampled +// +// candidates in a batch are unique. This requires some approximation to +// estimate the post-rejection sampling probabilities. +// +// range_max: The sampler will sample integers from the interval [0, range_max). +// +// Returns: +// +// sampled_candidates: A vector of length num_sampled, in which each element is +// +// the ID of a sampled candidate. +// +// true_expected_count: A batch_size * num_true matrix, representing +// +// the number of times each candidate is expected to occur in a batch +// of sampled candidates. If unique=true, then this is a probability. +// +// sampled_expected_count: A vector of length num_sampled, for each sampled +// +// candidate representing the number of times the candidate is expected +// to occur in a batch of sampled candidates. If unique=true, then this is a +// probability. +func UniformCandidateSampler(scope *Scope, true_classes tf.Output, num_true int64, num_sampled int64, unique bool, range_max int64, optional ...UniformCandidateSamplerAttr) (sampled_candidates tf.Output, true_expected_count tf.Output, sampled_expected_count tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_true": num_true, "num_sampled": num_sampled, "unique": unique, "range_max": range_max} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "UniformCandidateSampler", + Input: []tf.Input{ + true_classes, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// StageSizeAttr is an optional argument to StageSize. +type StageSizeAttr func(optionalAttr) + +// StageSizeCapacity sets the optional capacity attribute to value. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func StageSizeCapacity(value int64) StageSizeAttr { + return func(m optionalAttr) { + m["capacity"] = value + } +} + +// StageSizeMemoryLimit sets the optional memory_limit attribute to value. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func StageSizeMemoryLimit(value int64) StageSizeAttr { + return func(m optionalAttr) { + m["memory_limit"] = value + } +} + +// StageSizeContainer sets the optional container attribute to value. +// If not specified, defaults to "" +func StageSizeContainer(value string) StageSizeAttr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// StageSizeSharedName sets the optional shared_name attribute to value. +// If not specified, defaults to "" +func StageSizeSharedName(value string) StageSizeAttr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// Op returns the number of elements in the underlying container. +func StageSize(scope *Scope, dtypes []tf.DataType, optional ...StageSizeAttr) (size tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtypes": dtypes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "StageSize", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// CumulativeLogsumexpAttr is an optional argument to CumulativeLogsumexp. +type CumulativeLogsumexpAttr func(optionalAttr) + +// CumulativeLogsumexpExclusive sets the optional exclusive attribute to value. +// +// value: If `True`, perform exclusive cumulative log-sum-exp. +// If not specified, defaults to false +func CumulativeLogsumexpExclusive(value bool) CumulativeLogsumexpAttr { + return func(m optionalAttr) { + m["exclusive"] = value + } +} + +// CumulativeLogsumexpReverse sets the optional reverse attribute to value. +// +// value: A `bool` (default: False). +// If not specified, defaults to false +func CumulativeLogsumexpReverse(value bool) CumulativeLogsumexpAttr { + return func(m optionalAttr) { + m["reverse"] = value + } +} + +// Compute the cumulative product of the tensor `x` along `axis`. +// +// By default, this op performs an inclusive cumulative log-sum-exp, +// which means that the first +// element of the input is identical to the first element of the output: +// ```python +// tf.math.cumulative_logsumexp([a, b, c]) # => [a, log(exp(a) + exp(b)), log(exp(a) + exp(b) + exp(c))] +// ``` +// +// By setting the `exclusive` kwarg to `True`, an exclusive cumulative log-sum-exp is +// performed instead: +// ```python +// tf.cumulative_logsumexp([a, b, c], exclusive=True) # => [-inf, a, log(exp(a) * exp(b))] +// ``` +// Note that the neutral element of the log-sum-exp operation is `-inf`, +// however, for performance reasons, the minimal value representable by the +// floating point type is used instead. +// +// By setting the `reverse` kwarg to `True`, the cumulative log-sum-exp is performed in the +// opposite direction. +// +// Arguments: +// +// x: A `Tensor`. Must be one of the following types: `float16`, `float32`, `float64`. +// axis: A `Tensor` of type `int32` (default: 0). Must be in the range +// +// `[-rank(x), rank(x))`. +func CumulativeLogsumexp(scope *Scope, x tf.Output, axis tf.Output, optional ...CumulativeLogsumexpAttr) (out tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "CumulativeLogsumexp", + Input: []tf.Input{ + x, axis, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// CTCLossV2Attr is an optional argument to CTCLossV2. +type CTCLossV2Attr func(optionalAttr) + +// CTCLossV2PreprocessCollapseRepeated sets the optional preprocess_collapse_repeated attribute to value. +// +// value: Scalar, if true then repeated labels are +// collapsed prior to the CTC calculation. +// If not specified, defaults to false +func CTCLossV2PreprocessCollapseRepeated(value bool) CTCLossV2Attr { + return func(m optionalAttr) { + m["preprocess_collapse_repeated"] = value + } +} + +// CTCLossV2CtcMergeRepeated sets the optional ctc_merge_repeated attribute to value. +// +// value: Scalar. If set to false, *during* CTC calculation +// repeated non-blank labels will not be merged and are interpreted as +// individual labels. This is a simplified version of CTC. +// If not specified, defaults to true +func CTCLossV2CtcMergeRepeated(value bool) CTCLossV2Attr { + return func(m optionalAttr) { + m["ctc_merge_repeated"] = value + } +} + +// CTCLossV2IgnoreLongerOutputsThanInputs sets the optional ignore_longer_outputs_than_inputs attribute to value. +// +// value: Scalar. If set to true, during CTC +// calculation, items that have longer output sequences than input sequences +// are skipped: they don't contribute to the loss term and have zero-gradient. +// If not specified, defaults to false +func CTCLossV2IgnoreLongerOutputsThanInputs(value bool) CTCLossV2Attr { + return func(m optionalAttr) { + m["ignore_longer_outputs_than_inputs"] = value + } +} + +// Calculates the CTC Loss (log probability) for each batch entry. Also calculates +// +// the gradient. This class performs the softmax operation for you, so inputs +// should be e.g. linear projections of outputs by an LSTM. +// +// Arguments: +// +// inputs: 3-D, shape: `(max_time x batch_size x num_classes)`, the logits. Default blank +// +// label is 0 rather num_classes - 1. +// +// labels_indices: The indices of a `SparseTensor`. +// +// `labels_indices(i, :) == [b, t]` means `labels_values(i)` stores the id for +// `(batch b, time t)`. +// +// labels_values: The values (labels) associated with the given batch and time. +// sequence_length: A vector containing sequence lengths (batch). +// +// Returns: +// +// loss: A vector (batch) containing log-probabilities. +// gradient: The gradient of `loss`. 3-D, shape: +// +// `(max_time x batch_size x num_classes)`. +func CTCLossV2(scope *Scope, inputs tf.Output, labels_indices tf.Output, labels_values tf.Output, sequence_length tf.Output, optional ...CTCLossV2Attr) (loss tf.Output, gradient tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "CTCLossV2", + Input: []tf.Input{ + inputs, labels_indices, labels_values, sequence_length, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// Writes a tensor summary. +// +// Writes `tensor` at `step` with `tag` using summary `writer`. +// +// Returns the created operation. +func WriteSummary(scope *Scope, writer tf.Output, step tf.Output, tensor tf.Output, tag tf.Output, summary_metadata tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "WriteSummary", + Input: []tf.Input{ + writer, step, tensor, tag, summary_metadata, + }, + } + return scope.AddOperation(opspec) +} + +// OrderedMapUnstageNoKeyAttr is an optional argument to OrderedMapUnstageNoKey. +type OrderedMapUnstageNoKeyAttr func(optionalAttr) + +// OrderedMapUnstageNoKeyCapacity sets the optional capacity attribute to value. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func OrderedMapUnstageNoKeyCapacity(value int64) OrderedMapUnstageNoKeyAttr { + return func(m optionalAttr) { + m["capacity"] = value + } +} + +// OrderedMapUnstageNoKeyMemoryLimit sets the optional memory_limit attribute to value. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func OrderedMapUnstageNoKeyMemoryLimit(value int64) OrderedMapUnstageNoKeyAttr { + return func(m optionalAttr) { + m["memory_limit"] = value + } +} + +// OrderedMapUnstageNoKeyContainer sets the optional container attribute to value. +// If not specified, defaults to "" +func OrderedMapUnstageNoKeyContainer(value string) OrderedMapUnstageNoKeyAttr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// OrderedMapUnstageNoKeySharedName sets the optional shared_name attribute to value. +// If not specified, defaults to "" +func OrderedMapUnstageNoKeySharedName(value string) OrderedMapUnstageNoKeyAttr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// Op removes and returns the (key, value) element with the smallest +// +// key from the underlying container. If the underlying container +// does not contain elements, the op will block until it does. +func OrderedMapUnstageNoKey(scope *Scope, indices tf.Output, dtypes []tf.DataType, optional ...OrderedMapUnstageNoKeyAttr) (key tf.Output, values []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtypes": dtypes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "OrderedMapUnstageNoKey", + Input: []tf.Input{ + indices, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + key = op.Output(idx) + if values, idx, err = makeOutputList(op, idx, "values"); err != nil { + scope.UpdateErr("OrderedMapUnstageNoKey", err) + return + } + return key, values +} + +// Returns a diagonal tensor with a given diagonal values. +// +// Given a `diagonal`, this operation returns a tensor with the `diagonal` and +// everything else padded with zeros. The diagonal is computed as follows: +// +// Assume `diagonal` has dimensions [D1,..., Dk], then the output is a tensor of +// rank 2k with dimensions [D1,..., Dk, D1,..., Dk] where: +// +// `output[i1,..., ik, i1,..., ik] = diagonal[i1, ..., ik]` and 0 everywhere else. +// +// For example: +// +// ``` +// # 'diagonal' is [1, 2, 3, 4] +// tf.diag(diagonal) ==> [[1, 0, 0, 0] +// +// [0, 2, 0, 0] +// [0, 0, 3, 0] +// [0, 0, 0, 4]] +// +// ``` +// +// Arguments: +// +// diagonal: Rank k tensor where k is at most 1. +func Diag(scope *Scope, diagonal tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Diag", + Input: []tf.Input{ + diagonal, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Produce a string tensor that encodes the state of a Reader. +// +// Not all Readers support being serialized, so this can produce an +// Unimplemented error. +// +// Arguments: +// +// reader_handle: Handle to a Reader. +func ReaderSerializeStateV2(scope *Scope, reader_handle tf.Output) (state tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "ReaderSerializeStateV2", + Input: []tf.Input{ + reader_handle, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// SerializeIteratorAttr is an optional argument to SerializeIterator. +type SerializeIteratorAttr func(optionalAttr) + +// SerializeIteratorExternalStatePolicy sets the optional external_state_policy attribute to value. +// If not specified, defaults to 0 +func SerializeIteratorExternalStatePolicy(value int64) SerializeIteratorAttr { + return func(m optionalAttr) { + m["external_state_policy"] = value + } +} + +// Converts the given `resource_handle` representing an iterator to a variant tensor. +// +// Arguments: +// +// resource_handle: A handle to an iterator resource. +// +// Returns A variant tensor storing the state of the iterator contained in the +// resource. +func SerializeIterator(scope *Scope, resource_handle tf.Output, optional ...SerializeIteratorAttr) (serialized tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "SerializeIterator", + Input: []tf.Input{ + resource_handle, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Deprecated. Disallowed in GraphDef version >= 2. +// +// DEPRECATED at GraphDef version 2: Use AdjustContrastv2 instead +func AdjustContrast(scope *Scope, images tf.Output, contrast_factor tf.Output, min_value tf.Output, max_value tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "AdjustContrast", + Input: []tf.Input{ + images, contrast_factor, min_value, max_value, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Resizes the list. +// +// input_handle: the input list +// size: size of the output list +func TensorListResize(scope *Scope, input_handle tf.Output, size tf.Output) (output_handle tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "TensorListResize", + Input: []tf.Input{ + input_handle, size, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Outputs deterministic pseudorandom random numbers from a Poisson distribution. +// +// Outputs random values from a Poisson distribution. +// +// The outputs are a deterministic function of `shape`, `seed`, and `lam`. +// +// Arguments: +// +// shape: The shape of the output tensor. +// seed: 2 seeds (shape [2]). +// lam: The rate of the Poisson distribution. Shape must match the rightmost dimensions +// +// of `shape`. +// +// dtype: The type of the output. +// +// Returns Random values with specified shape. +func StatelessRandomPoisson(scope *Scope, shape tf.Output, seed tf.Output, lam tf.Output, dtype tf.DataType) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtype": dtype} + opspec := tf.OpSpec{ + Type: "StatelessRandomPoisson", + Input: []tf.Input{ + shape, seed, lam, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Debugging/model interpretability outputs for each example. +// +// It traverses all the trees and computes debug metrics for individual examples, +// such as getting split feature ids and logits after each split along the decision +// path used to compute directional feature contributions. +// +// Arguments: +// +// bucketized_features: A list of rank 1 Tensors containing bucket id for each +// +// feature. +// +// logits_dimension: scalar, dimension of the logits, to be used for constructing the protos in +// +// examples_debug_outputs_serialized. +// +// Returns Output rank 1 Tensor containing a proto serialized as a string for each example. +func BoostedTreesExampleDebugOutputs(scope *Scope, tree_ensemble_handle tf.Output, bucketized_features []tf.Output, logits_dimension int64) (examples_debug_outputs_serialized tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"logits_dimension": logits_dimension} + opspec := tf.OpSpec{ + Type: "BoostedTreesExampleDebugOutputs", + Input: []tf.Input{ + tree_ensemble_handle, tf.OutputList(bucketized_features), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Asserts that compilation succeeded. This op produces no output and closes the +// +// device during failure to ensure all pending device interactions fail. +// +// 'compilation_status' is a serialized CompilationResultProto. +// +// Returns the created operation. +func TPUCompileSucceededAssert(scope *Scope, compilation_status tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "TPUCompileSucceededAssert", + Input: []tf.Input{ + compilation_status, + }, + } + return scope.AddOperation(opspec) +} + +// Concatenates tensors along one dimension. +// +// Arguments: +// +// concat_dim: 0-D. The dimension along which to concatenate. Must be in the +// +// range [0, rank(values)). +// +// values: The `N` Tensors to concatenate. Their ranks and types must match, +// +// and their sizes must match in all dimensions except `concat_dim`. +// +// Returns A `Tensor` with the concatenation of values stacked along the +// `concat_dim` dimension. This tensor's shape matches that of `values` except +// in `concat_dim` where it has the sum of the sizes. +func Concat(scope *Scope, concat_dim tf.Output, values []tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Concat", + Input: []tf.Input{ + concat_dim, tf.OutputList(values), + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes the gradient for the sqrt of `x` wrt its input. +// +// Specifically, `grad = dy * 0.5 / y`, where `y = sqrt(x)`, and `dy` +// is the corresponding input gradient. +func SqrtGrad(scope *Scope, y tf.Output, dy tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "SqrtGrad", + Input: []tf.Input{ + y, dy, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// QuantizedMatMulWithBiasAttr is an optional argument to QuantizedMatMulWithBias. +type QuantizedMatMulWithBiasAttr func(optionalAttr) + +// QuantizedMatMulWithBiasToutput sets the optional Toutput attribute to value. +// If not specified, defaults to DT_QINT32 +func QuantizedMatMulWithBiasToutput(value tf.DataType) QuantizedMatMulWithBiasAttr { + return func(m optionalAttr) { + m["Toutput"] = value + } +} + +// QuantizedMatMulWithBiasTransposeA sets the optional transpose_a attribute to value. +// +// value: If true, `a` is transposed before multiplication. +// If not specified, defaults to false +func QuantizedMatMulWithBiasTransposeA(value bool) QuantizedMatMulWithBiasAttr { + return func(m optionalAttr) { + m["transpose_a"] = value + } +} + +// QuantizedMatMulWithBiasTransposeB sets the optional transpose_b attribute to value. +// +// value: If true, `b` is transposed before multiplication. +// If not specified, defaults to false +func QuantizedMatMulWithBiasTransposeB(value bool) QuantizedMatMulWithBiasAttr { + return func(m optionalAttr) { + m["transpose_b"] = value + } +} + +// QuantizedMatMulWithBiasInputQuantMode sets the optional input_quant_mode attribute to value. +// +// value: Input data quantization mode. Either MIN_FIRST(default) or SCALED. +// If not specified, defaults to "MIN_FIRST" +func QuantizedMatMulWithBiasInputQuantMode(value string) QuantizedMatMulWithBiasAttr { + return func(m optionalAttr) { + m["input_quant_mode"] = value + } +} + +// Performs a quantized matrix multiplication of `a` by the matrix `b` with bias +// add. +// +// The inputs must be two-dimensional matrices and 1D bias vector. And the inner +// dimension of `a` (after being transposed if `transpose_a` is non-zero) must +// match the outer dimension of `b` (after being transposed if `transposed_b` is +// non-zero). Then do broadcast add operation with bias values on the matrix +// multiplication result. The bias size must match inner dimension of `b`. +// +// Arguments: +// +// a: A matrix to be multiplied. Must be a two-dimensional tensor of type `quint8`. +// b: A matrix to be multiplied and must be a two-dimensional tensor of type `qint8`. +// bias: A 1D bias tensor with size matching inner dimension of `b` (after being +// +// transposed if `transposed_b` is non-zero). +// +// min_a: The float value that the lowest quantized `a` value represents. +// max_a: The float value that the highest quantized `a` value represents. +// min_b: The float value that the lowest quantized `b` value represents. +// max_b: The float value that the highest quantized `b` value represents. +// +// Returns: +// +// out +// min_out: The float value that the lowest quantized output value represents. +// max_out: The float value that the highest quantized output value represents. +func QuantizedMatMulWithBias(scope *Scope, a tf.Output, b tf.Output, bias tf.Output, min_a tf.Output, max_a tf.Output, min_b tf.Output, max_b tf.Output, optional ...QuantizedMatMulWithBiasAttr) (out tf.Output, min_out tf.Output, max_out tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "QuantizedMatMulWithBias", + Input: []tf.Input{ + a, b, bias, min_a, max_a, min_b, max_b, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// Returns the set of files matching one or more glob patterns. +// +// Note that this routine only supports wildcard characters in the +// basename portion of the pattern, not in the directory portion. +// Note also that the order of filenames returned is deterministic. +// +// Arguments: +// +// pattern: Shell wildcard pattern(s). Scalar or vector of type string. +// +// Returns A vector of matching filenames. +func MatchingFiles(scope *Scope, pattern tf.Output) (filenames tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "MatchingFiles", + Input: []tf.Input{ + pattern, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// UnbatchGradAttr is an optional argument to UnbatchGrad. +type UnbatchGradAttr func(optionalAttr) + +// UnbatchGradContainer sets the optional container attribute to value. +// If not specified, defaults to "" +func UnbatchGradContainer(value string) UnbatchGradAttr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// UnbatchGradSharedName sets the optional shared_name attribute to value. +// If not specified, defaults to "" +func UnbatchGradSharedName(value string) UnbatchGradAttr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// Gradient of Unbatch. +// +// Acts like Batch but using the given batch_index index of batching things as they +// become available. This ensures that the gradients are propagated back in the +// same session which did the forward pass. +// +// original_input: The input to the Unbatch operation this is the gradient of. +// batch_index: The batch_index given to the Unbatch operation this is the gradient +// of. +// grad: The downstream gradient. +// id: The id scalar emitted by Batch. +// batched_grad: The return value, either an empty tensor or the batched gradient. +// container: Container to control resource sharing. +// shared_name: Instances of UnbatchGrad with the same container and shared_name +// +// are assumed to possibly belong to the same batch. If left empty, the op name +// will be used as the shared name. +func UnbatchGrad(scope *Scope, original_input tf.Output, batch_index tf.Output, grad tf.Output, id tf.Output, optional ...UnbatchGradAttr) (batched_grad tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "UnbatchGrad", + Input: []tf.Input{ + original_input, batch_index, grad, id, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Reads and outputs the entire contents of the input filename. +func ReadFile(scope *Scope, filename tf.Output) (contents tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "ReadFile", + Input: []tf.Input{ + filename, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns the cardinality of `input_dataset`. +// +// Returns the cardinality of `input_dataset`. +// +// Arguments: +// +// input_dataset: A variant tensor representing the dataset to return cardinality for. +// +// Returns The cardinality of `input_dataset`. Named constants are used to represent +// infinite and unknown cardinality. +func ExperimentalDatasetCardinality(scope *Scope, input_dataset tf.Output) (cardinality tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "ExperimentalDatasetCardinality", + Input: []tf.Input{ + input_dataset, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes the mean along segments of a tensor. +// +// Read +// [the section on segmentation](https://tensorflow.org/api_docs/python/tf/math#Segmentation) +// for an explanation of segments. +// +// Computes a tensor such that +// \\(output_i = \frac{\sum_j data_j}{N}\\) where `mean` is +// over `j` such that `segment_ids[j] == i` and `N` is the total number of +// values summed. +// +// If the mean is empty for a given segment ID `i`, `output[i] = 0`. +// +//
+// +//
+// +// For example: +// +// ``` +// c = tf.constant([[1.0,2,3,4], [4, 3, 2, 1], [5,6,7,8]]) +// tf.segment_mean(c, tf.constant([0, 0, 1])) +// # ==> [[2.5, 2.5, 2.5, 2.5], +// # [5, 6, 7, 8]] +// ``` +// +// Arguments: +// +// segment_ids: A 1-D tensor whose size is equal to the size of `data`'s +// +// first dimension. Values should be sorted and can be repeated. +// +// Returns Has same shape as data, except for dimension 0 which +// has size `k`, the number of segments. +func SegmentMean(scope *Scope, data tf.Output, segment_ids tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "SegmentMean", + Input: []tf.Input{ + data, segment_ids, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// MapIncompleteSizeAttr is an optional argument to MapIncompleteSize. +type MapIncompleteSizeAttr func(optionalAttr) + +// MapIncompleteSizeCapacity sets the optional capacity attribute to value. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func MapIncompleteSizeCapacity(value int64) MapIncompleteSizeAttr { + return func(m optionalAttr) { + m["capacity"] = value + } +} + +// MapIncompleteSizeMemoryLimit sets the optional memory_limit attribute to value. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func MapIncompleteSizeMemoryLimit(value int64) MapIncompleteSizeAttr { + return func(m optionalAttr) { + m["memory_limit"] = value + } +} + +// MapIncompleteSizeContainer sets the optional container attribute to value. +// If not specified, defaults to "" +func MapIncompleteSizeContainer(value string) MapIncompleteSizeAttr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// MapIncompleteSizeSharedName sets the optional shared_name attribute to value. +// If not specified, defaults to "" +func MapIncompleteSizeSharedName(value string) MapIncompleteSizeAttr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// Op returns the number of incomplete elements in the underlying container. +func MapIncompleteSize(scope *Scope, dtypes []tf.DataType, optional ...MapIncompleteSizeAttr) (size tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtypes": dtypes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "MapIncompleteSize", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Saves tensors in V2 checkpoint format. +// +// By default, saves the named tensors in full. If the caller wishes to save +// specific slices of full tensors, "shape_and_slices" should be non-empty strings +// and correspondingly well-formed. +// +// Arguments: +// +// prefix: Must have a single element. The prefix of the V2 checkpoint to which we +// +// write the tensors. +// +// tensor_names: shape {N}. The names of the tensors to be saved. +// shape_and_slices: shape {N}. The slice specs of the tensors to be saved. +// +// Empty strings indicate that they are non-partitioned tensors. +// +// tensors: `N` tensors to save. +// +// Returns the created operation. +func SaveV2(scope *Scope, prefix tf.Output, tensor_names tf.Output, shape_and_slices tf.Output, tensors []tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "SaveV2", + Input: []tf.Input{ + prefix, tensor_names, shape_and_slices, tf.OutputList(tensors), + }, + } + return scope.AddOperation(opspec) +} + +// AssignVariableOpAttr is an optional argument to AssignVariableOp. +type AssignVariableOpAttr func(optionalAttr) + +// AssignVariableOpValidateShape sets the optional validate_shape attribute to value. +// If not specified, defaults to false +func AssignVariableOpValidateShape(value bool) AssignVariableOpAttr { + return func(m optionalAttr) { + m["validate_shape"] = value + } +} + +// Assigns a new value to a variable. +// +// Any ReadVariableOp with a control dependency on this op is guaranteed to return +// this value or a subsequent newer value of the variable. +// +// Arguments: +// +// resource: handle to the resource in which to store the variable. +// value: the value to set the new tensor to use. +// +// Returns the created operation. +func AssignVariableOp(scope *Scope, resource tf.Output, value tf.Output, optional ...AssignVariableOpAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "AssignVariableOp", + Input: []tf.Input{ + resource, value, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// StringUpperAttr is an optional argument to StringUpper. +type StringUpperAttr func(optionalAttr) + +// StringUpperEncoding sets the optional encoding attribute to value. +// If not specified, defaults to "" +func StringUpperEncoding(value string) StringUpperAttr { + return func(m optionalAttr) { + m["encoding"] = value + } +} + +// Converts all lowercase characters into their respective uppercase replacements. +// +// Example: +// +// >>> tf.strings.upper("CamelCase string and ALL CAPS") +// +func StringUpper(scope *Scope, input tf.Output, optional ...StringUpperAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "StringUpper", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// CumprodAttr is an optional argument to Cumprod. +type CumprodAttr func(optionalAttr) + +// CumprodExclusive sets the optional exclusive attribute to value. +// +// value: If `True`, perform exclusive cumprod. +// If not specified, defaults to false +func CumprodExclusive(value bool) CumprodAttr { + return func(m optionalAttr) { + m["exclusive"] = value + } +} + +// CumprodReverse sets the optional reverse attribute to value. +// +// value: A `bool` (default: False). +// If not specified, defaults to false +func CumprodReverse(value bool) CumprodAttr { + return func(m optionalAttr) { + m["reverse"] = value + } +} + +// Compute the cumulative product of the tensor `x` along `axis`. +// +// By default, this op performs an inclusive cumprod, which means that the first +// element of the input is identical to the first element of the output: +// +// ```python +// tf.cumprod([a, b, c]) # => [a, a * b, a * b * c] +// ``` +// +// By setting the `exclusive` kwarg to `True`, an exclusive cumprod is +// performed instead: +// +// ```python +// tf.cumprod([a, b, c], exclusive=True) # => [1, a, a * b] +// ``` +// +// By setting the `reverse` kwarg to `True`, the cumprod is performed in the +// opposite direction: +// +// ```python +// tf.cumprod([a, b, c], reverse=True) # => [a * b * c, b * c, c] +// ``` +// +// This is more efficient than using separate `tf.reverse` ops. +// +// The `reverse` and `exclusive` kwargs can also be combined: +// +// ```python +// tf.cumprod([a, b, c], exclusive=True, reverse=True) # => [b * c, c, 1] +// ``` +// +// Arguments: +// +// x: A `Tensor`. Must be one of the following types: `float32`, `float64`, +// +// `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, +// `complex128`, `qint8`, `quint8`, `qint32`, `half`. +// +// axis: A `Tensor` of type `int32` (default: 0). Must be in the range +// +// `[-rank(x), rank(x))`. +func Cumprod(scope *Scope, x tf.Output, axis tf.Output, optional ...CumprodAttr) (out tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Cumprod", + Input: []tf.Input{ + x, axis, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Writes contents to the file at input filename. Creates file and recursively +// +// creates directory if not existing. +// +// Arguments: +// +// filename: scalar. The name of the file to which we write the contents. +// contents: scalar. The content to be written to the output file. +// +// Returns the created operation. +func WriteFile(scope *Scope, filename tf.Output, contents tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "WriteFile", + Input: []tf.Input{ + filename, contents, + }, + } + return scope.AddOperation(opspec) +} + +// QuantizedResizeBilinearAttr is an optional argument to QuantizedResizeBilinear. +type QuantizedResizeBilinearAttr func(optionalAttr) + +// QuantizedResizeBilinearAlignCorners sets the optional align_corners attribute to value. +// +// value: If true, the centers of the 4 corner pixels of the input and output tensors are +// aligned, preserving the values at the corner pixels. Defaults to false. +// If not specified, defaults to false +func QuantizedResizeBilinearAlignCorners(value bool) QuantizedResizeBilinearAttr { + return func(m optionalAttr) { + m["align_corners"] = value + } +} + +// QuantizedResizeBilinearHalfPixelCenters sets the optional half_pixel_centers attribute to value. +// If not specified, defaults to false +func QuantizedResizeBilinearHalfPixelCenters(value bool) QuantizedResizeBilinearAttr { + return func(m optionalAttr) { + m["half_pixel_centers"] = value + } +} + +// Resize quantized `images` to `size` using quantized bilinear interpolation. +// +// Input images and output images must be quantized types. +// +// Arguments: +// +// images: 4-D with shape `[batch, height, width, channels]`. +// size: = A 1-D int32 Tensor of 2 elements: `new_height, new_width`. The +// +// new size for the images. +// +// Returns: +// +// resized_images: 4-D with shape +// +// `[batch, new_height, new_width, channels]`. +// +// out_min +// out_max +func QuantizedResizeBilinear(scope *Scope, images tf.Output, size tf.Output, min tf.Output, max tf.Output, optional ...QuantizedResizeBilinearAttr) (resized_images tf.Output, out_min tf.Output, out_max tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "QuantizedResizeBilinear", + Input: []tf.Input{ + images, size, min, max, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// Computes inverse hyperbolic cosine of x element-wise. +// +// Given an input tensor, the function computes inverse hyperbolic cosine of every element. +// Input range is `[1, inf]`. It returns `nan` if the input lies outside the range. +// +// ```python +// x = tf.constant([-2, -0.5, 1, 1.2, 200, 10000, float("inf")]) +// tf.math.acosh(x) ==> [nan nan 0. 0.62236255 5.9914584 9.903487 inf] +// ``` +func Acosh(scope *Scope, x tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Acosh", + Input: []tf.Input{ + x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns element-wise largest integer not greater than x. +func Floor(scope *Scope, x tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Floor", + Input: []tf.Input{ + x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// CombinedNonMaxSuppressionAttr is an optional argument to CombinedNonMaxSuppression. +type CombinedNonMaxSuppressionAttr func(optionalAttr) + +// CombinedNonMaxSuppressionPadPerClass sets the optional pad_per_class attribute to value. +// +// value: If false, the output nmsed boxes, scores and classes +// are padded/clipped to `max_total_size`. If true, the +// output nmsed boxes, scores and classes are padded to be of length +// `max_size_per_class`*`num_classes`, unless it exceeds `max_total_size` in +// which case it is clipped to `max_total_size`. Defaults to false. +// If not specified, defaults to false +func CombinedNonMaxSuppressionPadPerClass(value bool) CombinedNonMaxSuppressionAttr { + return func(m optionalAttr) { + m["pad_per_class"] = value + } +} + +// CombinedNonMaxSuppressionClipBoxes sets the optional clip_boxes attribute to value. +// +// value: If true, assume the box coordinates are between [0, 1] and clip the output boxes +// if they fall beyond [0, 1]. If false, do not do clipping and output the box +// coordinates as it is. +// If not specified, defaults to true +func CombinedNonMaxSuppressionClipBoxes(value bool) CombinedNonMaxSuppressionAttr { + return func(m optionalAttr) { + m["clip_boxes"] = value + } +} + +// Greedily selects a subset of bounding boxes in descending order of score, +// +// This operation performs non_max_suppression on the inputs per batch, across +// all classes. +// Prunes away boxes that have high intersection-over-union (IOU) overlap +// with previously selected boxes. Bounding boxes are supplied as +// [y1, x1, y2, x2], where (y1, x1) and (y2, x2) are the coordinates of any +// diagonal pair of box corners and the coordinates can be provided as normalized +// (i.e., lying in the interval [0, 1]) or absolute. Note that this algorithm +// is agnostic to where the origin is in the coordinate system. Also note that +// this algorithm is invariant to orthogonal transformations and translations +// of the coordinate system; thus translating or reflections of the coordinate +// system result in the same boxes being selected by the algorithm. +// The output of this operation is the final boxes, scores and classes tensor +// returned after performing non_max_suppression. +// +// Arguments: +// +// boxes: A 4-D float tensor of shape `[batch_size, num_boxes, q, 4]`. If `q` is 1 then +// +// same boxes are used for all classes otherwise, if `q` is equal to number of +// classes, class-specific boxes are used. +// +// scores: A 3-D float tensor of shape `[batch_size, num_boxes, num_classes]` +// +// representing a single score corresponding to each box (each row of boxes). +// +// max_output_size_per_class: A scalar integer tensor representing the maximum number of +// +// boxes to be selected by non max suppression per class +// +// max_total_size: A scalar representing maximum number of boxes retained over all classes. +// iou_threshold: A 0-D float tensor representing the threshold for deciding whether +// +// boxes overlap too much with respect to IOU. +// +// score_threshold: A 0-D float tensor representing the threshold for deciding when to remove +// +// boxes based on score. +// +// Returns: +// +// nmsed_boxes: A [batch_size, max_detections, 4] float32 tensor +// +// containing the non-max suppressed boxes. +// +// nmsed_scores: A [batch_size, max_detections] float32 tensor +// +// containing the scores for the boxes. +// +// nmsed_classes: A [batch_size, max_detections] float32 tensor +// +// containing the classes for the boxes. +// +// valid_detections: A [batch_size] int32 tensor indicating the number of +// +// valid detections per batch item. Only the top num_detections[i] entries in +// nms_boxes[i], nms_scores[i] and nms_class[i] are valid. The rest of the +// entries are zero paddings. +func CombinedNonMaxSuppression(scope *Scope, boxes tf.Output, scores tf.Output, max_output_size_per_class tf.Output, max_total_size tf.Output, iou_threshold tf.Output, score_threshold tf.Output, optional ...CombinedNonMaxSuppressionAttr) (nmsed_boxes tf.Output, nmsed_scores tf.Output, nmsed_classes tf.Output, valid_detections tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "CombinedNonMaxSuppression", + Input: []tf.Input{ + boxes, scores, max_output_size_per_class, max_total_size, iou_threshold, score_threshold, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2), op.Output(3) +} + +// Returns the truth value of (x >= y) element-wise. +// +// *NOTE*: `GreaterEqual` supports broadcasting. More about broadcasting +// [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) +// +// Example: +// +// ```python +// x = tf.constant([5, 4, 6, 7]) +// y = tf.constant([5, 2, 5, 10]) +// tf.math.greater_equal(x, y) ==> [True, True, True, False] +// +// x = tf.constant([5, 4, 6, 7]) +// y = tf.constant([5]) +// tf.math.greater_equal(x, y) ==> [True, False, True, True] +// ``` +func GreaterEqual(scope *Scope, x tf.Output, y tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "GreaterEqual", + Input: []tf.Input{ + x, y, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Conv3DBackpropInputV2Attr is an optional argument to Conv3DBackpropInputV2. +type Conv3DBackpropInputV2Attr func(optionalAttr) + +// Conv3DBackpropInputV2DataFormat sets the optional data_format attribute to value. +// +// value: The data format of the input and output data. With the +// default format "NDHWC", the data is stored in the order of: +// +// [batch, in_depth, in_height, in_width, in_channels]. +// +// Alternatively, the format could be "NCDHW", the data storage order is: +// +// [batch, in_channels, in_depth, in_height, in_width]. +// +// If not specified, defaults to "NDHWC" +func Conv3DBackpropInputV2DataFormat(value string) Conv3DBackpropInputV2Attr { + return func(m optionalAttr) { + m["data_format"] = value + } +} + +// Conv3DBackpropInputV2Dilations sets the optional dilations attribute to value. +// +// value: 1-D tensor of length 5. The dilation factor for each dimension of +// `input`. If set to k > 1, there will be k-1 skipped cells between each +// filter element on that dimension. The dimension order is determined by the +// value of `data_format`, see above for details. Dilations in the batch and +// depth dimensions must be 1. +// If not specified, defaults to +func Conv3DBackpropInputV2Dilations(value []int64) Conv3DBackpropInputV2Attr { + return func(m optionalAttr) { + m["dilations"] = value + } +} + +// Computes the gradients of 3-D convolution with respect to the input. +// +// Arguments: +// +// input_sizes: An integer vector representing the tensor shape of `input`, +// +// where `input` is a 5-D +// `[batch, depth, rows, cols, in_channels]` tensor. +// +// filter: Shape `[depth, rows, cols, in_channels, out_channels]`. +// +// `in_channels` must match between `input` and `filter`. +// +// out_backprop: Backprop signal of shape `[batch, out_depth, out_rows, out_cols, +// +// out_channels]`. +// +// strides: 1-D tensor of length 5. The stride of the sliding window for each +// +// dimension of `input`. Must have `strides[0] = strides[4] = 1`. +// +// padding: The type of padding algorithm to use. +func Conv3DBackpropInputV2(scope *Scope, input_sizes tf.Output, filter tf.Output, out_backprop tf.Output, strides []int64, padding string, optional ...Conv3DBackpropInputV2Attr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"strides": strides, "padding": padding} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Conv3DBackpropInputV2", + Input: []tf.Input{ + input_sizes, filter, out_backprop, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes the sparse Cholesky decomposition of `input`. +// +// Computes the Sparse Cholesky decomposition of a sparse matrix, with the given +// fill-in reducing permutation. +// +// The input sparse matrix and the fill-in reducing permutation `permutation` must +// have compatible shapes. If the sparse matrix has rank 3; with the batch +// dimension `B`, then the `permutation` must be of rank 2; with the same batch +// dimension `B`. There is no support for broadcasting. +// +// Furthermore, each component vector of `permutation` must be of length `N`, +// containing each of the integers {0, 1, ..., N - 1} exactly once, where `N` is +// the number of rows of each component of the sparse matrix. +// +// Each component of the input sparse matrix must represent a symmetric positive +// definite (SPD) matrix; although only the lower triangular part of the matrix is +// read. If any individual component is not SPD, then an InvalidArgument error is +// thrown. +// +// The returned sparse matrix has the same dense shape as the input sparse matrix. +// For each component `A` of the input sparse matrix, the corresponding output +// sparse matrix represents `L`, the lower triangular Cholesky factor satisfying +// the following identity: +// +// ``` +// +// A = L * Lt +// +// ``` +// +// where Lt denotes the transpose of L (or its conjugate transpose, if `type` is +// `complex64` or `complex128`). +// +// The `type` parameter denotes the type of the matrix elements. The supported +// types are: `float32`, `float64`, `complex64` and `complex128`. +// +// Usage example: +// +// ```python +// +// from tensorflow.python.ops.linalg.sparse import sparse_csr_matrix_ops +// +// a_indices = np.array([[0, 0], [1, 1], [2, 1], [2, 2], [3, 3]]) +// a_values = np.array([1.0, 2.0, 1.0, 3.0, 4.0], np.float32) +// a_dense_shape = [4, 4] +// +// with tf.Session() as sess: +// # Define (COO format) SparseTensor over Numpy array. +// a_st = tf.sparse.SparseTensor(a_indices, a_values, a_dense_shape) +// +// # Convert SparseTensors to CSR SparseMatrix. +// a_sm = sparse_csr_matrix_ops.sparse_tensor_to_csr_sparse_matrix( +// a_st.indices, a_st.values, a_st.dense_shape) +// +// # Obtain the Sparse Cholesky factor using AMD Ordering for reducing zero +// # fill-in (number of structural non-zeros in the sparse Cholesky factor). +// ordering_amd = sparse_csr_matrix_ops.sparse_matrix_ordering_amd(sparse_matrix) +// cholesky_sparse_matrices = ( +// sparse_csr_matrix_ops.sparse_matrix_sparse_cholesky( +// sparse_matrix, ordering_amd, type=tf.float32)) +// +// # Convert the CSRSparseMatrix Cholesky factor to a dense Tensor +// dense_cholesky = sparse_csr_matrix_ops.csr_sparse_matrix_to_dense( +// cholesky_sparse_matrices, tf.float32) +// +// # Evaluate the dense Tensor value. +// dense_cholesky_value = sess.run(dense_cholesky) +// +// ``` +// +// `dense_cholesky_value` stores the dense Cholesky factor: +// +// ``` +// +// [[ 1. 0. 0. 0.] +// [ 0. 1.41 0. 0.] +// [ 0. 0.70 1.58 0.] +// [ 0. 0. 0. 2.]] +// +// ``` +// +// input: A `CSRSparseMatrix`. +// permutation: A `Tensor`. +// type: The type of `input`. +// +// Arguments: +// +// input: A `CSRSparseMatrix`. +// permutation: A fill-in reducing permutation matrix. +// +// Returns The sparse Cholesky decompsition of `input`. +func SparseMatrixSparseCholesky(scope *Scope, input tf.Output, permutation tf.Output, type_ tf.DataType) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"type": type_} + opspec := tf.OpSpec{ + Type: "SparseMatrixSparseCholesky", + Input: []tf.Input{ + input, permutation, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Concatenates a list of `SparseTensor` along the specified dimension. +// +// Concatenation is with respect to the dense versions of these sparse tensors. +// It is assumed that each input is a `SparseTensor` whose elements are ordered +// along increasing dimension number. +// +// All inputs' shapes must match, except for the concat dimension. The +// `indices`, `values`, and `shapes` lists must have the same length. +// +// The output shape is identical to the inputs', except along the concat +// dimension, where it is the sum of the inputs' sizes along that dimension. +// +// The output elements will be resorted to preserve the sort order along +// increasing dimension number. +// +// This op runs in `O(M log M)` time, where `M` is the total number of non-empty +// values across all inputs. This is due to the need for an internal sort in +// order to concatenate efficiently across an arbitrary dimension. +// +// For example, if `concat_dim = 1` and the inputs are +// +// sp_inputs[0]: shape = [2, 3] +// [0, 2]: "a" +// [1, 0]: "b" +// [1, 1]: "c" +// +// sp_inputs[1]: shape = [2, 4] +// [0, 1]: "d" +// [0, 2]: "e" +// +// then the output will be +// +// shape = [2, 7] +// [0, 2]: "a" +// [0, 4]: "d" +// [0, 5]: "e" +// [1, 0]: "b" +// [1, 1]: "c" +// +// Graphically this is equivalent to doing +// +// [ a] concat [ d e ] = [ a d e ] +// [b c ] [ ] [b c ] +// +// Arguments: +// +// indices: 2-D. Indices of each input `SparseTensor`. +// values: 1-D. Non-empty values of each `SparseTensor`. +// shapes: 1-D. Shapes of each `SparseTensor`. +// concat_dim: Dimension to concatenate along. Must be in range [-rank, rank), +// +// where rank is the number of dimensions in each input `SparseTensor`. +// +// Returns: +// +// output_indices: 2-D. Indices of the concatenated `SparseTensor`. +// output_values: 1-D. Non-empty values of the concatenated `SparseTensor`. +// output_shape: 1-D. Shape of the concatenated `SparseTensor`. +func SparseConcat(scope *Scope, indices []tf.Output, values []tf.Output, shapes []tf.Output, concat_dim int64) (output_indices tf.Output, output_values tf.Output, output_shape tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"concat_dim": concat_dim} + opspec := tf.OpSpec{ + Type: "SparseConcat", + Input: []tf.Input{ + tf.OutputList(indices), tf.OutputList(values), tf.OutputList(shapes), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// Inverse fast Fourier transform. +// +// Computes the inverse 1-dimensional discrete Fourier transform over the +// inner-most dimension of `input`. +// +// Arguments: +// +// input: A complex tensor. +// +// Returns A complex tensor of the same shape as `input`. The inner-most +// +// dimension of `input` is replaced with its inverse 1D Fourier transform. +// +// @compatibility(numpy) +// Equivalent to np.fft.ifft +// @end_compatibility +func IFFT(scope *Scope, input tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "IFFT", + Input: []tf.Input{ + input, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Add the quantile summaries to each quantile stream resource. +// +// An op that adds a list of quantile summaries to a quantile stream resource. Each +// summary Tensor is rank 2, containing summaries (value, weight, min_rank, max_rank) +// for a single feature. +// +// Arguments: +// +// quantile_stream_resource_handle: resource handle referring to a QuantileStreamResource. +// summaries: string; List of Rank 2 Tensor each containing the summaries for a single feature. +// +// Returns the created operation. +func BoostedTreesQuantileStreamResourceAddSummaries(scope *Scope, quantile_stream_resource_handle tf.Output, summaries []tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "BoostedTreesQuantileStreamResourceAddSummaries", + Input: []tf.Input{ + quantile_stream_resource_handle, tf.OutputList(summaries), + }, + } + return scope.AddOperation(opspec) +} + +// StatelessRandomBinomialAttr is an optional argument to StatelessRandomBinomial. +type StatelessRandomBinomialAttr func(optionalAttr) + +// StatelessRandomBinomialDtype sets the optional dtype attribute to value. +// +// value: The type of the output. +// If not specified, defaults to DT_INT64 +func StatelessRandomBinomialDtype(value tf.DataType) StatelessRandomBinomialAttr { + return func(m optionalAttr) { + m["dtype"] = value + } +} + +// Outputs deterministic pseudorandom random numbers from a binomial distribution. +// +// Outputs random values from a binomial distribution. +// +// The outputs are a deterministic function of `shape`, `seed`, `counts`, and `probs`. +// +// Arguments: +// +// shape: The shape of the output tensor. +// seed: 2 seeds (shape [2]). +// counts: The counts of the binomial distribution. Must be broadcastable with `probs`, +// +// and broadcastable with the rightmost dimensions of `shape`. +// +// probs: The probability of success for the binomial distribution. Must be broadcastable +// +// with `counts` and broadcastable with the rightmost dimensions of `shape`. +// +// Returns Random values with specified shape. +func StatelessRandomBinomial(scope *Scope, shape tf.Output, seed tf.Output, counts tf.Output, probs tf.Output, optional ...StatelessRandomBinomialAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "StatelessRandomBinomial", + Input: []tf.Input{ + shape, seed, counts, probs, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// CudnnRNNParamsToCanonicalAttr is an optional argument to CudnnRNNParamsToCanonical. +type CudnnRNNParamsToCanonicalAttr func(optionalAttr) + +// CudnnRNNParamsToCanonicalRnnMode sets the optional rnn_mode attribute to value. +// If not specified, defaults to "lstm" +func CudnnRNNParamsToCanonicalRnnMode(value string) CudnnRNNParamsToCanonicalAttr { + return func(m optionalAttr) { + m["rnn_mode"] = value + } +} + +// CudnnRNNParamsToCanonicalInputMode sets the optional input_mode attribute to value. +// If not specified, defaults to "linear_input" +func CudnnRNNParamsToCanonicalInputMode(value string) CudnnRNNParamsToCanonicalAttr { + return func(m optionalAttr) { + m["input_mode"] = value + } +} + +// CudnnRNNParamsToCanonicalDirection sets the optional direction attribute to value. +// If not specified, defaults to "unidirectional" +func CudnnRNNParamsToCanonicalDirection(value string) CudnnRNNParamsToCanonicalAttr { + return func(m optionalAttr) { + m["direction"] = value + } +} + +// CudnnRNNParamsToCanonicalDropout sets the optional dropout attribute to value. +// If not specified, defaults to 0 +func CudnnRNNParamsToCanonicalDropout(value float32) CudnnRNNParamsToCanonicalAttr { + return func(m optionalAttr) { + m["dropout"] = value + } +} + +// CudnnRNNParamsToCanonicalSeed sets the optional seed attribute to value. +// If not specified, defaults to 0 +func CudnnRNNParamsToCanonicalSeed(value int64) CudnnRNNParamsToCanonicalAttr { + return func(m optionalAttr) { + m["seed"] = value + } +} + +// CudnnRNNParamsToCanonicalSeed2 sets the optional seed2 attribute to value. +// If not specified, defaults to 0 +func CudnnRNNParamsToCanonicalSeed2(value int64) CudnnRNNParamsToCanonicalAttr { + return func(m optionalAttr) { + m["seed2"] = value + } +} + +// Retrieves CudnnRNN params in canonical form. +// +// Retrieves a set of weights from the opaque params buffer that can be saved and +// restored in a way compatible with future runs. +// +// Note that the params buffer may not be compatible across different GPUs. So any +// save and restoration should be converted to and from the canonical weights and +// biases. +// +// num_layers: Specifies the number of layers in the RNN model. +// num_units: Specifies the size of the hidden state. +// input_size: Specifies the size of the input state. +// num_params: number of parameter sets for all layers. +// +// Each layer may contain multiple parameter sets, with each set consisting of +// a weight matrix and a bias vector. +// +// weights: the canonical form of weights that can be used for saving +// +// and restoration. They are more likely to be compatible across different +// generations. +// +// biases: the canonical form of biases that can be used for saving +// +// and restoration. They are more likely to be compatible across different +// generations. +// +// rnn_mode: Indicates the type of the RNN model. +// input_mode: Indicate whether there is a linear projection between the input and +// +// The actual computation before the first layer. 'skip_input' is only allowed +// when input_size == num_units; 'auto_select' implies 'skip_input' when +// input_size == num_units; otherwise, it implies 'linear_input'. +// +// direction: Indicates whether a bidirectional model will be used. +// +// dir = (direction == bidirectional) ? 2 : 1 +// +// dropout: dropout probability. When set to 0., dropout is disabled. +// seed: the 1st part of a seed to initialize dropout. +// seed2: the 2nd part of a seed to initialize dropout. +func CudnnRNNParamsToCanonical(scope *Scope, num_layers tf.Output, num_units tf.Output, input_size tf.Output, params tf.Output, num_params int64, optional ...CudnnRNNParamsToCanonicalAttr) (weights []tf.Output, biases []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_params": num_params} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "CudnnRNNParamsToCanonical", + Input: []tf.Input{ + num_layers, num_units, input_size, params, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if weights, idx, err = makeOutputList(op, idx, "weights"); err != nil { + scope.UpdateErr("CudnnRNNParamsToCanonical", err) + return + } + if biases, idx, err = makeOutputList(op, idx, "biases"); err != nil { + scope.UpdateErr("CudnnRNNParamsToCanonical", err) + return + } + return weights, biases +} + +// Elementwise computes the bitwise right-shift of `x` and `y`. +// +// Performs a logical shift for unsigned integer types, and an arithmetic shift +// for signed integer types. +// +// If `y` is negative, or greater than or equal to than the width of `x` in bits +// the result is implementation defined. +// +// Example: +// +// ```python +// import tensorflow as tf +// from tensorflow.python.ops import bitwise_ops +// import numpy as np +// dtype_list = [tf.int8, tf.int16, tf.int32, tf.int64] +// +// for dtype in dtype_list: +// +// lhs = tf.constant([-1, -5, -3, -14], dtype=dtype) +// rhs = tf.constant([5, 0, 7, 11], dtype=dtype) +// +// right_shift_result = bitwise_ops.right_shift(lhs, rhs) +// +// print(right_shift_result) +// +// # This will print: +// # tf.Tensor([-1 -5 -1 -1], shape=(4,), dtype=int8) +// # tf.Tensor([-1 -5 -1 -1], shape=(4,), dtype=int16) +// # tf.Tensor([-1 -5 -1 -1], shape=(4,), dtype=int32) +// # tf.Tensor([-1 -5 -1 -1], shape=(4,), dtype=int64) +// +// lhs = np.array([-2, 64, 101, 32], dtype=np.int8) +// rhs = np.array([-1, -5, -3, -14], dtype=np.int8) +// bitwise_ops.right_shift(lhs, rhs) +// # +// ``` +func RightShift(scope *Scope, x tf.Output, y tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "RightShift", + Input: []tf.Input{ + x, y, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes the minimum along segments of a tensor. +// +// Read +// [the section on segmentation](https://tensorflow.org/api_docs/python/tf/math#Segmentation) +// for an explanation of segments. +// +// Computes a tensor such that +// \\(output_i = \min_j(data_j)\\) where `min` is over `j` such +// that `segment_ids[j] == i`. +// +// If the min is empty for a given segment ID `i`, `output[i] = 0`. +// +//
+// +//
+// +// For example: +// +// ``` +// c = tf.constant([[1,2,3,4], [4, 3, 2, 1], [5,6,7,8]]) +// tf.segment_min(c, tf.constant([0, 0, 1])) +// # ==> [[1, 2, 2, 1], +// # [5, 6, 7, 8]] +// ``` +// +// Arguments: +// +// segment_ids: A 1-D tensor whose size is equal to the size of `data`'s +// +// first dimension. Values should be sorted and can be repeated. +// +// Returns Has same shape as data, except for dimension 0 which +// has size `k`, the number of segments. +func SegmentMin(scope *Scope, data tf.Output, segment_ids tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "SegmentMin", + Input: []tf.Input{ + data, segment_ids, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// FusedBatchNormGradV2Attr is an optional argument to FusedBatchNormGradV2. +type FusedBatchNormGradV2Attr func(optionalAttr) + +// FusedBatchNormGradV2Epsilon sets the optional epsilon attribute to value. +// +// value: A small float number added to the variance of x. +// If not specified, defaults to 0.0001 +func FusedBatchNormGradV2Epsilon(value float32) FusedBatchNormGradV2Attr { + return func(m optionalAttr) { + m["epsilon"] = value + } +} + +// FusedBatchNormGradV2DataFormat sets the optional data_format attribute to value. +// +// value: The data format for y_backprop, x, x_backprop. +// Either "NHWC" (default) or "NCHW". +// If not specified, defaults to "NHWC" +func FusedBatchNormGradV2DataFormat(value string) FusedBatchNormGradV2Attr { + return func(m optionalAttr) { + m["data_format"] = value + } +} + +// FusedBatchNormGradV2IsTraining sets the optional is_training attribute to value. +// +// value: A bool value to indicate the operation is for training (default) +// or inference. +// If not specified, defaults to true +func FusedBatchNormGradV2IsTraining(value bool) FusedBatchNormGradV2Attr { + return func(m optionalAttr) { + m["is_training"] = value + } +} + +// Gradient for batch normalization. +// +// Note that the size of 4D Tensors are defined by either "NHWC" or "NCHW". +// The size of 1D Tensors matches the dimension C of the 4D Tensors. +// +// Arguments: +// +// y_backprop: A 4D Tensor for the gradient with respect to y. +// x: A 4D Tensor for input data. +// scale: A 1D Tensor for scaling factor, to scale the normalized x. +// reserve_space_1: When is_training is True, a 1D Tensor for the computed batch +// +// mean to be reused in gradient computation. When is_training is +// False, a 1D Tensor for the population mean to be reused in both +// 1st and 2nd order gradient computation. +// +// reserve_space_2: When is_training is True, a 1D Tensor for the computed batch +// +// variance (inverted variance in the cuDNN case) to be reused in +// gradient computation. When is_training is False, a 1D Tensor +// for the population variance to be reused in both 1st and 2nd +// order gradient computation. +// +// Returns: +// +// x_backprop: A 4D Tensor for the gradient with respect to x. +// scale_backprop: A 1D Tensor for the gradient with respect to scale. +// offset_backprop: A 1D Tensor for the gradient with respect to offset. +// reserve_space_3: Unused placeholder to match the mean input in FusedBatchNorm. +// reserve_space_4: Unused placeholder to match the variance input +// +// in FusedBatchNorm. +func FusedBatchNormGradV2(scope *Scope, y_backprop tf.Output, x tf.Output, scale tf.Output, reserve_space_1 tf.Output, reserve_space_2 tf.Output, optional ...FusedBatchNormGradV2Attr) (x_backprop tf.Output, scale_backprop tf.Output, offset_backprop tf.Output, reserve_space_3 tf.Output, reserve_space_4 tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "FusedBatchNormGradV2", + Input: []tf.Input{ + y_backprop, x, scale, reserve_space_1, reserve_space_2, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2), op.Output(3), op.Output(4) +} + +// FixedUnigramCandidateSamplerAttr is an optional argument to FixedUnigramCandidateSampler. +type FixedUnigramCandidateSamplerAttr func(optionalAttr) + +// FixedUnigramCandidateSamplerVocabFile sets the optional vocab_file attribute to value. +// +// value: Each valid line in this file (which should have a CSV-like format) +// corresponds to a valid word ID. IDs are in sequential order, starting from +// num_reserved_ids. The last entry in each line is expected to be a value +// corresponding to the count or relative probability. Exactly one of vocab_file +// and unigrams needs to be passed to this op. +// If not specified, defaults to "" +func FixedUnigramCandidateSamplerVocabFile(value string) FixedUnigramCandidateSamplerAttr { + return func(m optionalAttr) { + m["vocab_file"] = value + } +} + +// FixedUnigramCandidateSamplerDistortion sets the optional distortion attribute to value. +// +// value: The distortion is used to skew the unigram probability distribution. +// Each weight is first raised to the distortion's power before adding to the +// internal unigram distribution. As a result, distortion = 1.0 gives regular +// unigram sampling (as defined by the vocab file), and distortion = 0.0 gives +// a uniform distribution. +// If not specified, defaults to 1 +func FixedUnigramCandidateSamplerDistortion(value float32) FixedUnigramCandidateSamplerAttr { + return func(m optionalAttr) { + m["distortion"] = value + } +} + +// FixedUnigramCandidateSamplerNumReservedIds sets the optional num_reserved_ids attribute to value. +// +// value: Optionally some reserved IDs can be added in the range [0, +// ..., num_reserved_ids) by the users. One use case is that a special unknown +// word token is used as ID 0. These IDs will have a sampling probability of 0. +// If not specified, defaults to 0 +func FixedUnigramCandidateSamplerNumReservedIds(value int64) FixedUnigramCandidateSamplerAttr { + return func(m optionalAttr) { + m["num_reserved_ids"] = value + } +} + +// FixedUnigramCandidateSamplerNumShards sets the optional num_shards attribute to value. +// +// value: A sampler can be used to sample from a subset of the original range +// in order to speed up the whole computation through parallelism. This parameter +// (together with 'shard') indicates the number of partitions that are being +// used in the overall computation. +// If not specified, defaults to 1 +// +// REQUIRES: value >= 1 +func FixedUnigramCandidateSamplerNumShards(value int64) FixedUnigramCandidateSamplerAttr { + return func(m optionalAttr) { + m["num_shards"] = value + } +} + +// FixedUnigramCandidateSamplerShard sets the optional shard attribute to value. +// +// value: A sampler can be used to sample from a subset of the original range +// in order to speed up the whole computation through parallelism. This parameter +// (together with 'num_shards') indicates the particular partition number of a +// sampler op, when partitioning is being used. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func FixedUnigramCandidateSamplerShard(value int64) FixedUnigramCandidateSamplerAttr { + return func(m optionalAttr) { + m["shard"] = value + } +} + +// FixedUnigramCandidateSamplerUnigrams sets the optional unigrams attribute to value. +// +// value: A list of unigram counts or probabilities, one per ID in sequential +// order. Exactly one of vocab_file and unigrams should be passed to this op. +// If not specified, defaults to <> +func FixedUnigramCandidateSamplerUnigrams(value []float32) FixedUnigramCandidateSamplerAttr { + return func(m optionalAttr) { + m["unigrams"] = value + } +} + +// FixedUnigramCandidateSamplerSeed sets the optional seed attribute to value. +// +// value: If either seed or seed2 are set to be non-zero, the random number +// generator is seeded by the given seed. Otherwise, it is seeded by a +// random seed. +// If not specified, defaults to 0 +func FixedUnigramCandidateSamplerSeed(value int64) FixedUnigramCandidateSamplerAttr { + return func(m optionalAttr) { + m["seed"] = value + } +} + +// FixedUnigramCandidateSamplerSeed2 sets the optional seed2 attribute to value. +// +// value: An second seed to avoid seed collision. +// If not specified, defaults to 0 +func FixedUnigramCandidateSamplerSeed2(value int64) FixedUnigramCandidateSamplerAttr { + return func(m optionalAttr) { + m["seed2"] = value + } +} + +// Generates labels for candidate sampling with a learned unigram distribution. +// +// A unigram sampler could use a fixed unigram distribution read from a +// file or passed in as an in-memory array instead of building up the distribution +// from data on the fly. There is also an option to skew the distribution by +// applying a distortion power to the weights. +// +// The vocabulary file should be in CSV-like format, with the last field +// being the weight associated with the word. +// +// For each batch, this op picks a single set of sampled candidate labels. +// +// The advantages of sampling candidates per-batch are simplicity and the +// possibility of efficient dense matrix multiplication. The disadvantage is that +// the sampled candidates must be chosen independently of the context and of the +// true labels. +// +// Arguments: +// +// true_classes: A batch_size * num_true matrix, in which each row contains the +// +// IDs of the num_true target_classes in the corresponding original label. +// +// num_true: Number of true labels per context. +// num_sampled: Number of candidates to randomly sample. +// unique: If unique is true, we sample with rejection, so that all sampled +// +// candidates in a batch are unique. This requires some approximation to +// estimate the post-rejection sampling probabilities. +// +// range_max: The sampler will sample integers from the interval [0, range_max). +// +// Returns: +// +// sampled_candidates: A vector of length num_sampled, in which each element is +// +// the ID of a sampled candidate. +// +// true_expected_count: A batch_size * num_true matrix, representing +// +// the number of times each candidate is expected to occur in a batch +// of sampled candidates. If unique=true, then this is a probability. +// +// sampled_expected_count: A vector of length num_sampled, for each sampled +// +// candidate representing the number of times the candidate is expected +// to occur in a batch of sampled candidates. If unique=true, then this is a +// probability. +func FixedUnigramCandidateSampler(scope *Scope, true_classes tf.Output, num_true int64, num_sampled int64, unique bool, range_max int64, optional ...FixedUnigramCandidateSamplerAttr) (sampled_candidates tf.Output, true_expected_count tf.Output, sampled_expected_count tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_true": num_true, "num_sampled": num_sampled, "unique": unique, "range_max": range_max} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "FixedUnigramCandidateSampler", + Input: []tf.Input{ + true_classes, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// AddSparseToTensorsMapAttr is an optional argument to AddSparseToTensorsMap. +type AddSparseToTensorsMapAttr func(optionalAttr) + +// AddSparseToTensorsMapContainer sets the optional container attribute to value. +// +// value: The container name for the `SparseTensorsMap` created by this op. +// If not specified, defaults to "" +func AddSparseToTensorsMapContainer(value string) AddSparseToTensorsMapAttr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// AddSparseToTensorsMapSharedName sets the optional shared_name attribute to value. +// +// value: The shared name for the `SparseTensorsMap` created by this op. +// If blank, the new Operation's unique name is used. +// If not specified, defaults to "" +func AddSparseToTensorsMapSharedName(value string) AddSparseToTensorsMapAttr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// Add a `SparseTensor` to a `SparseTensorsMap` return its handle. +// +// A `SparseTensor` is represented by three tensors: `sparse_indices`, +// `sparse_values`, and `sparse_shape`. +// +// This operator takes the given `SparseTensor` and adds it to a container +// object (a `SparseTensorsMap`). A unique key within this container is generated +// in the form of an `int64`, and this is the value that is returned. +// +// The `SparseTensor` can then be read out as part of a minibatch by passing +// the key as a vector element to `TakeManySparseFromTensorsMap`. To ensure +// the correct `SparseTensorsMap` is accessed, ensure that the same +// `container` and `shared_name` are passed to that Op. If no `shared_name` +// is provided here, instead use the *name* of the Operation created by calling +// `AddSparseToTensorsMap` as the `shared_name` passed to +// `TakeManySparseFromTensorsMap`. Ensure the Operations are colocated. +// +// Arguments: +// +// sparse_indices: 2-D. The `indices` of the `SparseTensor`. +// sparse_values: 1-D. The `values` of the `SparseTensor`. +// sparse_shape: 1-D. The `shape` of the `SparseTensor`. +// +// Returns 0-D. The handle of the `SparseTensor` now stored in the +// `SparseTensorsMap`. +func AddSparseToTensorsMap(scope *Scope, sparse_indices tf.Output, sparse_values tf.Output, sparse_shape tf.Output, optional ...AddSparseToTensorsMapAttr) (sparse_handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "AddSparseToTensorsMap", + Input: []tf.Input{ + sparse_indices, sparse_values, sparse_shape, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// StringJoinAttr is an optional argument to StringJoin. +type StringJoinAttr func(optionalAttr) + +// StringJoinSeparator sets the optional separator attribute to value. +// +// value: string, an optional join separator. +// If not specified, defaults to "" +func StringJoinSeparator(value string) StringJoinAttr { + return func(m optionalAttr) { + m["separator"] = value + } +} + +// Joins the strings in the given list of string tensors into one tensor; +// +// with the given separator (default is an empty separator). +// +// Examples: +// +// >>> s = ["hello", "world", "tensorflow"] +// >>> tf.strings.join(s, " ") +// +// +// Arguments: +// +// inputs: A list of string tensors. The tensors must all have the same shape, +// +// or be scalars. Scalars may be mixed in; these will be broadcast to the shape +// of non-scalar inputs. +func StringJoin(scope *Scope, inputs []tf.Output, optional ...StringJoinAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "StringJoin", + Input: []tf.Input{ + tf.OutputList(inputs), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ResourceSparseApplyFtrlAttr is an optional argument to ResourceSparseApplyFtrl. +type ResourceSparseApplyFtrlAttr func(optionalAttr) + +// ResourceSparseApplyFtrlUseLocking sets the optional use_locking attribute to value. +// +// value: If `True`, updating of the var and accum tensors will be protected +// by a lock; otherwise the behavior is undefined, but may exhibit less +// contention. +// If not specified, defaults to false +func ResourceSparseApplyFtrlUseLocking(value bool) ResourceSparseApplyFtrlAttr { + return func(m optionalAttr) { + m["use_locking"] = value + } +} + +// ResourceSparseApplyFtrlMultiplyLinearByLr sets the optional multiply_linear_by_lr attribute to value. +// If not specified, defaults to false +func ResourceSparseApplyFtrlMultiplyLinearByLr(value bool) ResourceSparseApplyFtrlAttr { + return func(m optionalAttr) { + m["multiply_linear_by_lr"] = value + } +} + +// Update relevant entries in '*var' according to the Ftrl-proximal scheme. +// +// That is for rows we have grad for, we update var, accum and linear as follows: +// accum_new = accum + grad * grad +// linear += grad - (accum_new^(-lr_power) - accum^(-lr_power)) / lr * var +// quadratic = 1.0 / (accum_new^(lr_power) * lr) + 2 * l2 +// var = (sign(linear) * l1 - linear) / quadratic if |linear| > l1 else 0.0 +// accum = accum_new +// +// Arguments: +// +// var_: Should be from a Variable(). +// accum: Should be from a Variable(). +// linear: Should be from a Variable(). +// grad: The gradient. +// indices: A vector of indices into the first dimension of var and accum. +// lr: Scaling factor. Must be a scalar. +// l1: L1 regularization. Must be a scalar. +// l2: L2 regularization. Must be a scalar. +// lr_power: Scaling factor. Must be a scalar. +// +// Returns the created operation. +func ResourceSparseApplyFtrl(scope *Scope, var_ tf.Output, accum tf.Output, linear tf.Output, grad tf.Output, indices tf.Output, lr tf.Output, l1 tf.Output, l2 tf.Output, lr_power tf.Output, optional ...ResourceSparseApplyFtrlAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ResourceSparseApplyFtrl", + Input: []tf.Input{ + var_, accum, linear, grad, indices, lr, l1, l2, lr_power, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// MatrixDiagPartV3Attr is an optional argument to MatrixDiagPartV3. +type MatrixDiagPartV3Attr func(optionalAttr) + +// MatrixDiagPartV3Align sets the optional align attribute to value. +// +// value: Some diagonals are shorter than `max_diag_len` and need to be padded. `align` is +// a string specifying how superdiagonals and subdiagonals should be aligned, +// respectively. There are four possible alignments: "RIGHT_LEFT" (default), +// "LEFT_RIGHT", "LEFT_LEFT", and "RIGHT_RIGHT". "RIGHT_LEFT" aligns superdiagonals +// to the right (left-pads the row) and subdiagonals to the left (right-pads the +// row). It is the packing format LAPACK uses. cuSPARSE uses "LEFT_RIGHT", which is +// the opposite alignment. +// If not specified, defaults to "RIGHT_LEFT" +func MatrixDiagPartV3Align(value string) MatrixDiagPartV3Attr { + return func(m optionalAttr) { + m["align"] = value + } +} + +// Returns the batched diagonal part of a batched tensor. +// +// Returns a tensor with the `k[0]`-th to `k[1]`-th diagonals of the batched +// `input`. +// +// Assume `input` has `r` dimensions `[I, J, ..., L, M, N]`. +// Let `max_diag_len` be the maximum length among all diagonals to be extracted, +// `max_diag_len = min(M + min(k[1], 0), N + min(-k[0], 0))` +// Let `num_diags` be the number of diagonals to extract, +// `num_diags = k[1] - k[0] + 1`. +// +// If `num_diags == 1`, the output tensor is of rank `r - 1` with shape +// `[I, J, ..., L, max_diag_len]` and values: +// +// ``` +// diagonal[i, j, ..., l, n] +// +// = input[i, j, ..., l, n+y, n+x] ; if 0 <= n+y < M and 0 <= n+x < N, +// padding_value ; otherwise. +// +// ``` +// where `y = max(-k[1], 0)`, `x = max(k[1], 0)`. +// +// Otherwise, the output tensor has rank `r` with dimensions +// `[I, J, ..., L, num_diags, max_diag_len]` with values: +// +// ``` +// diagonal[i, j, ..., l, m, n] +// +// = input[i, j, ..., l, n+y, n+x] ; if 0 <= n+y < M and 0 <= n+x < N, +// padding_value ; otherwise. +// +// ``` +// where `d = k[1] - m`, `y = max(-d, 0) - offset`, and `x = max(d, 0) - offset`. +// +// `offset` is zero except when the alignment of the diagonal is to the right. +// ``` +// offset = max_diag_len - diag_len(d) ; if (`align` in {RIGHT_LEFT, RIGHT_RIGHT} +// +// and `d >= 0`) or +// (`align` in {LEFT_RIGHT, RIGHT_RIGHT} +// and `d <= 0`) +// 0 ; otherwise +// +// ``` +// where `diag_len(d) = min(cols - max(d, 0), rows + min(d, 0))`. +// +// The input must be at least a matrix. +// +// For example: +// +// ``` +// input = np.array([[[1, 2, 3, 4], # Input shape: (2, 3, 4) +// +// [5, 6, 7, 8], +// [9, 8, 7, 6]], +// [[5, 4, 3, 2], +// [1, 2, 3, 4], +// [5, 6, 7, 8]]]) +// +// # A main diagonal from each batch. +// tf.matrix_diag_part(input) ==> [[1, 6, 7], # Output shape: (2, 3) +// +// [5, 2, 7]] +// +// # A superdiagonal from each batch. +// tf.matrix_diag_part(input, k = 1) +// +// ==> [[2, 7, 6], # Output shape: (2, 3) +// [4, 3, 8]] +// +// # A band from each batch. +// tf.matrix_diag_part(input, k = (-1, 2)) +// +// ==> [[[0, 3, 8], # Output shape: (2, 4, 3) +// [2, 7, 6], +// [1, 6, 7], +// [5, 8, 0]], +// [[0, 3, 4], +// [4, 3, 8], +// [5, 2, 7], +// [1, 6, 0]]] +// +// # LEFT_RIGHT alignment. +// tf.matrix_diag_part(input, k = (-1, 2), align="LEFT_RIGHT") +// +// ==> [[[3, 8, 0], # Output shape: (2, 4, 3) +// [2, 7, 6], +// [1, 6, 7], +// [0, 5, 8]], +// [[3, 4, 0], +// [4, 3, 8], +// [5, 2, 7], +// [0, 1, 6]]] +// +// # max_diag_len can be shorter than the main diagonal. +// tf.matrix_diag_part(input, k = (-2, -1)) +// +// ==> [[[5, 8], +// [9, 0]], +// [[1, 6], +// [5, 0]]] +// +// # padding_value = 9 +// tf.matrix_diag_part(input, k = (1, 3), padding_value = 9) +// +// ==> [[[9, 9, 4], # Output shape: (2, 3, 3) +// [9, 3, 8], +// [2, 7, 6]], +// [[9, 9, 2], +// [9, 3, 4], +// [4, 3, 8]]] +// +// ``` +// +// Arguments: +// +// input: Rank `r` tensor where `r >= 2`. +// k: Diagonal offset(s). Positive value means superdiagonal, 0 refers to the main +// +// diagonal, and negative value means subdiagonals. `k` can be a single integer +// (for a single diagonal) or a pair of integers specifying the low and high ends +// of a matrix band. `k[0]` must not be larger than `k[1]`. +// +// padding_value: The value to fill the area outside the specified diagonal band with. +// +// Default is 0. +// +// Returns The extracted diagonal(s). +func MatrixDiagPartV3(scope *Scope, input tf.Output, k tf.Output, padding_value tf.Output, optional ...MatrixDiagPartV3Attr) (diagonal tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "MatrixDiagPartV3", + Input: []tf.Input{ + input, k, padding_value, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// AngleAttr is an optional argument to Angle. +type AngleAttr func(optionalAttr) + +// AngleTout sets the optional Tout attribute to value. +// If not specified, defaults to DT_FLOAT +func AngleTout(value tf.DataType) AngleAttr { + return func(m optionalAttr) { + m["Tout"] = value + } +} + +// Returns the argument of a complex number. +// +// Given a tensor `input` of complex numbers, this operation returns a tensor of +// type `float` that is the argument of each element in `input`. All elements in +// `input` must be complex numbers of the form \\(a + bj\\), where *a* +// is the real part and *b* is the imaginary part. +// +// The argument returned by this operation is of the form \\(atan2(b, a)\\). +// +// For example: +// +// ``` +// # tensor 'input' is [-2.25 + 4.75j, 3.25 + 5.75j] +// tf.angle(input) ==> [2.0132, 1.056] +// ``` +// +// @compatibility(numpy) +// Equivalent to np.angle. +// @end_compatibility +func Angle(scope *Scope, input tf.Output, optional ...AngleAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Angle", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Delete the TensorArray from its resource container. +// +// This enables the user to close and release the resource in the middle +// of a step/run. +// +// Arguments: +// +// handle: The handle to a TensorArray (output of TensorArray or TensorArrayGrad). +// +// Returns the created operation. +func TensorArrayCloseV3(scope *Scope, handle tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "TensorArrayCloseV3", + Input: []tf.Input{ + handle, + }, + } + return scope.AddOperation(opspec) +} + +// MaxPoolGradWithArgmaxAttr is an optional argument to MaxPoolGradWithArgmax. +type MaxPoolGradWithArgmaxAttr func(optionalAttr) + +// MaxPoolGradWithArgmaxIncludeBatchInIndex sets the optional include_batch_in_index attribute to value. +// +// value: Whether to include batch dimension in flattened index of `argmax`. +// If not specified, defaults to false +func MaxPoolGradWithArgmaxIncludeBatchInIndex(value bool) MaxPoolGradWithArgmaxAttr { + return func(m optionalAttr) { + m["include_batch_in_index"] = value + } +} + +// Computes gradients of the maxpooling function. +// +// Arguments: +// +// input: The original input. +// grad: 4-D with shape `[batch, height, width, channels]`. Gradients w.r.t. the +// +// output of `max_pool`. +// +// argmax: The indices of the maximum values chosen for each output of `max_pool`. +// ksize: The size of the window for each dimension of the input tensor. +// strides: The stride of the sliding window for each dimension of the +// +// input tensor. +// +// padding: The type of padding algorithm to use. +// +// Returns Gradients w.r.t. the input of `max_pool`. +func MaxPoolGradWithArgmax(scope *Scope, input tf.Output, grad tf.Output, argmax tf.Output, ksize []int64, strides []int64, padding string, optional ...MaxPoolGradWithArgmaxAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"ksize": ksize, "strides": strides, "padding": padding} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "MaxPoolGradWithArgmax", + Input: []tf.Input{ + input, grad, argmax, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// AllAttr is an optional argument to All. +type AllAttr func(optionalAttr) + +// AllKeepDims sets the optional keep_dims attribute to value. +// +// value: If true, retain reduced dimensions with length 1. +// If not specified, defaults to false +func AllKeepDims(value bool) AllAttr { + return func(m optionalAttr) { + m["keep_dims"] = value + } +} + +// Computes the "logical and" of elements across dimensions of a tensor. +// +// Reduces `input` along the dimensions given in `axis`. Unless +// `keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in +// `axis`. If `keep_dims` is true, the reduced dimensions are +// retained with length 1. +// +// Arguments: +// +// input: The tensor to reduce. +// axis: The dimensions to reduce. Must be in the range +// +// `[-rank(input), rank(input))`. +// +// Returns The reduced tensor. +func All(scope *Scope, input tf.Output, axis tf.Output, optional ...AllAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "All", + Input: []tf.Input{ + input, axis, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// CollectiveBcastSendAttr is an optional argument to CollectiveBcastSend. +type CollectiveBcastSendAttr func(optionalAttr) + +// CollectiveBcastSendCommunicationHint sets the optional communication_hint attribute to value. +// If not specified, defaults to "auto" +func CollectiveBcastSendCommunicationHint(value string) CollectiveBcastSendAttr { + return func(m optionalAttr) { + m["communication_hint"] = value + } +} + +// CollectiveBcastSendTimeoutSeconds sets the optional timeout_seconds attribute to value. +// If not specified, defaults to 0 +func CollectiveBcastSendTimeoutSeconds(value float32) CollectiveBcastSendAttr { + return func(m optionalAttr) { + m["timeout_seconds"] = value + } +} + +// Broadcasts a tensor value to one or more other devices. +func CollectiveBcastSend(scope *Scope, input tf.Output, group_size int64, group_key int64, instance_key int64, shape tf.Shape, optional ...CollectiveBcastSendAttr) (data tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"group_size": group_size, "group_key": group_key, "instance_key": instance_key, "shape": shape} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "CollectiveBcastSend", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// SparseMatrixMatMulAttr is an optional argument to SparseMatrixMatMul. +type SparseMatrixMatMulAttr func(optionalAttr) + +// SparseMatrixMatMulTransposeA sets the optional transpose_a attribute to value. +// +// value: Indicates whether `a` should be transposed. +// If not specified, defaults to false +func SparseMatrixMatMulTransposeA(value bool) SparseMatrixMatMulAttr { + return func(m optionalAttr) { + m["transpose_a"] = value + } +} + +// SparseMatrixMatMulTransposeB sets the optional transpose_b attribute to value. +// +// value: Indicates whether `b` should be transposed. +// If not specified, defaults to false +func SparseMatrixMatMulTransposeB(value bool) SparseMatrixMatMulAttr { + return func(m optionalAttr) { + m["transpose_b"] = value + } +} + +// SparseMatrixMatMulAdjointA sets the optional adjoint_a attribute to value. +// +// value: Indicates whether `a` should be conjugate-transposed. +// If not specified, defaults to false +func SparseMatrixMatMulAdjointA(value bool) SparseMatrixMatMulAttr { + return func(m optionalAttr) { + m["adjoint_a"] = value + } +} + +// SparseMatrixMatMulAdjointB sets the optional adjoint_b attribute to value. +// +// value: Indicates whether `b` should be conjugate-transposed. +// If not specified, defaults to false +func SparseMatrixMatMulAdjointB(value bool) SparseMatrixMatMulAttr { + return func(m optionalAttr) { + m["adjoint_b"] = value + } +} + +// SparseMatrixMatMulTransposeOutput sets the optional transpose_output attribute to value. +// +// value: Transposes the product of `a` and `b`. +// If not specified, defaults to false +func SparseMatrixMatMulTransposeOutput(value bool) SparseMatrixMatMulAttr { + return func(m optionalAttr) { + m["transpose_output"] = value + } +} + +// SparseMatrixMatMulConjugateOutput sets the optional conjugate_output attribute to value. +// +// value: Conjugates the product of `a` and `b`. +// If not specified, defaults to false +func SparseMatrixMatMulConjugateOutput(value bool) SparseMatrixMatMulAttr { + return func(m optionalAttr) { + m["conjugate_output"] = value + } +} + +// Matrix-multiplies a sparse matrix with a dense matrix. +// +// Returns a dense matrix. +// For inputs A and B, where A is CSR and B is dense; this op returns a dense C; +// +// If transpose_output is false, returns: +// ``` +// +// C = A . B +// +// ``` +// +// If transpose_output is `true`, returns: +// ``` +// +// C = transpose(A . B) = transpose(B) . transpose(A) +// +// ``` +// where the transposition is performed along the two innermost (matrix) +// dimensions. +// +// If conjugate_output is `true`, returns: +// ``` +// +// C = conjugate(A . B) = conjugate(A) . conjugate(B) +// +// ``` +// +// If both conjugate_output and transpose_output are `true`, returns: +// ``` +// +// C = conjugate(transpose(A . B)) = conjugate(transpose(B)) . +// conjugate(transpose(A)) +// +// ``` +// +// Arguments: +// +// a: A CSRSparseMatrix. +// b: A dense tensor. +// +// Returns A dense output tensor. +func SparseMatrixMatMul(scope *Scope, a tf.Output, b tf.Output, optional ...SparseMatrixMatMulAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "SparseMatrixMatMul", + Input: []tf.Input{ + a, b, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Check if the input matches the regex pattern. +// +// The input is a string tensor of any shape. The pattern is a scalar +// string tensor which is applied to every element of the input tensor. +// The boolean values (True or False) of the output tensor indicate +// if the input matches the regex pattern provided. +// +// The pattern follows the re2 syntax (https://github.com/google/re2/wiki/Syntax) +// +// Examples: +// +// >>> tf.strings.regex_full_match(["TF lib", "lib TF"], ".*lib$") +// +// >>> tf.strings.regex_full_match(["TF lib", "lib TF"], ".*TF$") +// +// +// Arguments: +// +// input: A string tensor of the text to be processed. +// pattern: A scalar string tensor containing the regular expression to match the input. +// +// Returns A bool tensor with the same shape as `input`. +func RegexFullMatch(scope *Scope, input tf.Output, pattern tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "RegexFullMatch", + Input: []tf.Input{ + input, pattern, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// LoadTPUEmbeddingMomentumParametersAttr is an optional argument to LoadTPUEmbeddingMomentumParameters. +type LoadTPUEmbeddingMomentumParametersAttr func(optionalAttr) + +// LoadTPUEmbeddingMomentumParametersTableId sets the optional table_id attribute to value. +// If not specified, defaults to -1 +func LoadTPUEmbeddingMomentumParametersTableId(value int64) LoadTPUEmbeddingMomentumParametersAttr { + return func(m optionalAttr) { + m["table_id"] = value + } +} + +// LoadTPUEmbeddingMomentumParametersTableName sets the optional table_name attribute to value. +// If not specified, defaults to "" +func LoadTPUEmbeddingMomentumParametersTableName(value string) LoadTPUEmbeddingMomentumParametersAttr { + return func(m optionalAttr) { + m["table_name"] = value + } +} + +// LoadTPUEmbeddingMomentumParametersConfig sets the optional config attribute to value. +// If not specified, defaults to "" +func LoadTPUEmbeddingMomentumParametersConfig(value string) LoadTPUEmbeddingMomentumParametersAttr { + return func(m optionalAttr) { + m["config"] = value + } +} + +// Load Momentum embedding parameters. +// +// An op that loads optimization parameters into HBM for embedding. Must be +// preceded by a ConfigureTPUEmbeddingHost op that sets up the correct +// embedding table configuration. For example, this op is used to install +// parameters that are loaded from a checkpoint before a training loop is +// executed. +// +// Arguments: +// +// parameters: Value of parameters used in the Momentum optimization algorithm. +// momenta: Value of momenta used in the Momentum optimization algorithm. +// +// Returns the created operation. +func LoadTPUEmbeddingMomentumParameters(scope *Scope, parameters tf.Output, momenta tf.Output, num_shards int64, shard_id int64, optional ...LoadTPUEmbeddingMomentumParametersAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_shards": num_shards, "shard_id": shard_id} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "LoadTPUEmbeddingMomentumParameters", + Input: []tf.Input{ + parameters, momenta, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// Makes the summary of quantiles for the batch. +// +// An op that takes a list of tensors (one tensor per feature) and outputs the +// quantile summaries for each tensor. +// +// Arguments: +// +// float_values: float; List of Rank 1 Tensors each containing values for a single feature. +// example_weights: float; Rank 1 Tensor with weights per instance. +// epsilon: float; The required maximum approximation error. +// +// Returns float; List of Rank 2 Tensors each containing the quantile summary +// (value, weight, min_rank, max_rank) of a single feature. +func BoostedTreesMakeQuantileSummaries(scope *Scope, float_values []tf.Output, example_weights tf.Output, epsilon tf.Output) (summaries []tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "BoostedTreesMakeQuantileSummaries", + Input: []tf.Input{ + tf.OutputList(float_values), example_weights, epsilon, + }, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if summaries, idx, err = makeOutputList(op, idx, "summaries"); err != nil { + scope.UpdateErr("BoostedTreesMakeQuantileSummaries", err) + return + } + return summaries +} + +// DenseToSparseSetOperationAttr is an optional argument to DenseToSparseSetOperation. +type DenseToSparseSetOperationAttr func(optionalAttr) + +// DenseToSparseSetOperationValidateIndices sets the optional validate_indices attribute to value. +// If not specified, defaults to true +func DenseToSparseSetOperationValidateIndices(value bool) DenseToSparseSetOperationAttr { + return func(m optionalAttr) { + m["validate_indices"] = value + } +} + +// Applies set operation along last dimension of `Tensor` and `SparseTensor`. +// +// See SetOperationOp::SetOperationFromContext for values of `set_operation`. +// +// Input `set2` is a `SparseTensor` represented by `set2_indices`, `set2_values`, +// and `set2_shape`. For `set2` ranked `n`, 1st `n-1` dimensions must be the same +// as `set1`. Dimension `n` contains values in a set, duplicates are allowed but +// ignored. +// +// If `validate_indices` is `True`, this op validates the order and range of `set2` +// indices. +// +// Output `result` is a `SparseTensor` represented by `result_indices`, +// `result_values`, and `result_shape`. For `set1` and `set2` ranked `n`, this +// has rank `n` and the same 1st `n-1` dimensions as `set1` and `set2`. The `nth` +// dimension contains the result of `set_operation` applied to the corresponding +// `[0...n-1]` dimension of `set`. +// +// Arguments: +// +// set1: `Tensor` with rank `n`. 1st `n-1` dimensions must be the same as `set2`. +// +// Dimension `n` contains values in a set, duplicates are allowed but ignored. +// +// set2_indices: 2D `Tensor`, indices of a `SparseTensor`. Must be in row-major +// +// order. +// +// set2_values: 1D `Tensor`, values of a `SparseTensor`. Must be in row-major +// +// order. +// +// set2_shape: 1D `Tensor`, shape of a `SparseTensor`. `set2_shape[0...n-1]` must +// +// be the same as the 1st `n-1` dimensions of `set1`, `result_shape[n]` is the +// max set size across `n-1` dimensions. +// +// Returns: +// +// result_indices: 2D indices of a `SparseTensor`. +// result_values: 1D values of a `SparseTensor`. +// result_shape: 1D `Tensor` shape of a `SparseTensor`. `result_shape[0...n-1]` is +// +// the same as the 1st `n-1` dimensions of `set1` and `set2`, `result_shape[n]` +// is the max result set size across all `0...n-1` dimensions. +func DenseToSparseSetOperation(scope *Scope, set1 tf.Output, set2_indices tf.Output, set2_values tf.Output, set2_shape tf.Output, set_operation string, optional ...DenseToSparseSetOperationAttr) (result_indices tf.Output, result_values tf.Output, result_shape tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"set_operation": set_operation} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "DenseToSparseSetOperation", + Input: []tf.Input{ + set1, set2_indices, set2_values, set2_shape, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// RandomShuffleQueueV2Attr is an optional argument to RandomShuffleQueueV2. +type RandomShuffleQueueV2Attr func(optionalAttr) + +// RandomShuffleQueueV2Shapes sets the optional shapes attribute to value. +// +// value: The shape of each component in a value. The length of this attr must +// be either 0 or the same as the length of component_types. If the length of +// this attr is 0, the shapes of queue elements are not constrained, and +// only one element may be dequeued at a time. +// If not specified, defaults to <> +// +// REQUIRES: len(value) >= 0 +func RandomShuffleQueueV2Shapes(value []tf.Shape) RandomShuffleQueueV2Attr { + return func(m optionalAttr) { + m["shapes"] = value + } +} + +// RandomShuffleQueueV2Capacity sets the optional capacity attribute to value. +// +// value: The upper bound on the number of elements in this queue. +// Negative numbers mean no limit. +// If not specified, defaults to -1 +func RandomShuffleQueueV2Capacity(value int64) RandomShuffleQueueV2Attr { + return func(m optionalAttr) { + m["capacity"] = value + } +} + +// RandomShuffleQueueV2MinAfterDequeue sets the optional min_after_dequeue attribute to value. +// +// value: Dequeue will block unless there would be this +// many elements after the dequeue or the queue is closed. This +// ensures a minimum level of mixing of elements. +// If not specified, defaults to 0 +func RandomShuffleQueueV2MinAfterDequeue(value int64) RandomShuffleQueueV2Attr { + return func(m optionalAttr) { + m["min_after_dequeue"] = value + } +} + +// RandomShuffleQueueV2Seed sets the optional seed attribute to value. +// +// value: If either seed or seed2 is set to be non-zero, the random number +// generator is seeded by the given seed. Otherwise, a random seed is used. +// If not specified, defaults to 0 +func RandomShuffleQueueV2Seed(value int64) RandomShuffleQueueV2Attr { + return func(m optionalAttr) { + m["seed"] = value + } +} + +// RandomShuffleQueueV2Seed2 sets the optional seed2 attribute to value. +// +// value: A second seed to avoid seed collision. +// If not specified, defaults to 0 +func RandomShuffleQueueV2Seed2(value int64) RandomShuffleQueueV2Attr { + return func(m optionalAttr) { + m["seed2"] = value + } +} + +// RandomShuffleQueueV2Container sets the optional container attribute to value. +// +// value: If non-empty, this queue is placed in the given container. +// Otherwise, a default container is used. +// If not specified, defaults to "" +func RandomShuffleQueueV2Container(value string) RandomShuffleQueueV2Attr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// RandomShuffleQueueV2SharedName sets the optional shared_name attribute to value. +// +// value: If non-empty, this queue will be shared under the given name +// across multiple sessions. +// If not specified, defaults to "" +func RandomShuffleQueueV2SharedName(value string) RandomShuffleQueueV2Attr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// A queue that randomizes the order of elements. +// +// Arguments: +// +// component_types: The type of each component in a value. +// +// Returns The handle to the queue. +func RandomShuffleQueueV2(scope *Scope, component_types []tf.DataType, optional ...RandomShuffleQueueV2Attr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"component_types": component_types} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "RandomShuffleQueueV2", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns which elements of x are Inf. +// +// @compatibility(numpy) +// Equivalent to np.isinf +// @end_compatibility +// +// Example: +// +// ```python +// x = tf.constant([5.0, np.inf, 6.8, np.inf]) +// tf.math.is_inf(x) ==> [False, True, False, True] +// ``` +func IsInf(scope *Scope, x tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "IsInf", + Input: []tf.Input{ + x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns x / y element-wise for real types. +// +// If `x` and `y` are reals, this will return the floating-point division. +// +// *NOTE*: `Div` supports broadcasting. More about broadcasting +// [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) +func RealDiv(scope *Scope, x tf.Output, y tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "RealDiv", + Input: []tf.Input{ + x, y, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// FusedBatchNormV2Attr is an optional argument to FusedBatchNormV2. +type FusedBatchNormV2Attr func(optionalAttr) + +// FusedBatchNormV2Epsilon sets the optional epsilon attribute to value. +// +// value: A small float number added to the variance of x. +// If not specified, defaults to 0.0001 +func FusedBatchNormV2Epsilon(value float32) FusedBatchNormV2Attr { + return func(m optionalAttr) { + m["epsilon"] = value + } +} + +// FusedBatchNormV2ExponentialAvgFactor sets the optional exponential_avg_factor attribute to value. +// If not specified, defaults to 1 +func FusedBatchNormV2ExponentialAvgFactor(value float32) FusedBatchNormV2Attr { + return func(m optionalAttr) { + m["exponential_avg_factor"] = value + } +} + +// FusedBatchNormV2DataFormat sets the optional data_format attribute to value. +// +// value: The data format for x and y. Either "NHWC" (default) or "NCHW". +// If not specified, defaults to "NHWC" +func FusedBatchNormV2DataFormat(value string) FusedBatchNormV2Attr { + return func(m optionalAttr) { + m["data_format"] = value + } +} + +// FusedBatchNormV2IsTraining sets the optional is_training attribute to value. +// +// value: A bool value to indicate the operation is for training (default) +// or inference. +// If not specified, defaults to true +func FusedBatchNormV2IsTraining(value bool) FusedBatchNormV2Attr { + return func(m optionalAttr) { + m["is_training"] = value + } +} + +// Batch normalization. +// +// Note that the size of 4D Tensors are defined by either "NHWC" or "NCHW". +// The size of 1D Tensors matches the dimension C of the 4D Tensors. +// +// Arguments: +// +// x: A 4D Tensor for input data. +// scale: A 1D Tensor for scaling factor, to scale the normalized x. +// offset: A 1D Tensor for offset, to shift to the normalized x. +// mean: A 1D Tensor for population mean. Used for inference only; +// +// must be empty for training. +// +// variance: A 1D Tensor for population variance. Used for inference only; +// +// must be empty for training. +// +// Returns: +// +// y: A 4D Tensor for output data. +// batch_mean: A 1D Tensor for the computed batch mean, to be used by TensorFlow +// +// to compute the running mean. +// +// batch_variance: A 1D Tensor for the computed batch variance, to be used by +// +// TensorFlow to compute the running variance. +// +// reserve_space_1: A 1D Tensor for the computed batch mean, to be reused +// +// in the gradient computation. +// +// reserve_space_2: A 1D Tensor for the computed batch variance (inverted variance +// +// in the cuDNN case), to be reused in the gradient computation. +func FusedBatchNormV2(scope *Scope, x tf.Output, scale tf.Output, offset tf.Output, mean tf.Output, variance tf.Output, optional ...FusedBatchNormV2Attr) (y tf.Output, batch_mean tf.Output, batch_variance tf.Output, reserve_space_1 tf.Output, reserve_space_2 tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "FusedBatchNormV2", + Input: []tf.Input{ + x, scale, offset, mean, variance, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2), op.Output(3), op.Output(4) +} + +// Conv3DBackpropInputAttr is an optional argument to Conv3DBackpropInput. +type Conv3DBackpropInputAttr func(optionalAttr) + +// Conv3DBackpropInputDilations sets the optional dilations attribute to value. +// If not specified, defaults to +func Conv3DBackpropInputDilations(value []int64) Conv3DBackpropInputAttr { + return func(m optionalAttr) { + m["dilations"] = value + } +} + +// Computes the gradients of 3-D convolution with respect to the input. +// +// DEPRECATED at GraphDef version 10: Use Conv3DBackpropInputV2 +// +// Arguments: +// +// input: Shape `[batch, depth, rows, cols, in_channels]`. +// filter: Shape `[depth, rows, cols, in_channels, out_channels]`. +// +// `in_channels` must match between `input` and `filter`. +// +// out_backprop: Backprop signal of shape `[batch, out_depth, out_rows, out_cols, +// +// out_channels]`. +// +// strides: 1-D tensor of length 5. The stride of the sliding window for each +// +// dimension of `input`. Must have `strides[0] = strides[4] = 1`. +// +// padding: The type of padding algorithm to use. +func Conv3DBackpropInput(scope *Scope, input tf.Output, filter tf.Output, out_backprop tf.Output, strides []int64, padding string, optional ...Conv3DBackpropInputAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"strides": strides, "padding": padding} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Conv3DBackpropInput", + Input: []tf.Input{ + input, filter, out_backprop, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// CudnnRNNBackpropV2Attr is an optional argument to CudnnRNNBackpropV2. +type CudnnRNNBackpropV2Attr func(optionalAttr) + +// CudnnRNNBackpropV2RnnMode sets the optional rnn_mode attribute to value. +// If not specified, defaults to "lstm" +func CudnnRNNBackpropV2RnnMode(value string) CudnnRNNBackpropV2Attr { + return func(m optionalAttr) { + m["rnn_mode"] = value + } +} + +// CudnnRNNBackpropV2InputMode sets the optional input_mode attribute to value. +// If not specified, defaults to "linear_input" +func CudnnRNNBackpropV2InputMode(value string) CudnnRNNBackpropV2Attr { + return func(m optionalAttr) { + m["input_mode"] = value + } +} + +// CudnnRNNBackpropV2Direction sets the optional direction attribute to value. +// If not specified, defaults to "unidirectional" +func CudnnRNNBackpropV2Direction(value string) CudnnRNNBackpropV2Attr { + return func(m optionalAttr) { + m["direction"] = value + } +} + +// CudnnRNNBackpropV2Dropout sets the optional dropout attribute to value. +// If not specified, defaults to 0 +func CudnnRNNBackpropV2Dropout(value float32) CudnnRNNBackpropV2Attr { + return func(m optionalAttr) { + m["dropout"] = value + } +} + +// CudnnRNNBackpropV2Seed sets the optional seed attribute to value. +// If not specified, defaults to 0 +func CudnnRNNBackpropV2Seed(value int64) CudnnRNNBackpropV2Attr { + return func(m optionalAttr) { + m["seed"] = value + } +} + +// CudnnRNNBackpropV2Seed2 sets the optional seed2 attribute to value. +// If not specified, defaults to 0 +func CudnnRNNBackpropV2Seed2(value int64) CudnnRNNBackpropV2Attr { + return func(m optionalAttr) { + m["seed2"] = value + } +} + +// Backprop step of CudnnRNN. +// +// Compute the backprop of both data and weights in a RNN. Takes an extra +// +// "host_reserved" inupt than CudnnRNNBackprop, which is used to determine RNN +// cudnnRNNAlgo_t and cudnnMathType_t. +// +// rnn_mode: Indicates the type of the RNN model. +// input_mode: Indicates whether there is a linear projection between the input and +// +// the actual computation before the first layer. 'skip_input' is only allowed +// when input_size == num_units; 'auto_select' implies 'skip_input' when +// input_size == num_units; otherwise, it implies 'linear_input'. +// +// direction: Indicates whether a bidirectional model will be used. Should be +// +// "unidirectional" or "bidirectional". +// +// dropout: Dropout probability. When set to 0., dropout is disabled. +// seed: The 1st part of a seed to initialize dropout. +// seed2: The 2nd part of a seed to initialize dropout. +// input: A 3-D tensor with the shape of [seq_length, batch_size, input_size]. +// input_h: A 3-D tensor with the shape of [num_layer * dir, batch_size, +// +// num_units]. +// +// input_c: For LSTM, a 3-D tensor with the shape of +// +// [num_layer * dir, batch, num_units]. For other models, it is ignored. +// +// params: A 1-D tensor that contains the weights and biases in an opaque layout. +// +// The size must be created through CudnnRNNParamsSize, and initialized +// separately. Note that they might not be compatible across different +// generations. So it is a good idea to save and restore +// +// output: A 3-D tensor with the shape of [seq_length, batch_size, +// +// dir * num_units]. +// +// output_h: The same shape has input_h. +// output_c: The same shape as input_c for LSTM. An empty tensor for other models. +// output_backprop: A 3-D tensor with the same shape as output in the forward pass. +// output_h_backprop: A 3-D tensor with the same shape as output_h in the forward +// +// pass. +// +// output_c_backprop: A 3-D tensor with the same shape as output_c in the forward +// +// pass. +// +// reserve_space: The same reserve_space produced in the forward operation. +// host_reserved: The same host_reserved produced in the forward operation. +// input_backprop: The backprop to input in the forward pass. Has the same shape +// +// as input. +// +// input_h_backprop: The backprop to input_h in the forward pass. Has the same +// +// shape as input_h. +// +// input_c_backprop: The backprop to input_c in the forward pass. Has the same +// +// shape as input_c. +// +// params_backprop: The backprop to the params buffer in the forward pass. Has the +// +// same shape as params. +func CudnnRNNBackpropV2(scope *Scope, input tf.Output, input_h tf.Output, input_c tf.Output, params tf.Output, output tf.Output, output_h tf.Output, output_c tf.Output, output_backprop tf.Output, output_h_backprop tf.Output, output_c_backprop tf.Output, reserve_space tf.Output, host_reserved tf.Output, optional ...CudnnRNNBackpropV2Attr) (input_backprop tf.Output, input_h_backprop tf.Output, input_c_backprop tf.Output, params_backprop tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "CudnnRNNBackpropV2", + Input: []tf.Input{ + input, input_h, input_c, params, output, output_h, output_c, output_backprop, output_h_backprop, output_c_backprop, reserve_space, host_reserved, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2), op.Output(3) +} + +// StagePeekAttr is an optional argument to StagePeek. +type StagePeekAttr func(optionalAttr) + +// StagePeekCapacity sets the optional capacity attribute to value. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func StagePeekCapacity(value int64) StagePeekAttr { + return func(m optionalAttr) { + m["capacity"] = value + } +} + +// StagePeekMemoryLimit sets the optional memory_limit attribute to value. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func StagePeekMemoryLimit(value int64) StagePeekAttr { + return func(m optionalAttr) { + m["memory_limit"] = value + } +} + +// StagePeekContainer sets the optional container attribute to value. +// If not specified, defaults to "" +func StagePeekContainer(value string) StagePeekAttr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// StagePeekSharedName sets the optional shared_name attribute to value. +// If not specified, defaults to "" +func StagePeekSharedName(value string) StagePeekAttr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// Op peeks at the values at the specified index. If the +// +// underlying container does not contain sufficient elements +// this op will block until it does. This Op is optimized for +// performance. +func StagePeek(scope *Scope, index tf.Output, dtypes []tf.DataType, optional ...StagePeekAttr) (values []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtypes": dtypes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "StagePeek", + Input: []tf.Input{ + index, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if values, idx, err = makeOutputList(op, idx, "values"); err != nil { + scope.UpdateErr("StagePeek", err) + return + } + return values +} + +// Uncompresses a compressed dataset element. +func UncompressElement(scope *Scope, compressed tf.Output, output_types []tf.DataType, output_shapes []tf.Shape) (components []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + opspec := tf.OpSpec{ + Type: "UncompressElement", + Input: []tf.Input{ + compressed, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if components, idx, err = makeOutputList(op, idx, "components"); err != nil { + scope.UpdateErr("UncompressElement", err) + return + } + return components +} + +// RandomDatasetAttr is an optional argument to RandomDataset. +type RandomDatasetAttr func(optionalAttr) + +// RandomDatasetMetadata sets the optional metadata attribute to value. +// If not specified, defaults to "" +func RandomDatasetMetadata(value string) RandomDatasetAttr { + return func(m optionalAttr) { + m["metadata"] = value + } +} + +// Creates a Dataset that returns pseudorandom numbers. +// +// Creates a Dataset that returns a stream of uniformly distributed +// pseudorandom 64-bit signed integers. +// +// In the TensorFlow Python API, you can instantiate this dataset via the +// class `tf.data.experimental.RandomDataset`. +// +// Instances of this dataset are also created as a result of the +// `hoist_random_uniform` static optimization. Whether this optimization is +// performed is determined by the `experimental_optimization.hoist_random_uniform` +// option of `tf.data.Options`. +// +// Arguments: +// +// seed: A scalar seed for the random number generator. If either seed or +// +// seed2 is set to be non-zero, the random number generator is seeded +// by the given seed. Otherwise, a random seed is used. +// +// seed2: A second scalar seed to avoid seed collision. +func RandomDataset(scope *Scope, seed tf.Output, seed2 tf.Output, output_types []tf.DataType, output_shapes []tf.Shape, optional ...RandomDatasetAttr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "RandomDataset", + Input: []tf.Input{ + seed, seed2, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// VarHandleOpAttr is an optional argument to VarHandleOp. +type VarHandleOpAttr func(optionalAttr) + +// VarHandleOpContainer sets the optional container attribute to value. +// +// value: the container this variable is placed in. +// If not specified, defaults to "" +func VarHandleOpContainer(value string) VarHandleOpAttr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// VarHandleOpSharedName sets the optional shared_name attribute to value. +// +// value: the name by which this variable is referred to. +// If not specified, defaults to "" +func VarHandleOpSharedName(value string) VarHandleOpAttr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// VarHandleOpDebugName sets the optional debug_name attribute to value. +// If not specified, defaults to "" +func VarHandleOpDebugName(value string) VarHandleOpAttr { + return func(m optionalAttr) { + m["debug_name"] = value + } +} + +// VarHandleOpAllowedDevices sets the optional allowed_devices attribute to value. +// +// value: DEPRECATED. The allowed devices containing the resource variable. Set when the +// output ResourceHandle represents a per-replica/partitioned resource variable. +// If not specified, defaults to <> +func VarHandleOpAllowedDevices(value []string) VarHandleOpAttr { + return func(m optionalAttr) { + m["allowed_devices"] = value + } +} + +// Creates a handle to a Variable resource. +// +// Arguments: +// +// dtype: the type of this variable. Must agree with the dtypes +// +// of all ops using this variable. +// +// shape: The (possibly partially specified) shape of this variable. +func VarHandleOp(scope *Scope, dtype tf.DataType, shape tf.Shape, optional ...VarHandleOpAttr) (resource tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtype": dtype, "shape": shape} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "VarHandleOp", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// PlaceholderAttr is an optional argument to Placeholder. +type PlaceholderAttr func(optionalAttr) + +// PlaceholderShape sets the optional shape attribute to value. +// +// value: (Optional) The shape of the tensor. If the shape has 0 dimensions, the +// shape is unconstrained. +// If not specified, defaults to +func PlaceholderShape(value tf.Shape) PlaceholderAttr { + return func(m optionalAttr) { + m["shape"] = value + } +} + +// A placeholder op for a value that will be fed into the computation. +// +// N.B. This operation will fail with an error if it is executed. It is +// intended as a way to represent a value that will always be fed, and to +// provide attrs that enable the fed value to be checked at runtime. +// +// Arguments: +// +// dtype: The type of elements in the tensor. +// +// Returns A placeholder tensor that must be replaced using the feed mechanism. +func Placeholder(scope *Scope, dtype tf.DataType, optional ...PlaceholderAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtype": dtype} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Placeholder", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// SparseReduceMaxAttr is an optional argument to SparseReduceMax. +type SparseReduceMaxAttr func(optionalAttr) + +// SparseReduceMaxKeepDims sets the optional keep_dims attribute to value. +// +// value: If true, retain reduced dimensions with length 1. +// If not specified, defaults to false +func SparseReduceMaxKeepDims(value bool) SparseReduceMaxAttr { + return func(m optionalAttr) { + m["keep_dims"] = value + } +} + +// Computes the max of elements across dimensions of a SparseTensor. +// +// This Op takes a SparseTensor and is the sparse counterpart to +// `tf.reduce_max()`. In particular, this Op also returns a dense `Tensor` +// instead of a sparse one. +// +// Reduces `sp_input` along the dimensions given in `reduction_axes`. Unless +// `keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in +// `reduction_axes`. If `keep_dims` is true, the reduced dimensions are retained +// with length 1. +// +// If `reduction_axes` has no entries, all dimensions are reduced, and a tensor +// with a single element is returned. Additionally, the axes can be negative, +// which are interpreted according to the indexing rules in Python. +// +// Arguments: +// +// input_indices: 2-D. `N x R` matrix with the indices of non-empty values in a +// +// SparseTensor, possibly not in canonical ordering. +// +// input_values: 1-D. `N` non-empty values corresponding to `input_indices`. +// input_shape: 1-D. Shape of the input SparseTensor. +// reduction_axes: 1-D. Length-`K` vector containing the reduction axes. +// +// Returns `R-K`-D. The reduced Tensor. +func SparseReduceMax(scope *Scope, input_indices tf.Output, input_values tf.Output, input_shape tf.Output, reduction_axes tf.Output, optional ...SparseReduceMaxAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "SparseReduceMax", + Input: []tf.Input{ + input_indices, input_values, input_shape, reduction_axes, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// GatherNdAttr is an optional argument to GatherNd. +type GatherNdAttr func(optionalAttr) + +// GatherNdBadIndicesPolicy sets the optional bad_indices_policy attribute to value. +// If not specified, defaults to "" +func GatherNdBadIndicesPolicy(value string) GatherNdAttr { + return func(m optionalAttr) { + m["bad_indices_policy"] = value + } +} + +// Gather slices from `params` into a Tensor with shape specified by `indices`. +// +// `indices` is a K-dimensional integer tensor, best thought of as a +// (K-1)-dimensional tensor of indices into `params`, where each element defines a +// slice of `params`: +// +// output[\\(i_0, ..., i_{K-2}\\)] = params[indices[\\(i_0, ..., i_{K-2}\\)]] +// +// Whereas in `tf.gather` `indices` defines slices into the `axis` +// dimension of `params`, in `tf.gather_nd`, `indices` defines slices into the +// first `N` dimensions of `params`, where `N = indices.shape[-1]`. +// +// The last dimension of `indices` can be at most the rank of +// `params`: +// +// indices.shape[-1] <= params.rank +// +// The last dimension of `indices` corresponds to elements +// (if `indices.shape[-1] == params.rank`) or slices +// (if `indices.shape[-1] < params.rank`) along dimension `indices.shape[-1]` +// of `params`. The output tensor has shape +// +// indices.shape[:-1] + params.shape[indices.shape[-1]:] +// +// Note that on CPU, if an out of bound index is found, an error is returned. +// On GPU, if an out of bound index is found, a 0 is stored in the +// corresponding output value. +// +// Some examples below. +// +// Simple indexing into a matrix: +// +// ```python +// +// indices = [[0, 0], [1, 1]] +// params = [['a', 'b'], ['c', 'd']] +// output = ['a', 'd'] +// +// ``` +// +// Slice indexing into a matrix: +// +// ```python +// +// indices = [[1], [0]] +// params = [['a', 'b'], ['c', 'd']] +// output = [['c', 'd'], ['a', 'b']] +// +// ``` +// +// Indexing into a 3-tensor: +// +// ```python +// +// indices = [[1]] +// params = [[['a0', 'b0'], ['c0', 'd0']], +// [['a1', 'b1'], ['c1', 'd1']]] +// output = [[['a1', 'b1'], ['c1', 'd1']]] +// +// +// indices = [[0, 1], [1, 0]] +// params = [[['a0', 'b0'], ['c0', 'd0']], +// [['a1', 'b1'], ['c1', 'd1']]] +// output = [['c0', 'd0'], ['a1', 'b1']] +// +// +// indices = [[0, 0, 1], [1, 0, 1]] +// params = [[['a0', 'b0'], ['c0', 'd0']], +// [['a1', 'b1'], ['c1', 'd1']]] +// output = ['b0', 'b1'] +// +// ``` +// +// Batched indexing into a matrix: +// +// ```python +// +// indices = [[[0, 0]], [[0, 1]]] +// params = [['a', 'b'], ['c', 'd']] +// output = [['a'], ['b']] +// +// ``` +// +// Batched slice indexing into a matrix: +// +// ```python +// +// indices = [[[1]], [[0]]] +// params = [['a', 'b'], ['c', 'd']] +// output = [[['c', 'd']], [['a', 'b']]] +// +// ``` +// +// Batched indexing into a 3-tensor: +// +// ```python +// +// indices = [[[1]], [[0]]] +// params = [[['a0', 'b0'], ['c0', 'd0']], +// [['a1', 'b1'], ['c1', 'd1']]] +// output = [[[['a1', 'b1'], ['c1', 'd1']]], +// [[['a0', 'b0'], ['c0', 'd0']]]] +// +// indices = [[[0, 1], [1, 0]], [[0, 0], [1, 1]]] +// params = [[['a0', 'b0'], ['c0', 'd0']], +// [['a1', 'b1'], ['c1', 'd1']]] +// output = [[['c0', 'd0'], ['a1', 'b1']], +// [['a0', 'b0'], ['c1', 'd1']]] +// +// +// indices = [[[0, 0, 1], [1, 0, 1]], [[0, 1, 1], [1, 1, 0]]] +// params = [[['a0', 'b0'], ['c0', 'd0']], +// [['a1', 'b1'], ['c1', 'd1']]] +// output = [['b0', 'b1'], ['d0', 'c1']] +// +// ``` +// +// See also `tf.gather` and `tf.batch_gather`. +// +// Arguments: +// +// params: The tensor from which to gather values. +// indices: Index tensor. +// +// Returns Values from `params` gathered from indices given by `indices`, with +// shape `indices.shape[:-1] + params.shape[indices.shape[-1]:]`. +func GatherNd(scope *Scope, params tf.Output, indices tf.Output, optional ...GatherNdAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "GatherNd", + Input: []tf.Input{ + params, indices, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Split a `SparseTensor` into `num_split` tensors along one dimension. +// +// If the `shape[split_dim]` is not an integer multiple of `num_split`. Slices +// `[0 : shape[split_dim] % num_split]` gets one extra dimension. +// For example, if `split_dim = 1` and `num_split = 2` and the input is +// +// input_tensor = shape = [2, 7] +// [ a d e ] +// [b c ] +// +// Graphically the output tensors are: +// +// output_tensor[0] = shape = [2, 4] +// [ a ] +// [b c ] +// +// output_tensor[1] = shape = [2, 3] +// [ d e ] +// [ ] +// +// Arguments: +// +// split_dim: 0-D. The dimension along which to split. Must be in the range +// +// `[0, rank(shape))`. +// +// indices: 2-D tensor represents the indices of the sparse tensor. +// values: 1-D tensor represents the values of the sparse tensor. +// shape: 1-D. tensor represents the shape of the sparse tensor. +// +// output indices: A list of 1-D tensors represents the indices of the output +// sparse tensors. +// +// num_split: The number of ways to split. +// +// Returns: +// +// output_indices +// output_values: A list of 1-D tensors represents the values of the output sparse +// +// tensors. +// +// output_shape: A list of 1-D tensors represents the shape of the output sparse +// +// tensors. +func SparseSplit(scope *Scope, split_dim tf.Output, indices tf.Output, values tf.Output, shape tf.Output, num_split int64) (output_indices []tf.Output, output_values []tf.Output, output_shape []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_split": num_split} + opspec := tf.OpSpec{ + Type: "SparseSplit", + Input: []tf.Input{ + split_dim, indices, values, shape, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if output_indices, idx, err = makeOutputList(op, idx, "output_indices"); err != nil { + scope.UpdateErr("SparseSplit", err) + return + } + if output_values, idx, err = makeOutputList(op, idx, "output_values"); err != nil { + scope.UpdateErr("SparseSplit", err) + return + } + if output_shape, idx, err = makeOutputList(op, idx, "output_shape"); err != nil { + scope.UpdateErr("SparseSplit", err) + return + } + return output_indices, output_values, output_shape +} + +// Aggregates the summary of accumulated stats for the batch. +// +// The summary stats contains gradients and hessians accumulated for each node, feature dimension id and bucket. +// +// Arguments: +// +// node_ids: int32; Rank 1 Tensor containing node ids for each example, shape [batch_size]. +// gradients: float32; Rank 2 Tensor (shape=[batch_size, logits_dimension]) with gradients for each example. +// hessians: float32; Rank 2 Tensor (shape=[batch_size, hessian_dimension]) with hessians for each example. +// feature: int32; Rank 2 feature Tensors (shape=[batch_size, feature_dimension]). +// max_splits: int; the maximum number of splits possible in the whole tree. +// num_buckets: int; equals to the maximum possible value of bucketized feature. +// +// Returns output Rank 4 Tensor (shape=[splits, feature_dimension, buckets, logits_dimension + hessian_dimension]) +// containing accumulated stats for each node, feature dimension and bucket. +func BoostedTreesAggregateStats(scope *Scope, node_ids tf.Output, gradients tf.Output, hessians tf.Output, feature tf.Output, max_splits int64, num_buckets int64) (stats_summary tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"max_splits": max_splits, "num_buckets": num_buckets} + opspec := tf.OpSpec{ + Type: "BoostedTreesAggregateStats", + Input: []tf.Input{ + node_ids, gradients, hessians, feature, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Inverse 2D fast Fourier transform. +// +// Computes the inverse 2-dimensional discrete Fourier transform over the +// inner-most 2 dimensions of `input`. +// +// Arguments: +// +// input: A complex tensor. +// +// Returns A complex tensor of the same shape as `input`. The inner-most 2 +// +// dimensions of `input` are replaced with their inverse 2D Fourier transform. +// +// @compatibility(numpy) +// Equivalent to np.fft.ifft2 +// @end_compatibility +func IFFT2D(scope *Scope, input tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "IFFT2D", + Input: []tf.Input{ + input, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// FakeQuantWithMinMaxVarsPerChannelGradientAttr is an optional argument to FakeQuantWithMinMaxVarsPerChannelGradient. +type FakeQuantWithMinMaxVarsPerChannelGradientAttr func(optionalAttr) + +// FakeQuantWithMinMaxVarsPerChannelGradientNumBits sets the optional num_bits attribute to value. +// +// value: The bitwidth of the quantization; between 2 and 16, inclusive. +// If not specified, defaults to 8 +func FakeQuantWithMinMaxVarsPerChannelGradientNumBits(value int64) FakeQuantWithMinMaxVarsPerChannelGradientAttr { + return func(m optionalAttr) { + m["num_bits"] = value + } +} + +// FakeQuantWithMinMaxVarsPerChannelGradientNarrowRange sets the optional narrow_range attribute to value. +// +// value: Whether to quantize into 2^num_bits - 1 distinct values. +// If not specified, defaults to false +func FakeQuantWithMinMaxVarsPerChannelGradientNarrowRange(value bool) FakeQuantWithMinMaxVarsPerChannelGradientAttr { + return func(m optionalAttr) { + m["narrow_range"] = value + } +} + +// Compute gradients for a FakeQuantWithMinMaxVarsPerChannel operation. +// +// Arguments: +// +// gradients: Backpropagated gradients above the FakeQuantWithMinMaxVars operation, +// +// shape one of: `[d]`, `[b, d]`, `[b, h, w, d]`. +// +// inputs: Values passed as inputs to the FakeQuantWithMinMaxVars operation, shape +// same as `gradients`. +// +// min, max: Quantization interval, floats of shape `[d]`. +// +// Returns: +// +// backprops_wrt_input: Backpropagated gradients w.r.t. inputs, shape same as +// +// `inputs`: +// +// `gradients * (inputs >= min && inputs <= max)`. +// backprop_wrt_min: Backpropagated gradients w.r.t. min parameter, shape `[d]`: +// +// `sum_per_d(gradients * (inputs < min))`. +// +// backprop_wrt_max: Backpropagated gradients w.r.t. max parameter, shape `[d]`: +// +// `sum_per_d(gradients * (inputs > max))`. +func FakeQuantWithMinMaxVarsPerChannelGradient(scope *Scope, gradients tf.Output, inputs tf.Output, min tf.Output, max tf.Output, optional ...FakeQuantWithMinMaxVarsPerChannelGradientAttr) (backprops_wrt_input tf.Output, backprop_wrt_min tf.Output, backprop_wrt_max tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "FakeQuantWithMinMaxVarsPerChannelGradient", + Input: []tf.Input{ + gradients, inputs, min, max, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// Elementwise computes the bitwise left-shift of `x` and `y`. +// +// If `y` is negative, or greater than or equal to the width of `x` in bits the +// result is implementation defined. +// +// Example: +// +// ```python +// import tensorflow as tf +// from tensorflow.python.ops import bitwise_ops +// import numpy as np +// dtype_list = [tf.int8, tf.int16, tf.int32, tf.int64] +// +// for dtype in dtype_list: +// +// lhs = tf.constant([-1, -5, -3, -14], dtype=dtype) +// rhs = tf.constant([5, 0, 7, 11], dtype=dtype) +// +// left_shift_result = bitwise_ops.left_shift(lhs, rhs) +// +// print(left_shift_result) +// +// # This will print: +// # tf.Tensor([ -32 -5 -128 0], shape=(4,), dtype=int8) +// # tf.Tensor([ -32 -5 -384 -28672], shape=(4,), dtype=int16) +// # tf.Tensor([ -32 -5 -384 -28672], shape=(4,), dtype=int32) +// # tf.Tensor([ -32 -5 -384 -28672], shape=(4,), dtype=int64) +// +// lhs = np.array([-2, 64, 101, 32], dtype=np.int8) +// rhs = np.array([-1, -5, -3, -14], dtype=np.int8) +// bitwise_ops.left_shift(lhs, rhs) +// # +// ``` +func LeftShift(scope *Scope, x tf.Output, y tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "LeftShift", + Input: []tf.Input{ + x, y, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ExperimentalParseExampleDatasetAttr is an optional argument to ExperimentalParseExampleDataset. +type ExperimentalParseExampleDatasetAttr func(optionalAttr) + +// ExperimentalParseExampleDatasetSloppy sets the optional sloppy attribute to value. +// If not specified, defaults to false +func ExperimentalParseExampleDatasetSloppy(value bool) ExperimentalParseExampleDatasetAttr { + return func(m optionalAttr) { + m["sloppy"] = value + } +} + +// Transforms `input_dataset` containing `Example` protos as vectors of DT_STRING into a dataset of `Tensor` or `SparseTensor` objects representing the parsed features. +// +// Arguments: +// +// dense_defaults: A dict mapping string keys to `Tensor`s. +// +// The keys of the dict must match the dense_keys of the feature. +// +// sparse_keys: A list of string keys in the examples features. +// +// The results for these keys will be returned as `SparseTensor` objects. +// +// dense_keys: A list of Ndense string Tensors (scalars). +// +// The keys expected in the Examples features associated with dense values. +// +// sparse_types: A list of `DTypes` of the same length as `sparse_keys`. +// +// Only `tf.float32` (`FloatList`), `tf.int64` (`Int64List`), +// and `tf.string` (`BytesList`) are supported. +// +// dense_shapes: List of tuples with the same length as `dense_keys`. +// +// The shape of the data for each dense feature referenced by `dense_keys`. +// Required for any input tensors identified by `dense_keys`. Must be +// either fully defined, or may contain an unknown first dimension. +// An unknown first dimension means the feature is treated as having +// a variable number of blocks, and the output shape along this dimension +// is considered unknown at graph build time. Padding is applied for +// minibatch elements smaller than the maximum number of blocks for the +// given feature along this dimension. +// +// output_types: The type list for the return values. +// output_shapes: The list of shapes being produced. +func ExperimentalParseExampleDataset(scope *Scope, input_dataset tf.Output, num_parallel_calls tf.Output, dense_defaults []tf.Output, sparse_keys []string, dense_keys []string, sparse_types []tf.DataType, dense_shapes []tf.Shape, output_types []tf.DataType, output_shapes []tf.Shape, optional ...ExperimentalParseExampleDatasetAttr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"sparse_keys": sparse_keys, "dense_keys": dense_keys, "sparse_types": sparse_types, "dense_shapes": dense_shapes, "output_types": output_types, "output_shapes": output_shapes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ExperimentalParseExampleDataset", + Input: []tf.Input{ + input_dataset, num_parallel_calls, tf.OutputList(dense_defaults), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// StatsAggregatorHandleAttr is an optional argument to StatsAggregatorHandle. +type StatsAggregatorHandleAttr func(optionalAttr) + +// StatsAggregatorHandleContainer sets the optional container attribute to value. +// If not specified, defaults to "" +func StatsAggregatorHandleContainer(value string) StatsAggregatorHandleAttr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// StatsAggregatorHandleSharedName sets the optional shared_name attribute to value. +// If not specified, defaults to "" +func StatsAggregatorHandleSharedName(value string) StatsAggregatorHandleAttr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// Creates a statistics manager resource. +func StatsAggregatorHandle(scope *Scope, optional ...StatsAggregatorHandleAttr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "StatsAggregatorHandle", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns x * y element-wise. +// +// *NOTE*: `Multiply` supports broadcasting. More about broadcasting +// [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) +func Mul(scope *Scope, x tf.Output, y tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Mul", + Input: []tf.Input{ + x, y, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// BlockLSTMV2Attr is an optional argument to BlockLSTMV2. +type BlockLSTMV2Attr func(optionalAttr) + +// BlockLSTMV2CellClip sets the optional cell_clip attribute to value. +// +// value: Value to clip the 'cs' value to. +// If not specified, defaults to 0 +func BlockLSTMV2CellClip(value float32) BlockLSTMV2Attr { + return func(m optionalAttr) { + m["cell_clip"] = value + } +} + +// BlockLSTMV2UsePeephole sets the optional use_peephole attribute to value. +// +// value: Whether to use peephole weights. +// If not specified, defaults to false +func BlockLSTMV2UsePeephole(value bool) BlockLSTMV2Attr { + return func(m optionalAttr) { + m["use_peephole"] = value + } +} + +// Computes the LSTM cell forward propagation for all the time steps. +// +// This is equivalent to applying LSTMBlockCell in a loop, like so: +// +// ```python +// for x1 in unpack(x): +// +// i1, cs1, f1, o1, ci1, co1, h1 = LSTMBlock( +// x1, cs_prev, h_prev, w, wci, wcf, wco, b) +// cs_prev = cs1 +// h_prev = h1 +// i.append(i1) +// cs.append(cs1) +// f.append(f1) +// o.append(o1) +// ci.append(ci1) +// co.append(co1) +// h.append(h1) +// +// return pack(i), pack(cs), pack(f), pack(o), pack(ci), pack(ch), pack(h) +// +// Note that unlike LSTMBlockCell (and BlockLSTM) which uses ICFO gate layout, +// this op uses IFCO. So in order for the following snippet to be equivalent +// all gate-related outputs should be reordered. +// ``` +// +// Arguments: +// +// seq_len_max: Maximum time length actually used by this input. Outputs are padded +// +// with zeros beyond this length. +// +// x: The sequence input to the LSTM, shape (timelen, batch_size, num_inputs). +// cs_prev: Value of the initial cell state. +// h_prev: Initial output of cell (to be used for peephole). +// w: The weight matrix. +// wci: The weight matrix for input gate peephole connection. +// wcf: The weight matrix for forget gate peephole connection. +// wco: The weight matrix for output gate peephole connection. +// b: The bias vector. +// +// Returns: +// +// i: The input gate over the whole time sequence. +// cs: The cell state before the tanh over the whole time sequence. +// f: The forget gate over the whole time sequence. +// o: The output gate over the whole time sequence. +// ci: The cell input over the whole time sequence. +// co: The cell after the tanh over the whole time sequence. +// h: The output h vector over the whole time sequence. +func BlockLSTMV2(scope *Scope, seq_len_max tf.Output, x tf.Output, cs_prev tf.Output, h_prev tf.Output, w tf.Output, wci tf.Output, wcf tf.Output, wco tf.Output, b tf.Output, optional ...BlockLSTMV2Attr) (i tf.Output, cs tf.Output, f tf.Output, o tf.Output, ci tf.Output, co tf.Output, h tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "BlockLSTMV2", + Input: []tf.Input{ + seq_len_max, x, cs_prev, h_prev, w, wci, wcf, wco, b, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2), op.Output(3), op.Output(4), op.Output(5), op.Output(6) +} + +// StatefulUniformFullIntAttr is an optional argument to StatefulUniformFullInt. +type StatefulUniformFullIntAttr func(optionalAttr) + +// StatefulUniformFullIntDtype sets the optional dtype attribute to value. +// +// value: The type of the output. +// If not specified, defaults to DT_UINT64 +func StatefulUniformFullIntDtype(value tf.DataType) StatefulUniformFullIntAttr { + return func(m optionalAttr) { + m["dtype"] = value + } +} + +// Outputs random integers from a uniform distribution. +// +// The generated values are uniform integers covering the whole range of `dtype`. +// +// Arguments: +// +// resource: The handle of the resource variable that stores the state of the RNG. +// algorithm: The RNG algorithm. +// shape: The shape of the output tensor. +// +// Returns Random values with specified shape. +func StatefulUniformFullInt(scope *Scope, resource tf.Output, algorithm tf.Output, shape tf.Output, optional ...StatefulUniformFullIntAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "StatefulUniformFullInt", + Input: []tf.Input{ + resource, algorithm, shape, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Converts each string in the input Tensor to its hash mod by a number of buckets. +// +// The hash function is deterministic on the content of the string within the +// process. The hash function is a keyed hash function, where attribute `key` +// defines the key of the hash function. `key` is an array of 2 elements. +// +// A strong hash is important when inputs may be malicious, e.g. URLs with +// additional components. Adversaries could try to make their inputs hash to the +// same bucket for a denial-of-service attack or to skew the results. A strong +// hash can be used to make it difficult to find inputs with a skewed hash value +// distribution over buckets. This requires that the hash function is +// seeded by a high-entropy (random) "key" unknown to the adversary. +// +// The additional robustness comes at a cost of roughly 4x higher compute +// time than `tf.string_to_hash_bucket_fast`. +// +// Examples: +// +// >>> tf.strings.to_hash_bucket_strong(["Hello", "TF"], 3, [1, 2]).numpy() +// array([2, 0]) +// +// Arguments: +// +// input: The strings to assign a hash bucket. +// num_buckets: The number of buckets. +// key: The key used to seed the hash function, passed as a list of two uint64 +// +// elements. +// +// Returns A Tensor of the same shape as the input `string_tensor`. +func StringToHashBucketStrong(scope *Scope, input tf.Output, num_buckets int64, key []int64) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_buckets": num_buckets, "key": key} + opspec := tf.OpSpec{ + Type: "StringToHashBucketStrong", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// WriteAudioSummaryAttr is an optional argument to WriteAudioSummary. +type WriteAudioSummaryAttr func(optionalAttr) + +// WriteAudioSummaryMaxOutputs sets the optional max_outputs attribute to value. +// If not specified, defaults to 3 +// +// REQUIRES: value >= 1 +func WriteAudioSummaryMaxOutputs(value int64) WriteAudioSummaryAttr { + return func(m optionalAttr) { + m["max_outputs"] = value + } +} + +// Writes an audio summary. +// +// Writes encoded audio summary `tensor` at `step` with `tag` using summary `writer`. +// `sample_rate` is the audio sample rate is Hz. +// +// Returns the created operation. +func WriteAudioSummary(scope *Scope, writer tf.Output, step tf.Output, tag tf.Output, tensor tf.Output, sample_rate tf.Output, optional ...WriteAudioSummaryAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "WriteAudioSummary", + Input: []tf.Input{ + writer, step, tag, tensor, sample_rate, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// ResourceApplyProximalGradientDescentAttr is an optional argument to ResourceApplyProximalGradientDescent. +type ResourceApplyProximalGradientDescentAttr func(optionalAttr) + +// ResourceApplyProximalGradientDescentUseLocking sets the optional use_locking attribute to value. +// +// value: If True, the subtraction will be protected by a lock; +// otherwise the behavior is undefined, but may exhibit less contention. +// If not specified, defaults to false +func ResourceApplyProximalGradientDescentUseLocking(value bool) ResourceApplyProximalGradientDescentAttr { + return func(m optionalAttr) { + m["use_locking"] = value + } +} + +// Update '*var' as FOBOS algorithm with fixed learning rate. +// +// prox_v = var - alpha * delta +// var = sign(prox_v)/(1+alpha*l2) * max{|prox_v|-alpha*l1,0} +// +// Arguments: +// +// var_: Should be from a Variable(). +// alpha: Scaling factor. Must be a scalar. +// l1: L1 regularization. Must be a scalar. +// l2: L2 regularization. Must be a scalar. +// delta: The change. +// +// Returns the created operation. +func ResourceApplyProximalGradientDescent(scope *Scope, var_ tf.Output, alpha tf.Output, l1 tf.Output, l2 tf.Output, delta tf.Output, optional ...ResourceApplyProximalGradientDescentAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ResourceApplyProximalGradientDescent", + Input: []tf.Input{ + var_, alpha, l1, l2, delta, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// OrderedMapStageAttr is an optional argument to OrderedMapStage. +type OrderedMapStageAttr func(optionalAttr) + +// OrderedMapStageCapacity sets the optional capacity attribute to value. +// +// value: Maximum number of elements in the Staging Area. If > 0, inserts +// on the container will block when the capacity is reached. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func OrderedMapStageCapacity(value int64) OrderedMapStageAttr { + return func(m optionalAttr) { + m["capacity"] = value + } +} + +// OrderedMapStageMemoryLimit sets the optional memory_limit attribute to value. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func OrderedMapStageMemoryLimit(value int64) OrderedMapStageAttr { + return func(m optionalAttr) { + m["memory_limit"] = value + } +} + +// OrderedMapStageContainer sets the optional container attribute to value. +// +// value: If non-empty, this queue is placed in the given container. Otherwise, +// a default container is used. +// If not specified, defaults to "" +func OrderedMapStageContainer(value string) OrderedMapStageAttr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// OrderedMapStageSharedName sets the optional shared_name attribute to value. +// +// value: It is necessary to match this name to the matching Unstage Op. +// If not specified, defaults to "" +func OrderedMapStageSharedName(value string) OrderedMapStageAttr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// Stage (key, values) in the underlying container which behaves like a ordered +// +// associative container. Elements are ordered by key. +// +// Arguments: +// +// key: int64 +// +// values: a list of tensors +// +// dtypes A list of data types that inserted values should adhere to. +// +// Returns the created operation. +func OrderedMapStage(scope *Scope, key tf.Output, indices tf.Output, values []tf.Output, dtypes []tf.DataType, optional ...OrderedMapStageAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtypes": dtypes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "OrderedMapStage", + Input: []tf.Input{ + key, indices, tf.OutputList(values), + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// PrelinearizeTupleAttr is an optional argument to PrelinearizeTuple. +type PrelinearizeTupleAttr func(optionalAttr) + +// PrelinearizeTupleLayouts sets the optional layouts attribute to value. +// +// value: A vector holding the requested layout in minor-to-major sequence for all the +// tuple shapes in the order the shapes appear in the "shapes" input. The layout +// elements for a sub-shape can be set to -1 in which case the corresponding layout +// will be computed by the infeed operation. +// If not specified, defaults to <> +func PrelinearizeTupleLayouts(value []int64) PrelinearizeTupleAttr { + return func(m optionalAttr) { + m["layouts"] = value + } +} + +// An op which linearizes multiple Tensor values to an opaque variant tensor. +// +// Arguments: +// +// inputs: A list of tensors that will be provided using the infeed mechanism. +// shapes: The shapes of each tensor in `inputs`. +func PrelinearizeTuple(scope *Scope, inputs []tf.Output, shapes []tf.Shape, optional ...PrelinearizeTupleAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"shapes": shapes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "PrelinearizeTuple", + Input: []tf.Input{ + tf.OutputList(inputs), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Concatenates tensors along one dimension. +// +// Arguments: +// +// values: List of `N` Tensors to concatenate. Their ranks and types must match, +// +// and their sizes must match in all dimensions except `concat_dim`. +// +// axis: 0-D. The dimension along which to concatenate. Must be in the +// +// range [-rank(values), rank(values)). +// +// Returns A `Tensor` with the concatenation of values stacked along the +// `concat_dim` dimension. This tensor's shape matches that of `values` except +// in `concat_dim` where it has the sum of the sizes. +func ConcatV2(scope *Scope, values []tf.Output, axis tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "ConcatV2", + Input: []tf.Input{ + tf.OutputList(values), axis, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ConcatenateDatasetAttr is an optional argument to ConcatenateDataset. +type ConcatenateDatasetAttr func(optionalAttr) + +// ConcatenateDatasetMetadata sets the optional metadata attribute to value. +// If not specified, defaults to "" +func ConcatenateDatasetMetadata(value string) ConcatenateDatasetAttr { + return func(m optionalAttr) { + m["metadata"] = value + } +} + +// Creates a dataset that concatenates `input_dataset` with `another_dataset`. +func ConcatenateDataset(scope *Scope, input_dataset tf.Output, another_dataset tf.Output, output_types []tf.DataType, output_shapes []tf.Shape, optional ...ConcatenateDatasetAttr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ConcatenateDataset", + Input: []tf.Input{ + input_dataset, another_dataset, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// LRNAttr is an optional argument to LRN. +type LRNAttr func(optionalAttr) + +// LRNDepthRadius sets the optional depth_radius attribute to value. +// +// value: 0-D. Half-width of the 1-D normalization window. +// If not specified, defaults to 5 +func LRNDepthRadius(value int64) LRNAttr { + return func(m optionalAttr) { + m["depth_radius"] = value + } +} + +// LRNBias sets the optional bias attribute to value. +// +// value: An offset (usually positive to avoid dividing by 0). +// If not specified, defaults to 1 +func LRNBias(value float32) LRNAttr { + return func(m optionalAttr) { + m["bias"] = value + } +} + +// LRNAlpha sets the optional alpha attribute to value. +// +// value: A scale factor, usually positive. +// If not specified, defaults to 1 +func LRNAlpha(value float32) LRNAttr { + return func(m optionalAttr) { + m["alpha"] = value + } +} + +// LRNBeta sets the optional beta attribute to value. +// +// value: An exponent. +// If not specified, defaults to 0.5 +func LRNBeta(value float32) LRNAttr { + return func(m optionalAttr) { + m["beta"] = value + } +} + +// Local Response Normalization. +// +// The 4-D `input` tensor is treated as a 3-D array of 1-D vectors (along the last +// dimension), and each vector is normalized independently. Within a given vector, +// each component is divided by the weighted, squared sum of inputs within +// `depth_radius`. In detail, +// +// sqr_sum[a, b, c, d] = +// sum(input[a, b, c, d - depth_radius : d + depth_radius + 1] ** 2) +// output = input / (bias + alpha * sqr_sum) ** beta +// +// For details, see [Krizhevsky et al., ImageNet classification with deep +// convolutional neural networks (NIPS 2012)](http://papers.nips.cc/paper/4824-imagenet-classification-with-deep-convolutional-neural-networks). +// +// Arguments: +// +// input: 4-D. +func LRN(scope *Scope, input tf.Output, optional ...LRNAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "LRN", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ParameterizedTruncatedNormalAttr is an optional argument to ParameterizedTruncatedNormal. +type ParameterizedTruncatedNormalAttr func(optionalAttr) + +// ParameterizedTruncatedNormalSeed sets the optional seed attribute to value. +// +// value: If either `seed` or `seed2` are set to be non-zero, the random number +// generator is seeded by the given seed. Otherwise, it is seeded by a +// random seed. +// If not specified, defaults to 0 +func ParameterizedTruncatedNormalSeed(value int64) ParameterizedTruncatedNormalAttr { + return func(m optionalAttr) { + m["seed"] = value + } +} + +// ParameterizedTruncatedNormalSeed2 sets the optional seed2 attribute to value. +// +// value: A second seed to avoid seed collision. +// If not specified, defaults to 0 +func ParameterizedTruncatedNormalSeed2(value int64) ParameterizedTruncatedNormalAttr { + return func(m optionalAttr) { + m["seed2"] = value + } +} + +// Outputs random values from a normal distribution. The parameters may each be a +// +// scalar which applies to the entire output, or a vector of length shape[0] which +// stores the parameters for each batch. +// +// Arguments: +// +// shape: The shape of the output tensor. Batches are indexed by the 0th dimension. +// means: The mean parameter of each batch. +// stdevs: The standard deviation parameter of each batch. Must be greater than 0. +// minvals: The minimum cutoff. May be -infinity. +// maxvals: The maximum cutoff. May be +infinity, and must be more than the minval +// +// for each batch. +// +// Returns A matrix of shape num_batches x samples_per_batch, filled with random +// truncated normal values using the parameters for each row. +func ParameterizedTruncatedNormal(scope *Scope, shape tf.Output, means tf.Output, stdevs tf.Output, minvals tf.Output, maxvals tf.Output, optional ...ParameterizedTruncatedNormalAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ParameterizedTruncatedNormal", + Input: []tf.Input{ + shape, means, stdevs, minvals, maxvals, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Invert (flip) each bit of supported types; for example, type `uint8` value 01010101 becomes 10101010. +// +// Flip each bit of supported types. For example, type `int8` (decimal 2) binary 00000010 becomes (decimal -3) binary 11111101. +// This operation is performed on each element of the tensor argument `x`. +// +// Example: +// ```python +// import tensorflow as tf +// from tensorflow.python.ops import bitwise_ops +// +// # flip 2 (00000010) to -3 (11111101) +// tf.assert_equal(-3, bitwise_ops.invert(2)) +// +// dtype_list = [dtypes.int8, dtypes.int16, dtypes.int32, dtypes.int64, +// +// dtypes.uint8, dtypes.uint16, dtypes.uint32, dtypes.uint64] +// +// inputs = [0, 5, 3, 14] +// for dtype in dtype_list: +// +// # Because of issues with negative numbers, let's test this indirectly. +// # 1. invert(a) and a = 0 +// # 2. invert(a) or a = invert(0) +// input_tensor = tf.constant([0, 5, 3, 14], dtype=dtype) +// not_a_and_a, not_a_or_a, not_0 = [bitwise_ops.bitwise_and( +// input_tensor, bitwise_ops.invert(input_tensor)), +// bitwise_ops.bitwise_or( +// input_tensor, bitwise_ops.invert(input_tensor)), +// bitwise_ops.invert( +// tf.constant(0, dtype=dtype))] +// +// expected = tf.constant([0, 0, 0, 0], dtype=tf.float32) +// tf.assert_equal(tf.cast(not_a_and_a, tf.float32), expected) +// +// expected = tf.cast([not_0] * 4, tf.float32) +// tf.assert_equal(tf.cast(not_a_or_a, tf.float32), expected) +// +// # For unsigned dtypes let's also check the result directly. +// if dtype.is_unsigned: +// inverted = bitwise_ops.invert(input_tensor) +// expected = tf.constant([dtype.max - x for x in inputs], dtype=tf.float32) +// tf.assert_equal(tf.cast(inverted, tf.float32), tf.cast(expected, tf.float32)) +// +// ``` +func Invert(scope *Scope, x tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Invert", + Input: []tf.Input{ + x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ZipDatasetAttr is an optional argument to ZipDataset. +type ZipDatasetAttr func(optionalAttr) + +// ZipDatasetMetadata sets the optional metadata attribute to value. +// If not specified, defaults to "" +func ZipDatasetMetadata(value string) ZipDatasetAttr { + return func(m optionalAttr) { + m["metadata"] = value + } +} + +// Creates a dataset that zips together `input_datasets`. +// +// The elements of the resulting dataset are created by zipping corresponding +// elements from each of the input datasets. +// +// The size of the resulting dataset will match the size of the smallest input +// dataset, and no error will be raised if input datasets have different sizes. +// +// Arguments: +// +// input_datasets: List of `N` variant Tensors representing datasets to be zipped together. +func ZipDataset(scope *Scope, input_datasets []tf.Output, output_types []tf.DataType, output_shapes []tf.Shape, optional ...ZipDatasetAttr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ZipDataset", + Input: []tf.Input{ + tf.OutputList(input_datasets), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// FakeQuantWithMinMaxVarsPerChannelAttr is an optional argument to FakeQuantWithMinMaxVarsPerChannel. +type FakeQuantWithMinMaxVarsPerChannelAttr func(optionalAttr) + +// FakeQuantWithMinMaxVarsPerChannelNumBits sets the optional num_bits attribute to value. +// If not specified, defaults to 8 +func FakeQuantWithMinMaxVarsPerChannelNumBits(value int64) FakeQuantWithMinMaxVarsPerChannelAttr { + return func(m optionalAttr) { + m["num_bits"] = value + } +} + +// FakeQuantWithMinMaxVarsPerChannelNarrowRange sets the optional narrow_range attribute to value. +// If not specified, defaults to false +func FakeQuantWithMinMaxVarsPerChannelNarrowRange(value bool) FakeQuantWithMinMaxVarsPerChannelAttr { + return func(m optionalAttr) { + m["narrow_range"] = value + } +} + +// Fake-quantize the 'inputs' tensor of type float via per-channel floats +// +// Fake-quantize the `inputs` tensor of type float per-channel and one of the +// shapes: `[d]`, `[b, d]` `[b, h, w, d]` via per-channel floats `min` and `max` +// of shape `[d]` to `outputs` tensor of same shape as `inputs`. +// +// # Attributes +// +// * `[min; max]` define the clamping range for the `inputs` data. +// * `inputs` values are quantized into the quantization range ( +// `[0; 2^num_bits - 1]` when `narrow_range` is false and `[1; 2^num_bits - 1]` +// when it is true) and then de-quantized and output as floats in `[min; max]` +// interval. +// * `num_bits` is the bitwidth of the quantization; between 2 and 16, inclusive. +// +// Before quantization, `min` and `max` values are adjusted with the following +// logic. +// It is suggested to have `min <= 0 <= max`. If `0` is not in the range of values, +// the behavior can be unexpected: +// +// * If `0 < min < max`: `min_adj = 0` and `max_adj = max - min`. +// * If `min < max < 0`: `min_adj = min - max` and `max_adj = 0`. +// * If `min <= 0 <= max`: `scale = (max - min) / (2^num_bits - 1) `, +// `min_adj = scale * round(min / scale)` and `max_adj = max + min_adj - min`. +// +// This operation has a gradient and thus allows for training `min` and `max` +// values. +func FakeQuantWithMinMaxVarsPerChannel(scope *Scope, inputs tf.Output, min tf.Output, max tf.Output, optional ...FakeQuantWithMinMaxVarsPerChannelAttr) (outputs tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "FakeQuantWithMinMaxVarsPerChannel", + Input: []tf.Input{ + inputs, min, max, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// TensorScatterSubAttr is an optional argument to TensorScatterSub. +type TensorScatterSubAttr func(optionalAttr) + +// TensorScatterSubBadIndicesPolicy sets the optional bad_indices_policy attribute to value. +// If not specified, defaults to "" +func TensorScatterSubBadIndicesPolicy(value string) TensorScatterSubAttr { + return func(m optionalAttr) { + m["bad_indices_policy"] = value + } +} + +// Subtracts sparse `updates` from an existing tensor according to `indices`. +// +// This operation creates a new tensor by subtracting sparse `updates` from the +// passed in `tensor`. +// This operation is very similar to `tf.scatter_nd_sub`, except that the updates +// are subtracted from an existing tensor (as opposed to a variable). If the memory +// for the existing tensor cannot be re-used, a copy is made and updated. +// +// `indices` is an integer tensor containing indices into a new tensor of shape +// `shape`. The last dimension of `indices` can be at most the rank of `shape`: +// +// indices.shape[-1] <= shape.rank +// +// The last dimension of `indices` corresponds to indices into elements +// (if `indices.shape[-1] = shape.rank`) or slices +// (if `indices.shape[-1] < shape.rank`) along dimension `indices.shape[-1]` of +// `shape`. `updates` is a tensor with shape +// +// indices.shape[:-1] + shape[indices.shape[-1]:] +// +// The simplest form of tensor_scatter_sub is to subtract individual elements +// from a tensor by index. For example, say we want to insert 4 scattered elements +// in a rank-1 tensor with 8 elements. +// +// In Python, this scatter subtract operation would look like this: +// +// ```python +// +// indices = tf.constant([[4], [3], [1], [7]]) +// updates = tf.constant([9, 10, 11, 12]) +// tensor = tf.ones([8], dtype=tf.int32) +// updated = tf.tensor_scatter_nd_sub(tensor, indices, updates) +// print(updated) +// +// ``` +// +// The resulting tensor would look like this: +// +// [1, -10, 1, -9, -8, 1, 1, -11] +// +// We can also, insert entire slices of a higher rank tensor all at once. For +// example, if we wanted to insert two slices in the first dimension of a +// rank-3 tensor with two matrices of new values. +// +// In Python, this scatter add operation would look like this: +// +// ```python +// +// indices = tf.constant([[0], [2]]) +// updates = tf.constant([[[5, 5, 5, 5], [6, 6, 6, 6], +// [7, 7, 7, 7], [8, 8, 8, 8]], +// [[5, 5, 5, 5], [6, 6, 6, 6], +// [7, 7, 7, 7], [8, 8, 8, 8]]]) +// tensor = tf.ones([4, 4, 4],dtype=tf.int32) +// updated = tf.tensor_scatter_nd_sub(tensor, indices, updates) +// print(updated) +// +// ``` +// +// The resulting tensor would look like this: +// +// [[[-4, -4, -4, -4], [-5, -5, -5, -5], [-6, -6, -6, -6], [-7, -7, -7, -7]], +// [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]], +// [[-4, -4, -4, -4], [-5, -5, -5, -5], [-6, -6, -6, -6], [-7, -7, -7, -7]], +// [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]] +// +// Note that on CPU, if an out of bound index is found, an error is returned. +// On GPU, if an out of bound index is found, the index is ignored. +// +// Arguments: +// +// tensor: Tensor to copy/update. +// indices: Index tensor. +// updates: Updates to scatter into output. +// +// Returns A new tensor copied from tensor and updates subtracted according to the indices. +func TensorScatterSub(scope *Scope, tensor tf.Output, indices tf.Output, updates tf.Output, optional ...TensorScatterSubAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "TensorScatterSub", + Input: []tf.Input{ + tensor, indices, updates, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Forwards `data` to the output port determined by `pred`. +// +// If `pred` is true, the `data` input is forwarded to `output_true`. Otherwise, +// the data goes to `output_false`. +// +// See also `RefSwitch` and `Merge`. +// +// Arguments: +// +// data: The tensor to be forwarded to the appropriate output. +// pred: A scalar that specifies which output port will receive data. +// +// Returns: +// +// output_false: If `pred` is false, data will be forwarded to this output. +// output_true: If `pred` is true, data will be forwarded to this output. +func Switch(scope *Scope, data tf.Output, pred tf.Output) (output_false tf.Output, output_true tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Switch", + Input: []tf.Input{ + data, pred, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// Creates a dataset that splits a SparseTensor into elements row-wise. +func SparseTensorSliceDataset(scope *Scope, indices tf.Output, values tf.Output, dense_shape tf.Output) (handle tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "SparseTensorSliceDataset", + Input: []tf.Input{ + indices, values, dense_shape, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Wraps the XLA DotGeneral operator, documented at +// +// https://www.tensorflow.org/performance/xla/operation_semantics#dotgeneral +// +// . +// +// Arguments: +// +// lhs: the LHS tensor +// rhs: the RHS tensor +// dimension_numbers: a serialized xla::DotDimensionNumbers proto. +// precision_config: a serialized xla::PrecisionConfig proto. +func XlaDot(scope *Scope, lhs tf.Output, rhs tf.Output, dimension_numbers string, precision_config string) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dimension_numbers": dimension_numbers, "precision_config": precision_config} + opspec := tf.OpSpec{ + Type: "XlaDot", + Input: []tf.Input{ + lhs, rhs, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns the rank of a tensor. +// +// This operation returns an integer representing the rank of `input`. +// +// For example: +// +// ``` +// # 't' is [[[1, 1, 1], [2, 2, 2]], [[3, 3, 3], [4, 4, 4]]] +// # shape of tensor 't' is [2, 2, 3] +// rank(t) ==> 3 +// ``` +// +// **Note**: The rank of a tensor is not the same as the rank of a matrix. The rank +// of a tensor is the number of indices required to uniquely select each element +// of the tensor. Rank is also known as "order", "degree", or "ndims." +func Rank(scope *Scope, input tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Rank", + Input: []tf.Input{ + input, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Subtracts a value from the current value of a variable. +// +// Any ReadVariableOp with a control dependency on this op is guaranteed to +// see the decremented value or a subsequent newer one. +// +// Arguments: +// +// resource: handle to the resource in which to store the variable. +// value: the value by which the variable will be incremented. +// +// Returns the created operation. +func AssignSubVariableOp(scope *Scope, resource tf.Output, value tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "AssignSubVariableOp", + Input: []tf.Input{ + resource, value, + }, + } + return scope.AddOperation(opspec) +} + +// CollectiveBcastRecvAttr is an optional argument to CollectiveBcastRecv. +type CollectiveBcastRecvAttr func(optionalAttr) + +// CollectiveBcastRecvCommunicationHint sets the optional communication_hint attribute to value. +// If not specified, defaults to "auto" +func CollectiveBcastRecvCommunicationHint(value string) CollectiveBcastRecvAttr { + return func(m optionalAttr) { + m["communication_hint"] = value + } +} + +// CollectiveBcastRecvTimeoutSeconds sets the optional timeout_seconds attribute to value. +// If not specified, defaults to 0 +func CollectiveBcastRecvTimeoutSeconds(value float32) CollectiveBcastRecvAttr { + return func(m optionalAttr) { + m["timeout_seconds"] = value + } +} + +// Receives a tensor value broadcast from another device. +func CollectiveBcastRecv(scope *Scope, T tf.DataType, group_size int64, group_key int64, instance_key int64, shape tf.Shape, optional ...CollectiveBcastRecvAttr) (data tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"T": T, "group_size": group_size, "group_key": group_key, "instance_key": instance_key, "shape": shape} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "CollectiveBcastRecv", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// PreventGradientAttr is an optional argument to PreventGradient. +type PreventGradientAttr func(optionalAttr) + +// PreventGradientMessage sets the optional message attribute to value. +// +// value: Will be printed in the error when anyone tries to differentiate +// this operation. +// If not specified, defaults to "" +func PreventGradientMessage(value string) PreventGradientAttr { + return func(m optionalAttr) { + m["message"] = value + } +} + +// An identity op that triggers an error if a gradient is requested. +// +// When executed in a graph, this op outputs its input tensor as-is. +// +// When building ops to compute gradients, the TensorFlow gradient system +// will return an error when trying to lookup the gradient of this op, +// because no gradient must ever be registered for this function. This +// op exists to prevent subtle bugs from silently returning unimplemented +// gradients in some corner cases. +// +// Arguments: +// +// input: any tensor. +// +// Returns the same input tensor. +func PreventGradient(scope *Scope, input tf.Output, optional ...PreventGradientAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "PreventGradient", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns a copy of the input tensor. +func Snapshot(scope *Scope, input tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Snapshot", + Input: []tf.Input{ + input, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ResourceApplyProximalAdagradAttr is an optional argument to ResourceApplyProximalAdagrad. +type ResourceApplyProximalAdagradAttr func(optionalAttr) + +// ResourceApplyProximalAdagradUseLocking sets the optional use_locking attribute to value. +// +// value: If True, updating of the var and accum tensors will be protected by +// a lock; otherwise the behavior is undefined, but may exhibit less contention. +// If not specified, defaults to false +func ResourceApplyProximalAdagradUseLocking(value bool) ResourceApplyProximalAdagradAttr { + return func(m optionalAttr) { + m["use_locking"] = value + } +} + +// Update '*var' and '*accum' according to FOBOS with Adagrad learning rate. +// +// accum += grad * grad +// prox_v = var - lr * grad * (1 / sqrt(accum)) +// var = sign(prox_v)/(1+lr*l2) * max{|prox_v|-lr*l1,0} +// +// Arguments: +// +// var_: Should be from a Variable(). +// accum: Should be from a Variable(). +// lr: Scaling factor. Must be a scalar. +// l1: L1 regularization. Must be a scalar. +// l2: L2 regularization. Must be a scalar. +// grad: The gradient. +// +// Returns the created operation. +func ResourceApplyProximalAdagrad(scope *Scope, var_ tf.Output, accum tf.Output, lr tf.Output, l1 tf.Output, l2 tf.Output, grad tf.Output, optional ...ResourceApplyProximalAdagradAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ResourceApplyProximalAdagrad", + Input: []tf.Input{ + var_, accum, lr, l1, l2, grad, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// Computes the gradient for the tanh of `x` wrt its input. +// +// Specifically, `grad = dy * (1 - y*y)`, where `y = tanh(x)`, and `dy` +// is the corresponding input gradient. +func TanhGrad(scope *Scope, y tf.Output, dy tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "TanhGrad", + Input: []tf.Input{ + y, dy, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes the inverse permutation of a tensor. +// +// This operation computes the inverse of an index permutation. It takes a 1-D +// integer tensor `x`, which represents the indices of a zero-based array, and +// swaps each value with its index position. In other words, for an output tensor +// `y` and an input tensor `x`, this operation computes the following: +// +// `y[x[i]] = i for i in [0, 1, ..., len(x) - 1]` +// +// The values must include 0. There can be no duplicate values or negative values. +// +// For example: +// +// ``` +// # tensor `x` is [3, 4, 0, 2, 1] +// invert_permutation(x) ==> [2, 4, 3, 0, 1] +// ``` +// +// Arguments: +// +// x: 1-D. +// +// Returns 1-D. +func InvertPermutation(scope *Scope, x tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "InvertPermutation", + Input: []tf.Input{ + x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// OrderedMapIncompleteSizeAttr is an optional argument to OrderedMapIncompleteSize. +type OrderedMapIncompleteSizeAttr func(optionalAttr) + +// OrderedMapIncompleteSizeCapacity sets the optional capacity attribute to value. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func OrderedMapIncompleteSizeCapacity(value int64) OrderedMapIncompleteSizeAttr { + return func(m optionalAttr) { + m["capacity"] = value + } +} + +// OrderedMapIncompleteSizeMemoryLimit sets the optional memory_limit attribute to value. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func OrderedMapIncompleteSizeMemoryLimit(value int64) OrderedMapIncompleteSizeAttr { + return func(m optionalAttr) { + m["memory_limit"] = value + } +} + +// OrderedMapIncompleteSizeContainer sets the optional container attribute to value. +// If not specified, defaults to "" +func OrderedMapIncompleteSizeContainer(value string) OrderedMapIncompleteSizeAttr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// OrderedMapIncompleteSizeSharedName sets the optional shared_name attribute to value. +// If not specified, defaults to "" +func OrderedMapIncompleteSizeSharedName(value string) OrderedMapIncompleteSizeAttr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// Op returns the number of incomplete elements in the underlying container. +func OrderedMapIncompleteSize(scope *Scope, dtypes []tf.DataType, optional ...OrderedMapIncompleteSizeAttr) (size tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtypes": dtypes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "OrderedMapIncompleteSize", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Deprecated. Use TensorArrayScatterV3 +// +// DEPRECATED at GraphDef version 26: Use TensorArrayScatterV3 +func TensorArrayScatterV2(scope *Scope, handle tf.Output, indices tf.Output, value tf.Output, flow_in tf.Output) (flow_out tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "TensorArrayScatterV2", + Input: []tf.Input{ + handle, indices, value, flow_in, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes softsign: `features / (abs(features) + 1)`. +func Softsign(scope *Scope, features tf.Output) (activations tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Softsign", + Input: []tf.Input{ + features, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Generates sparse cross from a list of sparse and dense tensors. +// +// The op takes two lists, one of 2D `SparseTensor` and one of 2D `Tensor`, each +// representing features of one feature column. It outputs a 2D `SparseTensor` with +// the batchwise crosses of these features. +// +// For example, if the inputs are +// +// inputs[0]: SparseTensor with shape = [2, 2] +// [0, 0]: "a" +// [1, 0]: "b" +// [1, 1]: "c" +// +// inputs[1]: SparseTensor with shape = [2, 1] +// [0, 0]: "d" +// [1, 0]: "e" +// +// inputs[2]: Tensor [["f"], ["g"]] +// +// then the output will be +// +// shape = [2, 2] +// [0, 0]: "a_X_d_X_f" +// [1, 0]: "b_X_e_X_g" +// [1, 1]: "c_X_e_X_g" +// +// if hashed_output=true then the output will be +// +// shape = [2, 2] +// [0, 0]: FingerprintCat64( +// Fingerprint64("f"), FingerprintCat64( +// Fingerprint64("d"), Fingerprint64("a"))) +// [1, 0]: FingerprintCat64( +// Fingerprint64("g"), FingerprintCat64( +// Fingerprint64("e"), Fingerprint64("b"))) +// [1, 1]: FingerprintCat64( +// Fingerprint64("g"), FingerprintCat64( +// Fingerprint64("e"), Fingerprint64("c"))) +// +// Arguments: +// +// indices: 2-D. Indices of each input `SparseTensor`. +// values: 1-D. values of each `SparseTensor`. +// shapes: 1-D. Shapes of each `SparseTensor`. +// dense_inputs: 2-D. Columns represented by dense `Tensor`. +// num_buckets: It is used if hashed_output is true. +// +// output = hashed_value%num_buckets if num_buckets > 0 else hashed_value. +// +// strong_hash: boolean, if true, siphash with salt will be used instead of farmhash. +// salt: Specify the salt that will be used by the siphash function. +// +// Returns: +// +// output_indices: 2-D. Indices of the concatenated `SparseTensor`. +// output_values: 1-D. Non-empty values of the concatenated or hashed +// +// `SparseTensor`. +// +// output_shape: 1-D. Shape of the concatenated `SparseTensor`. +func SparseCrossHashed(scope *Scope, indices []tf.Output, values []tf.Output, shapes []tf.Output, dense_inputs []tf.Output, num_buckets tf.Output, strong_hash tf.Output, salt tf.Output) (output_indices tf.Output, output_values tf.Output, output_shape tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "SparseCrossHashed", + Input: []tf.Input{ + tf.OutputList(indices), tf.OutputList(values), tf.OutputList(shapes), tf.OutputList(dense_inputs), num_buckets, strong_hash, salt, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// Creates a TensorArray for storing multiple gradients of values in the given handle. +// +// Similar to TensorArrayGradV3. However it creates an accumulator with an +// expanded shape compared to the input TensorArray whose gradient is being +// computed. This enables multiple gradients for the same TensorArray to be +// calculated using the same accumulator. +// +// Arguments: +// +// handle: The handle to the forward TensorArray. +// flow_in: A float scalar that enforces proper chaining of operations. +// shape_to_prepend: An int32 vector representing a shape. Elements in the gradient accumulator will +// +// have shape which is this shape_to_prepend value concatenated with shape of the +// elements in the TensorArray corresponding to the input handle. +// +// source: The gradient source string, used to decide which gradient TensorArray +// +// to return. +func TensorArrayGradWithShape(scope *Scope, handle tf.Output, flow_in tf.Output, shape_to_prepend tf.Output, source string) (grad_handle tf.Output, flow_out tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"source": source} + opspec := tf.OpSpec{ + Type: "TensorArrayGradWithShape", + Input: []tf.Input{ + handle, flow_in, shape_to_prepend, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// FusedBatchNormV3Attr is an optional argument to FusedBatchNormV3. +type FusedBatchNormV3Attr func(optionalAttr) + +// FusedBatchNormV3Epsilon sets the optional epsilon attribute to value. +// +// value: A small float number added to the variance of x. +// If not specified, defaults to 0.0001 +func FusedBatchNormV3Epsilon(value float32) FusedBatchNormV3Attr { + return func(m optionalAttr) { + m["epsilon"] = value + } +} + +// FusedBatchNormV3ExponentialAvgFactor sets the optional exponential_avg_factor attribute to value. +// If not specified, defaults to 1 +func FusedBatchNormV3ExponentialAvgFactor(value float32) FusedBatchNormV3Attr { + return func(m optionalAttr) { + m["exponential_avg_factor"] = value + } +} + +// FusedBatchNormV3DataFormat sets the optional data_format attribute to value. +// +// value: The data format for x and y. Either "NHWC" (default) or "NCHW". +// If not specified, defaults to "NHWC" +func FusedBatchNormV3DataFormat(value string) FusedBatchNormV3Attr { + return func(m optionalAttr) { + m["data_format"] = value + } +} + +// FusedBatchNormV3IsTraining sets the optional is_training attribute to value. +// +// value: A bool value to indicate the operation is for training (default) +// or inference. +// If not specified, defaults to true +func FusedBatchNormV3IsTraining(value bool) FusedBatchNormV3Attr { + return func(m optionalAttr) { + m["is_training"] = value + } +} + +// Batch normalization. +// +// Note that the size of 4D Tensors are defined by either "NHWC" or "NCHW". +// The size of 1D Tensors matches the dimension C of the 4D Tensors. +// +// Arguments: +// +// x: A 4D Tensor for input data. +// scale: A 1D Tensor for scaling factor, to scale the normalized x. +// offset: A 1D Tensor for offset, to shift to the normalized x. +// mean: A 1D Tensor for population mean. Used for inference only; +// +// must be empty for training. +// +// variance: A 1D Tensor for population variance. Used for inference only; +// +// must be empty for training. +// +// Returns: +// +// y: A 4D Tensor for output data. +// batch_mean: A 1D Tensor for the computed batch mean, to be used by TensorFlow +// +// to compute the running mean. +// +// batch_variance: A 1D Tensor for the computed batch variance, to be used by +// +// TensorFlow to compute the running variance. +// +// reserve_space_1: A 1D Tensor for the computed batch mean, to be reused +// +// in the gradient computation. +// +// reserve_space_2: A 1D Tensor for the computed batch variance (inverted variance +// +// in the cuDNN case), to be reused in the gradient computation. +// +// reserve_space_3: A 1D Tensor for some intermediate results, to be reused in the gradient +// +// computation for better efficiency. +func FusedBatchNormV3(scope *Scope, x tf.Output, scale tf.Output, offset tf.Output, mean tf.Output, variance tf.Output, optional ...FusedBatchNormV3Attr) (y tf.Output, batch_mean tf.Output, batch_variance tf.Output, reserve_space_1 tf.Output, reserve_space_2 tf.Output, reserve_space_3 tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "FusedBatchNormV3", + Input: []tf.Input{ + x, scale, offset, mean, variance, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2), op.Output(3), op.Output(4), op.Output(5) +} + +// LoadTPUEmbeddingADAMParametersAttr is an optional argument to LoadTPUEmbeddingADAMParameters. +type LoadTPUEmbeddingADAMParametersAttr func(optionalAttr) + +// LoadTPUEmbeddingADAMParametersTableId sets the optional table_id attribute to value. +// If not specified, defaults to -1 +func LoadTPUEmbeddingADAMParametersTableId(value int64) LoadTPUEmbeddingADAMParametersAttr { + return func(m optionalAttr) { + m["table_id"] = value + } +} + +// LoadTPUEmbeddingADAMParametersTableName sets the optional table_name attribute to value. +// If not specified, defaults to "" +func LoadTPUEmbeddingADAMParametersTableName(value string) LoadTPUEmbeddingADAMParametersAttr { + return func(m optionalAttr) { + m["table_name"] = value + } +} + +// LoadTPUEmbeddingADAMParametersConfig sets the optional config attribute to value. +// If not specified, defaults to "" +func LoadTPUEmbeddingADAMParametersConfig(value string) LoadTPUEmbeddingADAMParametersAttr { + return func(m optionalAttr) { + m["config"] = value + } +} + +// Load ADAM embedding parameters. +// +// An op that loads optimization parameters into HBM for embedding. Must be +// preceded by a ConfigureTPUEmbeddingHost op that sets up the correct +// embedding table configuration. For example, this op is used to install +// parameters that are loaded from a checkpoint before a training loop is +// executed. +// +// Arguments: +// +// parameters: Value of parameters used in the ADAM optimization algorithm. +// momenta: Value of momenta used in the ADAM optimization algorithm. +// velocities: Value of velocities used in the ADAM optimization algorithm. +// +// Returns the created operation. +func LoadTPUEmbeddingADAMParameters(scope *Scope, parameters tf.Output, momenta tf.Output, velocities tf.Output, num_shards int64, shard_id int64, optional ...LoadTPUEmbeddingADAMParametersAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_shards": num_shards, "shard_id": shard_id} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "LoadTPUEmbeddingADAMParameters", + Input: []tf.Input{ + parameters, momenta, velocities, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// AnyAttr is an optional argument to Any. +type AnyAttr func(optionalAttr) + +// AnyKeepDims sets the optional keep_dims attribute to value. +// +// value: If true, retain reduced dimensions with length 1. +// If not specified, defaults to false +func AnyKeepDims(value bool) AnyAttr { + return func(m optionalAttr) { + m["keep_dims"] = value + } +} + +// Computes the "logical or" of elements across dimensions of a tensor. +// +// Reduces `input` along the dimensions given in `axis`. Unless +// `keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in +// `axis`. If `keep_dims` is true, the reduced dimensions are +// retained with length 1. +// +// Arguments: +// +// input: The tensor to reduce. +// axis: The dimensions to reduce. Must be in the range +// +// `[-rank(input), rank(input))`. +// +// Returns The reduced tensor. +func Any(scope *Scope, input tf.Output, axis tf.Output, optional ...AnyAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Any", + Input: []tf.Input{ + input, axis, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// EmptyAttr is an optional argument to Empty. +type EmptyAttr func(optionalAttr) + +// EmptyInit sets the optional init attribute to value. +// +// value: If True, initialize the returned tensor with the default value of dtype. Otherwise, the implementation is free not to initializethe tensor's content. +// If not specified, defaults to false +func EmptyInit(value bool) EmptyAttr { + return func(m optionalAttr) { + m["init"] = value + } +} + +// Creates a tensor with the given shape. +// +// This operation creates a tensor of `shape` and `dtype`. +// +// Arguments: +// +// shape: 1-D. Represents the shape of the output tensor. +// +// Returns A `Tensor` of type `T`. +func Empty(scope *Scope, shape tf.Output, dtype tf.DataType, optional ...EmptyAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtype": dtype} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Empty", + Input: []tf.Input{ + shape, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns a batched matrix tensor with new batched diagonal values. +// +// Given `input` and `diagonal`, this operation returns a tensor with the +// same shape and values as `input`, except for the specified diagonals of the +// innermost matrices. These will be overwritten by the values in `diagonal`. +// +// `input` has `r+1` dimensions `[I, J, ..., L, M, N]`. When `k` is scalar or +// `k[0] == k[1]`, `diagonal` has `r` dimensions `[I, J, ..., L, max_diag_len]`. +// Otherwise, it has `r+1` dimensions `[I, J, ..., L, num_diags, max_diag_len]`. +// `num_diags` is the number of diagonals, `num_diags = k[1] - k[0] + 1`. +// `max_diag_len` is the longest diagonal in the range `[k[0], k[1]]`, +// `max_diag_len = min(M + min(k[1], 0), N + min(-k[0], 0))` +// +// The output is a tensor of rank `k+1` with dimensions `[I, J, ..., L, M, N]`. +// If `k` is scalar or `k[0] == k[1]`: +// +// ``` +// output[i, j, ..., l, m, n] +// +// = diagonal[i, j, ..., l, n-max(k[1], 0)] ; if n - m == k[1] +// input[i, j, ..., l, m, n] ; otherwise +// +// ``` +// +// Otherwise, +// +// ``` +// output[i, j, ..., l, m, n] +// +// = diagonal[i, j, ..., l, diag_index, index_in_diag] ; if k[0] <= d <= k[1] +// input[i, j, ..., l, m, n] ; otherwise +// +// ``` +// where `d = n - m`, `diag_index = k[1] - d`, and `index_in_diag = n - max(d, 0)`. +// +// For example: +// +// ``` +// # The main diagonal. +// input = np.array([[[7, 7, 7, 7], # Input shape: (2, 3, 4) +// +// [7, 7, 7, 7], +// [7, 7, 7, 7]], +// [[7, 7, 7, 7], +// [7, 7, 7, 7], +// [7, 7, 7, 7]]]) +// +// diagonal = np.array([[1, 2, 3], # Diagonal shape: (2, 3) +// +// [4, 5, 6]]) +// +// tf.matrix_set_diag(diagonal) ==> [[[1, 7, 7, 7], # Output shape: (2, 3, 4) +// +// [7, 2, 7, 7], +// [7, 7, 3, 7]], +// [[4, 7, 7, 7], +// [7, 5, 7, 7], +// [7, 7, 6, 7]]] +// +// # A superdiagonal (per batch). +// tf.matrix_set_diag(diagonal, k = 1) +// +// ==> [[[7, 1, 7, 7], # Output shape: (2, 3, 4) +// [7, 7, 2, 7], +// [7, 7, 7, 3]], +// [[7, 4, 7, 7], +// [7, 7, 5, 7], +// [7, 7, 7, 6]]] +// +// # A band of diagonals. +// diagonals = np.array([[[1, 2, 3], # Diagonal shape: (2, 2, 3) +// +// [4, 5, 0]], +// [[6, 1, 2], +// [3, 4, 0]]]) +// +// tf.matrix_set_diag(diagonals, k = (-1, 0)) +// +// ==> [[[1, 7, 7, 7], # Output shape: (2, 3, 4) +// [4, 2, 7, 7], +// [0, 5, 3, 7]], +// [[6, 7, 7, 7], +// [3, 1, 7, 7], +// [7, 4, 2, 7]]] +// +// ``` +// +// Arguments: +// +// input: Rank `r+1`, where `r >= 1`. +// diagonal: Rank `r` when `k` is an integer or `k[0] == k[1]`. Otherwise, it has rank `r+1`. +// +// `k >= 1`. +// +// k: Diagonal offset(s). Positive value means superdiagonal, 0 refers to the main +// +// diagonal, and negative value means subdiagonals. `k` can be a single integer +// (for a single diagonal) or a pair of integers specifying the low and high ends +// of a matrix band. `k[0]` must not be larger than `k[1]`. +// +// Returns Rank `r+1`, with `output.shape = input.shape`. +func MatrixSetDiagV2(scope *Scope, input tf.Output, diagonal tf.Output, k tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "MatrixSetDiagV2", + Input: []tf.Input{ + input, diagonal, k, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Retrieves a single tensor from the computation outfeed. Device ordinal is a +// tensor allowing dynamic outfeed. +// +// This operation will block indefinitely until data is available. +// +// Arguments: +// +// device_ordinal: An int scalar tensor, representing the TPU device to use. This should be -1 when +// +// the Op is running on a TPU device, and >= 0 when the Op is running on the CPU +// device. +// +// dtype: The type of elements in the tensor. +// shape: The shape of the tensor. +// +// Returns A tensor that will be read from the device outfeed. +func OutfeedDequeueV2(scope *Scope, device_ordinal tf.Output, dtype tf.DataType, shape tf.Shape) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtype": dtype, "shape": shape} + opspec := tf.OpSpec{ + Type: "OutfeedDequeueV2", + Input: []tf.Input{ + device_ordinal, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns the number of tensors in the input tensor list. +// +// input_handle: the input list +// length: the number of tensors in the list +func TensorListLength(scope *Scope, input_handle tf.Output) (length tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "TensorListLength", + Input: []tf.Input{ + input_handle, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// XlaSpmdShardToFullShapeAttr is an optional argument to XlaSpmdShardToFullShape. +type XlaSpmdShardToFullShapeAttr func(optionalAttr) + +// XlaSpmdShardToFullShapeDim sets the optional dim attribute to value. +// If not specified, defaults to -1 +func XlaSpmdShardToFullShapeDim(value int64) XlaSpmdShardToFullShapeAttr { + return func(m optionalAttr) { + m["dim"] = value + } +} + +// XlaSpmdShardToFullShapeUnspecifiedDims sets the optional unspecified_dims attribute to value. +// If not specified, defaults to <> +func XlaSpmdShardToFullShapeUnspecifiedDims(value []int64) XlaSpmdShardToFullShapeAttr { + return func(m optionalAttr) { + m["unspecified_dims"] = value + } +} + +// An op used by XLA SPMD partitioner to switch from manual partitioning to +// +// automatic partitioning. It converts the shard-shaped, manually partitioned input +// into full-shaped tensor to be partitioned automatically with the same sharding +// used by manual partitioning. The conversion can happen partially in subgroups, +// by specifying the dim attribute, where only that dim will be converted. +func XlaSpmdShardToFullShape(scope *Scope, input tf.Output, manual_sharding string, full_shape tf.Shape, optional ...XlaSpmdShardToFullShapeAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"manual_sharding": manual_sharding, "full_shape": full_shape} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "XlaSpmdShardToFullShape", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// An Op to sum inputs across replicated TPU instances. +// +// Each instance supplies its own input. +// +// For example, suppose there are 8 TPU instances: `[A, B, C, D, E, F, G, H]`. +// Passing group_assignment=`[[0,2,4,6],[1,3,5,7]]` sets `A, C, E, G` as group 0, +// and `B, D, F, H` as group 1. Thus we get the outputs: +// `[A+C+E+G, B+D+F+H, A+C+E+G, B+D+F+H, A+C+E+G, B+D+F+H, A+C+E+G, B+D+F+H]`. +// +// Arguments: +// +// input: The local input to the sum. +// group_assignment: An int32 tensor with shape +// +// [num_groups, num_replicas_per_group]. `group_assignment[i]` represents the +// replica ids in the ith subgroup. +// +// Returns The sum of all the distributed inputs. +func CrossReplicaSum(scope *Scope, input tf.Output, group_assignment tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "CrossReplicaSum", + Input: []tf.Input{ + input, group_assignment, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// MaxPoolAttr is an optional argument to MaxPool. +type MaxPoolAttr func(optionalAttr) + +// MaxPoolExplicitPaddings sets the optional explicit_paddings attribute to value. +// If not specified, defaults to <> +func MaxPoolExplicitPaddings(value []int64) MaxPoolAttr { + return func(m optionalAttr) { + m["explicit_paddings"] = value + } +} + +// MaxPoolDataFormat sets the optional data_format attribute to value. +// +// value: Specify the data format of the input and output data. With the +// default format "NHWC", the data is stored in the order of: +// +// [batch, in_height, in_width, in_channels]. +// +// Alternatively, the format could be "NCHW", the data storage order of: +// +// [batch, in_channels, in_height, in_width]. +// +// If not specified, defaults to "NHWC" +func MaxPoolDataFormat(value string) MaxPoolAttr { + return func(m optionalAttr) { + m["data_format"] = value + } +} + +// Performs max pooling on the input. +// +// Arguments: +// +// input: 4-D input to pool over. +// ksize: The size of the window for each dimension of the input tensor. +// strides: The stride of the sliding window for each dimension of the +// +// input tensor. +// +// padding: The type of padding algorithm to use. +// +// Returns The max pooled output tensor. +func MaxPool(scope *Scope, input tf.Output, ksize []int64, strides []int64, padding string, optional ...MaxPoolAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"ksize": ksize, "strides": strides, "padding": padding} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "MaxPool", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Outputs a `Summary` protocol buffer with a tensor and per-plugin data. +// +// Arguments: +// +// tag: A string attached to this summary. Used for organization in TensorBoard. +// tensor: A tensor to serialize. +// serialized_summary_metadata: A serialized SummaryMetadata proto. Contains plugin +// +// data. +func TensorSummaryV2(scope *Scope, tag tf.Output, tensor tf.Output, serialized_summary_metadata tf.Output) (summary tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "TensorSummaryV2", + Input: []tf.Input{ + tag, tensor, serialized_summary_metadata, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// LeakyReluAttr is an optional argument to LeakyRelu. +type LeakyReluAttr func(optionalAttr) + +// LeakyReluAlpha sets the optional alpha attribute to value. +// If not specified, defaults to 0.2 +func LeakyReluAlpha(value float32) LeakyReluAttr { + return func(m optionalAttr) { + m["alpha"] = value + } +} + +// Computes rectified linear: `max(features, features * alpha)`. +func LeakyRelu(scope *Scope, features tf.Output, optional ...LeakyReluAttr) (activations tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "LeakyRelu", + Input: []tf.Input{ + features, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// QueueDequeueV2Attr is an optional argument to QueueDequeueV2. +type QueueDequeueV2Attr func(optionalAttr) + +// QueueDequeueV2TimeoutMs sets the optional timeout_ms attribute to value. +// +// value: If the queue is empty, this operation will block for up to +// timeout_ms milliseconds. +// Note: This option is not supported yet. +// If not specified, defaults to -1 +func QueueDequeueV2TimeoutMs(value int64) QueueDequeueV2Attr { + return func(m optionalAttr) { + m["timeout_ms"] = value + } +} + +// Dequeues a tuple of one or more tensors from the given queue. +// +// This operation has k outputs, where k is the number of components +// in the tuples stored in the given queue, and output i is the ith +// component of the dequeued tuple. +// +// N.B. If the queue is empty, this operation will block until an element +// has been dequeued (or 'timeout_ms' elapses, if specified). +// +// Arguments: +// +// handle: The handle to a queue. +// component_types: The type of each component in a tuple. +// +// Returns One or more tensors that were dequeued as a tuple. +func QueueDequeueV2(scope *Scope, handle tf.Output, component_types []tf.DataType, optional ...QueueDequeueV2Attr) (components []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"component_types": component_types} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "QueueDequeueV2", + Input: []tf.Input{ + handle, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if components, idx, err = makeOutputList(op, idx, "components"); err != nil { + scope.UpdateErr("QueueDequeueV2", err) + return + } + return components +} + +// Creates a MultiDeviceIterator resource. +// +// Arguments: +// +// devices: A list of devices the iterator works across. +// shared_name: If non-empty, this resource will be shared under the given name +// +// across multiple sessions. +// +// container: If non-empty, this resource is placed in the given container. +// +// Otherwise, a default container is used. +// +// output_types: The type list for the return values. +// output_shapes: The list of shapes being produced. +// +// Returns Handle to the resource created. +func MultiDeviceIterator(scope *Scope, devices []string, shared_name string, container string, output_types []tf.DataType, output_shapes []tf.Shape) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"devices": devices, "shared_name": shared_name, "container": container, "output_types": output_types, "output_shapes": output_shapes} + opspec := tf.OpSpec{ + Type: "MultiDeviceIterator", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// SparseReduceMaxSparseAttr is an optional argument to SparseReduceMaxSparse. +type SparseReduceMaxSparseAttr func(optionalAttr) + +// SparseReduceMaxSparseKeepDims sets the optional keep_dims attribute to value. +// +// value: If true, retain reduced dimensions with length 1. +// If not specified, defaults to false +func SparseReduceMaxSparseKeepDims(value bool) SparseReduceMaxSparseAttr { + return func(m optionalAttr) { + m["keep_dims"] = value + } +} + +// Computes the max of elements across dimensions of a SparseTensor. +// +// This Op takes a SparseTensor and is the sparse counterpart to +// `tf.reduce_max()`. In contrast to SparseReduceMax, this Op returns a +// SparseTensor. +// +// Reduces `sp_input` along the dimensions given in `reduction_axes`. Unless +// `keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in +// `reduction_axes`. If `keep_dims` is true, the reduced dimensions are retained +// with length 1. +// +// If `reduction_axes` has no entries, all dimensions are reduced, and a tensor +// with a single element is returned. Additionally, the axes can be negative, +// which are interpreted according to the indexing rules in Python. +// +// Arguments: +// +// input_indices: 2-D. `N x R` matrix with the indices of non-empty values in a +// +// SparseTensor, possibly not in canonical ordering. +// +// input_values: 1-D. `N` non-empty values corresponding to `input_indices`. +// input_shape: 1-D. Shape of the input SparseTensor. +// reduction_axes: 1-D. Length-`K` vector containing the reduction axes. +func SparseReduceMaxSparse(scope *Scope, input_indices tf.Output, input_values tf.Output, input_shape tf.Output, reduction_axes tf.Output, optional ...SparseReduceMaxSparseAttr) (output_indices tf.Output, output_values tf.Output, output_shape tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "SparseReduceMaxSparse", + Input: []tf.Input{ + input_indices, input_values, input_shape, reduction_axes, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// Creates a dataset that uses a custom thread pool to compute `input_dataset`. +// +// Arguments: +// +// num_threads: Identifies the number of threads to use for the private threadpool. +func ExperimentalPrivateThreadPoolDataset(scope *Scope, input_dataset tf.Output, num_threads tf.Output, output_types []tf.DataType, output_shapes []tf.Shape) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + opspec := tf.OpSpec{ + Type: "ExperimentalPrivateThreadPoolDataset", + Input: []tf.Input{ + input_dataset, num_threads, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Greedily selects a subset of bounding boxes in descending order of score, +// +// pruning away boxes that have high intersection-over-union (IOU) overlap +// with previously selected boxes. Bounding boxes with score less than +// `score_threshold` are removed. Bounding boxes are supplied as +// [y1, x1, y2, x2], where (y1, x1) and (y2, x2) are the coordinates of any +// diagonal pair of box corners and the coordinates can be provided as normalized +// (i.e., lying in the interval [0, 1]) or absolute. Note that this algorithm +// is agnostic to where the origin is in the coordinate system and more +// generally is invariant to orthogonal transformations and translations +// of the coordinate system; thus translating or reflections of the coordinate +// system result in the same boxes being selected by the algorithm. +// The output of this operation is a set of integers indexing into the input +// collection of bounding boxes representing the selected boxes. The bounding +// box coordinates corresponding to the selected indices can then be obtained +// using the `tf.gather operation`. For example: +// +// selected_indices = tf.image.non_max_suppression_v2( +// boxes, scores, max_output_size, iou_threshold, score_threshold) +// selected_boxes = tf.gather(boxes, selected_indices) +// +// Arguments: +// +// boxes: A 2-D float tensor of shape `[num_boxes, 4]`. +// scores: A 1-D float tensor of shape `[num_boxes]` representing a single +// +// score corresponding to each box (each row of boxes). +// +// max_output_size: A scalar integer tensor representing the maximum number of +// +// boxes to be selected by non max suppression. +// +// iou_threshold: A 0-D float tensor representing the threshold for deciding whether +// +// boxes overlap too much with respect to IOU. +// +// score_threshold: A 0-D float tensor representing the threshold for deciding when to remove +// +// boxes based on score. +// +// Returns A 1-D integer tensor of shape `[M]` representing the selected +// indices from the boxes tensor, where `M <= max_output_size`. +func NonMaxSuppressionV3(scope *Scope, boxes tf.Output, scores tf.Output, max_output_size tf.Output, iou_threshold tf.Output, score_threshold tf.Output) (selected_indices tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "NonMaxSuppressionV3", + Input: []tf.Input{ + boxes, scores, max_output_size, iou_threshold, score_threshold, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// SnapshotDatasetAttr is an optional argument to SnapshotDataset. +type SnapshotDatasetAttr func(optionalAttr) + +// SnapshotDatasetCompression sets the optional compression attribute to value. +// If not specified, defaults to "" +func SnapshotDatasetCompression(value string) SnapshotDatasetAttr { + return func(m optionalAttr) { + m["compression"] = value + } +} + +// SnapshotDatasetReaderPathPrefix sets the optional reader_path_prefix attribute to value. +// If not specified, defaults to "" +func SnapshotDatasetReaderPathPrefix(value string) SnapshotDatasetAttr { + return func(m optionalAttr) { + m["reader_path_prefix"] = value + } +} + +// SnapshotDatasetWriterPathPrefix sets the optional writer_path_prefix attribute to value. +// If not specified, defaults to "" +func SnapshotDatasetWriterPathPrefix(value string) SnapshotDatasetAttr { + return func(m optionalAttr) { + m["writer_path_prefix"] = value + } +} + +// SnapshotDatasetShardSizeBytes sets the optional shard_size_bytes attribute to value. +// If not specified, defaults to 10737418240 +func SnapshotDatasetShardSizeBytes(value int64) SnapshotDatasetAttr { + return func(m optionalAttr) { + m["shard_size_bytes"] = value + } +} + +// SnapshotDatasetPendingSnapshotExpirySeconds sets the optional pending_snapshot_expiry_seconds attribute to value. +// If not specified, defaults to 86400 +func SnapshotDatasetPendingSnapshotExpirySeconds(value int64) SnapshotDatasetAttr { + return func(m optionalAttr) { + m["pending_snapshot_expiry_seconds"] = value + } +} + +// SnapshotDatasetNumReaderThreads sets the optional num_reader_threads attribute to value. +// If not specified, defaults to 1 +func SnapshotDatasetNumReaderThreads(value int64) SnapshotDatasetAttr { + return func(m optionalAttr) { + m["num_reader_threads"] = value + } +} + +// SnapshotDatasetReaderBufferSize sets the optional reader_buffer_size attribute to value. +// If not specified, defaults to 1 +func SnapshotDatasetReaderBufferSize(value int64) SnapshotDatasetAttr { + return func(m optionalAttr) { + m["reader_buffer_size"] = value + } +} + +// SnapshotDatasetNumWriterThreads sets the optional num_writer_threads attribute to value. +// If not specified, defaults to 1 +func SnapshotDatasetNumWriterThreads(value int64) SnapshotDatasetAttr { + return func(m optionalAttr) { + m["num_writer_threads"] = value + } +} + +// SnapshotDatasetWriterBufferSize sets the optional writer_buffer_size attribute to value. +// If not specified, defaults to 1 +func SnapshotDatasetWriterBufferSize(value int64) SnapshotDatasetAttr { + return func(m optionalAttr) { + m["writer_buffer_size"] = value + } +} + +// SnapshotDatasetShuffleOnRead sets the optional shuffle_on_read attribute to value. +// If not specified, defaults to false +func SnapshotDatasetShuffleOnRead(value bool) SnapshotDatasetAttr { + return func(m optionalAttr) { + m["shuffle_on_read"] = value + } +} + +// SnapshotDatasetSeed sets the optional seed attribute to value. +// If not specified, defaults to 0 +func SnapshotDatasetSeed(value int64) SnapshotDatasetAttr { + return func(m optionalAttr) { + m["seed"] = value + } +} + +// SnapshotDatasetSeed2 sets the optional seed2 attribute to value. +// If not specified, defaults to 0 +func SnapshotDatasetSeed2(value int64) SnapshotDatasetAttr { + return func(m optionalAttr) { + m["seed2"] = value + } +} + +// SnapshotDatasetMode sets the optional mode attribute to value. +// If not specified, defaults to "auto" +func SnapshotDatasetMode(value string) SnapshotDatasetAttr { + return func(m optionalAttr) { + m["mode"] = value + } +} + +// SnapshotDatasetSnapshotName sets the optional snapshot_name attribute to value. +// If not specified, defaults to "" +func SnapshotDatasetSnapshotName(value string) SnapshotDatasetAttr { + return func(m optionalAttr) { + m["snapshot_name"] = value + } +} + +// Creates a dataset that will write to / read from a snapshot. +// +// This dataset attempts to determine whether a valid snapshot exists at the +// `snapshot_path`, and reads from the snapshot in lieu of using `input_dataset`. +// If not, it will run the preprocessing pipeline as usual, and write out a +// snapshot of the data processed for future use. +// +// Arguments: +// +// input_dataset: A variant tensor representing the input dataset. +// path: The path we should write snapshots to / read snapshots from. +func SnapshotDataset(scope *Scope, input_dataset tf.Output, path tf.Output, output_types []tf.DataType, output_shapes []tf.Shape, optional ...SnapshotDatasetAttr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "SnapshotDataset", + Input: []tf.Input{ + input_dataset, path, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes inverse hyperbolic tangent of x element-wise. +// +// Given an input tensor, this function computes inverse hyperbolic tangent +// for every element in the tensor. Input range is `[-1,1]` and output range is +// `[-inf, inf]`. If input is `-1`, output will be `-inf` and if the +// input is `1`, output will be `inf`. Values outside the range will have +// `nan` as output. +// +// ```python +// x = tf.constant([-float("inf"), -1, -0.5, 1, 0, 0.5, 10, float("inf")]) +// tf.math.atanh(x) ==> [nan -inf -0.54930615 inf 0. 0.54930615 nan nan] +// ``` +func Atanh(scope *Scope, x tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Atanh", + Input: []tf.Input{ + x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// QuantizedConv2DPerChannelAttr is an optional argument to QuantizedConv2DPerChannel. +type QuantizedConv2DPerChannelAttr func(optionalAttr) + +// QuantizedConv2DPerChannelOutType sets the optional out_type attribute to value. +// +// value: The quantized type of output tensor that needs to be converted. +// If not specified, defaults to DT_QINT32 +func QuantizedConv2DPerChannelOutType(value tf.DataType) QuantizedConv2DPerChannelAttr { + return func(m optionalAttr) { + m["out_type"] = value + } +} + +// QuantizedConv2DPerChannelDilations sets the optional dilations attribute to value. +// +// value: list of dilation values. +// If not specified, defaults to +func QuantizedConv2DPerChannelDilations(value []int64) QuantizedConv2DPerChannelAttr { + return func(m optionalAttr) { + m["dilations"] = value + } +} + +// Computes QuantizedConv2D per channel. +// +// Arguments: +// +// input: The original input tensor. +// filter: The original filter tensor. +// min_input: The minimum value of the input tensor +// max_input: The maximum value of the input tensor. +// min_filter: The minimum value of the filter tensor. +// max_filter: The maximum value of the filter tensor. +// strides: list of stride values. +// +// Returns: +// +// output: The output tensor. +// min_output: The minimum value of the final output tensor. +// max_output: The maximum value of the final output tensor. +func QuantizedConv2DPerChannel(scope *Scope, input tf.Output, filter tf.Output, min_input tf.Output, max_input tf.Output, min_filter tf.Output, max_filter tf.Output, strides []int64, padding string, optional ...QuantizedConv2DPerChannelAttr) (output tf.Output, min_output tf.Output, max_output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"strides": strides, "padding": padding} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "QuantizedConv2DPerChannel", + Input: []tf.Input{ + input, filter, min_input, max_input, min_filter, max_filter, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// Transforms a serialized tensorflow.TensorProto proto into a Tensor. +// +// Arguments: +// +// serialized: A scalar string containing a serialized TensorProto proto. +// out_type: The type of the serialized tensor. The provided type must match the +// +// type of the serialized tensor and no implicit conversion will take place. +// +// Returns A Tensor of type `out_type`. +func ParseTensor(scope *Scope, serialized tf.Output, out_type tf.DataType) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"out_type": out_type} + opspec := tf.OpSpec{ + Type: "ParseTensor", + Input: []tf.Input{ + serialized, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Says whether the targets are in the top `K` predictions. +// +// This outputs a `batch_size` bool array, an entry `out[i]` is `true` if the +// prediction for the target class is among the top `k` predictions among +// all predictions for example `i`. Note that the behavior of `InTopK` differs +// from the `TopK` op in its handling of ties; if multiple classes have the +// same prediction value and straddle the top-`k` boundary, all of those +// classes are considered to be in the top `k`. +// +// More formally, let +// +// \\(predictions_i\\) be the predictions for all classes for example `i`, +// \\(targets_i\\) be the target class for example `i`, +// \\(out_i\\) be the output for example `i`, +// +// $$out_i = predictions_{i, targets_i} \in TopKIncludingTies(predictions_i)$$ +// +// Arguments: +// +// predictions: A `batch_size` x `classes` tensor. +// targets: A `batch_size` vector of class ids. +// k: Number of top elements to look at for computing precision. +// +// Returns Computed precision at `k` as a `bool Tensor`. +func InTopKV2(scope *Scope, predictions tf.Output, targets tf.Output, k tf.Output) (precision tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "InTopKV2", + Input: []tf.Input{ + predictions, targets, k, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Applies softmax to a batched N-D `SparseTensor`. +// +// The inputs represent an N-D SparseTensor with logical shape `[..., B, C]` +// (where `N >= 2`), and with indices sorted in the canonical lexicographic order. +// +// This op is equivalent to applying the normal `tf.nn.softmax()` to each innermost +// logical submatrix with shape `[B, C]`, but with the catch that *the implicitly +// zero elements do not participate*. Specifically, the algorithm is equivalent +// to the following: +// +// (1) Applies `tf.nn.softmax()` to a densified view of each innermost submatrix +// with shape `[B, C]`, along the size-C dimension; +// (2) Masks out the original implicitly-zero locations; +// (3) Renormalizes the remaining elements. +// +// Hence, the `SparseTensor` result has exactly the same non-zero indices and +// shape. +// +// Arguments: +// +// sp_indices: 2-D. `NNZ x R` matrix with the indices of non-empty values in a +// +// SparseTensor, in canonical ordering. +// +// sp_values: 1-D. `NNZ` non-empty values corresponding to `sp_indices`. +// sp_shape: 1-D. Shape of the input SparseTensor. +// +// Returns 1-D. The `NNZ` values for the result `SparseTensor`. +func SparseSoftmax(scope *Scope, sp_indices tf.Output, sp_values tf.Output, sp_shape tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "SparseSoftmax", + Input: []tf.Input{ + sp_indices, sp_values, sp_shape, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Fast Fourier transform. +// +// Computes the 1-dimensional discrete Fourier transform over the inner-most +// dimension of `input`. +// +// Arguments: +// +// input: A complex tensor. +// +// Returns A complex tensor of the same shape as `input`. The inner-most +// +// dimension of `input` is replaced with its 1D Fourier transform. +// +// @compatibility(numpy) +// Equivalent to np.fft.fft +// @end_compatibility +func FFT(scope *Scope, input tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "FFT", + Input: []tf.Input{ + input, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Provides the time since epoch in seconds. +// +// Returns the timestamp as a `float64` for seconds since the Unix epoch. +// +// Note: the timestamp is computed when the op is executed, not when it is added +// to the graph. +func Timestamp(scope *Scope) (ts tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Timestamp", + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns conj(x - y)(x - y) element-wise. +// +// *NOTE*: `SquaredDifference` supports broadcasting. More about broadcasting +// [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) +func SquaredDifference(scope *Scope, x tf.Output, y tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "SquaredDifference", + Input: []tf.Input{ + x, y, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// RealAttr is an optional argument to Real. +type RealAttr func(optionalAttr) + +// RealTout sets the optional Tout attribute to value. +// If not specified, defaults to DT_FLOAT +func RealTout(value tf.DataType) RealAttr { + return func(m optionalAttr) { + m["Tout"] = value + } +} + +// Returns the real part of a complex number. +// +// Given a tensor `input` of complex numbers, this operation returns a tensor of +// type `float` that is the real part of each element in `input`. All elements in +// `input` must be complex numbers of the form \\(a + bj\\), where *a* is the real +// +// part returned by this operation and *b* is the imaginary part. +// +// For example: +// +// ``` +// # tensor 'input' is [-2.25 + 4.75j, 3.25 + 5.75j] +// tf.real(input) ==> [-2.25, 3.25] +// ``` +func Real(scope *Scope, input tf.Output, optional ...RealAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Real", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Read an element from the TensorArray into output `value`. +// +// Arguments: +// +// handle: The handle to a TensorArray. +// +// flow_in: A float scalar that enforces proper chaining of operations. +// dtype: The type of the elem that is returned. +// +// Returns The tensor that is read from the TensorArray. +func TensorArrayReadV3(scope *Scope, handle tf.Output, index tf.Output, flow_in tf.Output, dtype tf.DataType) (value tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtype": dtype} + opspec := tf.OpSpec{ + Type: "TensorArrayReadV3", + Input: []tf.Input{ + handle, index, flow_in, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// An Op to exchange data across TPU replicas. +// +// On each replica, the input is split into `split_count` blocks along +// `split_dimension` and send to the other replicas given group_assignment. After +// receiving `split_count` - 1 blocks from other replicas, we concatenate the +// blocks along `concat_dimension` as the output. +// +// For example, suppose there are 2 TPU replicas: +// replica 0 receives input: `[[A, B]]` +// replica 1 receives input: `[[C, D]]` +// +// group_assignment=`[[0, 1]]` +// concat_dimension=0 +// split_dimension=1 +// split_count=2 +// +// replica 0's output: `[[A], [C]]` +// replica 1's output: `[[B], [D]]` +// +// Arguments: +// +// input: The local input to the sum. +// group_assignment: An int32 tensor with shape +// +// [num_groups, num_replicas_per_group]. `group_assignment[i]` represents the +// replica ids in the ith subgroup. +// +// concat_dimension: The dimension number to concatenate. +// split_dimension: The dimension number to split. +// split_count: The number of splits, this number must equal to the sub-group +// +// size(group_assignment.get_shape()[1]) +// +// Returns The exchanged result. +func AllToAll(scope *Scope, input tf.Output, group_assignment tf.Output, concat_dimension int64, split_dimension int64, split_count int64) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"concat_dimension": concat_dimension, "split_dimension": split_dimension, "split_count": split_count} + opspec := tf.OpSpec{ + Type: "AllToAll", + Input: []tf.Input{ + input, group_assignment, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Identity op for gradient debugging. +// +// This op is hidden from public in Python. It is used by TensorFlow Debugger to +// register gradient tensors for gradient debugging. +// This op operates on non-reference-type tensors. +func DebugGradientIdentity(scope *Scope, input tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "DebugGradientIdentity", + Input: []tf.Input{ + input, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// OutfeedDequeueAttr is an optional argument to OutfeedDequeue. +type OutfeedDequeueAttr func(optionalAttr) + +// OutfeedDequeueDeviceOrdinal sets the optional device_ordinal attribute to value. +// +// value: The TPU device to use. This should be -1 when the Op +// is running on a TPU device, and >= 0 when the Op is running on the CPU +// device. +// If not specified, defaults to -1 +func OutfeedDequeueDeviceOrdinal(value int64) OutfeedDequeueAttr { + return func(m optionalAttr) { + m["device_ordinal"] = value + } +} + +// Retrieves a single tensor from the computation outfeed. +// +// This operation will block indefinitely until data is available. +// +// Arguments: +// +// dtype: The type of elements in the tensor. +// shape: The shape of the tensor. +// +// Returns A tensor that will be read from the device outfeed. +func OutfeedDequeue(scope *Scope, dtype tf.DataType, shape tf.Shape, optional ...OutfeedDequeueAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtype": dtype, "shape": shape} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "OutfeedDequeue", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Constructs a tensor by tiling a given tensor. +// +// This operation creates a new tensor by replicating `input` `multiples` times. +// The output tensor's i'th dimension has `input.dims(i) * multiples[i]` elements, +// and the values of `input` are replicated `multiples[i]` times along the 'i'th +// dimension. For example, tiling `[a b c d]` by `[2]` produces +// `[a b c d a b c d]`. +// +// >>> a = tf.constant([[1,2,3],[4,5,6]], tf.int32) +// >>> b = tf.constant([1,2], tf.int32) +// >>> tf.tile(a, b) +// +// +// >>> c = tf.constant([2,1], tf.int32) +// >>> tf.tile(a, c) +// +// +// >>> d = tf.constant([2,2], tf.int32) +// >>> tf.tile(a, d) +// +// +// Arguments: +// +// input: 1-D or higher. +// multiples: 1-D. Length must be the same as the number of dimensions in `input` +func Tile(scope *Scope, input tf.Output, multiples tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Tile", + Input: []tf.Input{ + input, multiples, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ListDiffAttr is an optional argument to ListDiff. +type ListDiffAttr func(optionalAttr) + +// ListDiffOutIdx sets the optional out_idx attribute to value. +// If not specified, defaults to DT_INT32 +func ListDiffOutIdx(value tf.DataType) ListDiffAttr { + return func(m optionalAttr) { + m["out_idx"] = value + } +} + +// Computes the difference between two lists of numbers or strings. +// +// Given a list `x` and a list `y`, this operation returns a list `out` that +// represents all values that are in `x` but not in `y`. The returned list `out` +// is sorted in the same order that the numbers appear in `x` (duplicates are +// preserved). This operation also returns a list `idx` that represents the +// position of each `out` element in `x`. In other words: +// +// `out[i] = x[idx[i]] for i in [0, 1, ..., len(out) - 1]` +// +// For example, given this input: +// +// ``` +// x = [1, 2, 3, 4, 5, 6] +// y = [1, 3, 5] +// ``` +// +// This operation would return: +// +// ``` +// out ==> [2, 4, 6] +// idx ==> [1, 3, 5] +// ``` +// +// Arguments: +// +// x: 1-D. Values to keep. +// y: 1-D. Values to remove. +// +// Returns: +// +// out: 1-D. Values present in `x` but not in `y`. +// idx: 1-D. Positions of `x` values preserved in `out`. +func ListDiff(scope *Scope, x tf.Output, y tf.Output, optional ...ListDiffAttr) (out tf.Output, idx tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ListDiff", + Input: []tf.Input{ + x, y, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// This op consumes a lock created by `MutexLock`. +// +// This op exists to consume a tensor created by `MutexLock` (other than +// direct control dependencies). It should be the only that consumes the tensor, +// and will raise an error if it is not. Its only purpose is to keep the +// mutex lock tensor alive until it is consumed by this op. +// +// **NOTE**: This operation must run on the same device as its input. This may +// be enforced via the `colocate_with` mechanism. +// +// Arguments: +// +// mutex_lock: A tensor returned by `MutexLock`. +// +// Returns the created operation. +func ConsumeMutexLock(scope *Scope, mutex_lock tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "ConsumeMutexLock", + Input: []tf.Input{ + mutex_lock, + }, + } + return scope.AddOperation(opspec) +} + +// An op to send a tensor to the host. +// +// input: the tensor that will be sent to the host. +// Tinput: element type for input. +// key: A unique identifier for this region used to match up host transfers. +// +// Returns the created operation. +func XlaSendToHost(scope *Scope, input tf.Output, key string) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"key": key} + opspec := tf.OpSpec{ + Type: "XlaSendToHost", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// RaggedRangeAttr is an optional argument to RaggedRange. +type RaggedRangeAttr func(optionalAttr) + +// RaggedRangeTsplits sets the optional Tsplits attribute to value. +// If not specified, defaults to DT_INT64 +func RaggedRangeTsplits(value tf.DataType) RaggedRangeAttr { + return func(m optionalAttr) { + m["Tsplits"] = value + } +} + +// Returns a `RaggedTensor` containing the specified sequences of numbers. +// +// Returns a `RaggedTensor` `result` composed from `rt_dense_values` and +// `rt_nested_splits`, such that +// `result[i] = range(starts[i], limits[i], deltas[i])`. +// +// ```python +// (rt_nested_splits, rt_dense_values) = ragged_range( +// +// starts=[2, 5, 8], limits=[3, 5, 12], deltas=1) +// +// result = tf.ragged.from_row_splits(rt_dense_values, rt_nested_splits) +// print(result) +// +// ``` +// +// The input tensors `starts`, `limits`, and `deltas` may be scalars or vectors. +// The vector inputs must all have the same size. Scalar inputs are broadcast +// to match the size of the vector inputs. +// +// Arguments: +// +// starts: The starts of each range. +// limits: The limits of each range. +// deltas: The deltas of each range. +// +// Returns: +// +// rt_nested_splits: The `row_splits` for the returned `RaggedTensor`. +// rt_dense_values: The `flat_values` for the returned `RaggedTensor`. +func RaggedRange(scope *Scope, starts tf.Output, limits tf.Output, deltas tf.Output, optional ...RaggedRangeAttr) (rt_nested_splits tf.Output, rt_dense_values tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "RaggedRange", + Input: []tf.Input{ + starts, limits, deltas, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// LeakyReluGradAttr is an optional argument to LeakyReluGrad. +type LeakyReluGradAttr func(optionalAttr) + +// LeakyReluGradAlpha sets the optional alpha attribute to value. +// If not specified, defaults to 0.2 +func LeakyReluGradAlpha(value float32) LeakyReluGradAttr { + return func(m optionalAttr) { + m["alpha"] = value + } +} + +// Computes rectified linear gradients for a LeakyRelu operation. +// +// Arguments: +// +// gradients: The backpropagated gradients to the corresponding LeakyRelu operation. +// features: The features passed as input to the corresponding LeakyRelu operation, +// +// OR the outputs of that operation (both work equivalently). +// +// Returns `gradients * (features > 0) + alpha * gradients * (features <= 0)`. +func LeakyReluGrad(scope *Scope, gradients tf.Output, features tf.Output, optional ...LeakyReluGradAttr) (backprops tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "LeakyReluGrad", + Input: []tf.Input{ + gradients, features, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns a map that is the 'input_handle' with the given key-value pair inserted. +// +// input_handle: the original map +// output_handle: the map with key and value inserted +// key: the key to be inserted +// value: the value to be inserted +func TensorMapInsert(scope *Scope, input_handle tf.Output, key tf.Output, value tf.Output) (output_handle tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "TensorMapInsert", + Input: []tf.Input{ + input_handle, key, value, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Interleave the values from the `data` tensors into a single tensor. +// +// # Builds a merged tensor such that +// +// ```python +// +// merged[indices[m][i, ..., j], ...] = data[m][i, ..., j, ...] +// +// ``` +// +// For example, if each `indices[m]` is scalar or vector, we have +// +// ```python +// +// # Scalar indices: +// merged[indices[m], ...] = data[m][...] +// +// # Vector indices: +// merged[indices[m][i], ...] = data[m][i, ...] +// +// ``` +// +// Each `data[i].shape` must start with the corresponding `indices[i].shape`, +// and the rest of `data[i].shape` must be constant w.r.t. `i`. That is, we +// must have `data[i].shape = indices[i].shape + constant`. In terms of this +// `constant`, the output shape is +// +// merged.shape = [max(indices)] + constant +// +// Values may be merged in parallel, so if an index appears in both `indices[m][i]` +// and `indices[n][j]`, the result may be invalid. This differs from the normal +// DynamicStitch operator that defines the behavior in that case. +// +// For example: +// +// ```python +// +// indices[0] = 6 +// indices[1] = [4, 1] +// indices[2] = [[5, 2], [0, 3]] +// data[0] = [61, 62] +// data[1] = [[41, 42], [11, 12]] +// data[2] = [[[51, 52], [21, 22]], [[1, 2], [31, 32]]] +// merged = [[1, 2], [11, 12], [21, 22], [31, 32], [41, 42], +// [51, 52], [61, 62]] +// +// ``` +// +// This method can be used to merge partitions created by `dynamic_partition` +// as illustrated on the following example: +// +// ```python +// +// # Apply function (increments x_i) on elements for which a certain condition +// # apply (x_i != -1 in this example). +// x=tf.constant([0.1, -1., 5.2, 4.3, -1., 7.4]) +// condition_mask=tf.not_equal(x,tf.constant(-1.)) +// partitioned_data = tf.dynamic_partition( +// x, tf.cast(condition_mask, tf.int32) , 2) +// partitioned_data[1] = partitioned_data[1] + 1.0 +// condition_indices = tf.dynamic_partition( +// tf.range(tf.shape(x)[0]), tf.cast(condition_mask, tf.int32) , 2) +// x = tf.dynamic_stitch(condition_indices, partitioned_data) +// # Here x=[1.1, -1., 6.2, 5.3, -1, 8.4], the -1. values remain +// # unchanged. +// +// ``` +// +//
+// +//
+func ParallelDynamicStitch(scope *Scope, indices []tf.Output, data []tf.Output) (merged tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "ParallelDynamicStitch", + Input: []tf.Input{ + tf.OutputList(indices), tf.OutputList(data), + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes square of x element-wise. +// +// I.e., \\(y = x * x = x^2\\). +func Square(scope *Scope, x tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Square", + Input: []tf.Input{ + x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// CropAndResizeGradImageAttr is an optional argument to CropAndResizeGradImage. +type CropAndResizeGradImageAttr func(optionalAttr) + +// CropAndResizeGradImageMethod sets the optional method attribute to value. +// +// value: A string specifying the interpolation method. Only 'bilinear' is +// supported for now. +// If not specified, defaults to "bilinear" +func CropAndResizeGradImageMethod(value string) CropAndResizeGradImageAttr { + return func(m optionalAttr) { + m["method"] = value + } +} + +// Computes the gradient of the crop_and_resize op wrt the input image tensor. +// +// Arguments: +// +// grads: A 4-D tensor of shape `[num_boxes, crop_height, crop_width, depth]`. +// boxes: A 2-D tensor of shape `[num_boxes, 4]`. The `i`-th row of the tensor +// +// specifies the coordinates of a box in the `box_ind[i]` image and is specified +// in normalized coordinates `[y1, x1, y2, x2]`. A normalized coordinate value of +// `y` is mapped to the image coordinate at `y * (image_height - 1)`, so as the +// `[0, 1]` interval of normalized image height is mapped to +// `[0, image_height - 1] in image height coordinates. We do allow y1 > y2, in +// which case the sampled crop is an up-down flipped version of the original +// image. The width dimension is treated similarly. Normalized coordinates +// outside the `[0, 1]` range are allowed, in which case we use +// `extrapolation_value` to extrapolate the input image values. +// +// box_ind: A 1-D tensor of shape `[num_boxes]` with int32 values in `[0, batch)`. +// +// The value of `box_ind[i]` specifies the image that the `i`-th box refers to. +// +// image_size: A 1-D tensor with value `[batch, image_height, image_width, depth]` +// +// containing the original image size. Both `image_height` and `image_width` need +// to be positive. +// +// Returns A 4-D tensor of shape `[batch, image_height, image_width, depth]`. +func CropAndResizeGradImage(scope *Scope, grads tf.Output, boxes tf.Output, box_ind tf.Output, image_size tf.Output, T tf.DataType, optional ...CropAndResizeGradImageAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"T": T} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "CropAndResizeGradImage", + Input: []tf.Input{ + grads, boxes, box_ind, image_size, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// StatelessRandomNormalAttr is an optional argument to StatelessRandomNormal. +type StatelessRandomNormalAttr func(optionalAttr) + +// StatelessRandomNormalDtype sets the optional dtype attribute to value. +// +// value: The type of the output. +// If not specified, defaults to DT_FLOAT +func StatelessRandomNormalDtype(value tf.DataType) StatelessRandomNormalAttr { + return func(m optionalAttr) { + m["dtype"] = value + } +} + +// Outputs deterministic pseudorandom values from a normal distribution. +// +// The generated values will have mean 0 and standard deviation 1. +// +// The outputs are a deterministic function of `shape` and `seed`. +// +// Arguments: +// +// shape: The shape of the output tensor. +// seed: 2 seeds (shape [2]). +// +// Returns Random values with specified shape. +func StatelessRandomNormal(scope *Scope, shape tf.Output, seed tf.Output, optional ...StatelessRandomNormalAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "StatelessRandomNormal", + Input: []tf.Input{ + shape, seed, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// IRFFTAttr is an optional argument to IRFFT. +type IRFFTAttr func(optionalAttr) + +// IRFFTTreal sets the optional Treal attribute to value. +// If not specified, defaults to DT_FLOAT +func IRFFTTreal(value tf.DataType) IRFFTAttr { + return func(m optionalAttr) { + m["Treal"] = value + } +} + +// Inverse real-valued fast Fourier transform. +// +// Computes the inverse 1-dimensional discrete Fourier transform of a real-valued +// signal over the inner-most dimension of `input`. +// +// The inner-most dimension of `input` is assumed to be the result of `RFFT`: the +// `fft_length / 2 + 1` unique components of the DFT of a real-valued signal. If +// `fft_length` is not provided, it is computed from the size of the inner-most +// dimension of `input` (`fft_length = 2 * (inner - 1)`). If the FFT length used to +// compute `input` is odd, it should be provided since it cannot be inferred +// properly. +// +// Along the axis `IRFFT` is computed on, if `fft_length / 2 + 1` is smaller +// than the corresponding dimension of `input`, the dimension is cropped. If it is +// larger, the dimension is padded with zeros. +// +// Arguments: +// +// input: A complex tensor. +// fft_length: An int32 tensor of shape [1]. The FFT length. +// +// Returns A float32 tensor of the same rank as `input`. The inner-most +// +// dimension of `input` is replaced with the `fft_length` samples of its inverse +// 1D Fourier transform. +// +// @compatibility(numpy) +// Equivalent to np.fft.irfft +// @end_compatibility +func IRFFT(scope *Scope, input tf.Output, fft_length tf.Output, optional ...IRFFTAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "IRFFT", + Input: []tf.Input{ + input, fft_length, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// StringLowerAttr is an optional argument to StringLower. +type StringLowerAttr func(optionalAttr) + +// StringLowerEncoding sets the optional encoding attribute to value. +// If not specified, defaults to "" +func StringLowerEncoding(value string) StringLowerAttr { + return func(m optionalAttr) { + m["encoding"] = value + } +} + +// Converts all uppercase characters into their respective lowercase replacements. +// +// Example: +// +// >>> tf.strings.lower("CamelCase string and ALL CAPS") +// +func StringLower(scope *Scope, input tf.Output, optional ...StringLowerAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "StringLower", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ResourceSparseApplyFtrlV2Attr is an optional argument to ResourceSparseApplyFtrlV2. +type ResourceSparseApplyFtrlV2Attr func(optionalAttr) + +// ResourceSparseApplyFtrlV2UseLocking sets the optional use_locking attribute to value. +// +// value: If `True`, updating of the var and accum tensors will be protected +// by a lock; otherwise the behavior is undefined, but may exhibit less +// contention. +// If not specified, defaults to false +func ResourceSparseApplyFtrlV2UseLocking(value bool) ResourceSparseApplyFtrlV2Attr { + return func(m optionalAttr) { + m["use_locking"] = value + } +} + +// ResourceSparseApplyFtrlV2MultiplyLinearByLr sets the optional multiply_linear_by_lr attribute to value. +// If not specified, defaults to false +func ResourceSparseApplyFtrlV2MultiplyLinearByLr(value bool) ResourceSparseApplyFtrlV2Attr { + return func(m optionalAttr) { + m["multiply_linear_by_lr"] = value + } +} + +// Update relevant entries in '*var' according to the Ftrl-proximal scheme. +// +// That is for rows we have grad for, we update var, accum and linear as follows: +// grad_with_shrinkage = grad + 2 * l2_shrinkage * var +// accum_new = accum + grad_with_shrinkage * grad_with_shrinkage +// linear += grad_with_shrinkage + +// +// (accum_new^(-lr_power) - accum^(-lr_power)) / lr * var +// +// quadratic = 1.0 / (accum_new^(lr_power) * lr) + 2 * l2 +// var = (sign(linear) * l1 - linear) / quadratic if |linear| > l1 else 0.0 +// accum = accum_new +// +// Arguments: +// +// var_: Should be from a Variable(). +// accum: Should be from a Variable(). +// linear: Should be from a Variable(). +// grad: The gradient. +// indices: A vector of indices into the first dimension of var and accum. +// lr: Scaling factor. Must be a scalar. +// l1: L1 regularization. Must be a scalar. +// l2: L2 shrinkage regularization. Must be a scalar. +// +// lr_power: Scaling factor. Must be a scalar. +// +// Returns the created operation. +func ResourceSparseApplyFtrlV2(scope *Scope, var_ tf.Output, accum tf.Output, linear tf.Output, grad tf.Output, indices tf.Output, lr tf.Output, l1 tf.Output, l2 tf.Output, l2_shrinkage tf.Output, lr_power tf.Output, optional ...ResourceSparseApplyFtrlV2Attr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ResourceSparseApplyFtrlV2", + Input: []tf.Input{ + var_, accum, linear, grad, indices, lr, l1, l2, l2_shrinkage, lr_power, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// ResourceApplyAddSignAttr is an optional argument to ResourceApplyAddSign. +type ResourceApplyAddSignAttr func(optionalAttr) + +// ResourceApplyAddSignUseLocking sets the optional use_locking attribute to value. +// +// value: If `True`, updating of the var and m tensors is +// protected by a lock; otherwise the behavior is undefined, but may exhibit less +// contention. +// If not specified, defaults to false +func ResourceApplyAddSignUseLocking(value bool) ResourceApplyAddSignAttr { + return func(m optionalAttr) { + m["use_locking"] = value + } +} + +// Update '*var' according to the AddSign update. +// +// m_t <- beta1 * m_{t-1} + (1 - beta1) * g +// update <- (alpha + sign_decay * sign(g) *sign(m)) * g +// variable <- variable - lr_t * update +// +// Arguments: +// +// var_: Should be from a Variable(). +// m: Should be from a Variable(). +// lr: Scaling factor. Must be a scalar. +// alpha: Must be a scalar. +// sign_decay: Must be a scalar. +// beta: Must be a scalar. +// grad: The gradient. +// +// Returns the created operation. +func ResourceApplyAddSign(scope *Scope, var_ tf.Output, m tf.Output, lr tf.Output, alpha tf.Output, sign_decay tf.Output, beta tf.Output, grad tf.Output, optional ...ResourceApplyAddSignAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ResourceApplyAddSign", + Input: []tf.Input{ + var_, m, lr, alpha, sign_decay, beta, grad, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// Computes the Cholesky decomposition of one or more square matrices. +// +// The input is a tensor of shape `[..., M, M]` whose inner-most 2 dimensions +// form square matrices. +// +// The input has to be symmetric and positive definite. Only the lower-triangular +// part of the input will be used for this operation. The upper-triangular part +// will not be read. +// +// The output is a tensor of the same shape as the input +// containing the Cholesky decompositions for all input submatrices `[..., :, :]`. +// +// **Note**: The gradient computation on GPU is faster for large matrices but +// not for large batch dimensions when the submatrices are small. In this +// case it might be faster to use the CPU. +// +// Arguments: +// +// input: Shape is `[..., M, M]`. +// +// Returns Shape is `[..., M, M]`. +func Cholesky(scope *Scope, input tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Cholesky", + Input: []tf.Input{ + input, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes exponential linear: `exp(features) - 1` if < 0, `features` otherwise. +// +// See [Fast and Accurate Deep Network Learning by Exponential Linear Units (ELUs) +// ](http://arxiv.org/abs/1511.07289) +func Elu(scope *Scope, features tf.Output) (activations tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Elu", + Input: []tf.Input{ + features, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Transforms a vector of brain.Example protos (as strings) into typed tensors. +// +// Arguments: +// +// serialized: A vector containing a batch of binary serialized Example protos. +// names: A vector containing the names of the serialized protos. +// +// May contain, for example, table key (descriptive) names for the +// corresponding serialized protos. These are purely useful for debugging +// purposes, and the presence of values here has no effect on the output. +// May also be an empty vector if no names are available. +// If non-empty, this vector must be the same length as "serialized". +// +// sparse_keys: A list of Nsparse string Tensors (scalars). +// +// The keys expected in the Examples' features associated with sparse values. +// +// dense_keys: A list of Ndense string Tensors (scalars). +// +// The keys expected in the Examples' features associated with dense values. +// +// dense_defaults: A list of Ndense Tensors (some may be empty). +// +// dense_defaults[j] provides default values +// when the example's feature_map lacks dense_key[j]. If an empty Tensor is +// provided for dense_defaults[j], then the Feature dense_keys[j] is required. +// The input type is inferred from dense_defaults[j], even when it's empty. +// If dense_defaults[j] is not empty, and dense_shapes[j] is fully defined, +// then the shape of dense_defaults[j] must match that of dense_shapes[j]. +// If dense_shapes[j] has an undefined major dimension (variable strides dense +// feature), dense_defaults[j] must contain a single element: +// the padding element. +// +// sparse_types: A list of Nsparse types; the data types of data in each Feature +// +// given in sparse_keys. +// Currently the ParseExample supports DT_FLOAT (FloatList), +// DT_INT64 (Int64List), and DT_STRING (BytesList). +// +// dense_shapes: A list of Ndense shapes; the shapes of data in each Feature +// +// given in dense_keys. +// The number of elements in the Feature corresponding to dense_key[j] +// must always equal dense_shapes[j].NumEntries(). +// If dense_shapes[j] == (D0, D1, ..., DN) then the shape of output +// Tensor dense_values[j] will be (|serialized|, D0, D1, ..., DN): +// The dense outputs are just the inputs row-stacked by batch. +// This works for dense_shapes[j] = (-1, D1, ..., DN). In this case +// the shape of the output Tensor dense_values[j] will be +// (|serialized|, M, D1, .., DN), where M is the maximum number of blocks +// of elements of length D1 * .... * DN, across all minibatch entries +// in the input. Any minibatch entry with less than M blocks of elements of +// length D1 * ... * DN will be padded with the corresponding default_value +// scalar element along the second dimension. +func ParseExample(scope *Scope, serialized tf.Output, names tf.Output, sparse_keys []tf.Output, dense_keys []tf.Output, dense_defaults []tf.Output, sparse_types []tf.DataType, dense_shapes []tf.Shape) (sparse_indices []tf.Output, sparse_values []tf.Output, sparse_shapes []tf.Output, dense_values []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"sparse_types": sparse_types, "dense_shapes": dense_shapes} + opspec := tf.OpSpec{ + Type: "ParseExample", + Input: []tf.Input{ + serialized, names, tf.OutputList(sparse_keys), tf.OutputList(dense_keys), tf.OutputList(dense_defaults), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if sparse_indices, idx, err = makeOutputList(op, idx, "sparse_indices"); err != nil { + scope.UpdateErr("ParseExample", err) + return + } + if sparse_values, idx, err = makeOutputList(op, idx, "sparse_values"); err != nil { + scope.UpdateErr("ParseExample", err) + return + } + if sparse_shapes, idx, err = makeOutputList(op, idx, "sparse_shapes"); err != nil { + scope.UpdateErr("ParseExample", err) + return + } + if dense_values, idx, err = makeOutputList(op, idx, "dense_values"); err != nil { + scope.UpdateErr("ParseExample", err) + return + } + return sparse_indices, sparse_values, sparse_shapes, dense_values +} + +// Bitcasts a tensor from one type to another without copying data. +// +// Given a tensor `input`, this operation returns a tensor that has the same buffer +// data as `input` with datatype `type`. +// +// If the input datatype `T` is larger than the output datatype `type` then the +// shape changes from [...] to [..., sizeof(`T`)/sizeof(`type`)]. +// +// If `T` is smaller than `type`, the operator requires that the rightmost +// dimension be equal to sizeof(`type`)/sizeof(`T`). The shape then goes from +// [..., sizeof(`type`)/sizeof(`T`)] to [...]. +// +// tf.bitcast() and tf.cast() work differently when real dtype is casted as a complex dtype +// (e.g. tf.complex64 or tf.complex128) as tf.cast() make imaginary part 0 while tf.bitcast() +// gives module error. +// For example, +// +// Example 1: +// +// >>> a = [1., 2., 3.] +// >>> equality_bitcast = tf.bitcast(a, tf.complex128) +// Traceback (most recent call last): +// ... +// InvalidArgumentError: Cannot bitcast from 1 to 18 [Op:Bitcast] +// >>> equality_cast = tf.cast(a, tf.complex128) +// >>> print(equality_cast) +// tf.Tensor([1.+0.j 2.+0.j 3.+0.j], shape=(3,), dtype=complex128) +// +// Example 2: +// +// >>> tf.bitcast(tf.constant(0xffffffff, dtype=tf.uint32), tf.uint8) +// +// +// Example 3: +// +// >>> x = [1., 2., 3.] +// >>> y = [0., 2., 3.] +// >>> equality= tf.equal(x,y) +// >>> equality_cast = tf.cast(equality,tf.float32) +// >>> equality_bitcast = tf.bitcast(equality_cast,tf.uint8) +// >>> print(equality) +// tf.Tensor([False True True], shape=(3,), dtype=bool) +// >>> print(equality_cast) +// tf.Tensor([0. 1. 1.], shape=(3,), dtype=float32) +// >>> print(equality_bitcast) +// tf.Tensor( +// +// [[ 0 0 0 0] +// [ 0 0 128 63] +// [ 0 0 128 63]], shape=(3, 4), dtype=uint8) +// +// *NOTE*: Bitcast is implemented as a low-level cast, so machines with different +// endian orderings will give different results. +func Bitcast(scope *Scope, input tf.Output, type_ tf.DataType) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"type": type_} + opspec := tf.OpSpec{ + Type: "Bitcast", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// GenerateVocabRemappingAttr is an optional argument to GenerateVocabRemapping. +type GenerateVocabRemappingAttr func(optionalAttr) + +// GenerateVocabRemappingOldVocabSize sets the optional old_vocab_size attribute to value. +// +// value: Number of entries in the old vocab file to consider. If -1, +// use the entire old vocabulary. +// If not specified, defaults to -1 +// +// REQUIRES: value >= -1 +func GenerateVocabRemappingOldVocabSize(value int64) GenerateVocabRemappingAttr { + return func(m optionalAttr) { + m["old_vocab_size"] = value + } +} + +// Given a path to new and old vocabulary files, returns a remapping Tensor of +// +// length `num_new_vocab`, where `remapping[i]` contains the row number in the old +// vocabulary that corresponds to row `i` in the new vocabulary (starting at line +// `new_vocab_offset` and up to `num_new_vocab` entities), or `-1` if entry `i` +// in the new vocabulary is not in the old vocabulary. The old vocabulary is +// constrained to the first `old_vocab_size` entries if `old_vocab_size` is not the +// default value of -1. +// +// `num_vocab_offset` enables +// use in the partitioned variable case, and should generally be set through +// examining partitioning info. The format of the files should be a text file, +// with each line containing a single entity within the vocabulary. +// +// For example, with `new_vocab_file` a text file containing each of the following +// elements on a single line: `[f0, f1, f2, f3]`, old_vocab_file = [f1, f0, f3], +// `num_new_vocab = 3, new_vocab_offset = 1`, the returned remapping would be +// `[0, -1, 2]`. +// +// The op also returns a count of how many entries in the new vocabulary +// were present in the old vocabulary, which is used to calculate the number of +// values to initialize in a weight matrix remapping +// +// This functionality can be used to remap both row vocabularies (typically, +// features) and column vocabularies (typically, classes) from TensorFlow +// checkpoints. Note that the partitioning logic relies on contiguous vocabularies +// corresponding to div-partitioned variables. Moreover, the underlying remapping +// uses an IndexTable (as opposed to an inexact CuckooTable), so client code should +// use the corresponding index_table_from_file() as the FeatureColumn framework +// does (as opposed to tf.feature_to_id(), which uses a CuckooTable). +// +// Arguments: +// +// new_vocab_file: Path to the new vocab file. +// old_vocab_file: Path to the old vocab file. +// new_vocab_offset: How many entries into the new vocab file to start reading. +// num_new_vocab: Number of entries in the new vocab file to remap. +// +// Returns: +// +// remapping: A Tensor of length num_new_vocab where the element at index i +// +// is equal to the old ID that maps to the new ID i. This element is -1 for any +// new ID that is not found in the old vocabulary. +// +// num_present: Number of new vocab entries found in old vocab. +func GenerateVocabRemapping(scope *Scope, new_vocab_file tf.Output, old_vocab_file tf.Output, new_vocab_offset int64, num_new_vocab int64, optional ...GenerateVocabRemappingAttr) (remapping tf.Output, num_present tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"new_vocab_offset": new_vocab_offset, "num_new_vocab": num_new_vocab} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "GenerateVocabRemapping", + Input: []tf.Input{ + new_vocab_file, old_vocab_file, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// Conv3DBackpropFilterAttr is an optional argument to Conv3DBackpropFilter. +type Conv3DBackpropFilterAttr func(optionalAttr) + +// Conv3DBackpropFilterDilations sets the optional dilations attribute to value. +// If not specified, defaults to +func Conv3DBackpropFilterDilations(value []int64) Conv3DBackpropFilterAttr { + return func(m optionalAttr) { + m["dilations"] = value + } +} + +// Computes the gradients of 3-D convolution with respect to the filter. +// +// DEPRECATED at GraphDef version 10: Use Conv3DBackpropFilterV2 +// +// Arguments: +// +// input: Shape `[batch, depth, rows, cols, in_channels]`. +// filter: Shape `[depth, rows, cols, in_channels, out_channels]`. +// +// `in_channels` must match between `input` and `filter`. +// +// out_backprop: Backprop signal of shape `[batch, out_depth, out_rows, out_cols, +// +// out_channels]`. +// +// strides: 1-D tensor of length 5. The stride of the sliding window for each +// +// dimension of `input`. Must have `strides[0] = strides[4] = 1`. +// +// padding: The type of padding algorithm to use. +func Conv3DBackpropFilter(scope *Scope, input tf.Output, filter tf.Output, out_backprop tf.Output, strides []int64, padding string, optional ...Conv3DBackpropFilterAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"strides": strides, "padding": padding} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Conv3DBackpropFilter", + Input: []tf.Input{ + input, filter, out_backprop, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// MapPeekAttr is an optional argument to MapPeek. +type MapPeekAttr func(optionalAttr) + +// MapPeekCapacity sets the optional capacity attribute to value. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func MapPeekCapacity(value int64) MapPeekAttr { + return func(m optionalAttr) { + m["capacity"] = value + } +} + +// MapPeekMemoryLimit sets the optional memory_limit attribute to value. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func MapPeekMemoryLimit(value int64) MapPeekAttr { + return func(m optionalAttr) { + m["memory_limit"] = value + } +} + +// MapPeekContainer sets the optional container attribute to value. +// If not specified, defaults to "" +func MapPeekContainer(value string) MapPeekAttr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// MapPeekSharedName sets the optional shared_name attribute to value. +// If not specified, defaults to "" +func MapPeekSharedName(value string) MapPeekAttr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// Op peeks at the values at the specified key. If the +// +// underlying container does not contain this key +// this op will block until it does. +func MapPeek(scope *Scope, key tf.Output, indices tf.Output, dtypes []tf.DataType, optional ...MapPeekAttr) (values []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtypes": dtypes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "MapPeek", + Input: []tf.Input{ + key, indices, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if values, idx, err = makeOutputList(op, idx, "values"); err != nil { + scope.UpdateErr("MapPeek", err) + return + } + return values +} + +// Computes the GRU cell forward propagation for 1 time step. +// +// Args +// +// x: Input to the GRU cell. +// h_prev: State input from the previous GRU cell. +// w_ru: Weight matrix for the reset and update gate. +// w_c: Weight matrix for the cell connection gate. +// b_ru: Bias vector for the reset and update gate. +// b_c: Bias vector for the cell connection gate. +// +// Returns +// +// r: Output of the reset gate. +// u: Output of the update gate. +// c: Output of the cell connection gate. +// h: Current state of the GRU cell. +// +// Note on notation of the variables: +// +// Concatenation of a and b is represented by a_b +// Element-wise dot product of a and b is represented by ab +// Element-wise dot product is represented by \circ +// Matrix multiplication is represented by * +// +// Biases are initialized with : +// `b_ru` - constant_initializer(1.0) +// `b_c` - constant_initializer(0.0) +// +// This kernel op implements the following mathematical equations: +// +// ``` +// x_h_prev = [x, h_prev] +// +// [r_bar u_bar] = x_h_prev * w_ru + b_ru +// +// r = sigmoid(r_bar) +// u = sigmoid(u_bar) +// +// h_prevr = h_prev \circ r +// +// x_h_prevr = [x h_prevr] +// +// c_bar = x_h_prevr * w_c + b_c +// c = tanh(c_bar) +// +// h = (1-u) \circ c + u \circ h_prev +// ``` +func GRUBlockCell(scope *Scope, x tf.Output, h_prev tf.Output, w_ru tf.Output, w_c tf.Output, b_ru tf.Output, b_c tf.Output) (r tf.Output, u tf.Output, c tf.Output, h tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "GRUBlockCell", + Input: []tf.Input{ + x, h_prev, w_ru, w_c, b_ru, b_c, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2), op.Output(3) +} + +// LoadTPUEmbeddingFTRLParametersAttr is an optional argument to LoadTPUEmbeddingFTRLParameters. +type LoadTPUEmbeddingFTRLParametersAttr func(optionalAttr) + +// LoadTPUEmbeddingFTRLParametersTableId sets the optional table_id attribute to value. +// If not specified, defaults to -1 +func LoadTPUEmbeddingFTRLParametersTableId(value int64) LoadTPUEmbeddingFTRLParametersAttr { + return func(m optionalAttr) { + m["table_id"] = value + } +} + +// LoadTPUEmbeddingFTRLParametersTableName sets the optional table_name attribute to value. +// If not specified, defaults to "" +func LoadTPUEmbeddingFTRLParametersTableName(value string) LoadTPUEmbeddingFTRLParametersAttr { + return func(m optionalAttr) { + m["table_name"] = value + } +} + +// LoadTPUEmbeddingFTRLParametersConfig sets the optional config attribute to value. +// If not specified, defaults to "" +func LoadTPUEmbeddingFTRLParametersConfig(value string) LoadTPUEmbeddingFTRLParametersAttr { + return func(m optionalAttr) { + m["config"] = value + } +} + +// Load FTRL embedding parameters. +// +// An op that loads optimization parameters into HBM for embedding. Must be +// preceded by a ConfigureTPUEmbeddingHost op that sets up the correct +// embedding table configuration. For example, this op is used to install +// parameters that are loaded from a checkpoint before a training loop is +// executed. +// +// Arguments: +// +// parameters: Value of parameters used in the FTRL optimization algorithm. +// accumulators: Value of accumulators used in the FTRL optimization algorithm. +// linears: Value of linears used in the FTRL optimization algorithm. +// +// Returns the created operation. +func LoadTPUEmbeddingFTRLParameters(scope *Scope, parameters tf.Output, accumulators tf.Output, linears tf.Output, num_shards int64, shard_id int64, optional ...LoadTPUEmbeddingFTRLParametersAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_shards": num_shards, "shard_id": shard_id} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "LoadTPUEmbeddingFTRLParameters", + Input: []tf.Input{ + parameters, accumulators, linears, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// MatrixSolveLsAttr is an optional argument to MatrixSolveLs. +type MatrixSolveLsAttr func(optionalAttr) + +// MatrixSolveLsFast sets the optional fast attribute to value. +// If not specified, defaults to true +func MatrixSolveLsFast(value bool) MatrixSolveLsAttr { + return func(m optionalAttr) { + m["fast"] = value + } +} + +// Solves one or more linear least-squares problems. +// +// `matrix` is a tensor of shape `[..., M, N]` whose inner-most 2 dimensions +// form real or complex matrices of size `[M, N]`. `Rhs` is a tensor of the same +// type as `matrix` and shape `[..., M, K]`. +// The output is a tensor shape `[..., N, K]` where each output matrix solves +// each of the equations +// `matrix[..., :, :]` * `output[..., :, :]` = `rhs[..., :, :]` +// in the least squares sense. +// +// We use the following notation for (complex) matrix and right-hand sides +// in the batch: +// +// `matrix`=\\(A \in \mathbb{C}^{m \times n}\\), +// `rhs`=\\(B \in \mathbb{C}^{m \times k}\\), +// `output`=\\(X \in \mathbb{C}^{n \times k}\\), +// `l2_regularizer`=\\(\lambda \in \mathbb{R}\\). +// +// If `fast` is `True`, then the solution is computed by solving the normal +// equations using Cholesky decomposition. Specifically, if \\(m \ge n\\) then +// \\(X = (A^H A + \lambda I)^{-1} A^H B\\), which solves the least-squares +// problem \\(X = \mathrm{argmin}_{Z \in \Re^{n \times k} } ||A Z - B||_F^2 + \lambda ||Z||_F^2\\). +// If \\(m \lt n\\) then `output` is computed as +// \\(X = A^H (A A^H + \lambda I)^{-1} B\\), which (for \\(\lambda = 0\\)) is the +// minimum-norm solution to the under-determined linear system, i.e. +// \\(X = \mathrm{argmin}_{Z \in \mathbb{C}^{n \times k} } ||Z||_F^2 \\), +// subject to \\(A Z = B\\). Notice that the fast path is only numerically stable +// when \\(A\\) is numerically full rank and has a condition number +// \\(\mathrm{cond}(A) \lt \frac{1}{\sqrt{\epsilon_{mach} } }\\) or \\(\lambda\\) is +// sufficiently large. +// +// If `fast` is `False` an algorithm based on the numerically robust complete +// orthogonal decomposition is used. This computes the minimum-norm +// least-squares solution, even when \\(A\\) is rank deficient. This path is +// typically 6-7 times slower than the fast path. If `fast` is `False` then +// `l2_regularizer` is ignored. +// +// Arguments: +// +// matrix: Shape is `[..., M, N]`. +// rhs: Shape is `[..., M, K]`. +// l2_regularizer: Scalar tensor. +// +// @compatibility(numpy) +// Equivalent to np.linalg.lstsq +// @end_compatibility +// +// Returns Shape is `[..., N, K]`. +func MatrixSolveLs(scope *Scope, matrix tf.Output, rhs tf.Output, l2_regularizer tf.Output, optional ...MatrixSolveLsAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "MatrixSolveLs", + Input: []tf.Input{ + matrix, rhs, l2_regularizer, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Updates the table to associates keys with values. +// +// The tensor `keys` must be of the same type as the keys of the table. +// The tensor `values` must be of the type of the table values. +// +// Arguments: +// +// table_handle: Handle to the table. +// keys: Any shape. Keys to look up. +// values: Values to associate with keys. +// +// Returns the created operation. +func LookupTableInsertV2(scope *Scope, table_handle tf.Output, keys tf.Output, values tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "LookupTableInsertV2", + Input: []tf.Input{ + table_handle, keys, values, + }, + } + return scope.AddOperation(opspec) +} + +// Extract `patches` from `input` and put them in the `"depth"` output dimension. 3D extension of `extract_image_patches`. +// +// Arguments: +// +// input: 5-D Tensor with shape `[batch, in_planes, in_rows, in_cols, depth]`. +// ksizes: The size of the sliding window for each dimension of `input`. +// strides: 1-D of length 5. How far the centers of two consecutive patches are in +// +// `input`. Must be: `[1, stride_planes, stride_rows, stride_cols, 1]`. +// +// padding: The type of padding algorithm to use. +// +// The size-related attributes are specified as follows: +// +// ```python +// ksizes = [1, ksize_planes, ksize_rows, ksize_cols, 1] +// strides = [1, stride_planes, strides_rows, strides_cols, 1] +// ``` +// +// Returns 5-D Tensor with shape `[batch, out_planes, out_rows, out_cols, +// ksize_planes * ksize_rows * ksize_cols * depth]` containing patches +// with size `ksize_planes x ksize_rows x ksize_cols x depth` vectorized +// in the "depth" dimension. Note `out_planes`, `out_rows` and `out_cols` +// are the dimensions of the output patches. +func ExtractVolumePatches(scope *Scope, input tf.Output, ksizes []int64, strides []int64, padding string) (patches tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"ksizes": ksizes, "strides": strides, "padding": padding} + opspec := tf.OpSpec{ + Type: "ExtractVolumePatches", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ResourceApplyGradientDescentAttr is an optional argument to ResourceApplyGradientDescent. +type ResourceApplyGradientDescentAttr func(optionalAttr) + +// ResourceApplyGradientDescentUseLocking sets the optional use_locking attribute to value. +// +// value: If `True`, the subtraction will be protected by a lock; +// otherwise the behavior is undefined, but may exhibit less contention. +// If not specified, defaults to false +func ResourceApplyGradientDescentUseLocking(value bool) ResourceApplyGradientDescentAttr { + return func(m optionalAttr) { + m["use_locking"] = value + } +} + +// Update '*var' by subtracting 'alpha' * 'delta' from it. +// +// Arguments: +// +// var_: Should be from a Variable(). +// alpha: Scaling factor. Must be a scalar. +// delta: The change. +// +// Returns the created operation. +func ResourceApplyGradientDescent(scope *Scope, var_ tf.Output, alpha tf.Output, delta tf.Output, optional ...ResourceApplyGradientDescentAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ResourceApplyGradientDescent", + Input: []tf.Input{ + var_, alpha, delta, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// Add all input tensors element wise. +// +// Inputs must be of same size and shape. +// +// ```python +// x = [9, 7, 10] +// tf.math.add_n(x) ==> 26 +// ``` +func AddN(scope *Scope, inputs []tf.Output) (sum tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "AddN", + Input: []tf.Input{ + tf.OutputList(inputs), + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// InfeedEnqueuePrelinearizedBufferAttr is an optional argument to InfeedEnqueuePrelinearizedBuffer. +type InfeedEnqueuePrelinearizedBufferAttr func(optionalAttr) + +// InfeedEnqueuePrelinearizedBufferDeviceOrdinal sets the optional device_ordinal attribute to value. +// +// value: The TPU device to use. This should be -1 when the Op is running on a TPU device +// and = 0 when the Op is running on the CPU device. +// If not specified, defaults to -1 +func InfeedEnqueuePrelinearizedBufferDeviceOrdinal(value int64) InfeedEnqueuePrelinearizedBufferAttr { + return func(m optionalAttr) { + m["device_ordinal"] = value + } +} + +// An op which enqueues prelinearized buffer into TPU infeed. +// +// Arguments: +// +// input: A variant tensor representing linearized output. +// +// Returns the created operation. +func InfeedEnqueuePrelinearizedBuffer(scope *Scope, input tf.Output, optional ...InfeedEnqueuePrelinearizedBufferAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "InfeedEnqueuePrelinearizedBuffer", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// Compute the Hurwitz zeta function \\(\zeta(x, q)\\). +// +// The Hurwitz zeta function is defined as: +// +// \\(\zeta(x, q) = \sum_{n=0}^{\infty} (q + n)^{-x}\\) +func Zeta(scope *Scope, x tf.Output, q tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Zeta", + Input: []tf.Input{ + x, q, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// StackV2Attr is an optional argument to StackV2. +type StackV2Attr func(optionalAttr) + +// StackV2StackName sets the optional stack_name attribute to value. +// +// value: Overrides the name used for the temporary stack resource. Default +// value is the name of the 'Stack' op (which is guaranteed unique). +// If not specified, defaults to "" +func StackV2StackName(value string) StackV2Attr { + return func(m optionalAttr) { + m["stack_name"] = value + } +} + +// A stack that produces elements in first-in last-out order. +// +// Arguments: +// +// max_size: The maximum size of the stack if non-negative. If negative, the stack +// +// size is unlimited. +// +// elem_type: The type of the elements on the stack. +// +// Returns The handle to the stack. +func StackV2(scope *Scope, max_size tf.Output, elem_type tf.DataType, optional ...StackV2Attr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"elem_type": elem_type} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "StackV2", + Input: []tf.Input{ + max_size, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Compute the pairwise cross product. +// +// `a` and `b` must be the same shape; they can either be simple 3-element vectors, +// or any shape where the innermost dimension is 3. In the latter case, each pair +// of corresponding 3-element vectors is cross-multiplied independently. +// +// Arguments: +// +// a: A tensor containing 3-element vectors. +// b: Another tensor, of same type and shape as `a`. +// +// Returns Pairwise cross product of the vectors in `a` and `b`. +func Cross(scope *Scope, a tf.Output, b tf.Output) (product tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Cross", + Input: []tf.Input{ + a, b, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// CudnnRNNBackpropAttr is an optional argument to CudnnRNNBackprop. +type CudnnRNNBackpropAttr func(optionalAttr) + +// CudnnRNNBackpropRnnMode sets the optional rnn_mode attribute to value. +// If not specified, defaults to "lstm" +func CudnnRNNBackpropRnnMode(value string) CudnnRNNBackpropAttr { + return func(m optionalAttr) { + m["rnn_mode"] = value + } +} + +// CudnnRNNBackpropInputMode sets the optional input_mode attribute to value. +// If not specified, defaults to "linear_input" +func CudnnRNNBackpropInputMode(value string) CudnnRNNBackpropAttr { + return func(m optionalAttr) { + m["input_mode"] = value + } +} + +// CudnnRNNBackpropDirection sets the optional direction attribute to value. +// If not specified, defaults to "unidirectional" +func CudnnRNNBackpropDirection(value string) CudnnRNNBackpropAttr { + return func(m optionalAttr) { + m["direction"] = value + } +} + +// CudnnRNNBackpropDropout sets the optional dropout attribute to value. +// If not specified, defaults to 0 +func CudnnRNNBackpropDropout(value float32) CudnnRNNBackpropAttr { + return func(m optionalAttr) { + m["dropout"] = value + } +} + +// CudnnRNNBackpropSeed sets the optional seed attribute to value. +// If not specified, defaults to 0 +func CudnnRNNBackpropSeed(value int64) CudnnRNNBackpropAttr { + return func(m optionalAttr) { + m["seed"] = value + } +} + +// CudnnRNNBackpropSeed2 sets the optional seed2 attribute to value. +// If not specified, defaults to 0 +func CudnnRNNBackpropSeed2(value int64) CudnnRNNBackpropAttr { + return func(m optionalAttr) { + m["seed2"] = value + } +} + +// Backprop step of CudnnRNN. +// +// Compute the backprop of both data and weights in a RNN. +// +// rnn_mode: Indicates the type of the RNN model. +// input_mode: Indicate whether there is a linear projection between the input and +// +// the actual computation before the first layer. 'skip_input' is only allowed +// when input_size == num_units; 'auto_select' implies 'skip_input' when +// input_size == num_units; otherwise, it implies 'linear_input'. +// +// direction: Indicates whether a bidirectional model will be used. Should be +// +// "unidirectional" or "bidirectional". +// +// dropout: Dropout probability. When set to 0., dropout is disabled. +// seed: The 1st part of a seed to initialize dropout. +// seed2: The 2nd part of a seed to initialize dropout. +// input: A 3-D tensor with the shape of [seq_length, batch_size, input_size]. +// input_h: A 3-D tensor with the shape of [num_layer * dir, batch_size, +// +// num_units]. +// +// input_c: For LSTM, a 3-D tensor with the shape of +// +// [num_layer * dir, batch, num_units]. For other models, it is ignored. +// +// params: A 1-D tensor that contains the weights and biases in an opaque layout. +// +// The size must be created through CudnnRNNParamsSize, and initialized +// separately. Note that they might not be compatible across different +// generations. So it is a good idea to save and restore +// +// output: A 3-D tensor with the shape of [seq_length, batch_size, +// +// dir * num_units]. +// +// output_h: The same shape has input_h. +// output_c: The same shape as input_c for LSTM. An empty tensor for other models. +// output_backprop: A 3-D tensor with the same shape as output in the forward pass. +// output_h_backprop: A 3-D tensor with the same shape as output_h in the forward +// +// pass. +// +// output_c_backprop: A 3-D tensor with the same shape as output_c in the forward +// +// pass. +// +// reserve_space: The same reserve_space produced in for forward operation. +// input_backprop: The backprop to input in the forward pass. Has the same shape +// +// as input. +// +// input_h_backprop: The backprop to input_h in the forward pass. Has the same +// +// shape as input_h. +// +// input_c_backprop: The backprop to input_c in the forward pass. Has the same +// +// shape as input_c. +// +// params_backprop: The backprop to the params buffer in the forward pass. Has the +// +// same shape as params. +func CudnnRNNBackprop(scope *Scope, input tf.Output, input_h tf.Output, input_c tf.Output, params tf.Output, output tf.Output, output_h tf.Output, output_c tf.Output, output_backprop tf.Output, output_h_backprop tf.Output, output_c_backprop tf.Output, reserve_space tf.Output, optional ...CudnnRNNBackpropAttr) (input_backprop tf.Output, input_h_backprop tf.Output, input_c_backprop tf.Output, params_backprop tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "CudnnRNNBackprop", + Input: []tf.Input{ + input, input_h, input_c, params, output, output_h, output_c, output_backprop, output_h_backprop, output_c_backprop, reserve_space, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2), op.Output(3) +} + +// ShapeNAttr is an optional argument to ShapeN. +type ShapeNAttr func(optionalAttr) + +// ShapeNOutType sets the optional out_type attribute to value. +// If not specified, defaults to DT_INT32 +func ShapeNOutType(value tf.DataType) ShapeNAttr { + return func(m optionalAttr) { + m["out_type"] = value + } +} + +// Returns shape of tensors. +// +// This operation returns N 1-D integer tensors representing shape of `input[i]s`. +func ShapeN(scope *Scope, input []tf.Output, optional ...ShapeNAttr) (output []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ShapeN", + Input: []tf.Input{ + tf.OutputList(input), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if output, idx, err = makeOutputList(op, idx, "output"); err != nil { + scope.UpdateErr("ShapeN", err) + return + } + return output +} + +// SizeAttr is an optional argument to Size. +type SizeAttr func(optionalAttr) + +// SizeOutType sets the optional out_type attribute to value. +// If not specified, defaults to DT_INT32 +func SizeOutType(value tf.DataType) SizeAttr { + return func(m optionalAttr) { + m["out_type"] = value + } +} + +// Returns the size of a tensor. +// +// This operation returns an integer representing the number of elements in +// `input`. +// +// For example: +// +// ``` +// # 't' is [[[1, 1,, 1], [2, 2, 2]], [[3, 3, 3], [4, 4, 4]]]] +// size(t) ==> 12 +// ``` +func Size(scope *Scope, input tf.Output, optional ...SizeAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Size", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Converts the given `resource_handle` representing an iterator to a string. +// +// Arguments: +// +// resource_handle: A handle to an iterator resource. +// +// Returns A string representation of the given handle. +func IteratorToStringHandle(scope *Scope, resource_handle tf.Output) (string_handle tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "IteratorToStringHandle", + Input: []tf.Input{ + resource_handle, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Creates a dataset that contains the unique elements of `input_dataset`. +func ExperimentalUniqueDataset(scope *Scope, input_dataset tf.Output, output_types []tf.DataType, output_shapes []tf.Shape) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + opspec := tf.OpSpec{ + Type: "ExperimentalUniqueDataset", + Input: []tf.Input{ + input_dataset, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Pads a tensor. +// +// This operation pads `input` according to the `paddings` and `constant_values` +// you specify. `paddings` is an integer tensor with shape `[Dn, 2]`, where n is +// the rank of `input`. For each dimension D of `input`, `paddings[D, 0]` indicates +// how many padding values to add before the contents of `input` in that dimension, +// and `paddings[D, 1]` indicates how many padding values to add after the contents +// of `input` in that dimension. `constant_values` is a scalar tensor of the same +// type as `input` that indicates the value to use for padding `input`. +// +// The padded size of each dimension D of the output is: +// +// `paddings(D, 0) + input.dim_size(D) + paddings(D, 1)` +// +// For example: +// +// ``` +// # 't' is [[1, 1], [2, 2]] +// # 'paddings' is [[1, 1], [2, 2]] +// # 'constant_values' is 0 +// # rank of 't' is 2 +// pad(t, paddings) ==> [[0, 0, 0, 0, 0, 0] +// +// [0, 0, 1, 1, 0, 0] +// [0, 0, 2, 2, 0, 0] +// [0, 0, 0, 0, 0, 0]] +// +// ``` +func PadV2(scope *Scope, input tf.Output, paddings tf.Output, constant_values tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "PadV2", + Input: []tf.Input{ + input, paddings, constant_values, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes the determinant of one or more square matrices. +// +// The input is a tensor of shape `[..., M, M]` whose inner-most 2 dimensions +// form square matrices. The output is a tensor containing the determinants +// for all input submatrices `[..., :, :]`. +// +// Arguments: +// +// input: Shape is `[..., M, M]`. +// +// Returns Shape is `[...]`. +func MatrixDeterminant(scope *Scope, input tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "MatrixDeterminant", + Input: []tf.Input{ + input, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Reshapes a tensor. +// +// Given `tensor`, this operation returns a tensor that has the same values +// as `tensor` with shape `shape`. +// +// If one component of 1-D tensor `shape` is the special value -1, the size of that +// dimension is computed so that the total size remains constant. In particular, a +// `shape` of `[-1]` flattens into 1-D. At most one component of `shape` may be +// unknown. +// +// The `shape` must be 1-D and the operation returns a tensor with shape +// `shape` filled with the values of `tensor`. In this case, the number of elements +// implied by `shape` must be the same as the number of elements in `tensor`. +// +// It is an error if `shape` is not 1-D. +// +// For example: +// +// ``` +// # tensor 't' is [1, 2, 3, 4, 5, 6, 7, 8, 9] +// # tensor 't' has shape [9] +// reshape(t, [3, 3]) ==> [[1, 2, 3], +// +// [4, 5, 6], +// [7, 8, 9]] +// +// # tensor 't' is [[[1, 1], [2, 2]], +// # [[3, 3], [4, 4]]] +// # tensor 't' has shape [2, 2, 2] +// reshape(t, [2, 4]) ==> [[1, 1, 2, 2], +// +// [3, 3, 4, 4]] +// +// # tensor 't' is [[[1, 1, 1], +// # [2, 2, 2]], +// # [[3, 3, 3], +// # [4, 4, 4]], +// # [[5, 5, 5], +// # [6, 6, 6]]] +// # tensor 't' has shape [3, 2, 3] +// # pass '[-1]' to flatten 't' +// reshape(t, [-1]) ==> [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6] +// +// # -1 can also be used to infer the shape +// +// # -1 is inferred to be 9: +// reshape(t, [2, -1]) ==> [[1, 1, 1, 2, 2, 2, 3, 3, 3], +// +// [4, 4, 4, 5, 5, 5, 6, 6, 6]] +// +// # -1 is inferred to be 2: +// reshape(t, [-1, 9]) ==> [[1, 1, 1, 2, 2, 2, 3, 3, 3], +// +// [4, 4, 4, 5, 5, 5, 6, 6, 6]] +// +// # -1 is inferred to be 3: +// reshape(t, [ 2, -1, 3]) ==> [[[1, 1, 1], +// +// [2, 2, 2], +// [3, 3, 3]], +// [[4, 4, 4], +// [5, 5, 5], +// [6, 6, 6]]] +// +// # tensor 't' is [7] +// # shape `[]` reshapes to a scalar +// reshape(t, []) ==> 7 +// ``` +// +// Arguments: +// +// shape: Defines the shape of the output tensor. +func Reshape(scope *Scope, tensor tf.Output, shape tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Reshape", + Input: []tf.Input{ + tensor, shape, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// CTCBeamSearchDecoderAttr is an optional argument to CTCBeamSearchDecoder. +type CTCBeamSearchDecoderAttr func(optionalAttr) + +// CTCBeamSearchDecoderMergeRepeated sets the optional merge_repeated attribute to value. +// +// value: If true, merge repeated classes in output. +// If not specified, defaults to true +func CTCBeamSearchDecoderMergeRepeated(value bool) CTCBeamSearchDecoderAttr { + return func(m optionalAttr) { + m["merge_repeated"] = value + } +} + +// Performs beam search decoding on the logits given in input. +// +// A note about the attribute merge_repeated: For the beam search decoder, +// this means that if consecutive entries in a beam are the same, only +// the first of these is emitted. That is, when the top path is "A B B B B", +// "A B" is returned if merge_repeated = True but "A B B B B" is +// returned if merge_repeated = False. +// +// Arguments: +// +// inputs: 3-D, shape: `(max_time x batch_size x num_classes)`, the logits. +// sequence_length: A vector containing sequence lengths, size `(batch)`. +// beam_width: A scalar >= 0 (beam search beam width). +// top_paths: A scalar >= 0, <= beam_width (controls output size). +// +// Returns: +// +// decoded_indices: A list (length: top_paths) of indices matrices. Matrix j, +// +// size `(total_decoded_outputs[j] x 2)`, has indices of a +// `SparseTensor`. The rows store: [batch, time]. +// +// decoded_values: A list (length: top_paths) of values vectors. Vector j, +// +// size `(length total_decoded_outputs[j])`, has the values of a +// `SparseTensor`. The vector stores the decoded classes for beam j. +// +// decoded_shape: A list (length: top_paths) of shape vector. Vector j, +// +// size `(2)`, stores the shape of the decoded `SparseTensor[j]`. +// Its values are: `[batch_size, max_decoded_length[j]]`. +// +// log_probability: A matrix, shaped: `(batch_size x top_paths)`. The +// +// sequence log-probabilities. +func CTCBeamSearchDecoder(scope *Scope, inputs tf.Output, sequence_length tf.Output, beam_width int64, top_paths int64, optional ...CTCBeamSearchDecoderAttr) (decoded_indices []tf.Output, decoded_values []tf.Output, decoded_shape []tf.Output, log_probability tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"beam_width": beam_width, "top_paths": top_paths} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "CTCBeamSearchDecoder", + Input: []tf.Input{ + inputs, sequence_length, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if decoded_indices, idx, err = makeOutputList(op, idx, "decoded_indices"); err != nil { + scope.UpdateErr("CTCBeamSearchDecoder", err) + return + } + if decoded_values, idx, err = makeOutputList(op, idx, "decoded_values"); err != nil { + scope.UpdateErr("CTCBeamSearchDecoder", err) + return + } + if decoded_shape, idx, err = makeOutputList(op, idx, "decoded_shape"); err != nil { + scope.UpdateErr("CTCBeamSearchDecoder", err) + return + } + log_probability = op.Output(idx) + return decoded_indices, decoded_values, decoded_shape, log_probability +} + +// Computes softplus: `log(exp(features) + 1)`. +func Softplus(scope *Scope, features tf.Output) (activations tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Softplus", + Input: []tf.Input{ + features, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// RestoreSliceAttr is an optional argument to RestoreSlice. +type RestoreSliceAttr func(optionalAttr) + +// RestoreSlicePreferredShard sets the optional preferred_shard attribute to value. +// +// value: Index of file to open first if multiple files match +// `file_pattern`. See the documentation for `Restore`. +// If not specified, defaults to -1 +func RestoreSlicePreferredShard(value int64) RestoreSliceAttr { + return func(m optionalAttr) { + m["preferred_shard"] = value + } +} + +// Restores a tensor from checkpoint files. +// +// This is like `Restore` except that restored tensor can be listed as filling +// only a slice of a larger tensor. `shape_and_slice` specifies the shape of the +// larger tensor and the slice that the restored tensor covers. +// +// The `shape_and_slice` input has the same format as the +// elements of the `shapes_and_slices` input of the `SaveSlices` op. +// +// Arguments: +// +// file_pattern: Must have a single element. The pattern of the files from +// +// which we read the tensor. +// +// tensor_name: Must have a single element. The name of the tensor to be +// +// restored. +// +// shape_and_slice: Scalar. The shapes and slice specifications to use when +// +// restoring a tensors. +// +// dt: The type of the tensor to be restored. +// +// Returns The restored tensor. +func RestoreSlice(scope *Scope, file_pattern tf.Output, tensor_name tf.Output, shape_and_slice tf.Output, dt tf.DataType, optional ...RestoreSliceAttr) (tensor tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dt": dt} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "RestoreSlice", + Input: []tf.Input{ + file_pattern, tensor_name, shape_and_slice, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Wraps the XLA AllReduce operator +// +// documented at https://www.tensorflow.org/xla/operation_semantics#allreduce. +// +// Arguments: +// +// input: Array or a non-empty tuple of arrays to reduce across replicas. +// group_assignment: Groups between which the reductions are performed. +// reduce_op: Reduction computation. +// mode: group mode. +// +// CrossReplica: group_assignment contains replica_id. Each group contains the +// +// replicas for the current partition. +// +// CrossReplicaAndPartition: group_assignment contains replica_id. Each group +// +// contains the replicas for all partitions. +func XlaAllReduce(scope *Scope, input tf.Output, group_assignment tf.Output, reduce_op string, mode string) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"reduce_op": reduce_op, "mode": mode} + opspec := tf.OpSpec{ + Type: "XlaAllReduce", + Input: []tf.Input{ + input, group_assignment, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Initializes the multi device iterator with the given dataset. +// +// Arguments: +// +// dataset: Dataset to be iterated upon. +// multi_device_iterator: A MultiDeviceIteratorResource. +// max_buffer_size: The maximum size of the host side per device buffer to keep. +// +// Returns An int64 indicating which incarnation of the MultiDeviceIterator +// is running. +func MultiDeviceIteratorInit(scope *Scope, dataset tf.Output, multi_device_iterator tf.Output, max_buffer_size tf.Output) (incarnation_id tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "MultiDeviceIteratorInit", + Input: []tf.Input{ + dataset, multi_device_iterator, max_buffer_size, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Selects the k nearest centers for each point. +// +// Rows of points are assumed to be input points. Rows of centers are assumed to be +// the list of candidate centers. For each point, the k centers that have least L2 +// distance to it are computed. +// +// Arguments: +// +// points: Matrix of shape (n, d). Rows are assumed to be input points. +// centers: Matrix of shape (m, d). Rows are assumed to be centers. +// k: Number of nearest centers to return for each point. If k is larger than m, then +// +// only m centers are returned. +// +// Returns: +// +// nearest_center_indices: Matrix of shape (n, min(m, k)). Each row contains the indices of the centers +// +// closest to the corresponding point, ordered by increasing distance. +// +// nearest_center_distances: Matrix of shape (n, min(m, k)). Each row contains the squared L2 distance to the +// +// corresponding center in nearest_center_indices. +func NearestNeighbors(scope *Scope, points tf.Output, centers tf.Output, k tf.Output) (nearest_center_indices tf.Output, nearest_center_distances tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "NearestNeighbors", + Input: []tf.Input{ + points, centers, k, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// CudnnRNNParamsToCanonicalV2Attr is an optional argument to CudnnRNNParamsToCanonicalV2. +type CudnnRNNParamsToCanonicalV2Attr func(optionalAttr) + +// CudnnRNNParamsToCanonicalV2RnnMode sets the optional rnn_mode attribute to value. +// If not specified, defaults to "lstm" +func CudnnRNNParamsToCanonicalV2RnnMode(value string) CudnnRNNParamsToCanonicalV2Attr { + return func(m optionalAttr) { + m["rnn_mode"] = value + } +} + +// CudnnRNNParamsToCanonicalV2InputMode sets the optional input_mode attribute to value. +// If not specified, defaults to "linear_input" +func CudnnRNNParamsToCanonicalV2InputMode(value string) CudnnRNNParamsToCanonicalV2Attr { + return func(m optionalAttr) { + m["input_mode"] = value + } +} + +// CudnnRNNParamsToCanonicalV2Direction sets the optional direction attribute to value. +// If not specified, defaults to "unidirectional" +func CudnnRNNParamsToCanonicalV2Direction(value string) CudnnRNNParamsToCanonicalV2Attr { + return func(m optionalAttr) { + m["direction"] = value + } +} + +// CudnnRNNParamsToCanonicalV2Dropout sets the optional dropout attribute to value. +// If not specified, defaults to 0 +func CudnnRNNParamsToCanonicalV2Dropout(value float32) CudnnRNNParamsToCanonicalV2Attr { + return func(m optionalAttr) { + m["dropout"] = value + } +} + +// CudnnRNNParamsToCanonicalV2Seed sets the optional seed attribute to value. +// If not specified, defaults to 0 +func CudnnRNNParamsToCanonicalV2Seed(value int64) CudnnRNNParamsToCanonicalV2Attr { + return func(m optionalAttr) { + m["seed"] = value + } +} + +// CudnnRNNParamsToCanonicalV2Seed2 sets the optional seed2 attribute to value. +// If not specified, defaults to 0 +func CudnnRNNParamsToCanonicalV2Seed2(value int64) CudnnRNNParamsToCanonicalV2Attr { + return func(m optionalAttr) { + m["seed2"] = value + } +} + +// CudnnRNNParamsToCanonicalV2NumProj sets the optional num_proj attribute to value. +// If not specified, defaults to 0 +func CudnnRNNParamsToCanonicalV2NumProj(value int64) CudnnRNNParamsToCanonicalV2Attr { + return func(m optionalAttr) { + m["num_proj"] = value + } +} + +// Retrieves CudnnRNN params in canonical form. It supports the projection in LSTM. +// +// Retrieves a set of weights from the opaque params buffer that can be saved and +// restored in a way compatible with future runs. +// +// Note that the params buffer may not be compatible across different GPUs. So any +// save and restoration should be converted to and from the canonical weights and +// biases. +// +// num_layers: Specifies the number of layers in the RNN model. +// num_units: Specifies the size of the hidden state. +// input_size: Specifies the size of the input state. +// num_params_weights: number of weight parameter matrix for all layers. +// num_params_biases: number of bias parameter vector for all layers. +// weights: the canonical form of weights that can be used for saving +// +// and restoration. They are more likely to be compatible across different +// generations. +// +// biases: the canonical form of biases that can be used for saving +// +// and restoration. They are more likely to be compatible across different +// generations. +// +// rnn_mode: Indicates the type of the RNN model. +// input_mode: Indicate whether there is a linear projection between the input and +// +// The actual computation before the first layer. 'skip_input' is only allowed +// when input_size == num_units; 'auto_select' implies 'skip_input' when +// input_size == num_units; otherwise, it implies 'linear_input'. +// +// direction: Indicates whether a bidirectional model will be used. +// +// dir = (direction == bidirectional) ? 2 : 1 +// +// dropout: dropout probability. When set to 0., dropout is disabled. +// seed: the 1st part of a seed to initialize dropout. +// seed2: the 2nd part of a seed to initialize dropout. +// num_proj: The output dimensionality for the projection matrices. If None or 0, +// +// no projection is performed. +func CudnnRNNParamsToCanonicalV2(scope *Scope, num_layers tf.Output, num_units tf.Output, input_size tf.Output, params tf.Output, num_params_weights int64, num_params_biases int64, optional ...CudnnRNNParamsToCanonicalV2Attr) (weights []tf.Output, biases []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_params_weights": num_params_weights, "num_params_biases": num_params_biases} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "CudnnRNNParamsToCanonicalV2", + Input: []tf.Input{ + num_layers, num_units, input_size, params, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if weights, idx, err = makeOutputList(op, idx, "weights"); err != nil { + scope.UpdateErr("CudnnRNNParamsToCanonicalV2", err) + return + } + if biases, idx, err = makeOutputList(op, idx, "biases"); err != nil { + scope.UpdateErr("CudnnRNNParamsToCanonicalV2", err) + return + } + return weights, biases +} + +// BoostedTreesCreateQuantileStreamResourceAttr is an optional argument to BoostedTreesCreateQuantileStreamResource. +type BoostedTreesCreateQuantileStreamResourceAttr func(optionalAttr) + +// BoostedTreesCreateQuantileStreamResourceMaxElements sets the optional max_elements attribute to value. +// +// value: int; The maximum number of data points that can be fed to the stream. +// If not specified, defaults to 1099511627776 +func BoostedTreesCreateQuantileStreamResourceMaxElements(value int64) BoostedTreesCreateQuantileStreamResourceAttr { + return func(m optionalAttr) { + m["max_elements"] = value + } +} + +// Create the Resource for Quantile Streams. +// +// Arguments: +// +// quantile_stream_resource_handle: resource; Handle to quantile stream resource. +// epsilon: float; The required approximation error of the stream resource. +// num_streams: int; The number of streams managed by the resource that shares the same epsilon. +// +// Returns the created operation. +func BoostedTreesCreateQuantileStreamResource(scope *Scope, quantile_stream_resource_handle tf.Output, epsilon tf.Output, num_streams tf.Output, optional ...BoostedTreesCreateQuantileStreamResourceAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "BoostedTreesCreateQuantileStreamResource", + Input: []tf.Input{ + quantile_stream_resource_handle, epsilon, num_streams, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// MapUnstageAttr is an optional argument to MapUnstage. +type MapUnstageAttr func(optionalAttr) + +// MapUnstageCapacity sets the optional capacity attribute to value. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func MapUnstageCapacity(value int64) MapUnstageAttr { + return func(m optionalAttr) { + m["capacity"] = value + } +} + +// MapUnstageMemoryLimit sets the optional memory_limit attribute to value. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func MapUnstageMemoryLimit(value int64) MapUnstageAttr { + return func(m optionalAttr) { + m["memory_limit"] = value + } +} + +// MapUnstageContainer sets the optional container attribute to value. +// If not specified, defaults to "" +func MapUnstageContainer(value string) MapUnstageAttr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// MapUnstageSharedName sets the optional shared_name attribute to value. +// If not specified, defaults to "" +func MapUnstageSharedName(value string) MapUnstageAttr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// Op removes and returns the values associated with the key +// +// from the underlying container. If the underlying container +// does not contain this key, the op will block until it does. +func MapUnstage(scope *Scope, key tf.Output, indices tf.Output, dtypes []tf.DataType, optional ...MapUnstageAttr) (values []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtypes": dtypes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "MapUnstage", + Input: []tf.Input{ + key, indices, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if values, idx, err = makeOutputList(op, idx, "values"); err != nil { + scope.UpdateErr("MapUnstage", err) + return + } + return values +} + +// SkipDatasetAttr is an optional argument to SkipDataset. +type SkipDatasetAttr func(optionalAttr) + +// SkipDatasetMetadata sets the optional metadata attribute to value. +// If not specified, defaults to "" +func SkipDatasetMetadata(value string) SkipDatasetAttr { + return func(m optionalAttr) { + m["metadata"] = value + } +} + +// Creates a dataset that skips `count` elements from the `input_dataset`. +// +// Arguments: +// +// count: A scalar representing the number of elements from the `input_dataset` +// +// that should be skipped. If count is -1, skips everything. +func SkipDataset(scope *Scope, input_dataset tf.Output, count tf.Output, output_types []tf.DataType, output_shapes []tf.Shape, optional ...SkipDatasetAttr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "SkipDataset", + Input: []tf.Input{ + input_dataset, count, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ModelDatasetAttr is an optional argument to ModelDataset. +type ModelDatasetAttr func(optionalAttr) + +// ModelDatasetAlgorithm sets the optional algorithm attribute to value. +// If not specified, defaults to 0 +func ModelDatasetAlgorithm(value int64) ModelDatasetAttr { + return func(m optionalAttr) { + m["algorithm"] = value + } +} + +// ModelDatasetCpuBudget sets the optional cpu_budget attribute to value. +// If not specified, defaults to 0 +func ModelDatasetCpuBudget(value int64) ModelDatasetAttr { + return func(m optionalAttr) { + m["cpu_budget"] = value + } +} + +// ModelDatasetRamBudget sets the optional ram_budget attribute to value. +// If not specified, defaults to 0 +func ModelDatasetRamBudget(value int64) ModelDatasetAttr { + return func(m optionalAttr) { + m["ram_budget"] = value + } +} + +// Identity transformation that models performance. +// +// Identity transformation that models performance. +// +// Arguments: +// +// input_dataset: A variant tensor representing the input dataset. +func ModelDataset(scope *Scope, input_dataset tf.Output, output_types []tf.DataType, output_shapes []tf.Shape, optional ...ModelDatasetAttr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ModelDataset", + Input: []tf.Input{ + input_dataset, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// MatrixInverseAttr is an optional argument to MatrixInverse. +type MatrixInverseAttr func(optionalAttr) + +// MatrixInverseAdjoint sets the optional adjoint attribute to value. +// If not specified, defaults to false +func MatrixInverseAdjoint(value bool) MatrixInverseAttr { + return func(m optionalAttr) { + m["adjoint"] = value + } +} + +// Computes the inverse of one or more square invertible matrices or their adjoints (conjugate transposes). +// +// The input is a tensor of shape `[..., M, M]` whose inner-most 2 dimensions +// form square matrices. The output is a tensor of the same shape as the input +// containing the inverse for all input submatrices `[..., :, :]`. +// +// The op uses LU decomposition with partial pivoting to compute the inverses. +// +// If a matrix is not invertible there is no guarantee what the op does. It +// may detect the condition and raise an exception or it may simply return a +// garbage result. +// +// Arguments: +// +// input: Shape is `[..., M, M]`. +// +// Returns Shape is `[..., M, M]`. +// +// @compatibility(numpy) +// Equivalent to np.linalg.inv +// @end_compatibility +func MatrixInverse(scope *Scope, input tf.Output, optional ...MatrixInverseAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "MatrixInverse", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Deprecated. Use TensorArraySplitV3 +// +// DEPRECATED at GraphDef version 26: Use TensorArraySplitV3 +func TensorArraySplitV2(scope *Scope, handle tf.Output, value tf.Output, lengths tf.Output, flow_in tf.Output) (flow_out tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "TensorArraySplitV2", + Input: []tf.Input{ + handle, value, lengths, flow_in, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// BatchToSpace for N-D tensors of type T. +// +// This operation reshapes the "batch" dimension 0 into `M + 1` dimensions of shape +// `block_shape + [batch]`, interleaves these blocks back into the grid defined by +// the spatial dimensions `[1, ..., M]`, to obtain a result with the same rank as +// the input. The spatial dimensions of this intermediate result are then +// optionally cropped according to `crops` to produce the output. This is the +// reverse of SpaceToBatch. See below for a precise description. +// +// Arguments: +// +// input: N-D with shape `input_shape = [batch] + spatial_shape + remaining_shape`, +// +// where spatial_shape has M dimensions. +// +// block_shape: 1-D with shape `[M]`, all values must be >= 1. +// crops: 2-D with shape `[M, 2]`, all values must be >= 0. +// `crops[i] = [crop_start, crop_end]` specifies the amount to crop from input +// dimension `i + 1`, which corresponds to spatial dimension `i`. It is +// required that +// `crop_start[i] + crop_end[i] <= block_shape[i] * input_shape[i + 1]`. +// +// This operation is equivalent to the following steps: +// +// 1. Reshape `input` to `reshaped` of shape: +// [block_shape[0], ..., block_shape[M-1], +// batch / prod(block_shape), +// input_shape[1], ..., input_shape[N-1]] +// +// 2. Permute dimensions of `reshaped` to produce `permuted` of shape +// [batch / prod(block_shape), +// +// input_shape[1], block_shape[0], +// ..., +// input_shape[M], block_shape[M-1], +// +// input_shape[M+1], ..., input_shape[N-1]] +// +// 3. Reshape `permuted` to produce `reshaped_permuted` of shape +// [batch / prod(block_shape), +// +// input_shape[1] * block_shape[0], +// ..., +// input_shape[M] * block_shape[M-1], +// +// input_shape[M+1], +// ..., +// input_shape[N-1]] +// +// 4. Crop the start and end of dimensions `[1, ..., M]` of +// `reshaped_permuted` according to `crops` to produce the output of shape: +// [batch / prod(block_shape), +// +// input_shape[1] * block_shape[0] - crops[0,0] - crops[0,1], +// ..., +// input_shape[M] * block_shape[M-1] - crops[M-1,0] - crops[M-1,1], +// +// input_shape[M+1], ..., input_shape[N-1]] +// +// Some examples: +// +// (1) For the following input of shape `[4, 1, 1, 1]`, `block_shape = [2, 2]`, and +// +// `crops = [[0, 0], [0, 0]]`: +// +// ``` +// [[[[1]]], [[[2]]], [[[3]]], [[[4]]]] +// ``` +// +// The output tensor has shape `[1, 2, 2, 1]` and value: +// +// ``` +// x = [[[[1], [2]], [[3], [4]]]] +// ``` +// +// (2) For the following input of shape `[4, 1, 1, 3]`, `block_shape = [2, 2]`, and +// +// `crops = [[0, 0], [0, 0]]`: +// +// ``` +// [[[[1, 2, 3]]], [[[4, 5, 6]]], [[[7, 8, 9]]], [[[10, 11, 12]]]] +// ``` +// +// The output tensor has shape `[1, 2, 2, 3]` and value: +// +// ``` +// x = [[[[1, 2, 3], [4, 5, 6]], +// +// [[7, 8, 9], [10, 11, 12]]]] +// +// ``` +// +// (3) For the following input of shape `[4, 2, 2, 1]`, `block_shape = [2, 2]`, and +// +// `crops = [[0, 0], [0, 0]]`: +// +// ``` +// x = [[[[1], [3]], [[9], [11]]], +// +// [[[2], [4]], [[10], [12]]], +// [[[5], [7]], [[13], [15]]], +// [[[6], [8]], [[14], [16]]]] +// +// ``` +// +// The output tensor has shape `[1, 4, 4, 1]` and value: +// +// ``` +// x = [[[[1], [2], [3], [4]], +// +// [[5], [6], [7], [8]], +// [[9], [10], [11], [12]], +// [[13], [14], [15], [16]]]] +// +// ``` +// +// (4) For the following input of shape `[8, 1, 3, 1]`, `block_shape = [2, 2]`, and +// +// `crops = [[0, 0], [2, 0]]`: +// +// ``` +// x = [[[[0], [1], [3]]], [[[0], [9], [11]]], +// +// [[[0], [2], [4]]], [[[0], [10], [12]]], +// [[[0], [5], [7]]], [[[0], [13], [15]]], +// [[[0], [6], [8]]], [[[0], [14], [16]]]] +// +// ``` +// +// The output tensor has shape `[2, 2, 4, 1]` and value: +// +// ``` +// x = [[[[1], [2], [3], [4]], +// +// [[5], [6], [7], [8]]], +// [[[9], [10], [11], [12]], +// [[13], [14], [15], [16]]]] +// +// ``` +func BatchToSpaceND(scope *Scope, input tf.Output, block_shape tf.Output, crops tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "BatchToSpaceND", + Input: []tf.Input{ + input, block_shape, crops, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// FakeQuantWithMinMaxVarsGradientAttr is an optional argument to FakeQuantWithMinMaxVarsGradient. +type FakeQuantWithMinMaxVarsGradientAttr func(optionalAttr) + +// FakeQuantWithMinMaxVarsGradientNumBits sets the optional num_bits attribute to value. +// +// value: The bitwidth of the quantization; between 2 and 8, inclusive. +// If not specified, defaults to 8 +func FakeQuantWithMinMaxVarsGradientNumBits(value int64) FakeQuantWithMinMaxVarsGradientAttr { + return func(m optionalAttr) { + m["num_bits"] = value + } +} + +// FakeQuantWithMinMaxVarsGradientNarrowRange sets the optional narrow_range attribute to value. +// +// value: Whether to quantize into 2^num_bits - 1 distinct values. +// If not specified, defaults to false +func FakeQuantWithMinMaxVarsGradientNarrowRange(value bool) FakeQuantWithMinMaxVarsGradientAttr { + return func(m optionalAttr) { + m["narrow_range"] = value + } +} + +// Compute gradients for a FakeQuantWithMinMaxVars operation. +// +// Arguments: +// +// gradients: Backpropagated gradients above the FakeQuantWithMinMaxVars operation. +// inputs: Values passed as inputs to the FakeQuantWithMinMaxVars operation. +// +// min, max: Quantization interval, scalar floats. +// +// Returns: +// +// backprops_wrt_input: Backpropagated gradients w.r.t. inputs: +// +// `gradients * (inputs >= min && inputs <= max)`. +// +// backprop_wrt_min: Backpropagated gradients w.r.t. min parameter: +// +// `sum(gradients * (inputs < min))`. +// +// backprop_wrt_max: Backpropagated gradients w.r.t. max parameter: +// +// `sum(gradients * (inputs > max))`. +func FakeQuantWithMinMaxVarsGradient(scope *Scope, gradients tf.Output, inputs tf.Output, min tf.Output, max tf.Output, optional ...FakeQuantWithMinMaxVarsGradientAttr) (backprops_wrt_input tf.Output, backprop_wrt_min tf.Output, backprop_wrt_max tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "FakeQuantWithMinMaxVarsGradient", + Input: []tf.Input{ + gradients, inputs, min, max, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// Sends `input` to all devices that are connected to the output. +// +// Sends `input` to all devices that are connected to the output. +// +// The graph should be constructed so that all ops connected to the output have a +// valid device assignment, and the op itself is assigned one of these devices. +// +// input: The input to the broadcast. +// output: The same as input. +// shape: The shape of the input tensor. +func NcclBroadcast(scope *Scope, input tf.Output, shape tf.Shape) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"shape": shape} + opspec := tf.OpSpec{ + Type: "NcclBroadcast", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// QuantizedRelu6Attr is an optional argument to QuantizedRelu6. +type QuantizedRelu6Attr func(optionalAttr) + +// QuantizedRelu6OutType sets the optional out_type attribute to value. +// If not specified, defaults to DT_QUINT8 +func QuantizedRelu6OutType(value tf.DataType) QuantizedRelu6Attr { + return func(m optionalAttr) { + m["out_type"] = value + } +} + +// Computes Quantized Rectified Linear 6: `min(max(features, 0), 6)` +// +// Arguments: +// +// min_features: The float value that the lowest quantized value represents. +// max_features: The float value that the highest quantized value represents. +// +// Returns: +// +// activations: Has the same output shape as "features". +// min_activations: The float value that the lowest quantized value represents. +// max_activations: The float value that the highest quantized value represents. +func QuantizedRelu6(scope *Scope, features tf.Output, min_features tf.Output, max_features tf.Output, optional ...QuantizedRelu6Attr) (activations tf.Output, min_activations tf.Output, max_activations tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "QuantizedRelu6", + Input: []tf.Input{ + features, min_features, max_features, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// Convert one or more images from HSV to RGB. +// +// Outputs a tensor of the same shape as the `images` tensor, containing the RGB +// value of the pixels. The output is only well defined if the value in `images` +// are in `[0,1]`. +// +// See `rgb_to_hsv` for a description of the HSV encoding. +// +// Arguments: +// +// images: 1-D or higher rank. HSV data to convert. Last dimension must be size 3. +// +// Returns `images` converted to RGB. +func HSVToRGB(scope *Scope, images tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "HSVToRGB", + Input: []tf.Input{ + images, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Checks a tensor for NaN, -Inf and +Inf values. +// +// When run, reports an `InvalidArgument` error if `tensor` has any values +// that are not a number (NaN) or infinity (Inf). Otherwise, passes `tensor` as-is. +// Unlike CheckNumerics (V1), CheckNumericsV2 distinguishes -Inf and +Inf in the +// errors it throws. +// +// Arguments: +// +// message: Prefix of the error message. +func CheckNumericsV2(scope *Scope, tensor tf.Output, message string) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"message": message} + opspec := tf.OpSpec{ + Type: "CheckNumericsV2", + Input: []tf.Input{ + tensor, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ShuffleDatasetAttr is an optional argument to ShuffleDataset. +type ShuffleDatasetAttr func(optionalAttr) + +// ShuffleDatasetReshuffleEachIteration sets the optional reshuffle_each_iteration attribute to value. +// +// value: If true, each iterator over this dataset will be given +// a different pseudorandomly generated seed, based on a sequence seeded by the +// `seed` and `seed2` inputs. If false, each iterator will be given the same +// seed, and repeated iteration over this dataset will yield the exact same +// sequence of results. +// If not specified, defaults to true +func ShuffleDatasetReshuffleEachIteration(value bool) ShuffleDatasetAttr { + return func(m optionalAttr) { + m["reshuffle_each_iteration"] = value + } +} + +// ShuffleDatasetMetadata sets the optional metadata attribute to value. +// If not specified, defaults to "" +func ShuffleDatasetMetadata(value string) ShuffleDatasetAttr { + return func(m optionalAttr) { + m["metadata"] = value + } +} + +// Creates a dataset that shuffles elements from `input_dataset` pseudorandomly. +// +// Arguments: +// +// buffer_size: The number of output elements to buffer in an iterator over +// +// this dataset. Compare with the `min_after_dequeue` attr when creating a +// `RandomShuffleQueue`. +// +// seed: A scalar seed for the random number generator. If either `seed` or +// +// `seed2` is set to be non-zero, the random number generator is seeded +// by the given seed. Otherwise, a random seed is used. +// +// seed2: A second scalar seed to avoid seed collision. +func ShuffleDataset(scope *Scope, input_dataset tf.Output, buffer_size tf.Output, seed tf.Output, seed2 tf.Output, output_types []tf.DataType, output_shapes []tf.Shape, optional ...ShuffleDatasetAttr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ShuffleDataset", + Input: []tf.Input{ + input_dataset, buffer_size, seed, seed2, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// TensorSliceDatasetAttr is an optional argument to TensorSliceDataset. +type TensorSliceDatasetAttr func(optionalAttr) + +// TensorSliceDatasetIsFiles sets the optional is_files attribute to value. +// If not specified, defaults to false +func TensorSliceDatasetIsFiles(value bool) TensorSliceDatasetAttr { + return func(m optionalAttr) { + m["is_files"] = value + } +} + +// TensorSliceDatasetMetadata sets the optional metadata attribute to value. +// If not specified, defaults to "" +func TensorSliceDatasetMetadata(value string) TensorSliceDatasetAttr { + return func(m optionalAttr) { + m["metadata"] = value + } +} + +// TensorSliceDatasetReplicateOnSplit sets the optional replicate_on_split attribute to value. +// If not specified, defaults to false +func TensorSliceDatasetReplicateOnSplit(value bool) TensorSliceDatasetAttr { + return func(m optionalAttr) { + m["replicate_on_split"] = value + } +} + +// Creates a dataset that emits each dim-0 slice of `components` once. +func TensorSliceDataset(scope *Scope, components []tf.Output, output_shapes []tf.Shape, optional ...TensorSliceDatasetAttr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_shapes": output_shapes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "TensorSliceDataset", + Input: []tf.Input{ + tf.OutputList(components), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// MaxPool3DAttr is an optional argument to MaxPool3D. +type MaxPool3DAttr func(optionalAttr) + +// MaxPool3DDataFormat sets the optional data_format attribute to value. +// +// value: The data format of the input and output data. With the +// default format "NDHWC", the data is stored in the order of: +// +// [batch, in_depth, in_height, in_width, in_channels]. +// +// Alternatively, the format could be "NCDHW", the data storage order is: +// +// [batch, in_channels, in_depth, in_height, in_width]. +// +// If not specified, defaults to "NDHWC" +func MaxPool3DDataFormat(value string) MaxPool3DAttr { + return func(m optionalAttr) { + m["data_format"] = value + } +} + +// Performs 3D max pooling on the input. +// +// Arguments: +// +// input: Shape `[batch, depth, rows, cols, channels]` tensor to pool over. +// ksize: 1-D tensor of length 5. The size of the window for each dimension of +// +// the input tensor. Must have `ksize[0] = ksize[4] = 1`. +// +// strides: 1-D tensor of length 5. The stride of the sliding window for each +// +// dimension of `input`. Must have `strides[0] = strides[4] = 1`. +// +// padding: The type of padding algorithm to use. +// +// Returns The max pooled output tensor. +func MaxPool3D(scope *Scope, input tf.Output, ksize []int64, strides []int64, padding string, optional ...MaxPool3DAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"ksize": ksize, "strides": strides, "padding": padding} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "MaxPool3D", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns the gradient of `Tile`. +// +// DEPRECATED at GraphDef version 3: TileGrad has been replaced with reduce_sum +// +// Since `Tile` takes an input and repeats the input `multiples` times +// along each dimension, `TileGrad` takes in `multiples` and aggregates +// each repeated tile of `input` into `output`. +func TileGrad(scope *Scope, input tf.Output, multiples tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "TileGrad", + Input: []tf.Input{ + input, multiples, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// QuantizedInstanceNormAttr is an optional argument to QuantizedInstanceNorm. +type QuantizedInstanceNormAttr func(optionalAttr) + +// QuantizedInstanceNormOutputRangeGiven sets the optional output_range_given attribute to value. +// +// value: If True, `given_y_min` and `given_y_min` +// and `given_y_max` are used as the output range. Otherwise, +// the implementation computes the output range. +// If not specified, defaults to false +func QuantizedInstanceNormOutputRangeGiven(value bool) QuantizedInstanceNormAttr { + return func(m optionalAttr) { + m["output_range_given"] = value + } +} + +// QuantizedInstanceNormGivenYMin sets the optional given_y_min attribute to value. +// +// value: Output in `y_min` if `output_range_given` is True. +// If not specified, defaults to 0 +func QuantizedInstanceNormGivenYMin(value float32) QuantizedInstanceNormAttr { + return func(m optionalAttr) { + m["given_y_min"] = value + } +} + +// QuantizedInstanceNormGivenYMax sets the optional given_y_max attribute to value. +// +// value: Output in `y_max` if `output_range_given` is True. +// If not specified, defaults to 0 +func QuantizedInstanceNormGivenYMax(value float32) QuantizedInstanceNormAttr { + return func(m optionalAttr) { + m["given_y_max"] = value + } +} + +// QuantizedInstanceNormVarianceEpsilon sets the optional variance_epsilon attribute to value. +// +// value: A small float number to avoid dividing by 0. +// If not specified, defaults to 1e-05 +func QuantizedInstanceNormVarianceEpsilon(value float32) QuantizedInstanceNormAttr { + return func(m optionalAttr) { + m["variance_epsilon"] = value + } +} + +// QuantizedInstanceNormMinSeparation sets the optional min_separation attribute to value. +// +// value: Minimum value of `y_max - y_min` +// If not specified, defaults to 0.001 +func QuantizedInstanceNormMinSeparation(value float32) QuantizedInstanceNormAttr { + return func(m optionalAttr) { + m["min_separation"] = value + } +} + +// Quantized Instance normalization. +// +// Arguments: +// +// x: A 4D input Tensor. +// x_min: The value represented by the lowest quantized input. +// x_max: The value represented by the highest quantized input. +// +// Returns: +// +// y: A 4D Tensor. +// y_min: The value represented by the lowest quantized output. +// y_max: The value represented by the highest quantized output. +func QuantizedInstanceNorm(scope *Scope, x tf.Output, x_min tf.Output, x_max tf.Output, optional ...QuantizedInstanceNormAttr) (y tf.Output, y_min tf.Output, y_max tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "QuantizedInstanceNorm", + Input: []tf.Input{ + x, x_min, x_max, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// Writes a histogram summary. +// +// Writes histogram `values` at `step` with `tag` using summary `writer`. +// +// Returns the created operation. +func WriteHistogramSummary(scope *Scope, writer tf.Output, step tf.Output, tag tf.Output, values tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "WriteHistogramSummary", + Input: []tf.Input{ + writer, step, tag, values, + }, + } + return scope.AddOperation(opspec) +} + +// Calculates gains for each feature and returns the best possible split information for each node. However, if no split is found, then no split information is returned for that node. +// +// The split information is the best threshold (bucket id), gains and left/right node contributions per node for each feature. +// +// It is possible that not all nodes can be split on each feature. Hence, the list of possible nodes can differ between the features. Therefore, we return `node_ids_list` for each feature, containing the list of nodes that this feature can be used to split. +// +// In this manner, the output is the best split per features and per node, so that it needs to be combined later to produce the best split for each node (among all possible features). +// +// The output shapes are compatible in a way that the first dimension of all tensors are the same and equal to the number of possible split nodes for each feature. +// +// Arguments: +// +// node_id_range: A Rank 1 tensor (shape=[2]) to specify the range [first, last) of node ids to process within `stats_summary_list`. The nodes are iterated between the two nodes specified by the tensor, as like `for node_id in range(node_id_range[0], node_id_range[1])` (Note that the last index node_id_range[1] is exclusive). +// stats_summaries_list: A list of Rank 4 tensor (#shape=[max_splits, feature_dims, bucket, stats_dims]) for accumulated stats summary (gradient/hessian) per node, per dimension, per buckets for each feature. +// +// The first dimension of the tensor is the maximum number of splits, and thus not all elements of it will be used, but only the indexes specified by node_ids will be used. +// +// split_types: A Rank 1 tensor indicating if this Op should perform inequality split or equality split per feature. +// candidate_feature_ids: Rank 1 tensor with ids for each feature. This is the real id of the feature. +// l1: l1 regularization factor on leaf weights, per instance based. +// l2: l2 regularization factor on leaf weights, per instance based. +// tree_complexity: adjustment to the gain, per leaf based. +// min_node_weight: minimum avg of hessians in a node before required for the node to be considered for splitting. +// logits_dimension: The dimension of logit, i.e., number of classes. +// +// Returns: +// +// node_ids: A Rank 1 tensors indicating possible split node ids for each feature. The length of the list is num_features, but each tensor has different size as each feature provides different possible nodes. See above for details like shapes and sizes. +// gains: A Rank 1 tensor indicating the best gains for each feature to split for certain nodes. See above for details like shapes and sizes. +// feature_ids: A Rank 1 tensors indicating the best feature id for each node. See above for details like shapes and sizes. +// feature_dimensions: A Rank 1 tensors indicating the best feature dimension for each feature to split for certain nodes if the feature is multi-dimension. See above for details like shapes and sizes. +// thresholds: A Rank 1 tensors indicating the bucket id to compare with (as a threshold) for split in each node. See above for details like shapes and sizes. +// left_node_contribs: A Rank 2 tensors indicating the contribution of the left nodes when branching from parent nodes (given by the tensor element in the output node_ids_list) to the left direction by the given threshold for each feature. This value will be used to make the left node value by adding to the parent node value. Second dimension size is 1 for 1-dimensional logits, but would be larger for multi-class problems. See above for details like shapes and sizes. +// right_node_contribs: A Rank 2 tensors, with the same shape/conditions as left_node_contribs_list, but just that the value is for the right node. +// split_with_default_directions: A Rank 1 tensors indicating the which direction to go if data is missing. See above for details like shapes and sizes. +// +// Inequality with default left returns 0, inequality with default right returns 1, equality with default right returns 2. +func BoostedTreesCalculateBestFeatureSplitV2(scope *Scope, node_id_range tf.Output, stats_summaries_list []tf.Output, split_types tf.Output, candidate_feature_ids tf.Output, l1 tf.Output, l2 tf.Output, tree_complexity tf.Output, min_node_weight tf.Output, logits_dimension int64) (node_ids tf.Output, gains tf.Output, feature_ids tf.Output, feature_dimensions tf.Output, thresholds tf.Output, left_node_contribs tf.Output, right_node_contribs tf.Output, split_with_default_directions tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"logits_dimension": logits_dimension} + opspec := tf.OpSpec{ + Type: "BoostedTreesCalculateBestFeatureSplitV2", + Input: []tf.Input{ + node_id_range, tf.OutputList(stats_summaries_list), split_types, candidate_feature_ids, l1, l2, tree_complexity, min_node_weight, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2), op.Output(3), op.Output(4), op.Output(5), op.Output(6), op.Output(7) +} + +// Writes a scalar summary. +// +// Writes scalar `value` at `step` with `tag` using summary `writer`. +// +// Returns the created operation. +func WriteScalarSummary(scope *Scope, writer tf.Output, step tf.Output, tag tf.Output, value tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "WriteScalarSummary", + Input: []tf.Input{ + writer, step, tag, value, + }, + } + return scope.AddOperation(opspec) +} + +// SerializeManySparseAttr is an optional argument to SerializeManySparse. +type SerializeManySparseAttr func(optionalAttr) + +// SerializeManySparseOutType sets the optional out_type attribute to value. +// +// value: The `dtype` to use for serialization; the supported types are `string` +// (default) and `variant`. +// If not specified, defaults to DT_STRING +func SerializeManySparseOutType(value tf.DataType) SerializeManySparseAttr { + return func(m optionalAttr) { + m["out_type"] = value + } +} + +// Serialize an `N`-minibatch `SparseTensor` into an `[N, 3]` `Tensor` object. +// +// The `SparseTensor` must have rank `R` greater than 1, and the first dimension +// is treated as the minibatch dimension. Elements of the `SparseTensor` +// must be sorted in increasing order of this first dimension. The serialized +// `SparseTensor` objects going into each row of `serialized_sparse` will have +// rank `R-1`. +// +// The minibatch size `N` is extracted from `sparse_shape[0]`. +// +// Arguments: +// +// sparse_indices: 2-D. The `indices` of the minibatch `SparseTensor`. +// sparse_values: 1-D. The `values` of the minibatch `SparseTensor`. +// sparse_shape: 1-D. The `shape` of the minibatch `SparseTensor`. +func SerializeManySparse(scope *Scope, sparse_indices tf.Output, sparse_values tf.Output, sparse_shape tf.Output, optional ...SerializeManySparseAttr) (serialized_sparse tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "SerializeManySparse", + Input: []tf.Input{ + sparse_indices, sparse_values, sparse_shape, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Outputs deterministic pseudorandom random numbers from a gamma distribution. +// +// Outputs random values from a gamma distribution. +// +// The outputs are a deterministic function of `shape`, `seed`, and `alpha`. +// +// Arguments: +// +// shape: The shape of the output tensor. +// seed: 2 seeds (shape [2]). +// alpha: The concentration of the gamma distribution. Shape must match the rightmost +// +// dimensions of `shape`. +// +// Returns Random values with specified shape. +func StatelessRandomGammaV2(scope *Scope, shape tf.Output, seed tf.Output, alpha tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "StatelessRandomGammaV2", + Input: []tf.Input{ + shape, seed, alpha, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// L2 Loss. +// +// Computes half the L2 norm of a tensor without the `sqrt`: +// +// output = sum(t ** 2) / 2 +// +// Arguments: +// +// t: Typically 2-D, but may have any dimensions. +// +// Returns 0-D. +func L2Loss(scope *Scope, t tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "L2Loss", + Input: []tf.Input{ + t, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// DebugNumericSummaryAttr is an optional argument to DebugNumericSummary. +type DebugNumericSummaryAttr func(optionalAttr) + +// DebugNumericSummaryDeviceName sets the optional device_name attribute to value. +// If not specified, defaults to "" +func DebugNumericSummaryDeviceName(value string) DebugNumericSummaryAttr { + return func(m optionalAttr) { + m["device_name"] = value + } +} + +// DebugNumericSummaryTensorName sets the optional tensor_name attribute to value. +// +// value: Name of the input tensor. +// If not specified, defaults to "" +func DebugNumericSummaryTensorName(value string) DebugNumericSummaryAttr { + return func(m optionalAttr) { + m["tensor_name"] = value + } +} + +// DebugNumericSummaryDebugUrls sets the optional debug_urls attribute to value. +// +// value: List of URLs to debug targets, e.g., +// +// file:///foo/tfdbg_dump, grpc:://localhost:11011. +// +// If not specified, defaults to <> +func DebugNumericSummaryDebugUrls(value []string) DebugNumericSummaryAttr { + return func(m optionalAttr) { + m["debug_urls"] = value + } +} + +// DebugNumericSummaryLowerBound sets the optional lower_bound attribute to value. +// +// value: (float) The lower bound <= which values will be included in the +// +// generalized -inf count. Default: -inf. +// +// If not specified, defaults to -inf +func DebugNumericSummaryLowerBound(value float32) DebugNumericSummaryAttr { + return func(m optionalAttr) { + m["lower_bound"] = value + } +} + +// DebugNumericSummaryUpperBound sets the optional upper_bound attribute to value. +// +// value: (float) The upper bound >= which values will be included in the +// +// generalized +inf count. Default: +inf. +// +// If not specified, defaults to inf +func DebugNumericSummaryUpperBound(value float32) DebugNumericSummaryAttr { + return func(m optionalAttr) { + m["upper_bound"] = value + } +} + +// DebugNumericSummaryMuteIfHealthy sets the optional mute_if_healthy attribute to value. +// +// value: (bool) Do not send data to the debug URLs unless at least one +// +// of elements [2], [3] and [7] (i.e., the nan count and the generalized -inf and +// inf counts) is non-zero. +// +// If not specified, defaults to false +func DebugNumericSummaryMuteIfHealthy(value bool) DebugNumericSummaryAttr { + return func(m optionalAttr) { + m["mute_if_healthy"] = value + } +} + +// DebugNumericSummaryGatedGrpc sets the optional gated_grpc attribute to value. +// +// value: Whether this op will be gated. If any of the debug_urls of this +// +// debug node is of the grpc:// scheme, when the value of this attribute is set +// to True, the data will not actually be sent via the grpc stream unless this +// debug op has been enabled at the debug_url. If all of the debug_urls of this +// debug node are of the grpc:// scheme and the debug op is enabled at none of +// them, the output will be an empty Tensor. +// +// If not specified, defaults to false +func DebugNumericSummaryGatedGrpc(value bool) DebugNumericSummaryAttr { + return func(m optionalAttr) { + m["gated_grpc"] = value + } +} + +// Debug Numeric Summary Op. +// +// Provide a basic summary of numeric value types, range and distribution. +// +// output: A double tensor of shape [14 + nDimensions], where nDimensions is the +// +// number of dimensions of the tensor's shape. The elements of output are: +// [0]: is initialized (1.0) or not (0.0). +// [1]: total number of elements +// [2]: NaN element count +// [3]: generalized -inf count: elements <= lower_bound. lower_bound is -inf by +// default. +// [4]: negative element count (excluding -inf), if lower_bound is the default +// -inf. Otherwise, this is the count of elements > lower_bound and < 0. +// [5]: zero element count +// [6]: positive element count (excluding +inf), if upper_bound is the default +// +inf. Otherwise, this is the count of elements < upper_bound and > 0. +// [7]: generalized +inf count, elements >= upper_bound. upper_bound is +inf by +// default. +// +// Output elements [1:8] are all zero, if the tensor is uninitialized. +// +// [8]: minimum of all non-inf and non-NaN elements. +// If uninitialized or no such element exists: +inf. +// [9]: maximum of all non-inf and non-NaN elements. +// If uninitialized or no such element exists: -inf. +// [10]: mean of all non-inf and non-NaN elements. +// If uninitialized or no such element exists: NaN. +// [11]: variance of all non-inf and non-NaN elements. +// If uninitialized or no such element exists: NaN. +// [12]: Data type of the tensor encoded as an enum integer. See the DataType +// proto for more details. +// [13]: Number of dimensions of the tensor (ndims). +// [14+]: Sizes of the dimensions. +// +// Arguments: +// +// input: Input tensor, non-Reference type. +func DebugNumericSummary(scope *Scope, input tf.Output, optional ...DebugNumericSummaryAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "DebugNumericSummary", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// SvdAttr is an optional argument to Svd. +type SvdAttr func(optionalAttr) + +// SvdComputeUv sets the optional compute_uv attribute to value. +// +// value: If true, left and right singular vectors will be +// computed and returned in `u` and `v`, respectively. +// If false, `u` and `v` are not set and should never referenced. +// If not specified, defaults to true +func SvdComputeUv(value bool) SvdAttr { + return func(m optionalAttr) { + m["compute_uv"] = value + } +} + +// SvdFullMatrices sets the optional full_matrices attribute to value. +// +// value: If true, compute full-sized `u` and `v`. If false +// (the default), compute only the leading `P` singular vectors. +// Ignored if `compute_uv` is `False`. +// If not specified, defaults to false +func SvdFullMatrices(value bool) SvdAttr { + return func(m optionalAttr) { + m["full_matrices"] = value + } +} + +// Computes the singular value decompositions of one or more matrices. +// +// Computes the SVD of each inner matrix in `input` such that +// `input[..., :, :] = u[..., :, :] * diag(s[..., :, :]) * transpose(v[..., :, :])` +// +// ```python +// # a is a tensor containing a batch of matrices. +// # s is a tensor of singular values for each matrix. +// # u is the tensor containing the left singular vectors for each matrix. +// # v is the tensor containing the right singular vectors for each matrix. +// s, u, v = svd(a) +// s, _, _ = svd(a, compute_uv=False) +// ``` +// +// Arguments: +// +// input: A tensor of shape `[..., M, N]` whose inner-most 2 dimensions +// +// form matrices of size `[M, N]`. Let `P` be the minimum of `M` and `N`. +// +// Returns: +// +// s: Singular values. Shape is `[..., P]`. +// u: Left singular vectors. If `full_matrices` is `False` then shape is +// +// `[..., M, P]`; if `full_matrices` is `True` then shape is +// `[..., M, M]`. Undefined if `compute_uv` is `False`. +// +// v: Left singular vectors. If `full_matrices` is `False` then shape is +// +// `[..., N, P]`. If `full_matrices` is `True` then shape is `[..., N, N]`. +// Undefined if `compute_uv` is false. +func Svd(scope *Scope, input tf.Output, optional ...SvdAttr) (s tf.Output, u tf.Output, v tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Svd", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// Returns the truth value of (x > y) element-wise. +// +// *NOTE*: `Greater` supports broadcasting. More about broadcasting +// [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) +// +// Example: +// +// ```python +// x = tf.constant([5, 4, 6]) +// y = tf.constant([5, 2, 5]) +// tf.math.greater(x, y) ==> [False, True, True] +// +// x = tf.constant([5, 4, 6]) +// y = tf.constant([5]) +// tf.math.greater(x, y) ==> [False, False, True] +// ``` +func Greater(scope *Scope, x tf.Output, y tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Greater", + Input: []tf.Input{ + x, y, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// FakeQuantWithMinMaxVarsAttr is an optional argument to FakeQuantWithMinMaxVars. +type FakeQuantWithMinMaxVarsAttr func(optionalAttr) + +// FakeQuantWithMinMaxVarsNumBits sets the optional num_bits attribute to value. +// If not specified, defaults to 8 +func FakeQuantWithMinMaxVarsNumBits(value int64) FakeQuantWithMinMaxVarsAttr { + return func(m optionalAttr) { + m["num_bits"] = value + } +} + +// FakeQuantWithMinMaxVarsNarrowRange sets the optional narrow_range attribute to value. +// If not specified, defaults to false +func FakeQuantWithMinMaxVarsNarrowRange(value bool) FakeQuantWithMinMaxVarsAttr { + return func(m optionalAttr) { + m["narrow_range"] = value + } +} + +// Fake-quantize the 'inputs' tensor of type float via global float scalars +// +// Fake-quantize the `inputs` tensor of type float via global float scalars +// `min` and `max` to `outputs` tensor of same shape as `inputs`. +// +// # Attributes +// +// * `[min; max]` define the clamping range for the `inputs` data. +// * `inputs` values are quantized into the quantization range ( +// `[0; 2^num_bits - 1]` when `narrow_range` is false and `[1; 2^num_bits - 1]` +// when it is true) and then de-quantized and output as floats in `[min; max]` +// interval. +// * `num_bits` is the bitwidth of the quantization; between 2 and 16, inclusive. +// +// Before quantization, `min` and `max` values are adjusted with the following +// logic. +// It is suggested to have `min <= 0 <= max`. If `0` is not in the range of values, +// the behavior can be unexpected: +// +// * If `0 < min < max`: `min_adj = 0` and `max_adj = max - min`. +// * If `min < max < 0`: `min_adj = min - max` and `max_adj = 0`. +// * If `min <= 0 <= max`: `scale = (max - min) / (2^num_bits - 1) `, +// `min_adj = scale * round(min / scale)` and `max_adj = max + min_adj - min`. +// +// This operation has a gradient and thus allows for training `min` and `max` +// values. +func FakeQuantWithMinMaxVars(scope *Scope, inputs tf.Output, min tf.Output, max tf.Output, optional ...FakeQuantWithMinMaxVarsAttr) (outputs tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "FakeQuantWithMinMaxVars", + Input: []tf.Input{ + inputs, min, max, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// UnicodeDecodeAttr is an optional argument to UnicodeDecode. +type UnicodeDecodeAttr func(optionalAttr) + +// UnicodeDecodeErrors sets the optional errors attribute to value. +// +// value: Error handling policy when there is invalid formatting found in the input. +// The value of 'strict' will cause the operation to produce a InvalidArgument +// error on any invalid input formatting. A value of 'replace' (the default) will +// cause the operation to replace any invalid formatting in the input with the +// `replacement_char` codepoint. A value of 'ignore' will cause the operation to +// skip any invalid formatting in the input and produce no corresponding output +// character. +// If not specified, defaults to "replace" +func UnicodeDecodeErrors(value string) UnicodeDecodeAttr { + return func(m optionalAttr) { + m["errors"] = value + } +} + +// UnicodeDecodeReplacementChar sets the optional replacement_char attribute to value. +// +// value: The replacement character codepoint to be used in place of any invalid +// formatting in the input when `errors='replace'`. Any valid unicode codepoint may +// be used. The default value is the default unicode replacement character is +// 0xFFFD or U+65533.) +// If not specified, defaults to 65533 +func UnicodeDecodeReplacementChar(value int64) UnicodeDecodeAttr { + return func(m optionalAttr) { + m["replacement_char"] = value + } +} + +// UnicodeDecodeReplaceControlCharacters sets the optional replace_control_characters attribute to value. +// +// value: Whether to replace the C0 control characters (00-1F) with the +// `replacement_char`. Default is false. +// If not specified, defaults to false +func UnicodeDecodeReplaceControlCharacters(value bool) UnicodeDecodeAttr { + return func(m optionalAttr) { + m["replace_control_characters"] = value + } +} + +// UnicodeDecodeTsplits sets the optional Tsplits attribute to value. +// If not specified, defaults to DT_INT64 +func UnicodeDecodeTsplits(value tf.DataType) UnicodeDecodeAttr { + return func(m optionalAttr) { + m["Tsplits"] = value + } +} + +// Decodes each string in `input` into a sequence of Unicode code points. +// +// The character codepoints for all strings are returned using a single vector +// `char_values`, with strings expanded to characters in row-major order. +// +// The `row_splits` tensor indicates where the codepoints for +// each input string begin and end within the `char_values` tensor. +// In particular, the values for the `i`th +// string (in row-major order) are stored in the slice +// `[row_splits[i]:row_splits[i+1]]`. Thus: +// +// - `char_values[row_splits[i]+j]` is the Unicode codepoint for the `j`th +// character in the `i`th string (in row-major order). +// - `row_splits[i+1] - row_splits[i]` is the number of characters in the `i`th +// string (in row-major order). +// +// Arguments: +// +// input: The text to be decoded. Can have any shape. Note that the output is flattened +// +// to a vector of char values. +// +// input_encoding: Text encoding of the input strings. This is any of the encodings supported +// +// by ICU ucnv algorithmic converters. Examples: `"UTF-16", "US ASCII", "UTF-8"`. +// +// Returns: +// +// row_splits: A 1D int32 tensor containing the row splits. +// char_values: A 1D int32 Tensor containing the decoded codepoints. +func UnicodeDecode(scope *Scope, input tf.Output, input_encoding string, optional ...UnicodeDecodeAttr) (row_splits tf.Output, char_values tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"input_encoding": input_encoding} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "UnicodeDecode", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// Reads out the CSR components at batch `index`. +// +// This op is meant only for debugging / testing, and its interface is not expected +// to be stable. +// +// Arguments: +// +// csr_sparse_matrix: A batched CSRSparseMatrix. +// index: The index in `csr_sparse_matrix`'s batch. +// +// Returns: +// +// row_ptrs: An array containing CSR matrix row pointers. +// col_inds: An array containing CSR matrix column indices. +// values: An array containing CSR matrix nonzero values. +func CSRSparseMatrixComponents(scope *Scope, csr_sparse_matrix tf.Output, index tf.Output, type_ tf.DataType) (row_ptrs tf.Output, col_inds tf.Output, values tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"type": type_} + opspec := tf.OpSpec{ + Type: "CSRSparseMatrixComponents", + Input: []tf.Input{ + csr_sparse_matrix, index, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// MergeV2CheckpointsAttr is an optional argument to MergeV2Checkpoints. +type MergeV2CheckpointsAttr func(optionalAttr) + +// MergeV2CheckpointsDeleteOldDirs sets the optional delete_old_dirs attribute to value. +// +// value: see above. +// If not specified, defaults to true +func MergeV2CheckpointsDeleteOldDirs(value bool) MergeV2CheckpointsAttr { + return func(m optionalAttr) { + m["delete_old_dirs"] = value + } +} + +// MergeV2CheckpointsAllowMissingFiles sets the optional allow_missing_files attribute to value. +// If not specified, defaults to false +func MergeV2CheckpointsAllowMissingFiles(value bool) MergeV2CheckpointsAttr { + return func(m optionalAttr) { + m["allow_missing_files"] = value + } +} + +// V2 format specific: merges the metadata files of sharded checkpoints. The +// +// result is one logical checkpoint, with one physical metadata file and renamed +// data files. +// +// Intended for "grouping" multiple checkpoints in a sharded checkpoint setup. +// +// If delete_old_dirs is true, attempts to delete recursively the dirname of each +// path in the input checkpoint_prefixes. This is useful when those paths are non +// user-facing temporary locations. +// +// Arguments: +// +// checkpoint_prefixes: prefixes of V2 checkpoints to merge. +// destination_prefix: scalar. The desired final prefix. Allowed to be the same +// +// as one of the checkpoint_prefixes. +// +// Returns the created operation. +func MergeV2Checkpoints(scope *Scope, checkpoint_prefixes tf.Output, destination_prefix tf.Output, optional ...MergeV2CheckpointsAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "MergeV2Checkpoints", + Input: []tf.Input{ + checkpoint_prefixes, destination_prefix, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// Op that executes a program with optional in-place variable updates. +// +// It (optionally) reads device variables, loads and executes a TPU program on a +// TPU device, and then (optionally) in-place updates variables using the program +// outputs, as specified in attributes device_var_reads_indices (program input +// indices from directly reading variables) and device_var_updates_indices (program +// output indices used to update variables, -1 means no-update/read-only). Such +// program outputs are consumed by these variables will not appear in the op +// output. For the internal use of the distributed TPU compiler. +func TPUExecuteAndUpdateVariables(scope *Scope, args []tf.Output, key tf.Output, Tresults []tf.DataType, device_var_reads_indices []int64, device_var_updates_indices []int64) (results []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"Tresults": Tresults, "device_var_reads_indices": device_var_reads_indices, "device_var_updates_indices": device_var_updates_indices} + opspec := tf.OpSpec{ + Type: "TPUExecuteAndUpdateVariables", + Input: []tf.Input{ + tf.OutputList(args), key, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if results, idx, err = makeOutputList(op, idx, "results"); err != nil { + scope.UpdateErr("TPUExecuteAndUpdateVariables", err) + return + } + return results +} + +// Creates and returns an empty tensor list. +// +// All list elements must be tensors of dtype element_dtype and shape compatible +// with element_shape. +// +// handle: an empty tensor list. +// element_dtype: the type of elements in the list. +// element_shape: a shape compatible with that of elements in the list. +func EmptyTensorList(scope *Scope, element_shape tf.Output, max_num_elements tf.Output, element_dtype tf.DataType) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"element_dtype": element_dtype} + opspec := tf.OpSpec{ + Type: "EmptyTensorList", + Input: []tf.Input{ + element_shape, max_num_elements, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes the gradient of morphological 2-D dilation with respect to the input. +// +// Arguments: +// +// input: 4-D with shape `[batch, in_height, in_width, depth]`. +// filter: 3-D with shape `[filter_height, filter_width, depth]`. +// out_backprop: 4-D with shape `[batch, out_height, out_width, depth]`. +// strides: 1-D of length 4. The stride of the sliding window for each dimension of +// +// the input tensor. Must be: `[1, stride_height, stride_width, 1]`. +// +// rates: 1-D of length 4. The input stride for atrous morphological dilation. +// +// Must be: `[1, rate_height, rate_width, 1]`. +// +// padding: The type of padding algorithm to use. +// +// Returns 4-D with shape `[batch, in_height, in_width, depth]`. +func Dilation2DBackpropInput(scope *Scope, input tf.Output, filter tf.Output, out_backprop tf.Output, strides []int64, rates []int64, padding string) (in_backprop tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"strides": strides, "rates": rates, "padding": padding} + opspec := tf.OpSpec{ + Type: "Dilation2DBackpropInput", + Input: []tf.Input{ + input, filter, out_backprop, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// EqualAttr is an optional argument to Equal. +type EqualAttr func(optionalAttr) + +// EqualIncompatibleShapeError sets the optional incompatible_shape_error attribute to value. +// If not specified, defaults to true +func EqualIncompatibleShapeError(value bool) EqualAttr { + return func(m optionalAttr) { + m["incompatible_shape_error"] = value + } +} + +// Returns the truth value of (x == y) element-wise. +// +// *NOTE*: `Equal` supports broadcasting. More about broadcasting +// [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) +// +// ```python +// x = tf.constant([2, 4]) +// y = tf.constant(2) +// tf.math.equal(x, y) ==> array([True, False]) +// +// x = tf.constant([2, 4]) +// y = tf.constant([2, 4]) +// tf.math.equal(x, y) ==> array([True, True]) +// ``` +func Equal(scope *Scope, x tf.Output, y tf.Output, optional ...EqualAttr) (z tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Equal", + Input: []tf.Input{ + x, y, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Push an element onto the tensor_array. +// +// Arguments: +// +// handle: The handle to a TensorArray. +// index: The position to write to inside the TensorArray. +// value: The tensor to write to the TensorArray. +// flow_in: A float scalar that enforces proper chaining of operations. +// +// Returns A float scalar that enforces proper chaining of operations. +func TensorArrayWriteV3(scope *Scope, handle tf.Output, index tf.Output, value tf.Output, flow_in tf.Output) (flow_out tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "TensorArrayWriteV3", + Input: []tf.Input{ + handle, index, value, flow_in, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes the eigen decomposition of a batch of self-adjoint matrices +// +// (Note: Only real inputs are supported). +// +// Computes the eigenvalues and eigenvectors of the innermost M-by-N matrices in +// tensor such that tensor[...,:,:] = u[..., :, :] * Diag(s[..., :]) * Transpose(v[...,:,:]). +// +// Arguments: +// +// a: the input tensor. +// max_iter: maximum number of sweep update, i.e., the whole lower triangular +// +// part or upper triangular part based on parameter lower. Heuristically, it has +// been argued that approximately log(min (M, N)) sweeps are needed in practice +// (Ref: Golub & van Loan "Matrix Computation"). +// +// epsilon: the tolerance ratio. +// precision_config: a serialized xla::PrecisionConfig proto. +// +// Returns: +// +// s: Singular values. The values are sorted in reverse order of magnitude, so +// +// s[..., 0] is the largest value, s[..., 1] is the second largest, etc. +// +// u: Left singular vectors. +// v: Right singular vectors. +func XlaSvd(scope *Scope, a tf.Output, max_iter int64, epsilon float32, precision_config string) (s tf.Output, u tf.Output, v tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"max_iter": max_iter, "epsilon": epsilon, "precision_config": precision_config} + opspec := tf.OpSpec{ + Type: "XlaSvd", + Input: []tf.Input{ + a, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// Computes the LSTM cell backward propagation for the entire time sequence. +// +// This implementation is to be used in conjunction of LSTMBlock. +// +// Arguments: +// +// seq_len_max: Maximum time length actually used by this input. Outputs are padded +// +// with zeros beyond this length. +// +// x: The sequence input to the LSTM, shape (timelen, batch_size, num_inputs). +// cs_prev: Value of the initial cell state. +// h_prev: Initial output of cell (to be used for peephole). +// w: The weight matrix. +// wci: The weight matrix for input gate peephole connection. +// wcf: The weight matrix for forget gate peephole connection. +// wco: The weight matrix for output gate peephole connection. +// b: The bias vector. +// i: The input gate over the whole time sequence. +// cs: The cell state before the tanh over the whole time sequence. +// f: The forget gate over the whole time sequence. +// o: The output gate over the whole time sequence. +// ci: The cell input over the whole time sequence. +// co: The cell after the tanh over the whole time sequence. +// h: The output h vector over the whole time sequence. +// cs_grad: The current gradient of cs. +// h_grad: The gradient of h vector. +// use_peephole: Whether to use peephole weights. +// +// Returns: +// +// x_grad: The gradient of x to be back-propped. +// cs_prev_grad: The gradient of cs_prev to be back-propped. +// h_prev_grad: The gradient of h_prev to be back-propped. +// w_grad: The gradient for w to be back-propped. +// wci_grad: The gradient for wci to be back-propped. +// wcf_grad: The gradient for wcf to be back-propped. +// wco_grad: The gradient for wco to be back-propped. +// b_grad: The gradient for w to be back-propped. +func BlockLSTMGrad(scope *Scope, seq_len_max tf.Output, x tf.Output, cs_prev tf.Output, h_prev tf.Output, w tf.Output, wci tf.Output, wcf tf.Output, wco tf.Output, b tf.Output, i tf.Output, cs tf.Output, f tf.Output, o tf.Output, ci tf.Output, co tf.Output, h tf.Output, cs_grad tf.Output, h_grad tf.Output, use_peephole bool) (x_grad tf.Output, cs_prev_grad tf.Output, h_prev_grad tf.Output, w_grad tf.Output, wci_grad tf.Output, wcf_grad tf.Output, wco_grad tf.Output, b_grad tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"use_peephole": use_peephole} + opspec := tf.OpSpec{ + Type: "BlockLSTMGrad", + Input: []tf.Input{ + seq_len_max, x, cs_prev, h_prev, w, wci, wcf, wco, b, i, cs, f, o, ci, co, h, cs_grad, h_grad, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2), op.Output(3), op.Output(4), op.Output(5), op.Output(6), op.Output(7) +} + +// RFFTAttr is an optional argument to RFFT. +type RFFTAttr func(optionalAttr) + +// RFFTTcomplex sets the optional Tcomplex attribute to value. +// If not specified, defaults to DT_COMPLEX64 +func RFFTTcomplex(value tf.DataType) RFFTAttr { + return func(m optionalAttr) { + m["Tcomplex"] = value + } +} + +// Real-valued fast Fourier transform. +// +// Computes the 1-dimensional discrete Fourier transform of a real-valued signal +// over the inner-most dimension of `input`. +// +// Since the DFT of a real signal is Hermitian-symmetric, `RFFT` only returns the +// `fft_length / 2 + 1` unique components of the FFT: the zero-frequency term, +// followed by the `fft_length / 2` positive-frequency terms. +// +// Along the axis `RFFT` is computed on, if `fft_length` is smaller than the +// corresponding dimension of `input`, the dimension is cropped. If it is larger, +// the dimension is padded with zeros. +// +// Arguments: +// +// input: A float32 tensor. +// fft_length: An int32 tensor of shape [1]. The FFT length. +// +// Returns A complex64 tensor of the same rank as `input`. The inner-most +// +// dimension of `input` is replaced with the `fft_length / 2 + 1` unique +// frequency components of its 1D Fourier transform. +// +// @compatibility(numpy) +// Equivalent to np.fft.rfft +// @end_compatibility +func RFFT(scope *Scope, input tf.Output, fft_length tf.Output, optional ...RFFTAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "RFFT", + Input: []tf.Input{ + input, fft_length, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Does nothing. Only useful as a placeholder for control edges. +// +// Returns the created operation. +func NoOp(scope *Scope) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "NoOp", + } + return scope.AddOperation(opspec) +} + +// QuantizeAndDequantizeAttr is an optional argument to QuantizeAndDequantize. +type QuantizeAndDequantizeAttr func(optionalAttr) + +// QuantizeAndDequantizeSignedInput sets the optional signed_input attribute to value. +// If not specified, defaults to true +func QuantizeAndDequantizeSignedInput(value bool) QuantizeAndDequantizeAttr { + return func(m optionalAttr) { + m["signed_input"] = value + } +} + +// QuantizeAndDequantizeNumBits sets the optional num_bits attribute to value. +// If not specified, defaults to 8 +func QuantizeAndDequantizeNumBits(value int64) QuantizeAndDequantizeAttr { + return func(m optionalAttr) { + m["num_bits"] = value + } +} + +// QuantizeAndDequantizeRangeGiven sets the optional range_given attribute to value. +// If not specified, defaults to false +func QuantizeAndDequantizeRangeGiven(value bool) QuantizeAndDequantizeAttr { + return func(m optionalAttr) { + m["range_given"] = value + } +} + +// QuantizeAndDequantizeInputMin sets the optional input_min attribute to value. +// If not specified, defaults to 0 +func QuantizeAndDequantizeInputMin(value float32) QuantizeAndDequantizeAttr { + return func(m optionalAttr) { + m["input_min"] = value + } +} + +// QuantizeAndDequantizeInputMax sets the optional input_max attribute to value. +// If not specified, defaults to 0 +func QuantizeAndDequantizeInputMax(value float32) QuantizeAndDequantizeAttr { + return func(m optionalAttr) { + m["input_max"] = value + } +} + +// Use QuantizeAndDequantizeV2 instead. +// +// DEPRECATED at GraphDef version 22: Replaced by QuantizeAndDequantizeV2 +func QuantizeAndDequantize(scope *Scope, input tf.Output, optional ...QuantizeAndDequantizeAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "QuantizeAndDequantize", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Extracts the average gradient in the given ConditionalAccumulator. +// +// The op blocks until sufficient (i.e., more than num_required) +// gradients have been accumulated. If the accumulator has already +// aggregated more than num_required gradients, it returns the average of +// the accumulated gradients. Also automatically increments the recorded +// global_step in the accumulator by 1, and resets the aggregate to 0. +// +// Arguments: +// +// handle: The handle to an accumulator. +// num_required: Number of gradients required before we return an aggregate. +// dtype: The data type of accumulated gradients. Needs to correspond to the type +// +// of the accumulator. +// +// Returns The average of the accumulated gradients. +func ResourceAccumulatorTakeGradient(scope *Scope, handle tf.Output, num_required tf.Output, dtype tf.DataType) (average tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtype": dtype} + opspec := tf.OpSpec{ + Type: "ResourceAccumulatorTakeGradient", + Input: []tf.Input{ + handle, num_required, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// XlaConvV2Attr is an optional argument to XlaConvV2. +type XlaConvV2Attr func(optionalAttr) + +// XlaConvV2BatchGroupCount sets the optional batch_group_count attribute to value. +// +// value: number of batch groups or grouped filters. +// If not specified, defaults to 1 +func XlaConvV2BatchGroupCount(value int64) XlaConvV2Attr { + return func(m optionalAttr) { + m["batch_group_count"] = value + } +} + +// Wraps the XLA ConvGeneralDilated operator, documented at +// +// https://www.tensorflow.org/performance/xla/operation_semantics#conv_convolution +// +// . +// +// Arguments: +// +// lhs: input tensor +// rhs: kernel tensor +// window_strides: inter-window strides +// padding: padding to apply at the start and end of each input dimensions +// lhs_dilation: dilation to apply between input elements +// rhs_dilation: dilation to apply between kernel elements +// feature_group_count: number of feature groups for grouped convolution. +// dimension_numbers: serialized xla::ConvolutionDimensionNumbers proto. +// precision_config: serialized xla::PrecisionConfig proto. +// preferred_element_type: type of the tensor. +func XlaConvV2(scope *Scope, lhs tf.Output, rhs tf.Output, window_strides tf.Output, padding tf.Output, lhs_dilation tf.Output, rhs_dilation tf.Output, feature_group_count tf.Output, dimension_numbers string, precision_config string, preferred_element_type tf.DataType, optional ...XlaConvV2Attr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dimension_numbers": dimension_numbers, "precision_config": precision_config, "preferred_element_type": preferred_element_type} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "XlaConvV2", + Input: []tf.Input{ + lhs, rhs, window_strides, padding, lhs_dilation, rhs_dilation, feature_group_count, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns a constant tensor on the host. Only for writing C++ tests. +// +// Arguments: +// +// value: Attr `value` is the tensor to return. +func HostConst(scope *Scope, value tf.Tensor, dtype tf.DataType) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"value": value, "dtype": dtype} + opspec := tf.OpSpec{ + Type: "HostConst", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Saves the input tensors to disk. +// +// The size of `tensor_names` must match the number of tensors in `data`. `data[i]` +// is written to `filename` with name `tensor_names[i]`. +// +// See also `SaveSlices`. +// +// Arguments: +// +// filename: Must have a single element. The name of the file to which we write +// +// the tensor. +// +// tensor_names: Shape `[N]`. The names of the tensors to be saved. +// data: `N` tensors to save. +// +// Returns the created operation. +func Save(scope *Scope, filename tf.Output, tensor_names tf.Output, data []tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Save", + Input: []tf.Input{ + filename, tensor_names, tf.OutputList(data), + }, + } + return scope.AddOperation(opspec) +} + +// RandomUniformAttr is an optional argument to RandomUniform. +type RandomUniformAttr func(optionalAttr) + +// RandomUniformSeed sets the optional seed attribute to value. +// +// value: If either `seed` or `seed2` are set to be non-zero, the random number +// generator is seeded by the given seed. Otherwise, it is seeded by a +// random seed. +// If not specified, defaults to 0 +func RandomUniformSeed(value int64) RandomUniformAttr { + return func(m optionalAttr) { + m["seed"] = value + } +} + +// RandomUniformSeed2 sets the optional seed2 attribute to value. +// +// value: A second seed to avoid seed collision. +// If not specified, defaults to 0 +func RandomUniformSeed2(value int64) RandomUniformAttr { + return func(m optionalAttr) { + m["seed2"] = value + } +} + +// Outputs random values from a uniform distribution. +// +// The generated values follow a uniform distribution in the range `[0, 1)`. The +// lower bound 0 is included in the range, while the upper bound 1 is excluded. +// +// Arguments: +// +// shape: The shape of the output tensor. +// dtype: The type of the output. +// +// Returns A tensor of the specified shape filled with uniform random values. +func RandomUniform(scope *Scope, shape tf.Output, dtype tf.DataType, optional ...RandomUniformAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtype": dtype} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "RandomUniform", + Input: []tf.Input{ + shape, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// BoostedTreesSparseCalculateBestFeatureSplitAttr is an optional argument to BoostedTreesSparseCalculateBestFeatureSplit. +type BoostedTreesSparseCalculateBestFeatureSplitAttr func(optionalAttr) + +// BoostedTreesSparseCalculateBestFeatureSplitSplitType sets the optional split_type attribute to value. +// +// value: A string indicating if this Op should perform inequality split or equality split. +// If not specified, defaults to "inequality" +func BoostedTreesSparseCalculateBestFeatureSplitSplitType(value string) BoostedTreesSparseCalculateBestFeatureSplitAttr { + return func(m optionalAttr) { + m["split_type"] = value + } +} + +// Calculates gains for each feature and returns the best possible split information for the feature. +// +// The split information is the best threshold (bucket id), gains and left/right node contributions per node for each feature. +// +// It is possible that not all nodes can be split on each feature. Hence, the list of possible nodes can differ between the features. Therefore, we return `node_ids_list` for each feature, containing the list of nodes that this feature can be used to split. +// +// In this manner, the output is the best split per features and per node, so that it needs to be combined later to produce the best split for each node (among all possible features). +// +// The output shapes are compatible in a way that the first dimension of all tensors are the same and equal to the number of possible split nodes for each feature. +// +// Arguments: +// +// node_id_range: A Rank 1 tensor (shape=[2]) to specify the range [first, last) of node ids to process within `stats_summary_list`. The nodes are iterated between the two nodes specified by the tensor, as like `for node_id in range(node_id_range[0], node_id_range[1])` (Note that the last index node_id_range[1] is exclusive). +// stats_summary_indices: A Rank 2 int64 tensor of dense shape [N, 4] (N specifies the number of non-zero values) for accumulated stats summary (gradient/hessian) per node per bucket for each feature. The second dimension contains node id, feature dimension, bucket id, and stats dim. +// +// stats dim is the sum of logits dimension and hessian dimension, hessian dimension can either be logits dimension if diagonal hessian is used, or logits dimension^2 if full hessian is used. +// +// stats_summary_values: A Rank 1 float tensor of dense shape [N] (N specifies the number of non-zero values), which supplies the values for each element in summary_indices. +// stats_summary_shape: A Rank 1 float tensor of dense shape [4], which specifies the dense shape of the sparse tensor, which is [num tree nodes, feature dimensions, num buckets, stats dim]. +// l1: l1 regularization factor on leaf weights, per instance based. +// l2: l2 regularization factor on leaf weights, per instance based. +// tree_complexity: adjustment to the gain, per leaf based. +// min_node_weight: minimum avg of hessians in a node before required for the node to be considered for splitting. +// logits_dimension: The dimension of logit, i.e., number of classes. +// +// Returns: +// +// node_ids: A Rank 1 tensor indicating possible node ids that can be split. +// gains: A Rank 1 tensor indicating the best gains to split each node. +// feature_dimensions: A Rank 1 tensor indicating the best feature dimension for each feature to split for each node. +// thresholds: A Rank 1 tensor indicating the bucket id to compare with (as a threshold) for split in each node. +// left_node_contribs: A Rank 2 tensor indicating the contribution of the left nodes when branching from parent nodes to the left direction by the given threshold for each feature. +// +// This value will be used to make the left node value by adding to the parent node value. Second dimension size is logits dimension. +// +// right_node_contribs: A Rank 2 tensor, with the same shape/conditions as left_node_contribs_list, but just that the value is for the right node. +// split_with_default_directions: A Rank 1 tensor indicating which direction to go if data is missing. +// +// Inequality with default left returns 0, inequality with default right returns 1, equality with default right returns 2. +func BoostedTreesSparseCalculateBestFeatureSplit(scope *Scope, node_id_range tf.Output, stats_summary_indices tf.Output, stats_summary_values tf.Output, stats_summary_shape tf.Output, l1 tf.Output, l2 tf.Output, tree_complexity tf.Output, min_node_weight tf.Output, logits_dimension int64, optional ...BoostedTreesSparseCalculateBestFeatureSplitAttr) (node_ids tf.Output, gains tf.Output, feature_dimensions tf.Output, thresholds tf.Output, left_node_contribs tf.Output, right_node_contribs tf.Output, split_with_default_directions tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"logits_dimension": logits_dimension} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "BoostedTreesSparseCalculateBestFeatureSplit", + Input: []tf.Input{ + node_id_range, stats_summary_indices, stats_summary_values, stats_summary_shape, l1, l2, tree_complexity, min_node_weight, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2), op.Output(3), op.Output(4), op.Output(5), op.Output(6) +} + +// RetrieveTPUEmbeddingStochasticGradientDescentParametersAttr is an optional argument to RetrieveTPUEmbeddingStochasticGradientDescentParameters. +type RetrieveTPUEmbeddingStochasticGradientDescentParametersAttr func(optionalAttr) + +// RetrieveTPUEmbeddingStochasticGradientDescentParametersTableId sets the optional table_id attribute to value. +// If not specified, defaults to -1 +func RetrieveTPUEmbeddingStochasticGradientDescentParametersTableId(value int64) RetrieveTPUEmbeddingStochasticGradientDescentParametersAttr { + return func(m optionalAttr) { + m["table_id"] = value + } +} + +// RetrieveTPUEmbeddingStochasticGradientDescentParametersTableName sets the optional table_name attribute to value. +// If not specified, defaults to "" +func RetrieveTPUEmbeddingStochasticGradientDescentParametersTableName(value string) RetrieveTPUEmbeddingStochasticGradientDescentParametersAttr { + return func(m optionalAttr) { + m["table_name"] = value + } +} + +// RetrieveTPUEmbeddingStochasticGradientDescentParametersConfig sets the optional config attribute to value. +// If not specified, defaults to "" +func RetrieveTPUEmbeddingStochasticGradientDescentParametersConfig(value string) RetrieveTPUEmbeddingStochasticGradientDescentParametersAttr { + return func(m optionalAttr) { + m["config"] = value + } +} + +// Retrieve SGD embedding parameters. +// +// An op that retrieves optimization parameters from embedding to host +// memory. Must be preceded by a ConfigureTPUEmbeddingHost op that sets up +// the correct embedding table configuration. For example, this op is +// used to retrieve updated parameters before saving a checkpoint. +// +// Returns Parameter parameters updated by the stochastic gradient descent optimization algorithm. +func RetrieveTPUEmbeddingStochasticGradientDescentParameters(scope *Scope, num_shards int64, shard_id int64, optional ...RetrieveTPUEmbeddingStochasticGradientDescentParametersAttr) (parameters tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_shards": num_shards, "shard_id": shard_id} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "RetrieveTPUEmbeddingStochasticGradientDescentParameters", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ResourceApplyCenteredRMSPropAttr is an optional argument to ResourceApplyCenteredRMSProp. +type ResourceApplyCenteredRMSPropAttr func(optionalAttr) + +// ResourceApplyCenteredRMSPropUseLocking sets the optional use_locking attribute to value. +// +// value: If `True`, updating of the var, mg, ms, and mom tensors is +// protected by a lock; otherwise the behavior is undefined, but may exhibit less +// contention. +// If not specified, defaults to false +func ResourceApplyCenteredRMSPropUseLocking(value bool) ResourceApplyCenteredRMSPropAttr { + return func(m optionalAttr) { + m["use_locking"] = value + } +} + +// Update '*var' according to the centered RMSProp algorithm. +// +// The centered RMSProp algorithm uses an estimate of the centered second moment +// (i.e., the variance) for normalization, as opposed to regular RMSProp, which +// uses the (uncentered) second moment. This often helps with training, but is +// slightly more expensive in terms of computation and memory. +// +// Note that in dense implementation of this algorithm, mg, ms, and mom will +// update even if the grad is zero, but in this sparse implementation, mg, ms, +// and mom will not update in iterations during which the grad is zero. +// +// mean_square = decay * mean_square + (1-decay) * gradient ** 2 +// mean_grad = decay * mean_grad + (1-decay) * gradient +// +// Delta = learning_rate * gradient / sqrt(mean_square + epsilon - mean_grad ** 2) +// +// mg <- rho * mg_{t-1} + (1-rho) * grad +// ms <- rho * ms_{t-1} + (1-rho) * grad * grad +// mom <- momentum * mom_{t-1} + lr * grad / sqrt(ms - mg * mg + epsilon) +// var <- var - mom +// +// Arguments: +// +// var_: Should be from a Variable(). +// mg: Should be from a Variable(). +// ms: Should be from a Variable(). +// mom: Should be from a Variable(). +// lr: Scaling factor. Must be a scalar. +// rho: Decay rate. Must be a scalar. +// momentum: Momentum Scale. Must be a scalar. +// epsilon: Ridge term. Must be a scalar. +// grad: The gradient. +// +// Returns the created operation. +func ResourceApplyCenteredRMSProp(scope *Scope, var_ tf.Output, mg tf.Output, ms tf.Output, mom tf.Output, lr tf.Output, rho tf.Output, momentum tf.Output, epsilon tf.Output, grad tf.Output, optional ...ResourceApplyCenteredRMSPropAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ResourceApplyCenteredRMSProp", + Input: []tf.Input{ + var_, mg, ms, mom, lr, rho, momentum, epsilon, grad, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// QueueEnqueueV2Attr is an optional argument to QueueEnqueueV2. +type QueueEnqueueV2Attr func(optionalAttr) + +// QueueEnqueueV2TimeoutMs sets the optional timeout_ms attribute to value. +// +// value: If the queue is full, this operation will block for up to +// timeout_ms milliseconds. +// Note: This option is not supported yet. +// If not specified, defaults to -1 +func QueueEnqueueV2TimeoutMs(value int64) QueueEnqueueV2Attr { + return func(m optionalAttr) { + m["timeout_ms"] = value + } +} + +// Enqueues a tuple of one or more tensors in the given queue. +// +// The components input has k elements, which correspond to the components of +// tuples stored in the given queue. +// +// N.B. If the queue is full, this operation will block until the given +// element has been enqueued (or 'timeout_ms' elapses, if specified). +// +// Arguments: +// +// handle: The handle to a queue. +// components: One or more tensors from which the enqueued tensors should be taken. +// +// Returns the created operation. +func QueueEnqueueV2(scope *Scope, handle tf.Output, components []tf.Output, optional ...QueueEnqueueV2Attr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "QueueEnqueueV2", + Input: []tf.Input{ + handle, tf.OutputList(components), + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// CudnnRNNCanonicalToParamsV2Attr is an optional argument to CudnnRNNCanonicalToParamsV2. +type CudnnRNNCanonicalToParamsV2Attr func(optionalAttr) + +// CudnnRNNCanonicalToParamsV2RnnMode sets the optional rnn_mode attribute to value. +// If not specified, defaults to "lstm" +func CudnnRNNCanonicalToParamsV2RnnMode(value string) CudnnRNNCanonicalToParamsV2Attr { + return func(m optionalAttr) { + m["rnn_mode"] = value + } +} + +// CudnnRNNCanonicalToParamsV2InputMode sets the optional input_mode attribute to value. +// If not specified, defaults to "linear_input" +func CudnnRNNCanonicalToParamsV2InputMode(value string) CudnnRNNCanonicalToParamsV2Attr { + return func(m optionalAttr) { + m["input_mode"] = value + } +} + +// CudnnRNNCanonicalToParamsV2Direction sets the optional direction attribute to value. +// If not specified, defaults to "unidirectional" +func CudnnRNNCanonicalToParamsV2Direction(value string) CudnnRNNCanonicalToParamsV2Attr { + return func(m optionalAttr) { + m["direction"] = value + } +} + +// CudnnRNNCanonicalToParamsV2Dropout sets the optional dropout attribute to value. +// If not specified, defaults to 0 +func CudnnRNNCanonicalToParamsV2Dropout(value float32) CudnnRNNCanonicalToParamsV2Attr { + return func(m optionalAttr) { + m["dropout"] = value + } +} + +// CudnnRNNCanonicalToParamsV2Seed sets the optional seed attribute to value. +// If not specified, defaults to 0 +func CudnnRNNCanonicalToParamsV2Seed(value int64) CudnnRNNCanonicalToParamsV2Attr { + return func(m optionalAttr) { + m["seed"] = value + } +} + +// CudnnRNNCanonicalToParamsV2Seed2 sets the optional seed2 attribute to value. +// If not specified, defaults to 0 +func CudnnRNNCanonicalToParamsV2Seed2(value int64) CudnnRNNCanonicalToParamsV2Attr { + return func(m optionalAttr) { + m["seed2"] = value + } +} + +// CudnnRNNCanonicalToParamsV2NumProj sets the optional num_proj attribute to value. +// If not specified, defaults to 0 +func CudnnRNNCanonicalToParamsV2NumProj(value int64) CudnnRNNCanonicalToParamsV2Attr { + return func(m optionalAttr) { + m["num_proj"] = value + } +} + +// Converts CudnnRNN params from canonical form to usable form. It supports the projection in LSTM. +// +// Writes a set of weights into the opaque params buffer so they can be used in +// upcoming training or inferences. +// +// Note that the params buffer may not be compatible across different GPUs. So any +// save and restoration should be converted to and from the canonical weights and +// biases. +// +// num_layers: Specifies the number of layers in the RNN model. +// num_units: Specifies the size of the hidden state. +// input_size: Specifies the size of the input state. +// weights: the canonical form of weights that can be used for saving +// +// and restoration. They are more likely to be compatible across different +// generations. +// +// biases: the canonical form of biases that can be used for saving +// +// and restoration. They are more likely to be compatible across different +// generations. +// +// num_params_weights: number of weight parameter matrix for all layers. +// num_params_biases: number of bias parameter vector for all layers. +// rnn_mode: Indicates the type of the RNN model. +// input_mode: Indicate whether there is a linear projection between the input and +// +// The actual computation before the first layer. 'skip_input' is only allowed +// when input_size == num_units; 'auto_select' implies 'skip_input' when +// input_size == num_units; otherwise, it implies 'linear_input'. +// +// direction: Indicates whether a bidirectional model will be used. +// +// dir = (direction == bidirectional) ? 2 : 1 +// +// dropout: dropout probability. When set to 0., dropout is disabled. +// seed: the 1st part of a seed to initialize dropout. +// seed2: the 2nd part of a seed to initialize dropout. +// num_proj: The output dimensionality for the projection matrices. If None or 0, +// +// no projection is performed. +func CudnnRNNCanonicalToParamsV2(scope *Scope, num_layers tf.Output, num_units tf.Output, input_size tf.Output, weights []tf.Output, biases []tf.Output, optional ...CudnnRNNCanonicalToParamsV2Attr) (params tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "CudnnRNNCanonicalToParamsV2", + Input: []tf.Input{ + num_layers, num_units, input_size, tf.OutputList(weights), tf.OutputList(biases), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Generate the bucket boundaries for each feature based on accumulated summaries. +// +// An op that returns a list of float tensors for a quantile stream resource. Each +// tensor is Rank 1 containing bucket boundaries for a single feature. +// +// Arguments: +// +// quantile_stream_resource_handle: resource handle referring to a QuantileStreamResource. +// num_features: inferred int; number of features to get bucket boundaries for. +// +// Returns float; List of Rank 1 Tensors each containing the bucket boundaries for a feature. +func BoostedTreesQuantileStreamResourceGetBucketBoundaries(scope *Scope, quantile_stream_resource_handle tf.Output, num_features int64) (bucket_boundaries []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_features": num_features} + opspec := tf.OpSpec{ + Type: "BoostedTreesQuantileStreamResourceGetBucketBoundaries", + Input: []tf.Input{ + quantile_stream_resource_handle, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if bucket_boundaries, idx, err = makeOutputList(op, idx, "bucket_boundaries"); err != nil { + scope.UpdateErr("BoostedTreesQuantileStreamResourceGetBucketBoundaries", err) + return + } + return bucket_boundaries +} + +// ResourceApplyAdadeltaAttr is an optional argument to ResourceApplyAdadelta. +type ResourceApplyAdadeltaAttr func(optionalAttr) + +// ResourceApplyAdadeltaUseLocking sets the optional use_locking attribute to value. +// +// value: If True, updating of the var, accum and update_accum tensors will be protected by +// a lock; otherwise the behavior is undefined, but may exhibit less contention. +// If not specified, defaults to false +func ResourceApplyAdadeltaUseLocking(value bool) ResourceApplyAdadeltaAttr { + return func(m optionalAttr) { + m["use_locking"] = value + } +} + +// Update '*var' according to the adadelta scheme. +// +// accum = rho() * accum + (1 - rho()) * grad.square(); +// update = (update_accum + epsilon).sqrt() * (accum + epsilon()).rsqrt() * grad; +// update_accum = rho() * update_accum + (1 - rho()) * update.square(); +// var -= update; +// +// Arguments: +// +// var_: Should be from a Variable(). +// accum: Should be from a Variable(). +// accum_update: Should be from a Variable(). +// lr: Scaling factor. Must be a scalar. +// rho: Decay factor. Must be a scalar. +// epsilon: Constant factor. Must be a scalar. +// grad: The gradient. +// +// Returns the created operation. +func ResourceApplyAdadelta(scope *Scope, var_ tf.Output, accum tf.Output, accum_update tf.Output, lr tf.Output, rho tf.Output, epsilon tf.Output, grad tf.Output, optional ...ResourceApplyAdadeltaAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ResourceApplyAdadelta", + Input: []tf.Input{ + var_, accum, accum_update, lr, rho, epsilon, grad, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// CumsumAttr is an optional argument to Cumsum. +type CumsumAttr func(optionalAttr) + +// CumsumExclusive sets the optional exclusive attribute to value. +// +// value: If `True`, perform exclusive cumsum. +// If not specified, defaults to false +func CumsumExclusive(value bool) CumsumAttr { + return func(m optionalAttr) { + m["exclusive"] = value + } +} + +// CumsumReverse sets the optional reverse attribute to value. +// +// value: A `bool` (default: False). +// If not specified, defaults to false +func CumsumReverse(value bool) CumsumAttr { + return func(m optionalAttr) { + m["reverse"] = value + } +} + +// Compute the cumulative sum of the tensor `x` along `axis`. +// +// By default, this op performs an inclusive cumsum, which means that the first +// element of the input is identical to the first element of the output: +// +// ```python +// tf.cumsum([a, b, c]) # => [a, a + b, a + b + c] +// ``` +// +// By setting the `exclusive` kwarg to `True`, an exclusive cumsum is +// performed instead: +// +// ```python +// tf.cumsum([a, b, c], exclusive=True) # => [0, a, a + b] +// ``` +// +// By setting the `reverse` kwarg to `True`, the cumsum is performed in the +// opposite direction: +// +// ```python +// tf.cumsum([a, b, c], reverse=True) # => [a + b + c, b + c, c] +// ``` +// +// This is more efficient than using separate `tf.reverse` ops. +// +// The `reverse` and `exclusive` kwargs can also be combined: +// +// ```python +// tf.cumsum([a, b, c], exclusive=True, reverse=True) # => [b + c, c, 0] +// ``` +// +// Arguments: +// +// x: A `Tensor`. Must be one of the following types: `float32`, `float64`, +// +// `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, +// `complex128`, `qint8`, `quint8`, `qint32`, `half`. +// +// axis: A `Tensor` of type `int32` (default: 0). Must be in the range +// +// `[-rank(x), rank(x))`. +func Cumsum(scope *Scope, x tf.Output, axis tf.Output, optional ...CumsumAttr) (out tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Cumsum", + Input: []tf.Input{ + x, axis, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Converts an array of flat indices into a tuple of coordinate arrays. +// +// Example: +// +// ``` +// y = tf.unravel_index(indices=[2, 5, 7], dims=[3, 3]) +// # 'dims' represent a hypothetical (3, 3) tensor of indices: +// # [[0, 1, *2*], +// # [3, 4, *5*], +// # [6, *7*, 8]] +// # For each entry from 'indices', this operation returns +// # its coordinates (marked with '*'), such as +// # 2 ==> (0, 2) +// # 5 ==> (1, 2) +// # 7 ==> (2, 1) +// y ==> [[0, 1, 2], [2, 2, 1]] +// ``` +// +// @compatibility(numpy) +// Equivalent to np.unravel_index +// @end_compatibility +// +// Arguments: +// +// indices: An 0-D or 1-D `int` Tensor whose elements are indices into the +// +// flattened version of an array of dimensions dims. +// +// dims: An 1-D `int` Tensor. The shape of the array to use for unraveling +// +// indices. +// +// Returns An 2-D (or 1-D if indices is 0-D) tensor where each row has the +// same shape as the indices array. +func UnravelIndex(scope *Scope, indices tf.Output, dims tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "UnravelIndex", + Input: []tf.Input{ + indices, dims, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// AudioSpectrogramAttr is an optional argument to AudioSpectrogram. +type AudioSpectrogramAttr func(optionalAttr) + +// AudioSpectrogramMagnitudeSquared sets the optional magnitude_squared attribute to value. +// +// value: Whether to return the squared magnitude or just the +// magnitude. Using squared magnitude can avoid extra calculations. +// If not specified, defaults to false +func AudioSpectrogramMagnitudeSquared(value bool) AudioSpectrogramAttr { + return func(m optionalAttr) { + m["magnitude_squared"] = value + } +} + +// Produces a visualization of audio data over time. +// +// Spectrograms are a standard way of representing audio information as a series of +// slices of frequency information, one slice for each window of time. By joining +// these together into a sequence, they form a distinctive fingerprint of the sound +// over time. +// +// This op expects to receive audio data as an input, stored as floats in the range +// -1 to 1, together with a window width in samples, and a stride specifying how +// far to move the window between slices. From this it generates a three +// dimensional output. The first dimension is for the channels in the input, so a +// stereo audio input would have two here for example. The second dimension is time, +// with successive frequency slices. The third dimension has an amplitude value for +// each frequency during that time slice. +// +// This means the layout when converted and saved as an image is rotated 90 degrees +// clockwise from a typical spectrogram. Time is descending down the Y axis, and +// the frequency decreases from left to right. +// +// Each value in the result represents the square root of the sum of the real and +// imaginary parts of an FFT on the current window of samples. In this way, the +// lowest dimension represents the power of each frequency in the current window, +// and adjacent windows are concatenated in the next dimension. +// +// To get a more intuitive and visual look at what this operation does, you can run +// tensorflow/examples/wav_to_spectrogram to read in an audio file and save out the +// resulting spectrogram as a PNG image. +// +// Arguments: +// +// input: Float representation of audio data. +// window_size: How wide the input window is in samples. For the highest efficiency +// +// this should be a power of two, but other values are accepted. +// +// stride: How widely apart the center of adjacent sample windows should be. +// +// Returns 3D representation of the audio frequencies as an image. +func AudioSpectrogram(scope *Scope, input tf.Output, window_size int64, stride int64, optional ...AudioSpectrogramAttr) (spectrogram tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"window_size": window_size, "stride": stride} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "AudioSpectrogram", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// A transformation that asserts which transformations happen next. +// +// This transformation checks whether the camel-case names (i.e. "FlatMap", not +// "flat_map") of the transformations following this transformation match the list +// of names in the `transformations` argument. If there is a mismatch, the +// transformation raises an exception. +// +// The check occurs when iterating over the contents of the dataset, which +// means that the check happens *after* any static optimizations are applied +// to the dataset graph. +// +// Arguments: +// +// input_dataset: A variant tensor representing the input dataset. +// +// `AssertNextDataset` passes through the outputs of its input dataset. +// +// transformations: A `tf.string` vector `tf.Tensor` identifying the transformations that are +// +// expected to happen next. +func AssertNextDataset(scope *Scope, input_dataset tf.Output, transformations tf.Output, output_types []tf.DataType, output_shapes []tf.Shape) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + opspec := tf.OpSpec{ + Type: "AssertNextDataset", + Input: []tf.Input{ + input_dataset, transformations, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns a batched diagonal tensor with a given batched diagonal values. +// +// Given a `diagonal`, this operation returns a tensor with the `diagonal` and +// everything else padded with zeros. The diagonal is computed as follows: +// +// Assume `diagonal` has `k` dimensions `[I, J, K, ..., N]`, then the output is a +// tensor of rank `k+1` with dimensions [I, J, K, ..., N, N]` where: +// +// `output[i, j, k, ..., m, n] = 1{m=n} * diagonal[i, j, k, ..., n]`. +// +// For example: +// +// ``` +// # 'diagonal' is [[1, 2, 3, 4], [5, 6, 7, 8]] +// +// and diagonal.shape = (2, 4) +// +// tf.matrix_diag(diagonal) ==> [[[1, 0, 0, 0] +// +// [0, 2, 0, 0] +// [0, 0, 3, 0] +// [0, 0, 0, 4]], +// [[5, 0, 0, 0] +// [0, 6, 0, 0] +// [0, 0, 7, 0] +// [0, 0, 0, 8]]] +// +// which has shape (2, 4, 4) +// ``` +// +// Arguments: +// +// diagonal: Rank `k`, where `k >= 1`. +// +// Returns Rank `k+1`, with `output.shape = diagonal.shape + [diagonal.shape[-1]]`. +func MatrixDiag(scope *Scope, diagonal tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "MatrixDiag", + Input: []tf.Input{ + diagonal, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes hyperbolic tangent of `x` element-wise. +// +// Given an input tensor, this function computes hyperbolic tangent of every +// element in the tensor. Input range is `[-inf, inf]` and +// output range is `[-1,1]`. +// +// >>> x = tf.constant([-float("inf"), -5, -0.5, 1, 1.2, 2, 3, float("inf")]) +// >>> tf.math.tanh(x) +// +func Tanh(scope *Scope, x tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Tanh", + Input: []tf.Input{ + x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns 0 if x == 0, and x * log1p(y) otherwise, elementwise. +func Xlog1py(scope *Scope, x tf.Output, y tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Xlog1py", + Input: []tf.Input{ + x, y, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes the LSTM cell backward propagation for 1 timestep. +// +// This implementation is to be used in conjunction of LSTMBlockCell. +// +// Arguments: +// +// x: The input to the LSTM cell, shape (batch_size, num_inputs). +// cs_prev: The previous cell state. +// h_prev: The previous h state. +// w: The weight matrix. +// wci: The weight matrix for input gate peephole connection. +// wcf: The weight matrix for forget gate peephole connection. +// wco: The weight matrix for output gate peephole connection. +// b: The bias vector. +// i: The input gate. +// cs: The cell state before the tanh. +// f: The forget gate. +// o: The output gate. +// ci: The cell input. +// co: The cell after the tanh. +// cs_grad: The current gradient of cs. +// h_grad: The gradient of h vector. +// use_peephole: Whether the cell uses peephole connections. +// +// Returns: +// +// cs_prev_grad: The gradient of cs to be back-propped. +// dicfo: The derivative wrt to [i, cs, f, o]. +// wci_grad: The gradient for wci to be back-propped. +// wcf_grad: The gradient for wcf to be back-propped. +// wco_grad: The gradient for wco to be back-propped. +func LSTMBlockCellGrad(scope *Scope, x tf.Output, cs_prev tf.Output, h_prev tf.Output, w tf.Output, wci tf.Output, wcf tf.Output, wco tf.Output, b tf.Output, i tf.Output, cs tf.Output, f tf.Output, o tf.Output, ci tf.Output, co tf.Output, cs_grad tf.Output, h_grad tf.Output, use_peephole bool) (cs_prev_grad tf.Output, dicfo tf.Output, wci_grad tf.Output, wcf_grad tf.Output, wco_grad tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"use_peephole": use_peephole} + opspec := tf.OpSpec{ + Type: "LSTMBlockCellGrad", + Input: []tf.Input{ + x, cs_prev, h_prev, w, wci, wcf, wco, b, i, cs, f, o, ci, co, cs_grad, h_grad, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2), op.Output(3), op.Output(4) +} + +// Adjust the hue of one or more images. +// +// `images` is a tensor of at least 3 dimensions. The last dimension is +// interpreted as channels, and must be three. +// +// The input image is considered in the RGB colorspace. Conceptually, the RGB +// colors are first mapped into HSV. A delta is then applied all the hue values, +// and then remapped back to RGB colorspace. +// +// Arguments: +// +// images: Images to adjust. At least 3-D. +// delta: A float delta to add to the hue. +// +// Returns The hue-adjusted image or images. +func AdjustHue(scope *Scope, images tf.Output, delta tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "AdjustHue", + Input: []tf.Input{ + images, delta, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// LoadTPUEmbeddingMDLAdagradLightParametersAttr is an optional argument to LoadTPUEmbeddingMDLAdagradLightParameters. +type LoadTPUEmbeddingMDLAdagradLightParametersAttr func(optionalAttr) + +// LoadTPUEmbeddingMDLAdagradLightParametersTableId sets the optional table_id attribute to value. +// If not specified, defaults to -1 +func LoadTPUEmbeddingMDLAdagradLightParametersTableId(value int64) LoadTPUEmbeddingMDLAdagradLightParametersAttr { + return func(m optionalAttr) { + m["table_id"] = value + } +} + +// LoadTPUEmbeddingMDLAdagradLightParametersTableName sets the optional table_name attribute to value. +// If not specified, defaults to "" +func LoadTPUEmbeddingMDLAdagradLightParametersTableName(value string) LoadTPUEmbeddingMDLAdagradLightParametersAttr { + return func(m optionalAttr) { + m["table_name"] = value + } +} + +// LoadTPUEmbeddingMDLAdagradLightParametersConfig sets the optional config attribute to value. +// If not specified, defaults to "" +func LoadTPUEmbeddingMDLAdagradLightParametersConfig(value string) LoadTPUEmbeddingMDLAdagradLightParametersAttr { + return func(m optionalAttr) { + m["config"] = value + } +} + +// Load MDL Adagrad Light embedding parameters. +// +// An op that loads optimization parameters into HBM for embedding. Must be +// preceded by a ConfigureTPUEmbeddingHost op that sets up the correct +// embedding table configuration. For example, this op is used to install +// parameters that are loaded from a checkpoint before a training loop is +// executed. +// +// Arguments: +// +// parameters: Value of parameters used in the MDL Adagrad Light optimization algorithm. +// accumulators: Value of accumulators used in the MDL Adagrad Light optimization algorithm. +// weights: Value of weights used in the MDL Adagrad Light optimization algorithm. +// benefits: Value of benefits used in the MDL Adagrad Light optimization algorithm. +// +// Returns the created operation. +func LoadTPUEmbeddingMDLAdagradLightParameters(scope *Scope, parameters tf.Output, accumulators tf.Output, weights tf.Output, benefits tf.Output, num_shards int64, shard_id int64, optional ...LoadTPUEmbeddingMDLAdagradLightParametersAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_shards": num_shards, "shard_id": shard_id} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "LoadTPUEmbeddingMDLAdagradLightParameters", + Input: []tf.Input{ + parameters, accumulators, weights, benefits, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// Computes arctangent of `y/x` element-wise, respecting signs of the arguments. +// +// This is the angle \( \theta \in [-\pi, \pi] \) such that +// \[ x = r \cos(\theta) \] +// and +// \[ y = r \sin(\theta) \] +// where \(r = \sqrt(x^2 + y^2) \). +func Atan2(scope *Scope, y tf.Output, x tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Atan2", + Input: []tf.Input{ + y, x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns the name of the device on which `resource` has been placed. +func IteratorGetDevice(scope *Scope, resource tf.Output) (device tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "IteratorGetDevice", + Input: []tf.Input{ + resource, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes gradients for the exponential linear (Elu) operation. +// +// Arguments: +// +// gradients: The backpropagated gradients to the corresponding Elu operation. +// outputs: The outputs of the corresponding Elu operation. +// +// Returns The gradients: `gradients * (outputs + 1)` if outputs < 0, +// `gradients` otherwise. +func EluGrad(scope *Scope, gradients tf.Output, outputs tf.Output) (backprops tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "EluGrad", + Input: []tf.Input{ + gradients, outputs, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// NotEqualAttr is an optional argument to NotEqual. +type NotEqualAttr func(optionalAttr) + +// NotEqualIncompatibleShapeError sets the optional incompatible_shape_error attribute to value. +// If not specified, defaults to true +func NotEqualIncompatibleShapeError(value bool) NotEqualAttr { + return func(m optionalAttr) { + m["incompatible_shape_error"] = value + } +} + +// Returns the truth value of (x != y) element-wise. +// +// *NOTE*: `NotEqual` supports broadcasting. More about broadcasting +// [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) +func NotEqual(scope *Scope, x tf.Output, y tf.Output, optional ...NotEqualAttr) (z tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "NotEqual", + Input: []tf.Input{ + x, y, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Make all elements in the non-Batch dimension unique, but \"close\" to +// +// their initial value. Never returns a sub-normal number. Never returns +// zero. The sign of each input element is always identical to the sign +// of the corresponding output element. Behavior for infinite elements is +// undefined. Behavior for subnormal elements is undefined. +func MakeUnique(scope *Scope, input tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "MakeUnique", + Input: []tf.Input{ + input, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// RequantizePerChannelAttr is an optional argument to RequantizePerChannel. +type RequantizePerChannelAttr func(optionalAttr) + +// RequantizePerChannelOutType sets the optional out_type attribute to value. +// +// value: The quantized type of output tensor that needs to be converted. +// If not specified, defaults to DT_QUINT8 +func RequantizePerChannelOutType(value tf.DataType) RequantizePerChannelAttr { + return func(m optionalAttr) { + m["out_type"] = value + } +} + +// Requantizes input with min and max values known per channel. +// +// Arguments: +// +// input: The original input tensor. +// input_min: The minimum value of the input tensor +// input_max: The maximum value of the input tensor. +// requested_output_min: The minimum value of the output tensor requested. +// requested_output_max: The maximum value of the output tensor requested. +// +// Returns: +// +// output: Output tensor. +// output_min: The minimum value of the final output tensor +// output_max: The maximum value of the final output tensor. +func RequantizePerChannel(scope *Scope, input tf.Output, input_min tf.Output, input_max tf.Output, requested_output_min tf.Output, requested_output_max tf.Output, optional ...RequantizePerChannelAttr) (output tf.Output, output_min tf.Output, output_max tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "RequantizePerChannel", + Input: []tf.Input{ + input, input_min, input_max, requested_output_min, requested_output_max, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// Deserialize and concatenate `SparseTensors` from a serialized minibatch. +// +// The input `serialized_sparse` must be a string matrix of shape `[N x 3]` where +// `N` is the minibatch size and the rows correspond to packed outputs of +// `SerializeSparse`. The ranks of the original `SparseTensor` objects +// must all match. When the final `SparseTensor` is created, it has rank one +// higher than the ranks of the incoming `SparseTensor` objects +// (they have been concatenated along a new row dimension). +// +// The output `SparseTensor` object's shape values for all dimensions but the +// first are the max across the input `SparseTensor` objects' shape values +// for the corresponding dimensions. Its first shape value is `N`, the minibatch +// size. +// +// The input `SparseTensor` objects' indices are assumed ordered in +// standard lexicographic order. If this is not the case, after this +// step run `SparseReorder` to restore index ordering. +// +// For example, if the serialized input is a `[2 x 3]` matrix representing two +// original `SparseTensor` objects: +// +// index = [ 0] +// [10] +// [20] +// values = [1, 2, 3] +// shape = [50] +// +// and +// +// index = [ 2] +// [10] +// values = [4, 5] +// shape = [30] +// +// then the final deserialized `SparseTensor` will be: +// +// index = [0 0] +// [0 10] +// [0 20] +// [1 2] +// [1 10] +// values = [1, 2, 3, 4, 5] +// shape = [2 50] +// +// Arguments: +// +// serialized_sparse: 2-D, The `N` serialized `SparseTensor` objects. +// +// Must have 3 columns. +// +// dtype: The `dtype` of the serialized `SparseTensor` objects. +func DeserializeManySparse(scope *Scope, serialized_sparse tf.Output, dtype tf.DataType) (sparse_indices tf.Output, sparse_values tf.Output, sparse_shape tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtype": dtype} + opspec := tf.OpSpec{ + Type: "DeserializeManySparse", + Input: []tf.Input{ + serialized_sparse, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// Computes a range that covers the actual values present in a quantized tensor. +// +// Given a quantized tensor described by `(input, input_min, input_max)`, outputs a +// range that covers the actual values present in that tensor. This op is typically +// used to produce the `requested_output_min` and `requested_output_max` for +// `Requantize`. +// +// Arguments: +// +// input_min: The float value that the minimum quantized input value represents. +// input_max: The float value that the maximum quantized input value represents. +// +// Returns: +// +// output_min: The computed min output. +// output_max: the computed max output. +func RequantizationRange(scope *Scope, input tf.Output, input_min tf.Output, input_max tf.Output) (output_min tf.Output, output_max tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "RequantizationRange", + Input: []tf.Input{ + input, input_min, input_max, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// DecodeCSVAttr is an optional argument to DecodeCSV. +type DecodeCSVAttr func(optionalAttr) + +// DecodeCSVFieldDelim sets the optional field_delim attribute to value. +// +// value: char delimiter to separate fields in a record. +// If not specified, defaults to "," +func DecodeCSVFieldDelim(value string) DecodeCSVAttr { + return func(m optionalAttr) { + m["field_delim"] = value + } +} + +// DecodeCSVUseQuoteDelim sets the optional use_quote_delim attribute to value. +// +// value: If false, treats double quotation marks as regular +// characters inside of the string fields (ignoring RFC 4180, Section 2, +// Bullet 5). +// If not specified, defaults to true +func DecodeCSVUseQuoteDelim(value bool) DecodeCSVAttr { + return func(m optionalAttr) { + m["use_quote_delim"] = value + } +} + +// DecodeCSVNaValue sets the optional na_value attribute to value. +// +// value: Additional string to recognize as NA/NaN. +// If not specified, defaults to "" +func DecodeCSVNaValue(value string) DecodeCSVAttr { + return func(m optionalAttr) { + m["na_value"] = value + } +} + +// DecodeCSVSelectCols sets the optional select_cols attribute to value. +// If not specified, defaults to <> +func DecodeCSVSelectCols(value []int64) DecodeCSVAttr { + return func(m optionalAttr) { + m["select_cols"] = value + } +} + +// Convert CSV records to tensors. Each column maps to one tensor. +// +// RFC 4180 format is expected for the CSV records. +// (https://tools.ietf.org/html/rfc4180) +// Note that we allow leading and trailing spaces with int or float field. +// +// Arguments: +// +// records: Each string is a record/row in the csv and all records should have +// +// the same format. +// +// record_defaults: One tensor per column of the input record, with either a +// +// scalar default value for that column or an empty vector if the column is +// required. +// +// Returns Each tensor will have the same shape as records. +func DecodeCSV(scope *Scope, records tf.Output, record_defaults []tf.Output, optional ...DecodeCSVAttr) (output []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "DecodeCSV", + Input: []tf.Input{ + records, tf.OutputList(record_defaults), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if output, idx, err = makeOutputList(op, idx, "output"); err != nil { + scope.UpdateErr("DecodeCSV", err) + return + } + return output +} + +// Returns element-wise integer closest to x. +// +// If the result is midway between two representable values, +// the even representable is chosen. +// For example: +// +// ``` +// rint(-1.5) ==> -2.0 +// rint(0.5000001) ==> 1.0 +// rint([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) ==> [-2., -2., -0., 0., 2., 2., 2.] +// ``` +func Rint(scope *Scope, x tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Rint", + Input: []tf.Input{ + x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// RegexReplaceAttr is an optional argument to RegexReplace. +type RegexReplaceAttr func(optionalAttr) + +// RegexReplaceReplaceGlobal sets the optional replace_global attribute to value. +// +// value: If True, the replacement is global (that is, all matches of the `pattern` regular +// expression in each input string are rewritten), otherwise the `rewrite` +// substitution is only made for the first `pattern` match. +// If not specified, defaults to true +func RegexReplaceReplaceGlobal(value bool) RegexReplaceAttr { + return func(m optionalAttr) { + m["replace_global"] = value + } +} + +// Replaces matches of the `pattern` regular expression in `input` with the +// replacement string provided in `rewrite`. +// +// It follows the re2 syntax (https://github.com/google/re2/wiki/Syntax) +// +// Arguments: +// +// input: The text to be processed. +// pattern: The regular expression to be matched in the `input` strings. +// rewrite: The rewrite string to be substituted for the `pattern` expression where it is +// +// matched in the `input` strings. +// +// Returns The text after applying pattern match and rewrite substitution. +func RegexReplace(scope *Scope, input tf.Output, pattern tf.Output, rewrite tf.Output, optional ...RegexReplaceAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "RegexReplace", + Input: []tf.Input{ + input, pattern, rewrite, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Convert the quantized 'input' tensor into a lower-precision 'output', using the +// +// actual distribution of the values to maximize the usage of the lower bit depth +// and adjusting the output min and max ranges accordingly. +// +// [input_min, input_max] are scalar floats that specify the range for the float +// interpretation of the 'input' data. For example, if input_min is -1.0f and +// input_max is 1.0f, and we are dealing with quint16 quantized data, then a 0 +// value in the 16-bit data should be interpreted as -1.0f, and a 65535 means 1.0f. +// +// This operator tries to squeeze as much precision as possible into an output with +// a lower bit depth by calculating the actual min and max values found in the +// data. For example, maybe that quint16 input has no values lower than 16,384 and +// none higher than 49,152. That means only half the range is actually needed, all +// the float interpretations are between -0.5f and 0.5f, so if we want to compress +// the data into a quint8 output, we can use that range rather than the theoretical +// -1.0f to 1.0f that is suggested by the input min and max. +// +// In practice, this is most useful for taking output from operations like +// QuantizedMatMul that can produce higher bit-depth outputs than their inputs and +// may have large potential output ranges, but in practice have a distribution of +// input values that only uses a small fraction of the possible range. By feeding +// that output into this operator, we can reduce it from 32 bits down to 8 with +// minimal loss of accuracy. +// +// Arguments: +// +// input_min: The float value that the minimum quantized input value represents. +// input_max: The float value that the maximum quantized input value represents. +// out_type: The type of the output. Should be a lower bit depth than Tinput. +// +// Returns: +// +// output +// output_min: The float value that the minimum quantized output value represents. +// output_max: The float value that the maximum quantized output value represents. +func QuantizeDownAndShrinkRange(scope *Scope, input tf.Output, input_min tf.Output, input_max tf.Output, out_type tf.DataType) (output tf.Output, output_min tf.Output, output_max tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"out_type": out_type} + opspec := tf.OpSpec{ + Type: "QuantizeDownAndShrinkRange", + Input: []tf.Input{ + input, input_min, input_max, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// CTCLossAttr is an optional argument to CTCLoss. +type CTCLossAttr func(optionalAttr) + +// CTCLossPreprocessCollapseRepeated sets the optional preprocess_collapse_repeated attribute to value. +// +// value: Scalar, if true then repeated labels are +// collapsed prior to the CTC calculation. +// If not specified, defaults to false +func CTCLossPreprocessCollapseRepeated(value bool) CTCLossAttr { + return func(m optionalAttr) { + m["preprocess_collapse_repeated"] = value + } +} + +// CTCLossCtcMergeRepeated sets the optional ctc_merge_repeated attribute to value. +// +// value: Scalar. If set to false, *during* CTC calculation +// repeated non-blank labels will not be merged and are interpreted as +// individual labels. This is a simplified version of CTC. +// If not specified, defaults to true +func CTCLossCtcMergeRepeated(value bool) CTCLossAttr { + return func(m optionalAttr) { + m["ctc_merge_repeated"] = value + } +} + +// CTCLossIgnoreLongerOutputsThanInputs sets the optional ignore_longer_outputs_than_inputs attribute to value. +// +// value: Scalar. If set to true, during CTC +// calculation, items that have longer output sequences than input sequences +// are skipped: they don't contribute to the loss term and have zero-gradient. +// If not specified, defaults to false +func CTCLossIgnoreLongerOutputsThanInputs(value bool) CTCLossAttr { + return func(m optionalAttr) { + m["ignore_longer_outputs_than_inputs"] = value + } +} + +// Calculates the CTC Loss (log probability) for each batch entry. Also calculates +// +// the gradient. This class performs the softmax operation for you, so inputs +// should be e.g. linear projections of outputs by an LSTM. +// +// Arguments: +// +// inputs: 3-D, shape: `(max_time x batch_size x num_classes)`, the logits. +// labels_indices: The indices of a `SparseTensor`. +// +// `labels_indices(i, :) == [b, t]` means `labels_values(i)` stores the id for +// `(batch b, time t)`. +// +// labels_values: The values (labels) associated with the given batch and time. +// sequence_length: A vector containing sequence lengths (batch). +// +// Returns: +// +// loss: A vector (batch) containing log-probabilities. +// gradient: The gradient of `loss`. 3-D, shape: +// +// `(max_time x batch_size x num_classes)`. +func CTCLoss(scope *Scope, inputs tf.Output, labels_indices tf.Output, labels_values tf.Output, sequence_length tf.Output, optional ...CTCLossAttr) (loss tf.Output, gradient tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "CTCLoss", + Input: []tf.Input{ + inputs, labels_indices, labels_values, sequence_length, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// Get the value of the tensor specified by its handle. +// +// Arguments: +// +// handle: The handle for a tensor stored in the session state. +// dtype: The type of the output value. +// +// Returns The tensor for the given handle. +func GetSessionTensor(scope *Scope, handle tf.Output, dtype tf.DataType) (value tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtype": dtype} + opspec := tf.OpSpec{ + Type: "GetSessionTensor", + Input: []tf.Input{ + handle, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Creates a Dataset that returns pseudorandom numbers. +// +// Arguments: +// +// seed: A scalar seed for the random number generator. If either seed or +// +// seed2 is set to be non-zero, the random number generator is seeded +// by the given seed. Otherwise, a random seed is used. +// +// seed2: A second scalar seed to avoid seed collision. +func ExperimentalRandomDataset(scope *Scope, seed tf.Output, seed2 tf.Output, output_types []tf.DataType, output_shapes []tf.Shape) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + opspec := tf.OpSpec{ + Type: "ExperimentalRandomDataset", + Input: []tf.Input{ + seed, seed2, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Fetches multiple values from infeed as an XLA tuple. +// +// Arguments: +// +// dtypes: The element types of each element in `outputs`. +// shapes: The shapes of each tensor in `outputs`. +// +// Returns A list of tensors that will be provided using the infeed mechanism. +func InfeedDequeueTuple(scope *Scope, dtypes []tf.DataType, shapes []tf.Shape) (outputs []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtypes": dtypes, "shapes": shapes} + opspec := tf.OpSpec{ + Type: "InfeedDequeueTuple", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if outputs, idx, err = makeOutputList(op, idx, "outputs"); err != nil { + scope.UpdateErr("InfeedDequeueTuple", err) + return + } + return outputs +} + +// UnbatchDatasetAttr is an optional argument to UnbatchDataset. +type UnbatchDatasetAttr func(optionalAttr) + +// UnbatchDatasetMetadata sets the optional metadata attribute to value. +// If not specified, defaults to "" +func UnbatchDatasetMetadata(value string) UnbatchDatasetAttr { + return func(m optionalAttr) { + m["metadata"] = value + } +} + +// A dataset that splits the elements of its input into multiple elements. +func UnbatchDataset(scope *Scope, input_dataset tf.Output, output_types []tf.DataType, output_shapes []tf.Shape, optional ...UnbatchDatasetAttr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "UnbatchDataset", + Input: []tf.Input{ + input_dataset, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns the truth value of `NOT x` element-wise. +// +// Arguments: +// +// x: A `Tensor` of type `bool`. +// +// Returns A `Tensor` of type `bool` with the same shape as `x`. The logical negation of `x`. +func LogicalNot(scope *Scope, x tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "LogicalNot", + Input: []tf.Input{ + x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// TensorArrayV2Attr is an optional argument to TensorArrayV2. +type TensorArrayV2Attr func(optionalAttr) + +// TensorArrayV2ElementShape sets the optional element_shape attribute to value. +// If not specified, defaults to +func TensorArrayV2ElementShape(value tf.Shape) TensorArrayV2Attr { + return func(m optionalAttr) { + m["element_shape"] = value + } +} + +// TensorArrayV2DynamicSize sets the optional dynamic_size attribute to value. +// If not specified, defaults to false +func TensorArrayV2DynamicSize(value bool) TensorArrayV2Attr { + return func(m optionalAttr) { + m["dynamic_size"] = value + } +} + +// TensorArrayV2ClearAfterRead sets the optional clear_after_read attribute to value. +// If not specified, defaults to true +func TensorArrayV2ClearAfterRead(value bool) TensorArrayV2Attr { + return func(m optionalAttr) { + m["clear_after_read"] = value + } +} + +// TensorArrayV2TensorArrayName sets the optional tensor_array_name attribute to value. +// If not specified, defaults to "" +func TensorArrayV2TensorArrayName(value string) TensorArrayV2Attr { + return func(m optionalAttr) { + m["tensor_array_name"] = value + } +} + +// Deprecated. Use TensorArrayV3 +// +// DEPRECATED at GraphDef version 26: Use TensorArrayV3 +func TensorArrayV2(scope *Scope, size tf.Output, dtype tf.DataType, optional ...TensorArrayV2Attr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtype": dtype} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "TensorArrayV2", + Input: []tf.Input{ + size, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// UniqueDatasetAttr is an optional argument to UniqueDataset. +type UniqueDatasetAttr func(optionalAttr) + +// UniqueDatasetMetadata sets the optional metadata attribute to value. +// If not specified, defaults to "" +func UniqueDatasetMetadata(value string) UniqueDatasetAttr { + return func(m optionalAttr) { + m["metadata"] = value + } +} + +// Creates a dataset that contains the unique elements of `input_dataset`. +func UniqueDataset(scope *Scope, input_dataset tf.Output, output_types []tf.DataType, output_shapes []tf.Shape, optional ...UniqueDatasetAttr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "UniqueDataset", + Input: []tf.Input{ + input_dataset, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// TensorArrayGatherV3Attr is an optional argument to TensorArrayGatherV3. +type TensorArrayGatherV3Attr func(optionalAttr) + +// TensorArrayGatherV3ElementShape sets the optional element_shape attribute to value. +// +// value: The expected shape of an element, if known. Used to +// validate the shapes of TensorArray elements. If this shape is not +// fully specified, gathering zero-size TensorArrays is an error. +// If not specified, defaults to +func TensorArrayGatherV3ElementShape(value tf.Shape) TensorArrayGatherV3Attr { + return func(m optionalAttr) { + m["element_shape"] = value + } +} + +// Gather specific elements from the TensorArray into output `value`. +// +// All elements selected by `indices` must have the same shape. +// +// Arguments: +// +// handle: The handle to a TensorArray. +// indices: The locations in the TensorArray from which to read tensor elements. +// flow_in: A float scalar that enforces proper chaining of operations. +// dtype: The type of the elem that is returned. +// +// Returns All of the elements in the TensorArray, concatenated along a new +// axis (the new dimension 0). +func TensorArrayGatherV3(scope *Scope, handle tf.Output, indices tf.Output, flow_in tf.Output, dtype tf.DataType, optional ...TensorArrayGatherV3Attr) (value tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtype": dtype} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "TensorArrayGatherV3", + Input: []tf.Input{ + handle, indices, flow_in, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ExperimentalRebatchDatasetAttr is an optional argument to ExperimentalRebatchDataset. +type ExperimentalRebatchDatasetAttr func(optionalAttr) + +// ExperimentalRebatchDatasetUseFallback sets the optional use_fallback attribute to value. +// If not specified, defaults to true +func ExperimentalRebatchDatasetUseFallback(value bool) ExperimentalRebatchDatasetAttr { + return func(m optionalAttr) { + m["use_fallback"] = value + } +} + +// Creates a dataset that changes the batch size. +// +// Creates a dataset that changes the batch size of the dataset to current batch +// size // num_replicas. +// +// Arguments: +// +// input_dataset: A variant tensor representing the input dataset. +// num_replicas: A scalar representing the number of replicas to distribute this batch across. As +// +// a result of this transformation the current batch size would end up being +// divided by this parameter. +func ExperimentalRebatchDataset(scope *Scope, input_dataset tf.Output, num_replicas tf.Output, output_types []tf.DataType, output_shapes []tf.Shape, optional ...ExperimentalRebatchDatasetAttr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ExperimentalRebatchDataset", + Input: []tf.Input{ + input_dataset, num_replicas, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// IdentityReaderV2Attr is an optional argument to IdentityReaderV2. +type IdentityReaderV2Attr func(optionalAttr) + +// IdentityReaderV2Container sets the optional container attribute to value. +// +// value: If non-empty, this reader is placed in the given container. +// Otherwise, a default container is used. +// If not specified, defaults to "" +func IdentityReaderV2Container(value string) IdentityReaderV2Attr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// IdentityReaderV2SharedName sets the optional shared_name attribute to value. +// +// value: If non-empty, this reader is named in the given bucket +// with this shared_name. Otherwise, the node name is used instead. +// If not specified, defaults to "" +func IdentityReaderV2SharedName(value string) IdentityReaderV2Attr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// A Reader that outputs the queued work as both the key and value. +// +// To use, enqueue strings in a Queue. ReaderRead will take the front +// work string and output (work, work). +// +// Returns The handle to reference the Reader. +func IdentityReaderV2(scope *Scope, optional ...IdentityReaderV2Attr) (reader_handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "IdentityReaderV2", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns the max of x and y (i.e. x > y ? x : y) element-wise. +// +// *NOTE*: `Maximum` supports broadcasting. More about broadcasting +// [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) +func Maximum(scope *Scope, x tf.Output, y tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Maximum", + Input: []tf.Input{ + x, y, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes softmax cross entropy cost and gradients to backpropagate. +// +// Inputs are the logits, not probabilities. +// +// Arguments: +// +// features: batch_size x num_classes matrix +// labels: batch_size x num_classes matrix +// +// The caller must ensure that each batch of labels represents a valid +// probability distribution. +// +// Returns: +// +// loss: Per example loss (batch_size vector). +// backprop: backpropagated gradients (batch_size x num_classes matrix). +func SoftmaxCrossEntropyWithLogits(scope *Scope, features tf.Output, labels tf.Output) (loss tf.Output, backprop tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "SoftmaxCrossEntropyWithLogits", + Input: []tf.Input{ + features, labels, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// ParseSequenceExampleAttr is an optional argument to ParseSequenceExample. +type ParseSequenceExampleAttr func(optionalAttr) + +// ParseSequenceExampleNcontextSparse sets the optional Ncontext_sparse attribute to value. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func ParseSequenceExampleNcontextSparse(value int64) ParseSequenceExampleAttr { + return func(m optionalAttr) { + m["Ncontext_sparse"] = value + } +} + +// ParseSequenceExampleNcontextDense sets the optional Ncontext_dense attribute to value. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func ParseSequenceExampleNcontextDense(value int64) ParseSequenceExampleAttr { + return func(m optionalAttr) { + m["Ncontext_dense"] = value + } +} + +// ParseSequenceExampleNfeatureListSparse sets the optional Nfeature_list_sparse attribute to value. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func ParseSequenceExampleNfeatureListSparse(value int64) ParseSequenceExampleAttr { + return func(m optionalAttr) { + m["Nfeature_list_sparse"] = value + } +} + +// ParseSequenceExampleNfeatureListDense sets the optional Nfeature_list_dense attribute to value. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func ParseSequenceExampleNfeatureListDense(value int64) ParseSequenceExampleAttr { + return func(m optionalAttr) { + m["Nfeature_list_dense"] = value + } +} + +// ParseSequenceExampleContextSparseTypes sets the optional context_sparse_types attribute to value. +// +// value: A list of Ncontext_sparse types; the data types of data in +// each context Feature given in context_sparse_keys. +// Currently the ParseSingleSequenceExample supports DT_FLOAT (FloatList), +// DT_INT64 (Int64List), and DT_STRING (BytesList). +// If not specified, defaults to <> +// +// REQUIRES: len(value) >= 0 +func ParseSequenceExampleContextSparseTypes(value []tf.DataType) ParseSequenceExampleAttr { + return func(m optionalAttr) { + m["context_sparse_types"] = value + } +} + +// ParseSequenceExampleFeatureListDenseTypes sets the optional feature_list_dense_types attribute to value. +// If not specified, defaults to <> +// +// REQUIRES: len(value) >= 0 +func ParseSequenceExampleFeatureListDenseTypes(value []tf.DataType) ParseSequenceExampleAttr { + return func(m optionalAttr) { + m["feature_list_dense_types"] = value + } +} + +// ParseSequenceExampleContextDenseShapes sets the optional context_dense_shapes attribute to value. +// +// value: A list of Ncontext_dense shapes; the shapes of data in +// each context Feature given in context_dense_keys. +// The number of elements in the Feature corresponding to context_dense_key[j] +// must always equal context_dense_shapes[j].NumEntries(). +// The shape of context_dense_values[j] will match context_dense_shapes[j]. +// If not specified, defaults to <> +// +// REQUIRES: len(value) >= 0 +func ParseSequenceExampleContextDenseShapes(value []tf.Shape) ParseSequenceExampleAttr { + return func(m optionalAttr) { + m["context_dense_shapes"] = value + } +} + +// ParseSequenceExampleFeatureListSparseTypes sets the optional feature_list_sparse_types attribute to value. +// +// value: A list of Nfeature_list_sparse types; the data types +// of data in each FeatureList given in feature_list_sparse_keys. +// Currently the ParseSingleSequenceExample supports DT_FLOAT (FloatList), +// DT_INT64 (Int64List), and DT_STRING (BytesList). +// If not specified, defaults to <> +// +// REQUIRES: len(value) >= 0 +func ParseSequenceExampleFeatureListSparseTypes(value []tf.DataType) ParseSequenceExampleAttr { + return func(m optionalAttr) { + m["feature_list_sparse_types"] = value + } +} + +// ParseSequenceExampleFeatureListDenseShapes sets the optional feature_list_dense_shapes attribute to value. +// +// value: A list of Nfeature_list_dense shapes; the shapes of +// data in each FeatureList given in feature_list_dense_keys. +// The shape of each Feature in the FeatureList corresponding to +// feature_list_dense_key[j] must always equal +// feature_list_dense_shapes[j].NumEntries(). +// If not specified, defaults to <> +// +// REQUIRES: len(value) >= 0 +func ParseSequenceExampleFeatureListDenseShapes(value []tf.Shape) ParseSequenceExampleAttr { + return func(m optionalAttr) { + m["feature_list_dense_shapes"] = value + } +} + +// Transforms a vector of brain.SequenceExample protos (as strings) into typed tensors. +// +// Arguments: +// +// serialized: A vector containing binary serialized SequenceExample protos. +// debug_name: A vector containing the names of the serialized protos. +// +// May contain, for example, table key (descriptive) name for the +// corresponding serialized proto. This is purely useful for debugging +// purposes, and the presence of values here has no effect on the output. +// May also be an empty vector if no name is available. +// +// context_dense_defaults: A list of Ncontext_dense Tensors (some may be empty). +// +// context_dense_defaults[j] provides default values +// when the SequenceExample's context map lacks context_dense_key[j]. +// If an empty Tensor is provided for context_dense_defaults[j], +// then the Feature context_dense_keys[j] is required. +// The input type is inferred from context_dense_defaults[j], even when it's +// empty. If context_dense_defaults[j] is not empty, its shape must match +// context_dense_shapes[j]. +// +// feature_list_dense_missing_assumed_empty: A vector listing the +// +// FeatureList keys which may be missing from the SequenceExamples. If the +// associated FeatureList is missing, it is treated as empty. By default, +// any FeatureList not listed in this vector must exist in the SequenceExamples. +// +// context_sparse_keys: A list of Ncontext_sparse string Tensors (scalars). +// +// The keys expected in the Examples' features associated with context_sparse +// values. +// +// context_dense_keys: A list of Ncontext_dense string Tensors (scalars). +// +// The keys expected in the SequenceExamples' context features associated with +// dense values. +// +// feature_list_sparse_keys: A list of Nfeature_list_sparse string Tensors +// +// (scalars). The keys expected in the FeatureLists associated with sparse +// values. +// +// feature_list_dense_keys: A list of Nfeature_list_dense string Tensors (scalars). +// +// The keys expected in the SequenceExamples' feature_lists associated +// with lists of dense values. +func ParseSequenceExample(scope *Scope, serialized tf.Output, debug_name tf.Output, context_dense_defaults []tf.Output, feature_list_dense_missing_assumed_empty []string, context_sparse_keys []string, context_dense_keys []string, feature_list_sparse_keys []string, feature_list_dense_keys []string, optional ...ParseSequenceExampleAttr) (context_sparse_indices []tf.Output, context_sparse_values []tf.Output, context_sparse_shapes []tf.Output, context_dense_values []tf.Output, feature_list_sparse_indices []tf.Output, feature_list_sparse_values []tf.Output, feature_list_sparse_shapes []tf.Output, feature_list_dense_values []tf.Output, feature_list_dense_lengths []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"feature_list_dense_missing_assumed_empty": feature_list_dense_missing_assumed_empty, "context_sparse_keys": context_sparse_keys, "context_dense_keys": context_dense_keys, "feature_list_sparse_keys": feature_list_sparse_keys, "feature_list_dense_keys": feature_list_dense_keys} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ParseSequenceExample", + Input: []tf.Input{ + serialized, debug_name, tf.OutputList(context_dense_defaults), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if context_sparse_indices, idx, err = makeOutputList(op, idx, "context_sparse_indices"); err != nil { + scope.UpdateErr("ParseSequenceExample", err) + return + } + if context_sparse_values, idx, err = makeOutputList(op, idx, "context_sparse_values"); err != nil { + scope.UpdateErr("ParseSequenceExample", err) + return + } + if context_sparse_shapes, idx, err = makeOutputList(op, idx, "context_sparse_shapes"); err != nil { + scope.UpdateErr("ParseSequenceExample", err) + return + } + if context_dense_values, idx, err = makeOutputList(op, idx, "context_dense_values"); err != nil { + scope.UpdateErr("ParseSequenceExample", err) + return + } + if feature_list_sparse_indices, idx, err = makeOutputList(op, idx, "feature_list_sparse_indices"); err != nil { + scope.UpdateErr("ParseSequenceExample", err) + return + } + if feature_list_sparse_values, idx, err = makeOutputList(op, idx, "feature_list_sparse_values"); err != nil { + scope.UpdateErr("ParseSequenceExample", err) + return + } + if feature_list_sparse_shapes, idx, err = makeOutputList(op, idx, "feature_list_sparse_shapes"); err != nil { + scope.UpdateErr("ParseSequenceExample", err) + return + } + if feature_list_dense_values, idx, err = makeOutputList(op, idx, "feature_list_dense_values"); err != nil { + scope.UpdateErr("ParseSequenceExample", err) + return + } + if feature_list_dense_lengths, idx, err = makeOutputList(op, idx, "feature_list_dense_lengths"); err != nil { + scope.UpdateErr("ParseSequenceExample", err) + return + } + return context_sparse_indices, context_sparse_values, context_sparse_shapes, context_dense_values, feature_list_sparse_indices, feature_list_sparse_values, feature_list_sparse_shapes, feature_list_dense_values, feature_list_dense_lengths +} + +// Locks a mutex resource. The output is the lock. So long as the lock tensor +// +// is alive, any other request to use `MutexLock` with this mutex will wait. +// +// This is particularly useful for creating a critical section when used in +// conjunction with `MutexLockIdentity`: +// +// ```python +// +// mutex = mutex_v2( +// +// shared_name=handle_name, container=container, name=name) +// +// def execute_in_critical_section(fn, *args, **kwargs): +// +// lock = gen_resource_variable_ops.mutex_lock(mutex) +// +// with ops.control_dependencies([lock]): +// r = fn(*args, **kwargs) +// +// with ops.control_dependencies(nest.flatten(r)): +// with ops.colocate_with(mutex): +// ensure_lock_exists = mutex_lock_identity(lock) +// +// # Make sure that if any element of r is accessed, all of +// # them are executed together. +// r = nest.map_structure(tf.identity, r) +// +// with ops.control_dependencies([ensure_lock_exists]): +// return nest.map_structure(tf.identity, r) +// +// ``` +// +// While `fn` is running in the critical section, no other functions which wish to +// use this critical section may run. +// +// Often the use case is that two executions of the same graph, in parallel, +// wish to run `fn`; and we wish to ensure that only one of them executes +// at a time. This is especially important if `fn` modifies one or more +// variables at a time. +// +// It is also useful if two separate functions must share a resource, but we +// wish to ensure the usage is exclusive. +// +// Arguments: +// +// mutex: The mutex resource to lock. +// +// Returns A tensor that keeps a shared pointer to a lock on the mutex; +// when the Tensor is destroyed, the use count on the shared pointer is decreased +// by 1. When it reaches 0, the lock is released. +func MutexLock(scope *Scope, mutex tf.Output) (mutex_lock tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "MutexLock", + Input: []tf.Input{ + mutex, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// QuantizedMulAttr is an optional argument to QuantizedMul. +type QuantizedMulAttr func(optionalAttr) + +// QuantizedMulToutput sets the optional Toutput attribute to value. +// If not specified, defaults to DT_QINT32 +func QuantizedMulToutput(value tf.DataType) QuantizedMulAttr { + return func(m optionalAttr) { + m["Toutput"] = value + } +} + +// Returns x * y element-wise, working on quantized buffers. +// +// Arguments: +// +// min_x: The float value that the lowest quantized `x` value represents. +// max_x: The float value that the highest quantized `x` value represents. +// min_y: The float value that the lowest quantized `y` value represents. +// max_y: The float value that the highest quantized `y` value represents. +// +// Returns: +// +// z +// min_z: The float value that the lowest quantized output value represents. +// max_z: The float value that the highest quantized output value represents. +// +// *NOTE*: `QuantizedMul` supports limited forms of broadcasting. More about +// broadcasting [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) +func QuantizedMul(scope *Scope, x tf.Output, y tf.Output, min_x tf.Output, max_x tf.Output, min_y tf.Output, max_y tf.Output, optional ...QuantizedMulAttr) (z tf.Output, min_z tf.Output, max_z tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "QuantizedMul", + Input: []tf.Input{ + x, y, min_x, max_x, min_y, max_y, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// Splits a tensor into `num_split` tensors along one dimension. +// +// Arguments: +// +// axis: 0-D. The dimension along which to split. Must be in the range +// +// `[-rank(value), rank(value))`. +// +// value: The tensor to split. +// num_split: The number of ways to split. Must evenly divide +// +// `value.shape[split_dim]`. +// +// Returns They are identically shaped tensors, whose shape matches that of `value` +// except along `axis`, where their sizes are +// `values.shape[split_dim] / num_split`. +func Split(scope *Scope, axis tf.Output, value tf.Output, num_split int64) (output []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_split": num_split} + opspec := tf.OpSpec{ + Type: "Split", + Input: []tf.Input{ + axis, value, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if output, idx, err = makeOutputList(op, idx, "output"); err != nil { + scope.UpdateErr("Split", err) + return + } + return output +} + +// Delete the tensor specified by its handle in the session. +// +// Arguments: +// +// handle: The handle for a tensor stored in the session state. +// +// Returns the created operation. +func DeleteSessionTensor(scope *Scope, handle tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "DeleteSessionTensor", + Input: []tf.Input{ + handle, + }, + } + return scope.AddOperation(opspec) +} + +// DecodeJpegAttr is an optional argument to DecodeJpeg. +type DecodeJpegAttr func(optionalAttr) + +// DecodeJpegChannels sets the optional channels attribute to value. +// +// value: Number of color channels for the decoded image. +// If not specified, defaults to 0 +func DecodeJpegChannels(value int64) DecodeJpegAttr { + return func(m optionalAttr) { + m["channels"] = value + } +} + +// DecodeJpegRatio sets the optional ratio attribute to value. +// +// value: Downscaling ratio. +// If not specified, defaults to 1 +func DecodeJpegRatio(value int64) DecodeJpegAttr { + return func(m optionalAttr) { + m["ratio"] = value + } +} + +// DecodeJpegFancyUpscaling sets the optional fancy_upscaling attribute to value. +// +// value: If true use a slower but nicer upscaling of the +// chroma planes (yuv420/422 only). +// If not specified, defaults to true +func DecodeJpegFancyUpscaling(value bool) DecodeJpegAttr { + return func(m optionalAttr) { + m["fancy_upscaling"] = value + } +} + +// DecodeJpegTryRecoverTruncated sets the optional try_recover_truncated attribute to value. +// +// value: If true try to recover an image from truncated input. +// If not specified, defaults to false +func DecodeJpegTryRecoverTruncated(value bool) DecodeJpegAttr { + return func(m optionalAttr) { + m["try_recover_truncated"] = value + } +} + +// DecodeJpegAcceptableFraction sets the optional acceptable_fraction attribute to value. +// +// value: The minimum required fraction of lines before a truncated +// input is accepted. +// If not specified, defaults to 1 +func DecodeJpegAcceptableFraction(value float32) DecodeJpegAttr { + return func(m optionalAttr) { + m["acceptable_fraction"] = value + } +} + +// DecodeJpegDctMethod sets the optional dct_method attribute to value. +// +// value: string specifying a hint about the algorithm used for +// decompression. Defaults to "" which maps to a system-specific +// default. Currently valid values are ["INTEGER_FAST", +// "INTEGER_ACCURATE"]. The hint may be ignored (e.g., the internal +// jpeg library changes to a version that does not have that specific +// option.) +// If not specified, defaults to "" +func DecodeJpegDctMethod(value string) DecodeJpegAttr { + return func(m optionalAttr) { + m["dct_method"] = value + } +} + +// Decode a JPEG-encoded image to a uint8 tensor. +// +// The attr `channels` indicates the desired number of color channels for the +// decoded image. +// +// Accepted values are: +// +// * 0: Use the number of channels in the JPEG-encoded image. +// * 1: output a grayscale image. +// * 3: output an RGB image. +// +// If needed, the JPEG-encoded image is transformed to match the requested number +// of color channels. +// +// The attr `ratio` allows downscaling the image by an integer factor during +// decoding. Allowed values are: 1, 2, 4, and 8. This is much faster than +// downscaling the image later. +// +// This op also supports decoding PNGs and non-animated GIFs since the interface is +// the same, though it is cleaner to use `tf.io.decode_image`. +// +// Arguments: +// +// contents: 0-D. The JPEG-encoded image. +// +// Returns 3-D with shape `[height, width, channels]`.. +func DecodeJpeg(scope *Scope, contents tf.Output, optional ...DecodeJpegAttr) (image tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "DecodeJpeg", + Input: []tf.Input{ + contents, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Generates sparse cross from a list of sparse and dense tensors. +// +// The op takes two lists, one of 2D `SparseTensor` and one of 2D `Tensor`, each +// representing features of one feature column. It outputs a 2D `SparseTensor` with +// the batchwise crosses of these features. +// +// For example, if the inputs are +// +// inputs[0]: SparseTensor with shape = [2, 2] +// [0, 0]: "a" +// [1, 0]: "b" +// [1, 1]: "c" +// +// inputs[1]: SparseTensor with shape = [2, 1] +// [0, 0]: "d" +// [1, 0]: "e" +// +// inputs[2]: Tensor [["f"], ["g"]] +// +// then the output will be +// +// shape = [2, 2] +// [0, 0]: "a_X_d_X_f" +// [1, 0]: "b_X_e_X_g" +// [1, 1]: "c_X_e_X_g" +// +// if hashed_output=true then the output will be +// +// shape = [2, 2] +// [0, 0]: FingerprintCat64( +// Fingerprint64("f"), FingerprintCat64( +// Fingerprint64("d"), Fingerprint64("a"))) +// [1, 0]: FingerprintCat64( +// Fingerprint64("g"), FingerprintCat64( +// Fingerprint64("e"), Fingerprint64("b"))) +// [1, 1]: FingerprintCat64( +// Fingerprint64("g"), FingerprintCat64( +// Fingerprint64("e"), Fingerprint64("c"))) +// +// Arguments: +// +// indices: 2-D. Indices of each input `SparseTensor`. +// values: 1-D. values of each `SparseTensor`. +// shapes: 1-D. Shapes of each `SparseTensor`. +// dense_inputs: 2-D. Columns represented by dense `Tensor`. +// hashed_output: If true, returns the hash of the cross instead of the string. +// +// This will allow us avoiding string manipulations. +// +// num_buckets: It is used if hashed_output is true. +// +// output = hashed_value%num_buckets if num_buckets > 0 else hashed_value. +// +// hash_key: Specify the hash_key that will be used by the `FingerprintCat64` +// +// function to combine the crosses fingerprints. +// +// Returns: +// +// output_indices: 2-D. Indices of the concatenated `SparseTensor`. +// output_values: 1-D. Non-empty values of the concatenated or hashed +// +// `SparseTensor`. +// +// output_shape: 1-D. Shape of the concatenated `SparseTensor`. +func SparseCross(scope *Scope, indices []tf.Output, values []tf.Output, shapes []tf.Output, dense_inputs []tf.Output, hashed_output bool, num_buckets int64, hash_key int64, out_type tf.DataType, internal_type tf.DataType) (output_indices tf.Output, output_values tf.Output, output_shape tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"hashed_output": hashed_output, "num_buckets": num_buckets, "hash_key": hash_key, "out_type": out_type, "internal_type": internal_type} + opspec := tf.OpSpec{ + Type: "SparseCross", + Input: []tf.Input{ + tf.OutputList(indices), tf.OutputList(values), tf.OutputList(shapes), tf.OutputList(dense_inputs), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// PaddingFIFOQueueV2Attr is an optional argument to PaddingFIFOQueueV2. +type PaddingFIFOQueueV2Attr func(optionalAttr) + +// PaddingFIFOQueueV2Shapes sets the optional shapes attribute to value. +// +// value: The shape of each component in a value. The length of this attr must +// be either 0 or the same as the length of component_types. +// Shapes of fixed rank but variable size are allowed by setting +// any shape dimension to -1. In this case, the inputs' shape may vary along +// the given dimension, and DequeueMany will pad the given dimension with +// zeros up to the maximum shape of all elements in the given batch. +// If the length of this attr is 0, different queue elements may have +// different ranks and shapes, but only one element may be dequeued at a time. +// If not specified, defaults to <> +// +// REQUIRES: len(value) >= 0 +func PaddingFIFOQueueV2Shapes(value []tf.Shape) PaddingFIFOQueueV2Attr { + return func(m optionalAttr) { + m["shapes"] = value + } +} + +// PaddingFIFOQueueV2Capacity sets the optional capacity attribute to value. +// +// value: The upper bound on the number of elements in this queue. +// Negative numbers mean no limit. +// If not specified, defaults to -1 +func PaddingFIFOQueueV2Capacity(value int64) PaddingFIFOQueueV2Attr { + return func(m optionalAttr) { + m["capacity"] = value + } +} + +// PaddingFIFOQueueV2Container sets the optional container attribute to value. +// +// value: If non-empty, this queue is placed in the given container. +// Otherwise, a default container is used. +// If not specified, defaults to "" +func PaddingFIFOQueueV2Container(value string) PaddingFIFOQueueV2Attr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// PaddingFIFOQueueV2SharedName sets the optional shared_name attribute to value. +// +// value: If non-empty, this queue will be shared under the given name +// across multiple sessions. +// If not specified, defaults to "" +func PaddingFIFOQueueV2SharedName(value string) PaddingFIFOQueueV2Attr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// A queue that produces elements in first-in first-out order. +// +// Variable-size shapes are allowed by setting the corresponding shape dimensions +// to 0 in the shape attr. In this case DequeueMany will pad up to the maximum +// size of any given element in the minibatch. See below for details. +// +// Arguments: +// +// component_types: The type of each component in a value. +// +// Returns The handle to the queue. +func PaddingFIFOQueueV2(scope *Scope, component_types []tf.DataType, optional ...PaddingFIFOQueueV2Attr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"component_types": component_types} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "PaddingFIFOQueueV2", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ImageProjectiveTransformV2Attr is an optional argument to ImageProjectiveTransformV2. +type ImageProjectiveTransformV2Attr func(optionalAttr) + +// ImageProjectiveTransformV2FillMode sets the optional fill_mode attribute to value. +// +// value: Fill mode, "REFLECT", "WRAP", or "CONSTANT". +// If not specified, defaults to "CONSTANT" +func ImageProjectiveTransformV2FillMode(value string) ImageProjectiveTransformV2Attr { + return func(m optionalAttr) { + m["fill_mode"] = value + } +} + +// Applies the given transform to each of the images. +// +// If one row of `transforms` is `[a0, a1, a2, b0, b1, b2, c0, c1]`, then it maps +// the *output* point `(x, y)` to a transformed *input* point +// `(x', y') = ((a0 x + a1 y + a2) / k, (b0 x + b1 y + b2) / k)`, where +// `k = c0 x + c1 y + 1`. If the transformed point lays outside of the input +// image, the output pixel is set to 0. +// +// Arguments: +// +// images: 4-D with shape `[batch, height, width, channels]`. +// transforms: 2-D Tensor, `[batch, 8]` or `[1, 8]` matrix, where each row corresponds to a 3 x 3 +// +// projective transformation matrix, with the last entry assumed to be 1. If there +// is one row, the same transformation will be applied to all images. +// +// output_shape: 1-D Tensor [new_height, new_width]. +// interpolation: Interpolation method, "NEAREST" or "BILINEAR". +// +// Returns 4-D with shape +// `[batch, new_height, new_width, channels]`. +func ImageProjectiveTransformV2(scope *Scope, images tf.Output, transforms tf.Output, output_shape tf.Output, interpolation string, optional ...ImageProjectiveTransformV2Attr) (transformed_images tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"interpolation": interpolation} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ImageProjectiveTransformV2", + Input: []tf.Input{ + images, transforms, output_shape, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Outputs a `Summary` protocol buffer with scalar values. +// +// The input `tags` and `values` must have the same shape. The generated summary +// has a summary value for each tag-value pair in `tags` and `values`. +// +// Arguments: +// +// tags: Tags for the summary. +// values: Same shape as `tags. Values for the summary. +// +// Returns Scalar. Serialized `Summary` protocol buffer. +func ScalarSummary(scope *Scope, tags tf.Output, values tf.Output) (summary tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "ScalarSummary", + Input: []tf.Input{ + tags, values, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Creates a sequence of numbers. +// +// This operation creates a sequence of numbers that begins at `start` and +// extends by increments of `delta` up to but not including `limit`. +// +// For example: +// +// ``` +// # 'start' is 3 +// # 'limit' is 18 +// # 'delta' is 3 +// tf.range(start, limit, delta) ==> [3, 6, 9, 12, 15] +// ``` +// +// Arguments: +// +// start: 0-D (scalar). First entry in the sequence. +// limit: 0-D (scalar). Upper limit of sequence, exclusive. +// delta: 0-D (scalar). Optional. Default is 1. Number that increments `start`. +// +// Returns 1-D. +func Range(scope *Scope, start tf.Output, limit tf.Output, delta tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Range", + Input: []tf.Input{ + start, limit, delta, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// QuantizedDepthwiseConv2DAttr is an optional argument to QuantizedDepthwiseConv2D. +type QuantizedDepthwiseConv2DAttr func(optionalAttr) + +// QuantizedDepthwiseConv2DOutType sets the optional out_type attribute to value. +// +// value: The type of the output. +// If not specified, defaults to DT_QINT32 +func QuantizedDepthwiseConv2DOutType(value tf.DataType) QuantizedDepthwiseConv2DAttr { + return func(m optionalAttr) { + m["out_type"] = value + } +} + +// QuantizedDepthwiseConv2DDilations sets the optional dilations attribute to value. +// +// value: List of dilation values. +// If not specified, defaults to +func QuantizedDepthwiseConv2DDilations(value []int64) QuantizedDepthwiseConv2DAttr { + return func(m optionalAttr) { + m["dilations"] = value + } +} + +// Computes quantized depthwise Conv2D. +// +// Arguments: +// +// input: The original input tensor. +// filter: The original filter tensor. +// min_input: The float value that the minimum quantized input value represents. +// max_input: The float value that the maximum quantized input value represents. +// min_filter: The float value that the minimum quantized filter value represents. +// max_filter: The float value that the maximum quantized filter value represents. +// strides: List of stride values. +// +// Returns: +// +// output: The output tensor. +// min_output: The float value that the minimum quantized output value represents. +// max_output: The float value that the maximum quantized output value represents. +func QuantizedDepthwiseConv2D(scope *Scope, input tf.Output, filter tf.Output, min_input tf.Output, max_input tf.Output, min_filter tf.Output, max_filter tf.Output, strides []int64, padding string, optional ...QuantizedDepthwiseConv2DAttr) (output tf.Output, min_output tf.Output, max_output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"strides": strides, "padding": padding} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "QuantizedDepthwiseConv2D", + Input: []tf.Input{ + input, filter, min_input, max_input, min_filter, max_filter, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// RFFT3DAttr is an optional argument to RFFT3D. +type RFFT3DAttr func(optionalAttr) + +// RFFT3DTcomplex sets the optional Tcomplex attribute to value. +// If not specified, defaults to DT_COMPLEX64 +func RFFT3DTcomplex(value tf.DataType) RFFT3DAttr { + return func(m optionalAttr) { + m["Tcomplex"] = value + } +} + +// 3D real-valued fast Fourier transform. +// +// Computes the 3-dimensional discrete Fourier transform of a real-valued signal +// over the inner-most 3 dimensions of `input`. +// +// Since the DFT of a real signal is Hermitian-symmetric, `RFFT3D` only returns the +// `fft_length / 2 + 1` unique components of the FFT for the inner-most dimension +// of `output`: the zero-frequency term, followed by the `fft_length / 2` +// positive-frequency terms. +// +// Along each axis `RFFT3D` is computed on, if `fft_length` is smaller than the +// corresponding dimension of `input`, the dimension is cropped. If it is larger, +// the dimension is padded with zeros. +// +// Arguments: +// +// input: A float32 tensor. +// fft_length: An int32 tensor of shape [3]. The FFT length for each dimension. +// +// Returns A complex64 tensor of the same rank as `input`. The inner-most 3 +// +// dimensions of `input` are replaced with the their 3D Fourier transform. The +// inner-most dimension contains `fft_length / 2 + 1` unique frequency +// components. +// +// @compatibility(numpy) +// Equivalent to np.fft.rfftn with 3 dimensions. +// @end_compatibility +func RFFT3D(scope *Scope, input tf.Output, fft_length tf.Output, optional ...RFFT3DAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "RFFT3D", + Input: []tf.Input{ + input, fft_length, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// TensorScatterUpdateAttr is an optional argument to TensorScatterUpdate. +type TensorScatterUpdateAttr func(optionalAttr) + +// TensorScatterUpdateBadIndicesPolicy sets the optional bad_indices_policy attribute to value. +// If not specified, defaults to "" +func TensorScatterUpdateBadIndicesPolicy(value string) TensorScatterUpdateAttr { + return func(m optionalAttr) { + m["bad_indices_policy"] = value + } +} + +// Scatter `updates` into an existing tensor according to `indices`. +// +// This operation creates a new tensor by applying sparse `updates` to the passed +// in `tensor`. +// This operation is very similar to `tf.scatter_nd`, except that the updates are +// scattered onto an existing tensor (as opposed to a zero-tensor). If the memory +// for the existing tensor cannot be re-used, a copy is made and updated. +// +// If `indices` contains duplicates, then we pick the last update for the index. +// +// If an out of bound index is found on CPU, an error is returned. +// +// **WARNING**: There are some GPU specific semantics for this operation. +// - If an out of bound index is found, the index is ignored. +// - The order in which updates are applied is nondeterministic, so the output +// will be nondeterministic if `indices` contains duplicates. +// +// `indices` is an integer tensor containing indices into a new tensor of shape +// `shape`. +// +// - `indices` must have at least 2 axes: `(num_updates, index_depth)`. +// - The last axis of `indices` is how deep to index into `tensor` so this index +// depth must be less than the rank of `tensor`: `indices.shape[-1] <= tensor.ndim` +// +// if `indices.shape[-1] = tensor.rank` this Op indexes and updates scalar elements. +// if `indices.shape[-1] < tensor.rank` it indexes and updates slices of the input +// `tensor`. +// +// Each `update` has a rank of `tensor.rank - indices.shape[-1]`. +// The overall shape of `updates` is: +// +// ``` +// indices.shape[:-1] + tensor.shape[indices.shape[-1]:] +// ``` +// +// For usage examples see the python [tf.tensor_scatter_nd_update]( +// https://www.tensorflow.org/api_docs/python/tf/tensor_scatter_nd_update) function +// +// Arguments: +// +// tensor: Tensor to copy/update. +// indices: Index tensor. +// updates: Updates to scatter into output. +// +// Returns A new tensor with the given shape and updates applied according +// to the indices. +func TensorScatterUpdate(scope *Scope, tensor tf.Output, indices tf.Output, updates tf.Output, optional ...TensorScatterUpdateAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "TensorScatterUpdate", + Input: []tf.Input{ + tensor, indices, updates, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Splits a tensor into a list. +// +// list[i] corresponds to lengths[i] tensors from the input tensor. +// The tensor must have rank at least 1 and contain exactly sum(lengths) elements. +// +// tensor: The input tensor. +// element_shape: A shape compatible with that of elements in the tensor. +// lengths: Vector of sizes of the 0th dimension of tensors in the list. +// output_handle: The list. +func TensorListSplit(scope *Scope, tensor tf.Output, element_shape tf.Output, lengths tf.Output) (output_handle tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "TensorListSplit", + Input: []tf.Input{ + tensor, element_shape, lengths, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes tan of x element-wise. +// +// Given an input tensor, this function computes tangent of every +// element in the tensor. Input range is `(-inf, inf)` and +// output range is `(-inf, inf)`. If input lies outside the boundary, `nan` +// is returned. +// +// ```python +// x = tf.constant([-float("inf"), -9, -0.5, 1, 1.2, 200, 10000, float("inf")]) +// tf.math.tan(x) ==> [nan 0.45231566 -0.5463025 1.5574077 2.572152 -1.7925274 0.32097113 nan] +// ``` +func Tan(scope *Scope, x tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Tan", + Input: []tf.Input{ + x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// The gradient of SparseFillEmptyRows. +// +// Takes vectors reverse_index_map, shaped `[N]`, and grad_values, +// shaped `[N_full]`, where `N_full >= N` and copies data into either +// `d_values` or `d_default_value`. Here `d_values` is shaped `[N]` and +// `d_default_value` is a scalar. +// +// d_values[j] = grad_values[reverse_index_map[j]] +// d_default_value = sum_{k : 0 .. N_full - 1} ( +// grad_values[k] * 1{k not in reverse_index_map}) +// +// Arguments: +// +// reverse_index_map: 1-D. The reverse index map from SparseFillEmptyRows. +// grad_values: 1-D. The gradients from backprop. +// +// Returns: +// +// d_values: 1-D. The backprop into values. +// d_default_value: 0-D. The backprop into default_value. +func SparseFillEmptyRowsGrad(scope *Scope, reverse_index_map tf.Output, grad_values tf.Output) (d_values tf.Output, d_default_value tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "SparseFillEmptyRowsGrad", + Input: []tf.Input{ + reverse_index_map, grad_values, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// Updates the tree ensemble by either adding a layer to the last tree being grown +// +// or by starting a new tree. +// +// Arguments: +// +// tree_ensemble_handle: Handle to the ensemble variable. +// feature_ids: Rank 1 tensor with ids for each feature. This is the real id of +// +// the feature that will be used in the split. +// +// node_ids: List of rank 1 tensors representing the nodes for which this feature +// +// has a split. +// +// gains: List of rank 1 tensors representing the gains for each of the feature's +// +// split. +// +// thresholds: List of rank 1 tensors representing the thesholds for each of the +// +// feature's split. +// +// left_node_contribs: List of rank 2 tensors with left leaf contribs for each of +// +// the feature's splits. Will be added to the previous node values to constitute +// the values of the left nodes. +// +// right_node_contribs: List of rank 2 tensors with right leaf contribs for each +// +// of the feature's splits. Will be added to the previous node values to constitute +// the values of the right nodes. +// +// max_depth: Max depth of the tree to build. +// learning_rate: shrinkage const for each new tree. +// pruning_mode: 0-No pruning, 1-Pre-pruning, 2-Post-pruning. +// +// Returns the created operation. +func BoostedTreesUpdateEnsemble(scope *Scope, tree_ensemble_handle tf.Output, feature_ids tf.Output, node_ids []tf.Output, gains []tf.Output, thresholds []tf.Output, left_node_contribs []tf.Output, right_node_contribs []tf.Output, max_depth tf.Output, learning_rate tf.Output, pruning_mode int64) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"pruning_mode": pruning_mode} + opspec := tf.OpSpec{ + Type: "BoostedTreesUpdateEnsemble", + Input: []tf.Input{ + tree_ensemble_handle, feature_ids, tf.OutputList(node_ids), tf.OutputList(gains), tf.OutputList(thresholds), tf.OutputList(left_node_contribs), tf.OutputList(right_node_contribs), max_depth, learning_rate, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// NonDeterministicIntsAttr is an optional argument to NonDeterministicInts. +type NonDeterministicIntsAttr func(optionalAttr) + +// NonDeterministicIntsDtype sets the optional dtype attribute to value. +// +// value: The type of the output. +// If not specified, defaults to DT_INT64 +func NonDeterministicIntsDtype(value tf.DataType) NonDeterministicIntsAttr { + return func(m optionalAttr) { + m["dtype"] = value + } +} + +// Non-deterministically generates some integers. +// +// This op may use some OS-provided source of non-determinism (e.g. an RNG), so each execution will give different results. +// +// Arguments: +// +// shape: The shape of the output tensor. +// +// Returns Non-deterministic integer values with specified shape. +func NonDeterministicInts(scope *Scope, shape tf.Output, optional ...NonDeterministicIntsAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "NonDeterministicInts", + Input: []tf.Input{ + shape, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// RetrieveTPUEmbeddingMomentumParametersAttr is an optional argument to RetrieveTPUEmbeddingMomentumParameters. +type RetrieveTPUEmbeddingMomentumParametersAttr func(optionalAttr) + +// RetrieveTPUEmbeddingMomentumParametersTableId sets the optional table_id attribute to value. +// If not specified, defaults to -1 +func RetrieveTPUEmbeddingMomentumParametersTableId(value int64) RetrieveTPUEmbeddingMomentumParametersAttr { + return func(m optionalAttr) { + m["table_id"] = value + } +} + +// RetrieveTPUEmbeddingMomentumParametersTableName sets the optional table_name attribute to value. +// If not specified, defaults to "" +func RetrieveTPUEmbeddingMomentumParametersTableName(value string) RetrieveTPUEmbeddingMomentumParametersAttr { + return func(m optionalAttr) { + m["table_name"] = value + } +} + +// RetrieveTPUEmbeddingMomentumParametersConfig sets the optional config attribute to value. +// If not specified, defaults to "" +func RetrieveTPUEmbeddingMomentumParametersConfig(value string) RetrieveTPUEmbeddingMomentumParametersAttr { + return func(m optionalAttr) { + m["config"] = value + } +} + +// Retrieve Momentum embedding parameters. +// +// An op that retrieves optimization parameters from embedding to host +// memory. Must be preceded by a ConfigureTPUEmbeddingHost op that sets up +// the correct embedding table configuration. For example, this op is +// used to retrieve updated parameters before saving a checkpoint. +// +// Returns: +// +// parameters: Parameter parameters updated by the Momentum optimization algorithm. +// momenta: Parameter momenta updated by the Momentum optimization algorithm. +func RetrieveTPUEmbeddingMomentumParameters(scope *Scope, num_shards int64, shard_id int64, optional ...RetrieveTPUEmbeddingMomentumParametersAttr) (parameters tf.Output, momenta tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_shards": num_shards, "shard_id": shard_id} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "RetrieveTPUEmbeddingMomentumParameters", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// SdcaOptimizerAttr is an optional argument to SdcaOptimizer. +type SdcaOptimizerAttr func(optionalAttr) + +// SdcaOptimizerAdaptative sets the optional adaptative attribute to value. +// +// value: Whether to use Adaptive SDCA for the inner loop. +// If not specified, defaults to true +func SdcaOptimizerAdaptative(value bool) SdcaOptimizerAttr { + return func(m optionalAttr) { + m["adaptative"] = value + } +} + +// Distributed version of Stochastic Dual Coordinate Ascent (SDCA) optimizer for +// +// linear models with L1 + L2 regularization. As global optimization objective is +// strongly-convex, the optimizer optimizes the dual objective at each step. The +// optimizer applies each update one example at a time. Examples are sampled +// uniformly, and the optimizer is learning rate free and enjoys linear convergence +// rate. +// +// [Proximal Stochastic Dual Coordinate Ascent](http://arxiv.org/pdf/1211.2717v1.pdf).
+// Shai Shalev-Shwartz, Tong Zhang. 2012 +// +// $$Loss Objective = \sum f_{i} (wx_{i}) + (l2 / 2) * |w|^2 + l1 * |w|$$ +// +// [Adding vs. Averaging in Distributed Primal-Dual Optimization](http://arxiv.org/abs/1502.03508).
+// Chenxin Ma, Virginia Smith, Martin Jaggi, Michael I. Jordan, +// Peter Richtarik, Martin Takac. 2015 +// +// [Stochastic Dual Coordinate Ascent with Adaptive Probabilities](https://arxiv.org/abs/1502.08053).
+// Dominik Csiba, Zheng Qu, Peter Richtarik. 2015 +// +// Arguments: +// +// sparse_example_indices: a list of vectors which contain example indices. +// sparse_feature_indices: a list of vectors which contain feature indices. +// sparse_feature_values: a list of vectors which contains feature value +// +// associated with each feature group. +// +// dense_features: a list of matrices which contains the dense feature values. +// example_weights: a vector which contains the weight associated with each +// +// example. +// +// example_labels: a vector which contains the label/target associated with each +// +// example. +// +// sparse_indices: a list of vectors where each value is the indices which has +// +// corresponding weights in sparse_weights. This field maybe omitted for the +// dense approach. +// +// sparse_weights: a list of vectors where each value is the weight associated with +// +// a sparse feature group. +// +// dense_weights: a list of vectors where the values are the weights associated +// +// with a dense feature group. +// +// example_state_data: a list of vectors containing the example state data. +// loss_type: Type of the primal loss. Currently SdcaSolver supports logistic, +// +// squared and hinge losses. +// +// l1: Symmetric l1 regularization strength. +// l2: Symmetric l2 regularization strength. +// num_loss_partitions: Number of partitions of the global loss function. +// num_inner_iterations: Number of iterations per mini-batch. +// +// Returns: +// +// out_example_state_data: a list of vectors containing the updated example state +// +// data. +// +// out_delta_sparse_weights: a list of vectors where each value is the delta +// +// weights associated with a sparse feature group. +// +// out_delta_dense_weights: a list of vectors where the values are the delta +// +// weights associated with a dense feature group. +func SdcaOptimizer(scope *Scope, sparse_example_indices []tf.Output, sparse_feature_indices []tf.Output, sparse_feature_values []tf.Output, dense_features []tf.Output, example_weights tf.Output, example_labels tf.Output, sparse_indices []tf.Output, sparse_weights []tf.Output, dense_weights []tf.Output, example_state_data tf.Output, loss_type string, l1 float32, l2 float32, num_loss_partitions int64, num_inner_iterations int64, optional ...SdcaOptimizerAttr) (out_example_state_data tf.Output, out_delta_sparse_weights []tf.Output, out_delta_dense_weights []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"loss_type": loss_type, "l1": l1, "l2": l2, "num_loss_partitions": num_loss_partitions, "num_inner_iterations": num_inner_iterations} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "SdcaOptimizer", + Input: []tf.Input{ + tf.OutputList(sparse_example_indices), tf.OutputList(sparse_feature_indices), tf.OutputList(sparse_feature_values), tf.OutputList(dense_features), example_weights, example_labels, tf.OutputList(sparse_indices), tf.OutputList(sparse_weights), tf.OutputList(dense_weights), example_state_data, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + out_example_state_data = op.Output(idx) + if out_delta_sparse_weights, idx, err = makeOutputList(op, idx, "out_delta_sparse_weights"); err != nil { + scope.UpdateErr("SdcaOptimizer", err) + return + } + if out_delta_dense_weights, idx, err = makeOutputList(op, idx, "out_delta_dense_weights"); err != nil { + scope.UpdateErr("SdcaOptimizer", err) + return + } + return out_example_state_data, out_delta_sparse_weights, out_delta_dense_weights +} + +// BiasAddGradAttr is an optional argument to BiasAddGrad. +type BiasAddGradAttr func(optionalAttr) + +// BiasAddGradDataFormat sets the optional data_format attribute to value. +// +// value: Specify the data format of the input and output data. With the +// default format "NHWC", the bias tensor will be added to the last dimension +// of the value tensor. +// Alternatively, the format could be "NCHW", the data storage order of: +// +// [batch, in_channels, in_height, in_width]. +// +// The tensor will be added to "in_channels", the third-to-the-last +// +// dimension. +// +// If not specified, defaults to "NHWC" +func BiasAddGradDataFormat(value string) BiasAddGradAttr { + return func(m optionalAttr) { + m["data_format"] = value + } +} + +// The backward operation for "BiasAdd" on the "bias" tensor. +// +// It accumulates all the values from out_backprop into the feature dimension. +// For NHWC data format, the feature dimension is the last. For NCHW data format, +// the feature dimension is the third-to-last. +// +// Arguments: +// +// out_backprop: Any number of dimensions. +// +// Returns 1-D with size the feature dimension of `out_backprop`. +func BiasAddGrad(scope *Scope, out_backprop tf.Output, optional ...BiasAddGradAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "BiasAddGrad", + Input: []tf.Input{ + out_backprop, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// MapClearAttr is an optional argument to MapClear. +type MapClearAttr func(optionalAttr) + +// MapClearCapacity sets the optional capacity attribute to value. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func MapClearCapacity(value int64) MapClearAttr { + return func(m optionalAttr) { + m["capacity"] = value + } +} + +// MapClearMemoryLimit sets the optional memory_limit attribute to value. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func MapClearMemoryLimit(value int64) MapClearAttr { + return func(m optionalAttr) { + m["memory_limit"] = value + } +} + +// MapClearContainer sets the optional container attribute to value. +// If not specified, defaults to "" +func MapClearContainer(value string) MapClearAttr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// MapClearSharedName sets the optional shared_name attribute to value. +// If not specified, defaults to "" +func MapClearSharedName(value string) MapClearAttr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// Op removes all elements in the underlying container. +// +// Returns the created operation. +func MapClear(scope *Scope, dtypes []tf.DataType, optional ...MapClearAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtypes": dtypes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "MapClear", + + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// Adjust the saturation of one or more images. +// +// `images` is a tensor of at least 3 dimensions. The last dimension is +// interpreted as channels, and must be three. +// +// The input image is considered in the RGB colorspace. Conceptually, the RGB +// colors are first mapped into HSV. A scale is then applied all the saturation +// values, and then remapped back to RGB colorspace. +// +// Arguments: +// +// images: Images to adjust. At least 3-D. +// scale: A float scale to add to the saturation. +// +// Returns The hue-adjusted image or images. +func AdjustSaturation(scope *Scope, images tf.Output, scale tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "AdjustSaturation", + Input: []tf.Input{ + images, scale, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes log softmax activations. +// +// For each batch `i` and class `j` we have +// +// logsoftmax[i, j] = logits[i, j] - log(sum(exp(logits[i]))) +// +// Arguments: +// +// logits: 2-D with shape `[batch_size, num_classes]`. +// +// Returns Same shape as `logits`. +func LogSoftmax(scope *Scope, logits tf.Output) (logsoftmax tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "LogSoftmax", + Input: []tf.Input{ + logits, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Reduces sparse updates into the variable referenced by `resource` using the `min` operation. +// +// This operation computes +// +// # Scalar indices +// ref[indices, ...] = min(ref[indices, ...], updates[...]) +// +// # Vector indices (for each i) +// ref[indices[i], ...] = min(ref[indices[i], ...], updates[i, ...]) +// +// # High rank indices (for each i, ..., j) +// ref[indices[i, ..., j], ...] = min(ref[indices[i, ..., j], ...], updates[i, ..., j, ...]) +// +// Duplicate entries are handled correctly: if multiple `indices` reference +// the same location, their contributions are combined. +// +// Requires `updates.shape = indices.shape + ref.shape[1:]` or `updates.shape = []`. +// +//
+// +//
+// +// Arguments: +// +// resource: Should be from a `Variable` node. +// indices: A tensor of indices into the first dimension of `ref`. +// updates: A tensor of updated values to add to `ref`. +// +// Returns the created operation. +func ResourceScatterMin(scope *Scope, resource tf.Output, indices tf.Output, updates tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "ResourceScatterMin", + Input: []tf.Input{ + resource, indices, updates, + }, + } + return scope.AddOperation(opspec) +} + +// StringLengthAttr is an optional argument to StringLength. +type StringLengthAttr func(optionalAttr) + +// StringLengthUnit sets the optional unit attribute to value. +// +// value: The unit that is counted to compute string length. One of: `"BYTE"` (for +// the number of bytes in each string) or `"UTF8_CHAR"` (for the number of UTF-8 +// encoded Unicode code points in each string). Results are undefined +// if `unit=UTF8_CHAR` and the `input` strings do not contain structurally +// valid UTF-8. +// If not specified, defaults to "BYTE" +func StringLengthUnit(value string) StringLengthAttr { + return func(m optionalAttr) { + m["unit"] = value + } +} + +// String lengths of `input`. +// +// Computes the length of each string given in the input tensor. +// +// >>> strings = tf.constant(['Hello','TensorFlow', '\U0001F642']) +// >>> tf.strings.length(strings).numpy() # default counts bytes +// array([ 5, 10, 4], dtype=int32) +// >>> tf.strings.length(strings, unit="UTF8_CHAR").numpy() +// array([ 5, 10, 1], dtype=int32) +// +// Arguments: +// +// input: The strings for which to compute the length for each element. +// +// Returns Integer tensor that has the same shape as `input`. The output contains the +// element-wise string lengths of `input`. +func StringLength(scope *Scope, input tf.Output, optional ...StringLengthAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "StringLength", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Creates a dataset that batches input elements into a SparseTensor. +// +// Arguments: +// +// input_dataset: A handle to an input dataset. Must have a single component. +// batch_size: A scalar representing the number of elements to accumulate in a +// +// batch. +// +// row_shape: A vector representing the dense shape of each row in the produced +// +// SparseTensor. The shape may be partially specified, using `-1` to indicate +// that a particular dimension should use the maximum size of all batch elements. +func DenseToSparseBatchDataset(scope *Scope, input_dataset tf.Output, batch_size tf.Output, row_shape tf.Output, output_types []tf.DataType, output_shapes []tf.Shape) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + opspec := tf.OpSpec{ + Type: "DenseToSparseBatchDataset", + Input: []tf.Input{ + input_dataset, batch_size, row_shape, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Connects N outputs from an N-way replicated TPU computation. +// +// This operation holds a replicated output from a `tpu.replicate()` computation subgraph. +// Each replicated output has the same shape and type alongside the input. +// +// For example: +// ``` +// %computation = "tf.Computation"() +// %replicated_output:2 = "tf.TPUReplicatedOutput"(%computation) +// ``` +// The above computation has a replicated output of two replicas. +func TPUReplicatedOutput(scope *Scope, input tf.Output, num_replicas int64) (outputs []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_replicas": num_replicas} + opspec := tf.OpSpec{ + Type: "TPUReplicatedOutput", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if outputs, idx, err = makeOutputList(op, idx, "outputs"); err != nil { + scope.UpdateErr("TPUReplicatedOutput", err) + return + } + return outputs +} + +// SparseToDenseAttr is an optional argument to SparseToDense. +type SparseToDenseAttr func(optionalAttr) + +// SparseToDenseValidateIndices sets the optional validate_indices attribute to value. +// +// value: If true, indices are checked to make sure they are sorted in +// lexicographic order and that there are no repeats. +// If not specified, defaults to true +func SparseToDenseValidateIndices(value bool) SparseToDenseAttr { + return func(m optionalAttr) { + m["validate_indices"] = value + } +} + +// Converts a sparse representation into a dense tensor. +// +// Builds an array `dense` with shape `output_shape` such that +// +// ``` +// # If sparse_indices is scalar +// dense[i] = (i == sparse_indices ? sparse_values : default_value) +// +// # If sparse_indices is a vector, then for each i +// dense[sparse_indices[i]] = sparse_values[i] +// +// # If sparse_indices is an n by d matrix, then for each i in [0, n) +// dense[sparse_indices[i][0], ..., sparse_indices[i][d-1]] = sparse_values[i] +// ``` +// +// All other values in `dense` are set to `default_value`. If `sparse_values` is a +// scalar, all sparse indices are set to this single value. +// +// Indices should be sorted in lexicographic order, and indices must not +// contain any repeats. If `validate_indices` is true, these properties +// are checked during execution. +// +// Arguments: +// +// sparse_indices: 0-D, 1-D, or 2-D. `sparse_indices[i]` contains the complete +// +// index where `sparse_values[i]` will be placed. +// +// output_shape: 1-D. Shape of the dense output tensor. +// sparse_values: 1-D. Values corresponding to each row of `sparse_indices`, +// +// or a scalar value to be used for all sparse indices. +// +// default_value: Scalar value to set for indices not specified in +// +// `sparse_indices`. +// +// Returns Dense output tensor of shape `output_shape`. +func SparseToDense(scope *Scope, sparse_indices tf.Output, output_shape tf.Output, sparse_values tf.Output, default_value tf.Output, optional ...SparseToDenseAttr) (dense tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "SparseToDense", + Input: []tf.Input{ + sparse_indices, output_shape, sparse_values, default_value, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Wraps the XLA ReduceScatter operator +// +// documented at https://www.tensorflow.org/xla/operation_semantics#reducescatter. +// +// Arguments: +// +// input: Array or a non-empty tuple of arrays to reduce across replicas. +// group_assignment: Groups between which the reductions are performed. +// scatter_dimension: Dimension to scatter. +// reduce_op: Reduction computation. +func XlaReduceScatter(scope *Scope, input tf.Output, group_assignment tf.Output, scatter_dimension tf.Output, reduce_op string) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"reduce_op": reduce_op} + opspec := tf.OpSpec{ + Type: "XlaReduceScatter", + Input: []tf.Input{ + input, group_assignment, scatter_dimension, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Creates a dataset that uses a custom thread pool to compute `input_dataset`. +// +// Arguments: +// +// num_threads: Identifies the number of threads to use for the private threadpool. +func PrivateThreadPoolDataset(scope *Scope, input_dataset tf.Output, num_threads tf.Output, output_types []tf.DataType, output_shapes []tf.Shape) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + opspec := tf.OpSpec{ + Type: "PrivateThreadPoolDataset", + Input: []tf.Input{ + input_dataset, num_threads, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns a list which has the passed-in `Tensor` as last element and the other elements of the given list in `input_handle`. +// +// tensor: The tensor to put on the list. +// input_handle: The old list. +// output_handle: A list with the elements of the old list followed by tensor. +// element_dtype: the type of elements in the list. +// element_shape: a shape compatible with that of elements in the list. +func TensorListPushBack(scope *Scope, input_handle tf.Output, tensor tf.Output) (output_handle tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "TensorListPushBack", + Input: []tf.Input{ + input_handle, tensor, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// AvgPool3DGradAttr is an optional argument to AvgPool3DGrad. +type AvgPool3DGradAttr func(optionalAttr) + +// AvgPool3DGradDataFormat sets the optional data_format attribute to value. +// +// value: The data format of the input and output data. With the +// default format "NDHWC", the data is stored in the order of: +// +// [batch, in_depth, in_height, in_width, in_channels]. +// +// Alternatively, the format could be "NCDHW", the data storage order is: +// +// [batch, in_channels, in_depth, in_height, in_width]. +// +// If not specified, defaults to "NDHWC" +func AvgPool3DGradDataFormat(value string) AvgPool3DGradAttr { + return func(m optionalAttr) { + m["data_format"] = value + } +} + +// Computes gradients of average pooling function. +// +// Arguments: +// +// orig_input_shape: The original input dimensions. +// grad: Output backprop of shape `[batch, depth, rows, cols, channels]`. +// ksize: 1-D tensor of length 5. The size of the window for each dimension of +// +// the input tensor. Must have `ksize[0] = ksize[4] = 1`. +// +// strides: 1-D tensor of length 5. The stride of the sliding window for each +// +// dimension of `input`. Must have `strides[0] = strides[4] = 1`. +// +// padding: The type of padding algorithm to use. +// +// Returns The backprop for input. +func AvgPool3DGrad(scope *Scope, orig_input_shape tf.Output, grad tf.Output, ksize []int64, strides []int64, padding string, optional ...AvgPool3DGradAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"ksize": ksize, "strides": strides, "padding": padding} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "AvgPool3DGrad", + Input: []tf.Input{ + orig_input_shape, grad, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes inverse hyperbolic sine of x element-wise. +// +// Given an input tensor, this function computes inverse hyperbolic sine +// for every element in the tensor. Both input and output has a range of +// `[-inf, inf]`. +// +// ```python +// x = tf.constant([-float("inf"), -2, -0.5, 1, 1.2, 200, 10000, float("inf")]) +// tf.math.asinh(x) ==> [-inf -1.4436355 -0.4812118 0.8813736 1.0159732 5.991471 9.903487 inf] +// ``` +func Asinh(scope *Scope, x tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Asinh", + Input: []tf.Input{ + x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ResizeBilinearGradAttr is an optional argument to ResizeBilinearGrad. +type ResizeBilinearGradAttr func(optionalAttr) + +// ResizeBilinearGradAlignCorners sets the optional align_corners attribute to value. +// +// value: If true, the centers of the 4 corner pixels of the input and grad tensors are +// aligned. Defaults to false. +// If not specified, defaults to false +func ResizeBilinearGradAlignCorners(value bool) ResizeBilinearGradAttr { + return func(m optionalAttr) { + m["align_corners"] = value + } +} + +// ResizeBilinearGradHalfPixelCenters sets the optional half_pixel_centers attribute to value. +// If not specified, defaults to false +func ResizeBilinearGradHalfPixelCenters(value bool) ResizeBilinearGradAttr { + return func(m optionalAttr) { + m["half_pixel_centers"] = value + } +} + +// Computes the gradient of bilinear interpolation. +// +// Arguments: +// +// grads: 4-D with shape `[batch, height, width, channels]`. +// original_image: 4-D with shape `[batch, orig_height, orig_width, channels]`, +// +// The image tensor that was resized. +// +// Returns 4-D with shape `[batch, orig_height, orig_width, channels]`. +// Gradients with respect to the input image. Input image must have been +// float or double. +func ResizeBilinearGrad(scope *Scope, grads tf.Output, original_image tf.Output, optional ...ResizeBilinearGradAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ResizeBilinearGrad", + Input: []tf.Input{ + grads, original_image, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Conv2DAttr is an optional argument to Conv2D. +type Conv2DAttr func(optionalAttr) + +// Conv2DUseCudnnOnGpu sets the optional use_cudnn_on_gpu attribute to value. +// If not specified, defaults to true +func Conv2DUseCudnnOnGpu(value bool) Conv2DAttr { + return func(m optionalAttr) { + m["use_cudnn_on_gpu"] = value + } +} + +// Conv2DExplicitPaddings sets the optional explicit_paddings attribute to value. +// +// value: If `padding` is `"EXPLICIT"`, the list of explicit padding amounts. For the ith +// dimension, the amount of padding inserted before and after the dimension is +// `explicit_paddings[2 * i]` and `explicit_paddings[2 * i + 1]`, respectively. If +// `padding` is not `"EXPLICIT"`, `explicit_paddings` must be empty. +// If not specified, defaults to <> +func Conv2DExplicitPaddings(value []int64) Conv2DAttr { + return func(m optionalAttr) { + m["explicit_paddings"] = value + } +} + +// Conv2DDataFormat sets the optional data_format attribute to value. +// +// value: Specify the data format of the input and output data. With the +// default format "NHWC", the data is stored in the order of: +// +// [batch, height, width, channels]. +// +// Alternatively, the format could be "NCHW", the data storage order of: +// +// [batch, channels, height, width]. +// +// If not specified, defaults to "NHWC" +func Conv2DDataFormat(value string) Conv2DAttr { + return func(m optionalAttr) { + m["data_format"] = value + } +} + +// Conv2DDilations sets the optional dilations attribute to value. +// +// value: 1-D tensor of length 4. The dilation factor for each dimension of +// `input`. If set to k > 1, there will be k-1 skipped cells between each +// filter element on that dimension. The dimension order is determined by the +// value of `data_format`, see above for details. Dilations in the batch and +// depth dimensions must be 1. +// If not specified, defaults to +func Conv2DDilations(value []int64) Conv2DAttr { + return func(m optionalAttr) { + m["dilations"] = value + } +} + +// Computes a 2-D convolution given 4-D `input` and `filter` tensors. +// +// Given an input tensor of shape `[batch, in_height, in_width, in_channels]` +// and a filter / kernel tensor of shape +// `[filter_height, filter_width, in_channels, out_channels]`, this op +// performs the following: +// +// 1. Flattens the filter to a 2-D matrix with shape +// `[filter_height * filter_width * in_channels, output_channels]`. +// 2. Extracts image patches from the input tensor to form a *virtual* +// tensor of shape `[batch, out_height, out_width, +// filter_height * filter_width * in_channels]`. +// 3. For each patch, right-multiplies the filter matrix and the image patch +// vector. +// +// In detail, with the default NHWC format, +// +// output[b, i, j, k] = +// sum_{di, dj, q} input[b, strides[1] * i + di, strides[2] * j + dj, q] * +// filter[di, dj, q, k] +// +// Must have `strides[0] = strides[3] = 1`. For the most common case of the same +// horizontal and vertices strides, `strides = [1, stride, stride, 1]`. +// +// Arguments: +// +// input: A 4-D tensor. The dimension order is interpreted according to the value +// +// of `data_format`, see below for details. +// +// filter: A 4-D tensor of shape +// +// `[filter_height, filter_width, in_channels, out_channels]` +// +// strides: 1-D tensor of length 4. The stride of the sliding window for each +// +// dimension of `input`. The dimension order is determined by the value of +// `data_format`, see below for details. +// +// padding: The type of padding algorithm to use. +// +// Returns A 4-D tensor. The dimension order is determined by the value of +// `data_format`, see below for details. +func Conv2D(scope *Scope, input tf.Output, filter tf.Output, strides []int64, padding string, optional ...Conv2DAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"strides": strides, "padding": padding} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Conv2D", + Input: []tf.Input{ + input, filter, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Generates sparse cross from a list of sparse and dense tensors. +// +// The op takes two lists, one of 2D `SparseTensor` and one of 2D `Tensor`, each +// representing features of one feature column. It outputs a 2D `SparseTensor` with +// the batchwise crosses of these features. +// +// For example, if the inputs are +// +// inputs[0]: SparseTensor with shape = [2, 2] +// [0, 0]: "a" +// [1, 0]: "b" +// [1, 1]: "c" +// +// inputs[1]: SparseTensor with shape = [2, 1] +// [0, 0]: "d" +// [1, 0]: "e" +// +// inputs[2]: Tensor [["f"], ["g"]] +// +// then the output will be +// +// shape = [2, 2] +// [0, 0]: "a_X_d_X_f" +// [1, 0]: "b_X_e_X_g" +// [1, 1]: "c_X_e_X_g" +// +// if hashed_output=true then the output will be +// +// shape = [2, 2] +// [0, 0]: FingerprintCat64( +// Fingerprint64("f"), FingerprintCat64( +// Fingerprint64("d"), Fingerprint64("a"))) +// [1, 0]: FingerprintCat64( +// Fingerprint64("g"), FingerprintCat64( +// Fingerprint64("e"), Fingerprint64("b"))) +// [1, 1]: FingerprintCat64( +// Fingerprint64("g"), FingerprintCat64( +// Fingerprint64("e"), Fingerprint64("c"))) +// +// Arguments: +// +// indices: 2-D. Indices of each input `SparseTensor`. +// values: 1-D. values of each `SparseTensor`. +// shapes: 1-D. Shapes of each `SparseTensor`. +// dense_inputs: 2-D. Columns represented by dense `Tensor`. +// sep: string used when joining a list of string inputs, can be used as separator later. +// +// Returns: +// +// output_indices: 2-D. Indices of the concatenated `SparseTensor`. +// output_values: 1-D. Non-empty values of the concatenated or hashed +// +// `SparseTensor`. +// +// output_shape: 1-D. Shape of the concatenated `SparseTensor`. +func SparseCrossV2(scope *Scope, indices []tf.Output, values []tf.Output, shapes []tf.Output, dense_inputs []tf.Output, sep tf.Output) (output_indices tf.Output, output_values tf.Output, output_shape tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "SparseCrossV2", + Input: []tf.Input{ + tf.OutputList(indices), tf.OutputList(values), tf.OutputList(shapes), tf.OutputList(dense_inputs), sep, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// IRFFT3DAttr is an optional argument to IRFFT3D. +type IRFFT3DAttr func(optionalAttr) + +// IRFFT3DTreal sets the optional Treal attribute to value. +// If not specified, defaults to DT_FLOAT +func IRFFT3DTreal(value tf.DataType) IRFFT3DAttr { + return func(m optionalAttr) { + m["Treal"] = value + } +} + +// Inverse 3D real-valued fast Fourier transform. +// +// Computes the inverse 3-dimensional discrete Fourier transform of a real-valued +// signal over the inner-most 3 dimensions of `input`. +// +// The inner-most 3 dimensions of `input` are assumed to be the result of `RFFT3D`: +// The inner-most dimension contains the `fft_length / 2 + 1` unique components of +// the DFT of a real-valued signal. If `fft_length` is not provided, it is computed +// from the size of the inner-most 3 dimensions of `input`. If the FFT length used +// to compute `input` is odd, it should be provided since it cannot be inferred +// properly. +// +// Along each axis `IRFFT3D` is computed on, if `fft_length` (or +// `fft_length / 2 + 1` for the inner-most dimension) is smaller than the +// corresponding dimension of `input`, the dimension is cropped. If it is larger, +// the dimension is padded with zeros. +// +// Arguments: +// +// input: A complex tensor. +// fft_length: An int32 tensor of shape [3]. The FFT length for each dimension. +// +// Returns A float32 tensor of the same rank as `input`. The inner-most 3 +// +// dimensions of `input` are replaced with the `fft_length` samples of their +// inverse 3D real Fourier transform. +// +// @compatibility(numpy) +// Equivalent to np.irfftn with 3 dimensions. +// @end_compatibility +func IRFFT3D(scope *Scope, input tf.Output, fft_length tf.Output, optional ...IRFFT3DAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "IRFFT3D", + Input: []tf.Input{ + input, fft_length, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ConfigureDistributedTPUAttr is an optional argument to ConfigureDistributedTPU. +type ConfigureDistributedTPUAttr func(optionalAttr) + +// ConfigureDistributedTPUEmbeddingConfig sets the optional embedding_config attribute to value. +// +// value: Reserved. Do not use. +// If not specified, defaults to "" +func ConfigureDistributedTPUEmbeddingConfig(value string) ConfigureDistributedTPUAttr { + return func(m optionalAttr) { + m["embedding_config"] = value + } +} + +// ConfigureDistributedTPUTpuEmbeddingConfig sets the optional tpu_embedding_config attribute to value. +// +// value: Serialized tensorflow.tpu.TPUEmbeddingConfiguration that +// describes the embedding lookups of the program. +// If not specified, defaults to "" +func ConfigureDistributedTPUTpuEmbeddingConfig(value string) ConfigureDistributedTPUAttr { + return func(m optionalAttr) { + m["tpu_embedding_config"] = value + } +} + +// ConfigureDistributedTPUIsGlobalInit sets the optional is_global_init attribute to value. +// +// value: Reserved. Do not use. +// If not specified, defaults to false +func ConfigureDistributedTPUIsGlobalInit(value bool) ConfigureDistributedTPUAttr { + return func(m optionalAttr) { + m["is_global_init"] = value + } +} + +// ConfigureDistributedTPUEnableWholeMeshCompilations sets the optional enable_whole_mesh_compilations attribute to value. +// If not specified, defaults to false +func ConfigureDistributedTPUEnableWholeMeshCompilations(value bool) ConfigureDistributedTPUAttr { + return func(m optionalAttr) { + m["enable_whole_mesh_compilations"] = value + } +} + +// ConfigureDistributedTPUCompilationFailureClosesChips sets the optional compilation_failure_closes_chips attribute to value. +// If not specified, defaults to true +func ConfigureDistributedTPUCompilationFailureClosesChips(value bool) ConfigureDistributedTPUAttr { + return func(m optionalAttr) { + m["compilation_failure_closes_chips"] = value + } +} + +// ConfigureDistributedTPUTpuCancellationClosesChips sets the optional tpu_cancellation_closes_chips attribute to value. +// If not specified, defaults to 0 +func ConfigureDistributedTPUTpuCancellationClosesChips(value int64) ConfigureDistributedTPUAttr { + return func(m optionalAttr) { + m["tpu_cancellation_closes_chips"] = value + } +} + +// Sets up the centralized structures for a distributed TPU system. +// +// Returns A serialized tensorflow.tpu.TopologyProto that describes the TPU +// topology. +func ConfigureDistributedTPU(scope *Scope, optional ...ConfigureDistributedTPUAttr) (topology tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ConfigureDistributedTPU", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// RetrieveTPUEmbeddingAdagradParametersAttr is an optional argument to RetrieveTPUEmbeddingAdagradParameters. +type RetrieveTPUEmbeddingAdagradParametersAttr func(optionalAttr) + +// RetrieveTPUEmbeddingAdagradParametersTableId sets the optional table_id attribute to value. +// If not specified, defaults to -1 +func RetrieveTPUEmbeddingAdagradParametersTableId(value int64) RetrieveTPUEmbeddingAdagradParametersAttr { + return func(m optionalAttr) { + m["table_id"] = value + } +} + +// RetrieveTPUEmbeddingAdagradParametersTableName sets the optional table_name attribute to value. +// If not specified, defaults to "" +func RetrieveTPUEmbeddingAdagradParametersTableName(value string) RetrieveTPUEmbeddingAdagradParametersAttr { + return func(m optionalAttr) { + m["table_name"] = value + } +} + +// RetrieveTPUEmbeddingAdagradParametersConfig sets the optional config attribute to value. +// If not specified, defaults to "" +func RetrieveTPUEmbeddingAdagradParametersConfig(value string) RetrieveTPUEmbeddingAdagradParametersAttr { + return func(m optionalAttr) { + m["config"] = value + } +} + +// Retrieve Adagrad embedding parameters. +// +// An op that retrieves optimization parameters from embedding to host +// memory. Must be preceded by a ConfigureTPUEmbeddingHost op that sets up +// the correct embedding table configuration. For example, this op is +// used to retrieve updated parameters before saving a checkpoint. +// +// Returns: +// +// parameters: Parameter parameters updated by the Adagrad optimization algorithm. +// accumulators: Parameter accumulators updated by the Adagrad optimization algorithm. +func RetrieveTPUEmbeddingAdagradParameters(scope *Scope, num_shards int64, shard_id int64, optional ...RetrieveTPUEmbeddingAdagradParametersAttr) (parameters tf.Output, accumulators tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_shards": num_shards, "shard_id": shard_id} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "RetrieveTPUEmbeddingAdagradParameters", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// Computes the complementary error function of `x` element-wise. +func Erfc(scope *Scope, x tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Erfc", + Input: []tf.Input{ + x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// TakeManySparseFromTensorsMapAttr is an optional argument to TakeManySparseFromTensorsMap. +type TakeManySparseFromTensorsMapAttr func(optionalAttr) + +// TakeManySparseFromTensorsMapContainer sets the optional container attribute to value. +// +// value: The container name for the `SparseTensorsMap` read by this op. +// If not specified, defaults to "" +func TakeManySparseFromTensorsMapContainer(value string) TakeManySparseFromTensorsMapAttr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// TakeManySparseFromTensorsMapSharedName sets the optional shared_name attribute to value. +// +// value: The shared name for the `SparseTensorsMap` read by this op. +// It should not be blank; rather the `shared_name` or unique Operation name +// of the Op that created the original `SparseTensorsMap` should be used. +// If not specified, defaults to "" +func TakeManySparseFromTensorsMapSharedName(value string) TakeManySparseFromTensorsMapAttr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// Read `SparseTensors` from a `SparseTensorsMap` and concatenate them. +// +// The input `sparse_handles` must be an `int64` matrix of shape `[N, 1]` where +// `N` is the minibatch size and the rows correspond to the output handles of +// `AddSparseToTensorsMap` or `AddManySparseToTensorsMap`. The ranks of the +// original `SparseTensor` objects that went into the given input ops must all +// match. When the final `SparseTensor` is created, it has rank one +// higher than the ranks of the incoming `SparseTensor` objects +// (they have been concatenated along a new row dimension on the left). +// +// The output `SparseTensor` object's shape values for all dimensions but the +// first are the max across the input `SparseTensor` objects' shape values +// for the corresponding dimensions. Its first shape value is `N`, the minibatch +// size. +// +// The input `SparseTensor` objects' indices are assumed ordered in +// standard lexicographic order. If this is not the case, after this +// step run `SparseReorder` to restore index ordering. +// +// For example, if the handles represent an input, which is a `[2, 3]` matrix +// representing two original `SparseTensor` objects: +// +// ``` +// +// index = [ 0] +// [10] +// [20] +// values = [1, 2, 3] +// shape = [50] +// +// ``` +// +// and +// +// ``` +// +// index = [ 2] +// [10] +// values = [4, 5] +// shape = [30] +// +// ``` +// +// then the final `SparseTensor` will be: +// +// ``` +// +// index = [0 0] +// [0 10] +// [0 20] +// [1 2] +// [1 10] +// values = [1, 2, 3, 4, 5] +// shape = [2 50] +// +// ``` +// +// Arguments: +// +// sparse_handles: 1-D, The `N` serialized `SparseTensor` objects. +// +// Shape: `[N]`. +// +// dtype: The `dtype` of the `SparseTensor` objects stored in the +// +// `SparseTensorsMap`. +// +// Returns: +// +// sparse_indices: 2-D. The `indices` of the minibatch `SparseTensor`. +// sparse_values: 1-D. The `values` of the minibatch `SparseTensor`. +// sparse_shape: 1-D. The `shape` of the minibatch `SparseTensor`. +func TakeManySparseFromTensorsMap(scope *Scope, sparse_handles tf.Output, dtype tf.DataType, optional ...TakeManySparseFromTensorsMapAttr) (sparse_indices tf.Output, sparse_values tf.Output, sparse_shape tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtype": dtype} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "TakeManySparseFromTensorsMap", + Input: []tf.Input{ + sparse_handles, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// IgnoreErrorsDatasetAttr is an optional argument to IgnoreErrorsDataset. +type IgnoreErrorsDatasetAttr func(optionalAttr) + +// IgnoreErrorsDatasetLogWarning sets the optional log_warning attribute to value. +// If not specified, defaults to false +func IgnoreErrorsDatasetLogWarning(value bool) IgnoreErrorsDatasetAttr { + return func(m optionalAttr) { + m["log_warning"] = value + } +} + +// Creates a dataset that contains the elements of `input_dataset` ignoring errors. +func IgnoreErrorsDataset(scope *Scope, input_dataset tf.Output, output_types []tf.DataType, output_shapes []tf.Shape, optional ...IgnoreErrorsDatasetAttr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "IgnoreErrorsDataset", + Input: []tf.Input{ + input_dataset, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// MatMulAttr is an optional argument to MatMul. +type MatMulAttr func(optionalAttr) + +// MatMulTransposeA sets the optional transpose_a attribute to value. +// +// value: If true, "a" is transposed before multiplication. +// If not specified, defaults to false +func MatMulTransposeA(value bool) MatMulAttr { + return func(m optionalAttr) { + m["transpose_a"] = value + } +} + +// MatMulTransposeB sets the optional transpose_b attribute to value. +// +// value: If true, "b" is transposed before multiplication. +// If not specified, defaults to false +func MatMulTransposeB(value bool) MatMulAttr { + return func(m optionalAttr) { + m["transpose_b"] = value + } +} + +// MatMulGradA sets the optional grad_a attribute to value. +// If not specified, defaults to false +func MatMulGradA(value bool) MatMulAttr { + return func(m optionalAttr) { + m["grad_a"] = value + } +} + +// MatMulGradB sets the optional grad_b attribute to value. +// If not specified, defaults to false +func MatMulGradB(value bool) MatMulAttr { + return func(m optionalAttr) { + m["grad_b"] = value + } +} + +// Multiply the matrix "a" by the matrix "b". +// +// The inputs must be two-dimensional matrices and the inner dimension of +// "a" (after being transposed if transpose_a is true) must match the +// outer dimension of "b" (after being transposed if transposed_b is +// true). +// +// *Note*: The default kernel implementation for MatMul on GPUs uses +// cublas. +func MatMul(scope *Scope, a tf.Output, b tf.Output, optional ...MatMulAttr) (product tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "MatMul", + Input: []tf.Input{ + a, b, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ResourceConditionalAccumulatorAttr is an optional argument to ResourceConditionalAccumulator. +type ResourceConditionalAccumulatorAttr func(optionalAttr) + +// ResourceConditionalAccumulatorContainer sets the optional container attribute to value. +// +// value: If non-empty, this accumulator is placed in the given container. +// Otherwise, a default container is used. +// If not specified, defaults to "" +func ResourceConditionalAccumulatorContainer(value string) ResourceConditionalAccumulatorAttr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// ResourceConditionalAccumulatorSharedName sets the optional shared_name attribute to value. +// +// value: If non-empty, this accumulator will be shared under the +// given name across multiple sessions. +// If not specified, defaults to "" +func ResourceConditionalAccumulatorSharedName(value string) ResourceConditionalAccumulatorAttr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// ResourceConditionalAccumulatorReductionType sets the optional reduction_type attribute to value. +// If not specified, defaults to "MEAN" +func ResourceConditionalAccumulatorReductionType(value string) ResourceConditionalAccumulatorAttr { + return func(m optionalAttr) { + m["reduction_type"] = value + } +} + +// A conditional accumulator for aggregating gradients. +// +// The accumulator accepts gradients marked with local_step greater or +// equal to the most recent global_step known to the accumulator. The +// average can be extracted from the accumulator, provided sufficient +// gradients have been accumulated. Extracting the average automatically +// resets the aggregate to 0, and increments the global_step recorded by +// the accumulator. +// This is a resource version of ConditionalAccumulator that will work in TF2.0 +// with tf.cond version 2. +// +// Arguments: +// +// dtype: The type of the value being accumulated. +// shape: The shape of the values, can be [], in which case shape is unknown. +// +// Returns The handle to the accumulator. +func ResourceConditionalAccumulator(scope *Scope, dtype tf.DataType, shape tf.Shape, optional ...ResourceConditionalAccumulatorAttr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtype": dtype, "shape": shape} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ResourceConditionalAccumulator", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Calculates the softmax of a CSRSparseMatrix. +// +// Calculate the softmax of the innermost dimensions of a SparseMatrix. +// +// Missing values are treated as `-inf` (i.e., logits of zero probability); and +// the output has the same sparsity structure as the input (though missing values +// in the output may now be treated as having probability zero). +// +// Arguments: +// +// logits: A CSRSparseMatrix. +// +// Returns A CSRSparseMatrix. +func SparseMatrixSoftmax(scope *Scope, logits tf.Output, type_ tf.DataType) (softmax tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"type": type_} + opspec := tf.OpSpec{ + Type: "SparseMatrixSoftmax", + Input: []tf.Input{ + logits, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes sigmoid of `x` element-wise. +// +// Specifically, `y = 1 / (1 + exp(-x))`. +func Sigmoid(scope *Scope, x tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Sigmoid", + Input: []tf.Input{ + x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// FractionalAvgPoolAttr is an optional argument to FractionalAvgPool. +type FractionalAvgPoolAttr func(optionalAttr) + +// FractionalAvgPoolPseudoRandom sets the optional pseudo_random attribute to value. +// +// value: When set to True, generates the pooling sequence in a +// pseudorandom fashion, otherwise, in a random fashion. Check paper [Benjamin +// Graham, Fractional Max-Pooling](http://arxiv.org/abs/1412.6071) for +// difference between pseudorandom and random. +// If not specified, defaults to false +func FractionalAvgPoolPseudoRandom(value bool) FractionalAvgPoolAttr { + return func(m optionalAttr) { + m["pseudo_random"] = value + } +} + +// FractionalAvgPoolOverlapping sets the optional overlapping attribute to value. +// +// value: When set to True, it means when pooling, the values at the boundary +// of adjacent pooling cells are used by both cells. For example: +// +// `index 0 1 2 3 4` +// +// `value 20 5 16 3 7` +// +// If the pooling sequence is [0, 2, 4], then 16, at index 2 will be used twice. +// The result would be [41/3, 26/3] for fractional avg pooling. +// If not specified, defaults to false +func FractionalAvgPoolOverlapping(value bool) FractionalAvgPoolAttr { + return func(m optionalAttr) { + m["overlapping"] = value + } +} + +// FractionalAvgPoolDeterministic sets the optional deterministic attribute to value. +// +// value: When set to True, a fixed pooling region will be used when +// iterating over a FractionalAvgPool node in the computation graph. Mainly used +// in unit test to make FractionalAvgPool deterministic. +// If not specified, defaults to false +func FractionalAvgPoolDeterministic(value bool) FractionalAvgPoolAttr { + return func(m optionalAttr) { + m["deterministic"] = value + } +} + +// FractionalAvgPoolSeed sets the optional seed attribute to value. +// +// value: If either seed or seed2 are set to be non-zero, the random number +// generator is seeded by the given seed. Otherwise, it is seeded by a +// random seed. +// If not specified, defaults to 0 +func FractionalAvgPoolSeed(value int64) FractionalAvgPoolAttr { + return func(m optionalAttr) { + m["seed"] = value + } +} + +// FractionalAvgPoolSeed2 sets the optional seed2 attribute to value. +// +// value: An second seed to avoid seed collision. +// If not specified, defaults to 0 +func FractionalAvgPoolSeed2(value int64) FractionalAvgPoolAttr { + return func(m optionalAttr) { + m["seed2"] = value + } +} + +// Performs fractional average pooling on the input. +// +// Fractional average pooling is similar to Fractional max pooling in the pooling +// region generation step. The only difference is that after pooling regions are +// generated, a mean operation is performed instead of a max operation in each +// pooling region. +// +// Arguments: +// +// value: 4-D with shape `[batch, height, width, channels]`. +// pooling_ratio: Pooling ratio for each dimension of `value`, currently only +// +// supports row and col dimension and should be >= 1.0. For example, a valid +// pooling ratio looks like [1.0, 1.44, 1.73, 1.0]. The first and last elements +// must be 1.0 because we don't allow pooling on batch and channels +// dimensions. 1.44 and 1.73 are pooling ratio on height and width dimensions +// respectively. +// +// Returns: +// +// output: output tensor after fractional avg pooling. +// row_pooling_sequence: row pooling sequence, needed to calculate gradient. +// col_pooling_sequence: column pooling sequence, needed to calculate gradient. +func FractionalAvgPool(scope *Scope, value tf.Output, pooling_ratio []float32, optional ...FractionalAvgPoolAttr) (output tf.Output, row_pooling_sequence tf.Output, col_pooling_sequence tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"pooling_ratio": pooling_ratio} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "FractionalAvgPool", + Input: []tf.Input{ + value, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// Computes rectified linear: `max(features, 0)`. +// +// See: https://en.wikipedia.org/wiki/Rectifier_(neural_networks) +// Example usage: +// >>> tf.nn.relu([-2., 0., -0., 3.]).numpy() +// array([ 0., 0., -0., 3.], dtype=float32) +func Relu(scope *Scope, features tf.Output) (activations tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Relu", + Input: []tf.Input{ + features, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ParseExampleDatasetAttr is an optional argument to ParseExampleDataset. +type ParseExampleDatasetAttr func(optionalAttr) + +// ParseExampleDatasetSloppy sets the optional sloppy attribute to value. +// If not specified, defaults to false +func ParseExampleDatasetSloppy(value bool) ParseExampleDatasetAttr { + return func(m optionalAttr) { + m["sloppy"] = value + } +} + +// ParseExampleDatasetRaggedKeys sets the optional ragged_keys attribute to value. +// If not specified, defaults to <> +// +// REQUIRES: len(value) >= 0 +func ParseExampleDatasetRaggedKeys(value []string) ParseExampleDatasetAttr { + return func(m optionalAttr) { + m["ragged_keys"] = value + } +} + +// ParseExampleDatasetRaggedValueTypes sets the optional ragged_value_types attribute to value. +// If not specified, defaults to <> +// +// REQUIRES: len(value) >= 0 +func ParseExampleDatasetRaggedValueTypes(value []tf.DataType) ParseExampleDatasetAttr { + return func(m optionalAttr) { + m["ragged_value_types"] = value + } +} + +// ParseExampleDatasetRaggedSplitTypes sets the optional ragged_split_types attribute to value. +// If not specified, defaults to <> +// +// REQUIRES: len(value) >= 0 +func ParseExampleDatasetRaggedSplitTypes(value []tf.DataType) ParseExampleDatasetAttr { + return func(m optionalAttr) { + m["ragged_split_types"] = value + } +} + +// Transforms `input_dataset` containing `Example` protos as vectors of DT_STRING into a dataset of `Tensor` or `SparseTensor` objects representing the parsed features. +// +// Arguments: +// +// dense_defaults: A dict mapping string keys to `Tensor`s. +// +// The keys of the dict must match the dense_keys of the feature. +// +// sparse_keys: A list of string keys in the examples features. +// +// The results for these keys will be returned as `SparseTensor` objects. +// +// dense_keys: A list of Ndense string Tensors (scalars). +// +// The keys expected in the Examples features associated with dense values. +// +// sparse_types: A list of `DTypes` of the same length as `sparse_keys`. +// +// Only `tf.float32` (`FloatList`), `tf.int64` (`Int64List`), +// and `tf.string` (`BytesList`) are supported. +// +// dense_shapes: List of tuples with the same length as `dense_keys`. +// +// The shape of the data for each dense feature referenced by `dense_keys`. +// Required for any input tensors identified by `dense_keys`. Must be +// either fully defined, or may contain an unknown first dimension. +// An unknown first dimension means the feature is treated as having +// a variable number of blocks, and the output shape along this dimension +// is considered unknown at graph build time. Padding is applied for +// minibatch elements smaller than the maximum number of blocks for the +// given feature along this dimension. +// +// output_types: The type list for the return values. +// output_shapes: The list of shapes being produced. +func ParseExampleDataset(scope *Scope, input_dataset tf.Output, num_parallel_calls tf.Output, dense_defaults []tf.Output, sparse_keys []string, dense_keys []string, sparse_types []tf.DataType, dense_shapes []tf.Shape, output_types []tf.DataType, output_shapes []tf.Shape, optional ...ParseExampleDatasetAttr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"sparse_keys": sparse_keys, "dense_keys": dense_keys, "sparse_types": sparse_types, "dense_shapes": dense_shapes, "output_types": output_types, "output_shapes": output_shapes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ParseExampleDataset", + Input: []tf.Input{ + input_dataset, num_parallel_calls, tf.OutputList(dense_defaults), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ImageProjectiveTransformV3Attr is an optional argument to ImageProjectiveTransformV3. +type ImageProjectiveTransformV3Attr func(optionalAttr) + +// ImageProjectiveTransformV3FillMode sets the optional fill_mode attribute to value. +// +// value: Fill mode, "REFLECT", "WRAP", or "CONSTANT". +// If not specified, defaults to "CONSTANT" +func ImageProjectiveTransformV3FillMode(value string) ImageProjectiveTransformV3Attr { + return func(m optionalAttr) { + m["fill_mode"] = value + } +} + +// Applies the given transform to each of the images. +// +// If one row of `transforms` is `[a0, a1, a2, b0, b1, b2, c0, c1]`, then it maps +// the *output* point `(x, y)` to a transformed *input* point +// `(x', y') = ((a0 x + a1 y + a2) / k, (b0 x + b1 y + b2) / k)`, where +// `k = c0 x + c1 y + 1`. If the transformed point lays outside of the input +// image, the output pixel is set to fill_value. +// +// Arguments: +// +// images: 4-D with shape `[batch, height, width, channels]`. +// transforms: 2-D Tensor, `[batch, 8]` or `[1, 8]` matrix, where each row corresponds to a 3 x 3 +// +// projective transformation matrix, with the last entry assumed to be 1. If there +// is one row, the same transformation will be applied to all images. +// +// output_shape: 1-D Tensor [new_height, new_width]. +// fill_value: float, the value to be filled when fill_mode is constant". +// interpolation: Interpolation method, "NEAREST" or "BILINEAR". +// +// Returns 4-D with shape +// `[batch, new_height, new_width, channels]`. +func ImageProjectiveTransformV3(scope *Scope, images tf.Output, transforms tf.Output, output_shape tf.Output, fill_value tf.Output, interpolation string, optional ...ImageProjectiveTransformV3Attr) (transformed_images tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"interpolation": interpolation} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ImageProjectiveTransformV3", + Input: []tf.Input{ + images, transforms, output_shape, fill_value, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// NonMaxSuppressionAttr is an optional argument to NonMaxSuppression. +type NonMaxSuppressionAttr func(optionalAttr) + +// NonMaxSuppressionIouThreshold sets the optional iou_threshold attribute to value. +// +// value: A float representing the threshold for deciding whether boxes +// overlap too much with respect to IOU. +// If not specified, defaults to 0.5 +func NonMaxSuppressionIouThreshold(value float32) NonMaxSuppressionAttr { + return func(m optionalAttr) { + m["iou_threshold"] = value + } +} + +// Greedily selects a subset of bounding boxes in descending order of score, +// +// pruning away boxes that have high intersection-over-union (IOU) overlap +// with previously selected boxes. Bounding boxes are supplied as +// [y1, x1, y2, x2], where (y1, x1) and (y2, x2) are the coordinates of any +// diagonal pair of box corners and the coordinates can be provided as normalized +// (i.e., lying in the interval [0, 1]) or absolute. Note that this algorithm +// is agnostic to where the origin is in the coordinate system. Note that this +// algorithm is invariant to orthogonal transformations and translations +// of the coordinate system; thus translating or reflections of the coordinate +// system result in the same boxes being selected by the algorithm. +// The output of this operation is a set of integers indexing into the input +// collection of bounding boxes representing the selected boxes. The bounding +// box coordinates corresponding to the selected indices can then be obtained +// using the `tf.gather operation`. For example: +// +// selected_indices = tf.image.non_max_suppression( +// boxes, scores, max_output_size, iou_threshold) +// selected_boxes = tf.gather(boxes, selected_indices) +// +// Arguments: +// +// boxes: A 2-D float tensor of shape `[num_boxes, 4]`. +// scores: A 1-D float tensor of shape `[num_boxes]` representing a single +// +// score corresponding to each box (each row of boxes). +// +// max_output_size: A scalar integer tensor representing the maximum number of +// +// boxes to be selected by non max suppression. +// +// Returns A 1-D integer tensor of shape `[M]` representing the selected +// indices from the boxes tensor, where `M <= max_output_size`. +func NonMaxSuppression(scope *Scope, boxes tf.Output, scores tf.Output, max_output_size tf.Output, optional ...NonMaxSuppressionAttr) (selected_indices tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "NonMaxSuppression", + Input: []tf.Input{ + boxes, scores, max_output_size, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Gets next element for the provided shard number. +// +// Arguments: +// +// multi_device_iterator: A MultiDeviceIterator resource. +// shard_num: Integer representing which shard to fetch data for. +// incarnation_id: Which incarnation of the MultiDeviceIterator is running. +// output_types: The type list for the return values. +// output_shapes: The list of shapes being produced. +// +// Returns Result of the get_next on the dataset. +func MultiDeviceIteratorGetNextFromShard(scope *Scope, multi_device_iterator tf.Output, shard_num tf.Output, incarnation_id tf.Output, output_types []tf.DataType, output_shapes []tf.Shape) (components []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + opspec := tf.OpSpec{ + Type: "MultiDeviceIteratorGetNextFromShard", + Input: []tf.Input{ + multi_device_iterator, shard_num, incarnation_id, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if components, idx, err = makeOutputList(op, idx, "components"); err != nil { + scope.UpdateErr("MultiDeviceIteratorGetNextFromShard", err) + return + } + return components +} + +// Calculates the prior from the training data (the bias) and fills in the first node with the logits' prior. Returns a boolean indicating whether to continue centering. +// +// Arguments: +// +// tree_ensemble_handle: Handle to the tree ensemble. +// mean_gradients: A tensor with shape=[logits_dimension] with mean of gradients for a first node. +// mean_hessians: A tensor with shape=[logits_dimension] mean of hessians for a first node. +// l1: l1 regularization factor on leaf weights, per instance based. +// l2: l2 regularization factor on leaf weights, per instance based. +// +// Returns Bool, whether to continue bias centering. +func BoostedTreesCenterBias(scope *Scope, tree_ensemble_handle tf.Output, mean_gradients tf.Output, mean_hessians tf.Output, l1 tf.Output, l2 tf.Output) (continue_centering tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "BoostedTreesCenterBias", + Input: []tf.Input{ + tree_ensemble_handle, mean_gradients, mean_hessians, l1, l2, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// MutableHashTableOfTensorsV2Attr is an optional argument to MutableHashTableOfTensorsV2. +type MutableHashTableOfTensorsV2Attr func(optionalAttr) + +// MutableHashTableOfTensorsV2Container sets the optional container attribute to value. +// +// value: If non-empty, this table is placed in the given container. +// Otherwise, a default container is used. +// If not specified, defaults to "" +func MutableHashTableOfTensorsV2Container(value string) MutableHashTableOfTensorsV2Attr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// MutableHashTableOfTensorsV2SharedName sets the optional shared_name attribute to value. +// +// value: If non-empty, this table is shared under the given name across +// multiple sessions. +// If not specified, defaults to "" +func MutableHashTableOfTensorsV2SharedName(value string) MutableHashTableOfTensorsV2Attr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// MutableHashTableOfTensorsV2UseNodeNameSharing sets the optional use_node_name_sharing attribute to value. +// If not specified, defaults to false +func MutableHashTableOfTensorsV2UseNodeNameSharing(value bool) MutableHashTableOfTensorsV2Attr { + return func(m optionalAttr) { + m["use_node_name_sharing"] = value + } +} + +// MutableHashTableOfTensorsV2ValueShape sets the optional value_shape attribute to value. +// If not specified, defaults to <> +func MutableHashTableOfTensorsV2ValueShape(value tf.Shape) MutableHashTableOfTensorsV2Attr { + return func(m optionalAttr) { + m["value_shape"] = value + } +} + +// Creates an empty hash table. +// +// This op creates a mutable hash table, specifying the type of its keys and +// values. Each value must be a vector. Data can be inserted into the table using +// the insert operations. It does not support the initialization operation. +// +// Arguments: +// +// key_dtype: Type of the table keys. +// value_dtype: Type of the table values. +// +// Returns Handle to a table. +func MutableHashTableOfTensorsV2(scope *Scope, key_dtype tf.DataType, value_dtype tf.DataType, optional ...MutableHashTableOfTensorsV2Attr) (table_handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"key_dtype": key_dtype, "value_dtype": value_dtype} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "MutableHashTableOfTensorsV2", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// DecodePngAttr is an optional argument to DecodePng. +type DecodePngAttr func(optionalAttr) + +// DecodePngChannels sets the optional channels attribute to value. +// +// value: Number of color channels for the decoded image. +// If not specified, defaults to 0 +func DecodePngChannels(value int64) DecodePngAttr { + return func(m optionalAttr) { + m["channels"] = value + } +} + +// DecodePngDtype sets the optional dtype attribute to value. +// If not specified, defaults to DT_UINT8 +func DecodePngDtype(value tf.DataType) DecodePngAttr { + return func(m optionalAttr) { + m["dtype"] = value + } +} + +// Decode a PNG-encoded image to a uint8 or uint16 tensor. +// +// The attr `channels` indicates the desired number of color channels for the +// decoded image. +// +// Accepted values are: +// +// * 0: Use the number of channels in the PNG-encoded image. +// * 1: output a grayscale image. +// * 3: output an RGB image. +// * 4: output an RGBA image. +// +// If needed, the PNG-encoded image is transformed to match the requested number +// of color channels. +// +// This op also supports decoding JPEGs and non-animated GIFs since the interface +// is the same, though it is cleaner to use `tf.io.decode_image`. +// +// Arguments: +// +// contents: 0-D. The PNG-encoded image. +// +// Returns 3-D with shape `[height, width, channels]`. +func DecodePng(scope *Scope, contents tf.Output, optional ...DecodePngAttr) (image tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "DecodePng", + Input: []tf.Input{ + contents, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Wraps the XLA ReducePrecision operator +// +// documented at https://www.tensorflow.org/xla/operation_semantics#reduceprecision. +// +// Arguments: +// +// operand: array of floating-point type. +// exponent_bits: number of exponent bits in lower-precision format +// mantissa_bits: number of mantissa bits in lower-precision format +func XlaReducePrecision(scope *Scope, operand tf.Output, exponent_bits int64, mantissa_bits int64) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"exponent_bits": exponent_bits, "mantissa_bits": mantissa_bits} + opspec := tf.OpSpec{ + Type: "XlaReducePrecision", + Input: []tf.Input{ + operand, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// AudioSummaryAttr is an optional argument to AudioSummary. +type AudioSummaryAttr func(optionalAttr) + +// AudioSummaryMaxOutputs sets the optional max_outputs attribute to value. +// +// value: Max number of batch elements to generate audio for. +// If not specified, defaults to 3 +// +// REQUIRES: value >= 1 +func AudioSummaryMaxOutputs(value int64) AudioSummaryAttr { + return func(m optionalAttr) { + m["max_outputs"] = value + } +} + +// Outputs a `Summary` protocol buffer with audio. +// +// DEPRECATED at GraphDef version 15: Use AudioSummaryV2. +// +// The summary has up to `max_outputs` summary values containing audio. The +// audio is built from `tensor` which must be 3-D with shape `[batch_size, +// frames, channels]` or 2-D with shape `[batch_size, frames]`. The values are +// assumed to be in the range of `[-1.0, 1.0]` with a sample rate of `sample_rate`. +// +// The `tag` argument is a scalar `Tensor` of type `string`. It is used to +// build the `tag` of the summary values: +// +// - If `max_outputs` is 1, the summary value tag is '*tag*/audio'. +// - If `max_outputs` is greater than 1, the summary value tags are +// generated sequentially as '*tag*/audio/0', '*tag*/audio/1', etc. +// +// Arguments: +// +// tag: Scalar. Used to build the `tag` attribute of the summary values. +// tensor: 2-D of shape `[batch_size, frames]`. +// sample_rate: The sample rate of the signal in hertz. +// +// Returns Scalar. Serialized `Summary` protocol buffer. +func AudioSummary(scope *Scope, tag tf.Output, tensor tf.Output, sample_rate float32, optional ...AudioSummaryAttr) (summary tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"sample_rate": sample_rate} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "AudioSummary", + Input: []tf.Input{ + tag, tensor, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns the batched diagonal part of a batched tensor. +// +// Returns a tensor with the `k[0]`-th to `k[1]`-th diagonals of the batched +// `input`. +// +// Assume `input` has `r` dimensions `[I, J, ..., L, M, N]`. +// Let `max_diag_len` be the maximum length among all diagonals to be extracted, +// `max_diag_len = min(M + min(k[1], 0), N + min(-k[0], 0))` +// Let `num_diags` be the number of diagonals to extract, +// `num_diags = k[1] - k[0] + 1`. +// +// If `num_diags == 1`, the output tensor is of rank `r - 1` with shape +// `[I, J, ..., L, max_diag_len]` and values: +// +// ``` +// diagonal[i, j, ..., l, n] +// +// = input[i, j, ..., l, n+y, n+x] ; if 0 <= n+y < M and 0 <= n+x < N, +// padding_value ; otherwise. +// +// ``` +// where `y = max(-k[1], 0)`, `x = max(k[1], 0)`. +// +// Otherwise, the output tensor has rank `r` with dimensions +// `[I, J, ..., L, num_diags, max_diag_len]` with values: +// +// ``` +// diagonal[i, j, ..., l, m, n] +// +// = input[i, j, ..., l, n+y, n+x] ; if 0 <= n+y < M and 0 <= n+x < N, +// padding_value ; otherwise. +// +// ``` +// where `d = k[1] - m`, `y = max(-d, 0)`, and `x = max(d, 0)`. +// +// The input must be at least a matrix. +// +// For example: +// +// ``` +// input = np.array([[[1, 2, 3, 4], # Input shape: (2, 3, 4) +// +// [5, 6, 7, 8], +// [9, 8, 7, 6]], +// [[5, 4, 3, 2], +// [1, 2, 3, 4], +// [5, 6, 7, 8]]]) +// +// # A main diagonal from each batch. +// tf.matrix_diag_part(input) ==> [[1, 6, 7], # Output shape: (2, 3) +// +// [5, 2, 7]] +// +// # A superdiagonal from each batch. +// tf.matrix_diag_part(input, k = 1) +// +// ==> [[2, 7, 6], # Output shape: (2, 3) +// [4, 3, 8]] +// +// # A tridiagonal band from each batch. +// tf.matrix_diag_part(input, k = (-1, 1)) +// +// ==> [[[2, 7, 6], # Output shape: (2, 3, 3) +// [1, 6, 7], +// [5, 8, 0]], +// [[4, 3, 8], +// [5, 2, 7], +// [1, 6, 0]]] +// +// # Padding value = 9 +// tf.matrix_diag_part(input, k = (1, 3), padding_value = 9) +// +// ==> [[[4, 9, 9], # Output shape: (2, 3, 3) +// [3, 8, 9], +// [2, 7, 6]], +// [[2, 9, 9], +// [3, 4, 9], +// [4, 3, 8]]] +// +// ``` +// +// Arguments: +// +// input: Rank `r` tensor where `r >= 2`. +// k: Diagonal offset(s). Positive value means superdiagonal, 0 refers to the main +// +// diagonal, and negative value means subdiagonals. `k` can be a single integer +// (for a single diagonal) or a pair of integers specifying the low and high ends +// of a matrix band. `k[0]` must not be larger than `k[1]`. +// +// padding_value: The value to fill the area outside the specified diagonal band with. +// +// Default is 0. +// +// Returns The extracted diagonal(s). +func MatrixDiagPartV2(scope *Scope, input tf.Output, k tf.Output, padding_value tf.Output) (diagonal tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "MatrixDiagPartV2", + Input: []tf.Input{ + input, k, padding_value, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Picks the best algorithm based on device, and scrambles seed into key and counter. +// +// This op picks the best counter-based RNG algorithm based on device, and scrambles a shape-[2] seed into a key and a counter, both needed by the counter-based algorithm. The scrambling is opaque but approximately satisfies the property that different seed results in different key/counter pair (which will in turn result in different random numbers). +// +// Arguments: +// +// seed: 2 seeds (shape [2]). +// +// Returns: +// +// key: Key for the counter-based RNG algorithm (shape uint64[1]). +// counter: Counter for the counter-based RNG algorithm. Since counter size is algorithm-dependent, this output will be right-padded with zeros to reach shape uint64[2] (the current maximal counter size among algorithms). +// alg: The RNG algorithm (shape int32[]). +func StatelessRandomGetKeyCounterAlg(scope *Scope, seed tf.Output) (key tf.Output, counter tf.Output, alg tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "StatelessRandomGetKeyCounterAlg", + Input: []tf.Input{ + seed, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// MaxPoolGradV2Attr is an optional argument to MaxPoolGradV2. +type MaxPoolGradV2Attr func(optionalAttr) + +// MaxPoolGradV2DataFormat sets the optional data_format attribute to value. +// +// value: Specify the data format of the input and output data. With the +// default format "NHWC", the data is stored in the order of: +// +// [batch, in_height, in_width, in_channels]. +// +// Alternatively, the format could be "NCHW", the data storage order of: +// +// [batch, in_channels, in_height, in_width]. +// +// If not specified, defaults to "NHWC" +func MaxPoolGradV2DataFormat(value string) MaxPoolGradV2Attr { + return func(m optionalAttr) { + m["data_format"] = value + } +} + +// Computes gradients of the maxpooling function. +// +// Arguments: +// +// orig_input: The original input tensor. +// orig_output: The original output tensor. +// grad: 4-D. Gradients w.r.t. the output of `max_pool`. +// ksize: The size of the window for each dimension of the input tensor. +// strides: The stride of the sliding window for each dimension of the +// +// input tensor. +// +// padding: The type of padding algorithm to use. +// +// Returns Gradients w.r.t. the input to `max_pool`. +func MaxPoolGradV2(scope *Scope, orig_input tf.Output, orig_output tf.Output, grad tf.Output, ksize tf.Output, strides tf.Output, padding string, optional ...MaxPoolGradV2Attr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"padding": padding} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "MaxPoolGradV2", + Input: []tf.Input{ + orig_input, orig_output, grad, ksize, strides, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// EnqueueTPUEmbeddingIntegerBatchAttr is an optional argument to EnqueueTPUEmbeddingIntegerBatch. +type EnqueueTPUEmbeddingIntegerBatchAttr func(optionalAttr) + +// EnqueueTPUEmbeddingIntegerBatchDeviceOrdinal sets the optional device_ordinal attribute to value. +// +// value: The TPU device to use. Should be >= 0 and less than the number +// of TPU cores in the task on which the node is placed. +// If not specified, defaults to -1 +func EnqueueTPUEmbeddingIntegerBatchDeviceOrdinal(value int64) EnqueueTPUEmbeddingIntegerBatchAttr { + return func(m optionalAttr) { + m["device_ordinal"] = value + } +} + +// An op that enqueues a list of input batch tensors to TPUEmbedding. +// +// Arguments: +// +// batch: A list of 1D tensors, one for each embedding table, containing the +// +// indices into the tables. +// +// mode_override: A string input that overrides the mode specified in the +// +// TPUEmbeddingConfiguration. Supported values are {'unspecified', 'inference', +// 'training', 'backward_pass_only'}. When set to 'unspecified', the mode set +// in TPUEmbeddingConfiguration is used, otherwise mode_override is used. +// +// Returns the created operation. +func EnqueueTPUEmbeddingIntegerBatch(scope *Scope, batch []tf.Output, mode_override tf.Output, optional ...EnqueueTPUEmbeddingIntegerBatchAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "EnqueueTPUEmbeddingIntegerBatch", + Input: []tf.Input{ + tf.OutputList(batch), mode_override, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// Computes the product along segments of a tensor. +// +// Read +// [the section on segmentation](https://tensorflow.org/api_docs/python/tf/math#Segmentation) +// for an explanation of segments. +// +// This operator is similar to the unsorted segment sum operator found +// [(here)](../../../api_docs/python/math_ops.md#UnsortedSegmentSum). +// Instead of computing the sum over segments, it computes the product of all +// entries belonging to a segment such that: +// +// \\(output_i = \prod_{j...} data[j...]\\) where the product is over tuples +// `j...` such that `segment_ids[j...] == i`. +// +// For example: +// +// ``` python +// c = tf.constant([[1,2,3,4], [5,6,7,8], [4,3,2,1]]) +// tf.unsorted_segment_prod(c, tf.constant([0, 1, 0]), num_segments=2) +// # ==> [[ 4, 6, 6, 4], +// # [5, 6, 7, 8]] +// ``` +// +// If there is no entry for a given segment ID `i`, it outputs 1. +// +// If the given segment ID `i` is negative, then the corresponding value is +// dropped, and will not be included in the result. +// +// Arguments: +// +// segment_ids: A tensor whose shape is a prefix of `data.shape`. +// +// Returns Has same shape as data, except for the first `segment_ids.rank` +// dimensions, which are replaced with a single dimension which has size +// `num_segments`. +func UnsortedSegmentProd(scope *Scope, data tf.Output, segment_ids tf.Output, num_segments tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "UnsortedSegmentProd", + Input: []tf.Input{ + data, segment_ids, num_segments, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ResourceSparseApplyRMSPropAttr is an optional argument to ResourceSparseApplyRMSProp. +type ResourceSparseApplyRMSPropAttr func(optionalAttr) + +// ResourceSparseApplyRMSPropUseLocking sets the optional use_locking attribute to value. +// +// value: If `True`, updating of the var, ms, and mom tensors is protected +// by a lock; otherwise the behavior is undefined, but may exhibit less +// contention. +// If not specified, defaults to false +func ResourceSparseApplyRMSPropUseLocking(value bool) ResourceSparseApplyRMSPropAttr { + return func(m optionalAttr) { + m["use_locking"] = value + } +} + +// Update '*var' according to the RMSProp algorithm. +// +// Note that in dense implementation of this algorithm, ms and mom will +// update even if the grad is zero, but in this sparse implementation, ms +// and mom will not update in iterations during which the grad is zero. +// +// mean_square = decay * mean_square + (1-decay) * gradient ** 2 +// Delta = learning_rate * gradient / sqrt(mean_square + epsilon) +// +// ms <- rho * ms_{t-1} + (1-rho) * grad * grad +// mom <- momentum * mom_{t-1} + lr * grad / sqrt(ms + epsilon) +// var <- var - mom +// +// Arguments: +// +// var_: Should be from a Variable(). +// ms: Should be from a Variable(). +// mom: Should be from a Variable(). +// lr: Scaling factor. Must be a scalar. +// rho: Decay rate. Must be a scalar. +// +// epsilon: Ridge term. Must be a scalar. +// grad: The gradient. +// indices: A vector of indices into the first dimension of var, ms and mom. +// +// Returns the created operation. +func ResourceSparseApplyRMSProp(scope *Scope, var_ tf.Output, ms tf.Output, mom tf.Output, lr tf.Output, rho tf.Output, momentum tf.Output, epsilon tf.Output, grad tf.Output, indices tf.Output, optional ...ResourceSparseApplyRMSPropAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ResourceSparseApplyRMSProp", + Input: []tf.Input{ + var_, ms, mom, lr, rho, momentum, epsilon, grad, indices, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// EncodeJpegAttr is an optional argument to EncodeJpeg. +type EncodeJpegAttr func(optionalAttr) + +// EncodeJpegFormat sets the optional format attribute to value. +// +// value: Per pixel image format. +// If not specified, defaults to "" +func EncodeJpegFormat(value string) EncodeJpegAttr { + return func(m optionalAttr) { + m["format"] = value + } +} + +// EncodeJpegQuality sets the optional quality attribute to value. +// +// value: Quality of the compression from 0 to 100 (higher is better and slower). +// If not specified, defaults to 95 +func EncodeJpegQuality(value int64) EncodeJpegAttr { + return func(m optionalAttr) { + m["quality"] = value + } +} + +// EncodeJpegProgressive sets the optional progressive attribute to value. +// +// value: If True, create a JPEG that loads progressively (coarse to fine). +// If not specified, defaults to false +func EncodeJpegProgressive(value bool) EncodeJpegAttr { + return func(m optionalAttr) { + m["progressive"] = value + } +} + +// EncodeJpegOptimizeSize sets the optional optimize_size attribute to value. +// +// value: If True, spend CPU/RAM to reduce size with no quality change. +// If not specified, defaults to false +func EncodeJpegOptimizeSize(value bool) EncodeJpegAttr { + return func(m optionalAttr) { + m["optimize_size"] = value + } +} + +// EncodeJpegChromaDownsampling sets the optional chroma_downsampling attribute to value. +// +// value: See http://en.wikipedia.org/wiki/Chroma_subsampling. +// If not specified, defaults to true +func EncodeJpegChromaDownsampling(value bool) EncodeJpegAttr { + return func(m optionalAttr) { + m["chroma_downsampling"] = value + } +} + +// EncodeJpegDensityUnit sets the optional density_unit attribute to value. +// +// value: Unit used to specify `x_density` and `y_density`: +// pixels per inch (`'in'`) or centimeter (`'cm'`). +// If not specified, defaults to "in" +func EncodeJpegDensityUnit(value string) EncodeJpegAttr { + return func(m optionalAttr) { + m["density_unit"] = value + } +} + +// EncodeJpegXDensity sets the optional x_density attribute to value. +// +// value: Horizontal pixels per density unit. +// If not specified, defaults to 300 +func EncodeJpegXDensity(value int64) EncodeJpegAttr { + return func(m optionalAttr) { + m["x_density"] = value + } +} + +// EncodeJpegYDensity sets the optional y_density attribute to value. +// +// value: Vertical pixels per density unit. +// If not specified, defaults to 300 +func EncodeJpegYDensity(value int64) EncodeJpegAttr { + return func(m optionalAttr) { + m["y_density"] = value + } +} + +// EncodeJpegXmpMetadata sets the optional xmp_metadata attribute to value. +// +// value: If not empty, embed this XMP metadata in the image header. +// If not specified, defaults to "" +func EncodeJpegXmpMetadata(value string) EncodeJpegAttr { + return func(m optionalAttr) { + m["xmp_metadata"] = value + } +} + +// JPEG-encode an image. +// +// `image` is a 3-D uint8 Tensor of shape `[height, width, channels]`. +// +// The attr `format` can be used to override the color format of the encoded +// output. Values can be: +// +// - `”`: Use a default format based on the number of channels in the image. +// - `grayscale`: Output a grayscale JPEG image. The `channels` dimension +// of `image` must be 1. +// - `rgb`: Output an RGB JPEG image. The `channels` dimension +// of `image` must be 3. +// +// If `format` is not specified or is the empty string, a default format is picked +// in function of the number of channels in `image`: +// +// * 1: Output a grayscale image. +// * 3: Output an RGB image. +// +// Arguments: +// +// image: 3-D with shape `[height, width, channels]`. +// +// Returns 0-D. JPEG-encoded image. +func EncodeJpeg(scope *Scope, image tf.Output, optional ...EncodeJpegAttr) (contents tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "EncodeJpeg", + Input: []tf.Input{ + image, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// MapUnstageNoKeyAttr is an optional argument to MapUnstageNoKey. +type MapUnstageNoKeyAttr func(optionalAttr) + +// MapUnstageNoKeyCapacity sets the optional capacity attribute to value. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func MapUnstageNoKeyCapacity(value int64) MapUnstageNoKeyAttr { + return func(m optionalAttr) { + m["capacity"] = value + } +} + +// MapUnstageNoKeyMemoryLimit sets the optional memory_limit attribute to value. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func MapUnstageNoKeyMemoryLimit(value int64) MapUnstageNoKeyAttr { + return func(m optionalAttr) { + m["memory_limit"] = value + } +} + +// MapUnstageNoKeyContainer sets the optional container attribute to value. +// If not specified, defaults to "" +func MapUnstageNoKeyContainer(value string) MapUnstageNoKeyAttr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// MapUnstageNoKeySharedName sets the optional shared_name attribute to value. +// If not specified, defaults to "" +func MapUnstageNoKeySharedName(value string) MapUnstageNoKeyAttr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// Op removes and returns a random (key, value) +// +// from the underlying container. If the underlying container +// does not contain elements, the op will block until it does. +func MapUnstageNoKey(scope *Scope, indices tf.Output, dtypes []tf.DataType, optional ...MapUnstageNoKeyAttr) (key tf.Output, values []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtypes": dtypes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "MapUnstageNoKey", + Input: []tf.Input{ + indices, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + key = op.Output(idx) + if values, idx, err = makeOutputList(op, idx, "values"); err != nil { + scope.UpdateErr("MapUnstageNoKey", err) + return + } + return key, values +} + +// ParseSingleSequenceExampleAttr is an optional argument to ParseSingleSequenceExample. +type ParseSingleSequenceExampleAttr func(optionalAttr) + +// ParseSingleSequenceExampleContextSparseTypes sets the optional context_sparse_types attribute to value. +// +// value: A list of Ncontext_sparse types; the data types of data in +// each context Feature given in context_sparse_keys. +// Currently the ParseSingleSequenceExample supports DT_FLOAT (FloatList), +// DT_INT64 (Int64List), and DT_STRING (BytesList). +// If not specified, defaults to <> +// +// REQUIRES: len(value) >= 0 +func ParseSingleSequenceExampleContextSparseTypes(value []tf.DataType) ParseSingleSequenceExampleAttr { + return func(m optionalAttr) { + m["context_sparse_types"] = value + } +} + +// ParseSingleSequenceExampleFeatureListDenseTypes sets the optional feature_list_dense_types attribute to value. +// If not specified, defaults to <> +// +// REQUIRES: len(value) >= 0 +func ParseSingleSequenceExampleFeatureListDenseTypes(value []tf.DataType) ParseSingleSequenceExampleAttr { + return func(m optionalAttr) { + m["feature_list_dense_types"] = value + } +} + +// ParseSingleSequenceExampleContextDenseShapes sets the optional context_dense_shapes attribute to value. +// +// value: A list of Ncontext_dense shapes; the shapes of data in +// each context Feature given in context_dense_keys. +// The number of elements in the Feature corresponding to context_dense_key[j] +// must always equal context_dense_shapes[j].NumEntries(). +// The shape of context_dense_values[j] will match context_dense_shapes[j]. +// If not specified, defaults to <> +// +// REQUIRES: len(value) >= 0 +func ParseSingleSequenceExampleContextDenseShapes(value []tf.Shape) ParseSingleSequenceExampleAttr { + return func(m optionalAttr) { + m["context_dense_shapes"] = value + } +} + +// ParseSingleSequenceExampleFeatureListSparseTypes sets the optional feature_list_sparse_types attribute to value. +// +// value: A list of Nfeature_list_sparse types; the data types +// of data in each FeatureList given in feature_list_sparse_keys. +// Currently the ParseSingleSequenceExample supports DT_FLOAT (FloatList), +// DT_INT64 (Int64List), and DT_STRING (BytesList). +// If not specified, defaults to <> +// +// REQUIRES: len(value) >= 0 +func ParseSingleSequenceExampleFeatureListSparseTypes(value []tf.DataType) ParseSingleSequenceExampleAttr { + return func(m optionalAttr) { + m["feature_list_sparse_types"] = value + } +} + +// ParseSingleSequenceExampleFeatureListDenseShapes sets the optional feature_list_dense_shapes attribute to value. +// +// value: A list of Nfeature_list_dense shapes; the shapes of +// data in each FeatureList given in feature_list_dense_keys. +// The shape of each Feature in the FeatureList corresponding to +// feature_list_dense_key[j] must always equal +// feature_list_dense_shapes[j].NumEntries(). +// If not specified, defaults to <> +// +// REQUIRES: len(value) >= 0 +func ParseSingleSequenceExampleFeatureListDenseShapes(value []tf.Shape) ParseSingleSequenceExampleAttr { + return func(m optionalAttr) { + m["feature_list_dense_shapes"] = value + } +} + +// Transforms a scalar brain.SequenceExample proto (as strings) into typed tensors. +// +// Arguments: +// +// serialized: A scalar containing a binary serialized SequenceExample proto. +// feature_list_dense_missing_assumed_empty: A vector listing the +// +// FeatureList keys which may be missing from the SequenceExample. If the +// associated FeatureList is missing, it is treated as empty. By default, +// any FeatureList not listed in this vector must exist in the SequenceExample. +// +// context_sparse_keys: A list of Ncontext_sparse string Tensors (scalars). +// +// The keys expected in the Examples' features associated with context_sparse +// values. +// +// context_dense_keys: A list of Ncontext_dense string Tensors (scalars). +// +// The keys expected in the SequenceExamples' context features associated with +// dense values. +// +// feature_list_sparse_keys: A list of Nfeature_list_sparse string Tensors +// +// (scalars). The keys expected in the FeatureLists associated with sparse +// values. +// +// feature_list_dense_keys: A list of Nfeature_list_dense string Tensors (scalars). +// +// The keys expected in the SequenceExamples' feature_lists associated +// with lists of dense values. +// +// context_dense_defaults: A list of Ncontext_dense Tensors (some may be empty). +// +// context_dense_defaults[j] provides default values +// when the SequenceExample's context map lacks context_dense_key[j]. +// If an empty Tensor is provided for context_dense_defaults[j], +// then the Feature context_dense_keys[j] is required. +// The input type is inferred from context_dense_defaults[j], even when it's +// empty. If context_dense_defaults[j] is not empty, its shape must match +// context_dense_shapes[j]. +// +// debug_name: A scalar containing the name of the serialized proto. +// +// May contain, for example, table key (descriptive) name for the +// corresponding serialized proto. This is purely useful for debugging +// purposes, and the presence of values here has no effect on the output. +// May also be an empty scalar if no name is available. +func ParseSingleSequenceExample(scope *Scope, serialized tf.Output, feature_list_dense_missing_assumed_empty tf.Output, context_sparse_keys []tf.Output, context_dense_keys []tf.Output, feature_list_sparse_keys []tf.Output, feature_list_dense_keys []tf.Output, context_dense_defaults []tf.Output, debug_name tf.Output, optional ...ParseSingleSequenceExampleAttr) (context_sparse_indices []tf.Output, context_sparse_values []tf.Output, context_sparse_shapes []tf.Output, context_dense_values []tf.Output, feature_list_sparse_indices []tf.Output, feature_list_sparse_values []tf.Output, feature_list_sparse_shapes []tf.Output, feature_list_dense_values []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ParseSingleSequenceExample", + Input: []tf.Input{ + serialized, feature_list_dense_missing_assumed_empty, tf.OutputList(context_sparse_keys), tf.OutputList(context_dense_keys), tf.OutputList(feature_list_sparse_keys), tf.OutputList(feature_list_dense_keys), tf.OutputList(context_dense_defaults), debug_name, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if context_sparse_indices, idx, err = makeOutputList(op, idx, "context_sparse_indices"); err != nil { + scope.UpdateErr("ParseSingleSequenceExample", err) + return + } + if context_sparse_values, idx, err = makeOutputList(op, idx, "context_sparse_values"); err != nil { + scope.UpdateErr("ParseSingleSequenceExample", err) + return + } + if context_sparse_shapes, idx, err = makeOutputList(op, idx, "context_sparse_shapes"); err != nil { + scope.UpdateErr("ParseSingleSequenceExample", err) + return + } + if context_dense_values, idx, err = makeOutputList(op, idx, "context_dense_values"); err != nil { + scope.UpdateErr("ParseSingleSequenceExample", err) + return + } + if feature_list_sparse_indices, idx, err = makeOutputList(op, idx, "feature_list_sparse_indices"); err != nil { + scope.UpdateErr("ParseSingleSequenceExample", err) + return + } + if feature_list_sparse_values, idx, err = makeOutputList(op, idx, "feature_list_sparse_values"); err != nil { + scope.UpdateErr("ParseSingleSequenceExample", err) + return + } + if feature_list_sparse_shapes, idx, err = makeOutputList(op, idx, "feature_list_sparse_shapes"); err != nil { + scope.UpdateErr("ParseSingleSequenceExample", err) + return + } + if feature_list_dense_values, idx, err = makeOutputList(op, idx, "feature_list_dense_values"); err != nil { + scope.UpdateErr("ParseSingleSequenceExample", err) + return + } + return context_sparse_indices, context_sparse_values, context_sparse_shapes, context_dense_values, feature_list_sparse_indices, feature_list_sparse_values, feature_list_sparse_shapes, feature_list_dense_values +} + +// ResourceStridedSliceAssignAttr is an optional argument to ResourceStridedSliceAssign. +type ResourceStridedSliceAssignAttr func(optionalAttr) + +// ResourceStridedSliceAssignBeginMask sets the optional begin_mask attribute to value. +// If not specified, defaults to 0 +func ResourceStridedSliceAssignBeginMask(value int64) ResourceStridedSliceAssignAttr { + return func(m optionalAttr) { + m["begin_mask"] = value + } +} + +// ResourceStridedSliceAssignEndMask sets the optional end_mask attribute to value. +// If not specified, defaults to 0 +func ResourceStridedSliceAssignEndMask(value int64) ResourceStridedSliceAssignAttr { + return func(m optionalAttr) { + m["end_mask"] = value + } +} + +// ResourceStridedSliceAssignEllipsisMask sets the optional ellipsis_mask attribute to value. +// If not specified, defaults to 0 +func ResourceStridedSliceAssignEllipsisMask(value int64) ResourceStridedSliceAssignAttr { + return func(m optionalAttr) { + m["ellipsis_mask"] = value + } +} + +// ResourceStridedSliceAssignNewAxisMask sets the optional new_axis_mask attribute to value. +// If not specified, defaults to 0 +func ResourceStridedSliceAssignNewAxisMask(value int64) ResourceStridedSliceAssignAttr { + return func(m optionalAttr) { + m["new_axis_mask"] = value + } +} + +// ResourceStridedSliceAssignShrinkAxisMask sets the optional shrink_axis_mask attribute to value. +// If not specified, defaults to 0 +func ResourceStridedSliceAssignShrinkAxisMask(value int64) ResourceStridedSliceAssignAttr { + return func(m optionalAttr) { + m["shrink_axis_mask"] = value + } +} + +// Assign `value` to the sliced l-value reference of `ref`. +// +// The values of `value` are assigned to the positions in the variable +// `ref` that are selected by the slice parameters. The slice parameters +// `begin, `end`, `strides`, etc. work exactly as in `StridedSlice`. +// +// NOTE this op currently does not support broadcasting and so `value`'s +// shape must be exactly the shape produced by the slice of `ref`. +// +// Returns the created operation. +func ResourceStridedSliceAssign(scope *Scope, ref tf.Output, begin tf.Output, end tf.Output, strides tf.Output, value tf.Output, optional ...ResourceStridedSliceAssignAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ResourceStridedSliceAssign", + Input: []tf.Input{ + ref, begin, end, strides, value, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// Produces a summary of any statistics recorded by the given statistics manager. +func StatsAggregatorSummary(scope *Scope, iterator tf.Output) (summary tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "StatsAggregatorSummary", + Input: []tf.Input{ + iterator, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes the gradient for the inverse of `x` wrt its input. +// +// Specifically, `grad = -dy * y*y`, where `y = 1/x`, and `dy` +// is the corresponding input gradient. +func ReciprocalGrad(scope *Scope, y tf.Output, dy tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "ReciprocalGrad", + Input: []tf.Input{ + y, dy, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ResourceApplyAdagradV2Attr is an optional argument to ResourceApplyAdagradV2. +type ResourceApplyAdagradV2Attr func(optionalAttr) + +// ResourceApplyAdagradV2UseLocking sets the optional use_locking attribute to value. +// +// value: If `True`, updating of the var and accum tensors will be protected +// by a lock; otherwise the behavior is undefined, but may exhibit less +// contention. +// If not specified, defaults to false +func ResourceApplyAdagradV2UseLocking(value bool) ResourceApplyAdagradV2Attr { + return func(m optionalAttr) { + m["use_locking"] = value + } +} + +// ResourceApplyAdagradV2UpdateSlots sets the optional update_slots attribute to value. +// If not specified, defaults to true +func ResourceApplyAdagradV2UpdateSlots(value bool) ResourceApplyAdagradV2Attr { + return func(m optionalAttr) { + m["update_slots"] = value + } +} + +// Update '*var' according to the adagrad scheme. +// +// accum += grad * grad +// var -= lr * grad * (1 / (sqrt(accum) + epsilon)) +// +// Arguments: +// +// var_: Should be from a Variable(). +// accum: Should be from a Variable(). +// lr: Scaling factor. Must be a scalar. +// epsilon: Constant factor. Must be a scalar. +// grad: The gradient. +// +// Returns the created operation. +func ResourceApplyAdagradV2(scope *Scope, var_ tf.Output, accum tf.Output, lr tf.Output, epsilon tf.Output, grad tf.Output, optional ...ResourceApplyAdagradV2Attr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ResourceApplyAdagradV2", + Input: []tf.Input{ + var_, accum, lr, epsilon, grad, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// DebugNumericSummaryV2Attr is an optional argument to DebugNumericSummaryV2. +type DebugNumericSummaryV2Attr func(optionalAttr) + +// DebugNumericSummaryV2OutputDtype sets the optional output_dtype attribute to value. +// +// value: Optional. The type of the output. Can be float32 or float64 (default: float32). +// If not specified, defaults to DT_FLOAT +func DebugNumericSummaryV2OutputDtype(value tf.DataType) DebugNumericSummaryV2Attr { + return func(m optionalAttr) { + m["output_dtype"] = value + } +} + +// DebugNumericSummaryV2TensorDebugMode sets the optional tensor_debug_mode attribute to value. +// +// value: Tensor debug mode: the mode in which the input tensor is summarized +// +// by the op. See the TensorDebugMode enum in +// tensorflow/core/protobuf/debug_event.proto for details. +// +// Supported values: +// +// 2 (CURT_HEALTH): Output a float32/64 tensor of shape [2]. The 1st +// element is the tensor_id, if provided, and -1 otherwise. The 2nd +// element is a bit which is set to 1 if the input tensor has an +// infinity or nan value, or zero otherwise. +// +// 3 (CONCISE_HEALTH): Output a float32/64 tensor of shape [5]. The 1st +// element is the tensor_id, if provided, and -1 otherwise. The +// remaining four slots are the total number of elements, -infs, +// +infs, and nans in the input tensor respectively. +// +// 4 (FULL_HEALTH): Output a float32/64 tensor of shape [11]. The 1st +// element is the tensor_id, if provided, and -1 otherwise. The 2nd +// element is the device_id, if provided, and -1 otherwise. The 3rd +// element holds the datatype value of the input tensor as according +// to the enumerated type in tensorflow/core/framework/types.proto. +// The remaining elements hold the total number of elements, -infs, +// +infs, nans, negative finite numbers, zeros, and positive finite +// numbers in the input tensor respectively. +// +// 5 (SHAPE): Output a float32/64 tensor of shape [10]. The 1st +// element is the tensor_id, if provided, and -1 otherwise. The 2nd +// element holds the datatype value of the input tensor as according +// to the enumerated type in tensorflow/core/framework/types.proto. +// The 3rd element holds the rank of the tensor. The 4th element holds +// the number of elements within the tensor. Finally the remaining 6 +// elements hold the shape of the tensor. If the rank of the tensor +// is lower than 6, the shape is right padded with zeros. If the rank +// is greater than 6, the head of the shape is truncated. +// +// 6 (FULL_NUMERICS): Output a float32/64 tensor of shape [22]. The 1st +// element is the tensor_id, if provided, and -1 otherwise. The 2nd +// element is the device_id, if provided, and -1 otherwise. The 3rd +// element holds the datatype value of the input tensor as according +// to the enumerated type in tensorflow/core/framework/types.proto. +// The 4th element holds the rank of the tensor. The 5th to 11th +// elements hold the shape of the tensor. If the rank of the tensor +// is lower than 6, the shape is right padded with zeros. If the rank +// is greater than 6, the head of the shape is truncated. The 12th to +// 18th elements hold the number of elements, -infs, +infs, nans, +// denormal floats, negative finite numbers, zeros, and positive +// finite numbers in the input tensor respectively. The final four +// elements hold the min value, max value, mean, and variance of the +// input tensor. +// +// 8 (REDUCE_INF_NAN_THREE_SLOTS): Output a float32/64 tensor of shape +// [3]. The 1st element is -inf if any elements of the input tensor +// is -inf, or zero otherwise. The 2nd element is +inf if any elements +// of the input tensor is +inf, or zero otherwise. The 3rd element is +// nan if any element of the input tensor is nan, or zero otherwise. +// +// If not specified, defaults to -1 +func DebugNumericSummaryV2TensorDebugMode(value int64) DebugNumericSummaryV2Attr { + return func(m optionalAttr) { + m["tensor_debug_mode"] = value + } +} + +// DebugNumericSummaryV2TensorId sets the optional tensor_id attribute to value. +// +// value: Optional. An integer identifier for the tensor being summarized by this op. +// If not specified, defaults to -1 +func DebugNumericSummaryV2TensorId(value int64) DebugNumericSummaryV2Attr { + return func(m optionalAttr) { + m["tensor_id"] = value + } +} + +// Debug Numeric Summary V2 Op. +// +// Computes a numeric summary of the input tensor. The shape of the output +// depends on the tensor_debug_mode attribute. +// This op is used internally by TensorFlow Debugger (tfdbg) v2. +// +// Arguments: +// +// input: Input tensor, to be summarized by the op. +func DebugNumericSummaryV2(scope *Scope, input tf.Output, optional ...DebugNumericSummaryV2Attr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "DebugNumericSummaryV2", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Deprecated. Use TensorArrayGradV3 +// +// DEPRECATED at GraphDef version 26: Use TensorArrayWriteV3 +func TensorArrayWriteV2(scope *Scope, handle tf.Output, index tf.Output, value tf.Output, flow_in tf.Output) (flow_out tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "TensorArrayWriteV2", + Input: []tf.Input{ + handle, index, value, flow_in, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// RetrieveTPUEmbeddingCenteredRMSPropParametersAttr is an optional argument to RetrieveTPUEmbeddingCenteredRMSPropParameters. +type RetrieveTPUEmbeddingCenteredRMSPropParametersAttr func(optionalAttr) + +// RetrieveTPUEmbeddingCenteredRMSPropParametersTableId sets the optional table_id attribute to value. +// If not specified, defaults to -1 +func RetrieveTPUEmbeddingCenteredRMSPropParametersTableId(value int64) RetrieveTPUEmbeddingCenteredRMSPropParametersAttr { + return func(m optionalAttr) { + m["table_id"] = value + } +} + +// RetrieveTPUEmbeddingCenteredRMSPropParametersTableName sets the optional table_name attribute to value. +// If not specified, defaults to "" +func RetrieveTPUEmbeddingCenteredRMSPropParametersTableName(value string) RetrieveTPUEmbeddingCenteredRMSPropParametersAttr { + return func(m optionalAttr) { + m["table_name"] = value + } +} + +// RetrieveTPUEmbeddingCenteredRMSPropParametersConfig sets the optional config attribute to value. +// If not specified, defaults to "" +func RetrieveTPUEmbeddingCenteredRMSPropParametersConfig(value string) RetrieveTPUEmbeddingCenteredRMSPropParametersAttr { + return func(m optionalAttr) { + m["config"] = value + } +} + +// Retrieve centered RMSProp embedding parameters. +// +// An op that retrieves optimization parameters from embedding to host +// memory. Must be preceded by a ConfigureTPUEmbeddingHost op that sets up +// the correct embedding table configuration. For example, this op is +// used to retrieve updated parameters before saving a checkpoint. +// +// Returns: +// +// parameters: Parameter parameters updated by the centered RMSProp optimization algorithm. +// ms: Parameter ms updated by the centered RMSProp optimization algorithm. +// mom: Parameter mom updated by the centered RMSProp optimization algorithm. +// mg: Parameter mg updated by the centered RMSProp optimization algorithm. +func RetrieveTPUEmbeddingCenteredRMSPropParameters(scope *Scope, num_shards int64, shard_id int64, optional ...RetrieveTPUEmbeddingCenteredRMSPropParametersAttr) (parameters tf.Output, ms tf.Output, mom tf.Output, mg tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_shards": num_shards, "shard_id": shard_id} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "RetrieveTPUEmbeddingCenteredRMSPropParameters", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2), op.Output(3) +} + +// Computes square root of x element-wise. +// +// I.e., \\(y = \sqrt{x} = x^{1/2}\\). +func Sqrt(scope *Scope, x tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Sqrt", + Input: []tf.Input{ + x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// RetrieveTPUEmbeddingMDLAdagradLightParametersAttr is an optional argument to RetrieveTPUEmbeddingMDLAdagradLightParameters. +type RetrieveTPUEmbeddingMDLAdagradLightParametersAttr func(optionalAttr) + +// RetrieveTPUEmbeddingMDLAdagradLightParametersTableId sets the optional table_id attribute to value. +// If not specified, defaults to -1 +func RetrieveTPUEmbeddingMDLAdagradLightParametersTableId(value int64) RetrieveTPUEmbeddingMDLAdagradLightParametersAttr { + return func(m optionalAttr) { + m["table_id"] = value + } +} + +// RetrieveTPUEmbeddingMDLAdagradLightParametersTableName sets the optional table_name attribute to value. +// If not specified, defaults to "" +func RetrieveTPUEmbeddingMDLAdagradLightParametersTableName(value string) RetrieveTPUEmbeddingMDLAdagradLightParametersAttr { + return func(m optionalAttr) { + m["table_name"] = value + } +} + +// RetrieveTPUEmbeddingMDLAdagradLightParametersConfig sets the optional config attribute to value. +// If not specified, defaults to "" +func RetrieveTPUEmbeddingMDLAdagradLightParametersConfig(value string) RetrieveTPUEmbeddingMDLAdagradLightParametersAttr { + return func(m optionalAttr) { + m["config"] = value + } +} + +// Retrieve MDL Adagrad Light embedding parameters. +// +// An op that retrieves optimization parameters from embedding to host +// memory. Must be preceded by a ConfigureTPUEmbeddingHost op that sets up +// the correct embedding table configuration. For example, this op is +// used to retrieve updated parameters before saving a checkpoint. +// +// Returns: +// +// parameters: Parameter parameters updated by the MDL Adagrad Light optimization algorithm. +// accumulators: Parameter accumulators updated by the MDL Adagrad Light optimization algorithm. +// weights: Parameter weights updated by the MDL Adagrad Light optimization algorithm. +// benefits: Parameter benefits updated by the MDL Adagrad Light optimization algorithm. +func RetrieveTPUEmbeddingMDLAdagradLightParameters(scope *Scope, num_shards int64, shard_id int64, optional ...RetrieveTPUEmbeddingMDLAdagradLightParametersAttr) (parameters tf.Output, accumulators tf.Output, weights tf.Output, benefits tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_shards": num_shards, "shard_id": shard_id} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "RetrieveTPUEmbeddingMDLAdagradLightParameters", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2), op.Output(3) +} + +// List of the given size with empty elements. +// +// element_shape: the shape of the future elements of the list +// num_elements: the number of elements to reserve +// handle: the output list +// element_dtype: the desired type of elements in the list. +func TensorListReserve(scope *Scope, element_shape tf.Output, num_elements tf.Output, element_dtype tf.DataType) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"element_dtype": element_dtype} + opspec := tf.OpSpec{ + Type: "TensorListReserve", + Input: []tf.Input{ + element_shape, num_elements, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes rectified linear 6 gradients for a Relu6 operation. +// +// Arguments: +// +// gradients: The backpropagated gradients to the corresponding Relu6 operation. +// features: The features passed as input to the corresponding Relu6 operation, or +// +// its output; using either one produces the same result. +// +// Returns The gradients: +// `gradients * (features > 0) * (features < 6)`. +func Relu6Grad(scope *Scope, gradients tf.Output, features tf.Output) (backprops tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Relu6Grad", + Input: []tf.Input{ + gradients, features, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Wraps the XLA DynamicSlice operator, documented at +// +// https://www.tensorflow.org/performance/xla/operation_semantics#dynamicslice +// +// . +// +// DynamicSlice extracts a sub-array from the input array at dynamic +// start_indices. The size of the slice in each dimension is passed in +// size_indices, which specify the end point of exclusive slice intervals in each +// dimension -- [start, start + size). The shape of start_indices must have rank 1, +// with dimension size equal to the rank of operand. +// +// Arguments: +// +// input: A `Tensor` of type T. +// start_indices: List of N integers containing the slice size for each +// +// dimension. Each value must be strictly greater than zero, and start + size +// must be less than or equal to the size of the dimension to avoid +// implementation defined behavior. +func XlaDynamicSlice(scope *Scope, input tf.Output, start_indices tf.Output, size_indices tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "XlaDynamicSlice", + Input: []tf.Input{ + input, start_indices, size_indices, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Interleave the values from the `data` tensors into a single tensor. +// +// # Builds a merged tensor such that +// +// ```python +// +// merged[indices[m][i, ..., j], ...] = data[m][i, ..., j, ...] +// +// ``` +// +// For example, if each `indices[m]` is scalar or vector, we have +// +// ```python +// +// # Scalar indices: +// merged[indices[m], ...] = data[m][...] +// +// # Vector indices: +// merged[indices[m][i], ...] = data[m][i, ...] +// +// ``` +// +// Each `data[i].shape` must start with the corresponding `indices[i].shape`, +// and the rest of `data[i].shape` must be constant w.r.t. `i`. That is, we +// must have `data[i].shape = indices[i].shape + constant`. In terms of this +// `constant`, the output shape is +// +// merged.shape = [max(indices)] + constant +// +// Values are merged in order, so if an index appears in both `indices[m][i]` and +// `indices[n][j]` for `(m,i) < (n,j)` the slice `data[n][j]` will appear in the +// merged result. If you do not need this guarantee, ParallelDynamicStitch might +// perform better on some devices. +// +// For example: +// +// ```python +// +// indices[0] = 6 +// indices[1] = [4, 1] +// indices[2] = [[5, 2], [0, 3]] +// data[0] = [61, 62] +// data[1] = [[41, 42], [11, 12]] +// data[2] = [[[51, 52], [21, 22]], [[1, 2], [31, 32]]] +// merged = [[1, 2], [11, 12], [21, 22], [31, 32], [41, 42], +// [51, 52], [61, 62]] +// +// ``` +// +// This method can be used to merge partitions created by `dynamic_partition` +// as illustrated on the following example: +// +// ```python +// +// # Apply function (increments x_i) on elements for which a certain condition +// # apply (x_i != -1 in this example). +// x=tf.constant([0.1, -1., 5.2, 4.3, -1., 7.4]) +// condition_mask=tf.not_equal(x,tf.constant(-1.)) +// partitioned_data = tf.dynamic_partition( +// x, tf.cast(condition_mask, tf.int32) , 2) +// partitioned_data[1] = partitioned_data[1] + 1.0 +// condition_indices = tf.dynamic_partition( +// tf.range(tf.shape(x)[0]), tf.cast(condition_mask, tf.int32) , 2) +// x = tf.dynamic_stitch(condition_indices, partitioned_data) +// # Here x=[1.1, -1., 6.2, 5.3, -1, 8.4], the -1. values remain +// # unchanged. +// +// ``` +// +//
+// +//
+func DynamicStitch(scope *Scope, indices []tf.Output, data []tf.Output) (merged tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "DynamicStitch", + Input: []tf.Input{ + tf.OutputList(indices), tf.OutputList(data), + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns the batched diagonal part of a batched tensor. +// +// This operation returns a tensor with the `diagonal` part +// of the batched `input`. The `diagonal` part is computed as follows: +// +// Assume `input` has `k` dimensions `[I, J, K, ..., M, N]`, then the output is a +// tensor of rank `k - 1` with dimensions `[I, J, K, ..., min(M, N)]` where: +// +// `diagonal[i, j, k, ..., n] = input[i, j, k, ..., n, n]`. +// +// The input must be at least a matrix. +// +// For example: +// +// ``` +// # 'input' is [[[1, 0, 0, 0] +// +// [0, 2, 0, 0] +// [0, 0, 3, 0] +// [0, 0, 0, 4]], +// [[5, 0, 0, 0] +// [0, 6, 0, 0] +// [0, 0, 7, 0] +// [0, 0, 0, 8]]] +// +// and input.shape = (2, 4, 4) +// +// tf.matrix_diag_part(input) ==> [[1, 2, 3, 4], [5, 6, 7, 8]] +// +// which has shape (2, 4) +// ``` +// +// Arguments: +// +// input: Rank `k` tensor where `k >= 2`. +// +// Returns The extracted diagonal(s) having shape +// `diagonal.shape = input.shape[:-2] + [min(input.shape[-2:])]`. +func MatrixDiagPart(scope *Scope, input tf.Output) (diagonal tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "MatrixDiagPart", + Input: []tf.Input{ + input, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes the reciprocal of x element-wise. +// +// I.e., \\(y = 1 / x\\). +func Reciprocal(scope *Scope, x tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Reciprocal", + Input: []tf.Input{ + x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Adds v into specified rows of x. +// +// Computes y = x; y[i, :] += v; return y. +// +// Arguments: +// +// x: A `Tensor` of type T. +// i: A vector. Indices into the left-most dimension of `x`. +// v: A `Tensor` of type T. Same dimension sizes as x except the first dimension, which must be the same as i's size. +// +// Returns A `Tensor` of type T. An alias of `x`. The content of `y` is undefined if there are duplicates in `i`. +func InplaceAdd(scope *Scope, x tf.Output, i tf.Output, v tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "InplaceAdd", + Input: []tf.Input{ + x, i, v, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// RetrieveTPUEmbeddingAdadeltaParametersAttr is an optional argument to RetrieveTPUEmbeddingAdadeltaParameters. +type RetrieveTPUEmbeddingAdadeltaParametersAttr func(optionalAttr) + +// RetrieveTPUEmbeddingAdadeltaParametersTableId sets the optional table_id attribute to value. +// If not specified, defaults to -1 +func RetrieveTPUEmbeddingAdadeltaParametersTableId(value int64) RetrieveTPUEmbeddingAdadeltaParametersAttr { + return func(m optionalAttr) { + m["table_id"] = value + } +} + +// RetrieveTPUEmbeddingAdadeltaParametersTableName sets the optional table_name attribute to value. +// If not specified, defaults to "" +func RetrieveTPUEmbeddingAdadeltaParametersTableName(value string) RetrieveTPUEmbeddingAdadeltaParametersAttr { + return func(m optionalAttr) { + m["table_name"] = value + } +} + +// RetrieveTPUEmbeddingAdadeltaParametersConfig sets the optional config attribute to value. +// If not specified, defaults to "" +func RetrieveTPUEmbeddingAdadeltaParametersConfig(value string) RetrieveTPUEmbeddingAdadeltaParametersAttr { + return func(m optionalAttr) { + m["config"] = value + } +} + +// Retrieve Adadelta embedding parameters. +// +// An op that retrieves optimization parameters from embedding to host +// memory. Must be preceded by a ConfigureTPUEmbeddingHost op that sets up +// the correct embedding table configuration. For example, this op is +// used to retrieve updated parameters before saving a checkpoint. +// +// Returns: +// +// parameters: Parameter parameters updated by the Adadelta optimization algorithm. +// accumulators: Parameter accumulators updated by the Adadelta optimization algorithm. +// updates: Parameter updates updated by the Adadelta optimization algorithm. +func RetrieveTPUEmbeddingAdadeltaParameters(scope *Scope, num_shards int64, shard_id int64, optional ...RetrieveTPUEmbeddingAdadeltaParametersAttr) (parameters tf.Output, accumulators tf.Output, updates tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_shards": num_shards, "shard_id": shard_id} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "RetrieveTPUEmbeddingAdadeltaParameters", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// Return a tensor with the same shape and contents as the input tensor or value. +func Identity(scope *Scope, input tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Identity", + Input: []tf.Input{ + input, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns the truth value of x OR y element-wise. +// +// *NOTE*: `LogicalOr` supports broadcasting. More about broadcasting +// [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) +func LogicalOr(scope *Scope, x tf.Output, y tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "LogicalOr", + Input: []tf.Input{ + x, y, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// QuantizedReluAttr is an optional argument to QuantizedRelu. +type QuantizedReluAttr func(optionalAttr) + +// QuantizedReluOutType sets the optional out_type attribute to value. +// If not specified, defaults to DT_QUINT8 +func QuantizedReluOutType(value tf.DataType) QuantizedReluAttr { + return func(m optionalAttr) { + m["out_type"] = value + } +} + +// Computes Quantized Rectified Linear: `max(features, 0)` +// +// Arguments: +// +// min_features: The float value that the lowest quantized value represents. +// max_features: The float value that the highest quantized value represents. +// +// Returns: +// +// activations: Has the same output shape as "features". +// min_activations: The float value that the lowest quantized value represents. +// max_activations: The float value that the highest quantized value represents. +func QuantizedRelu(scope *Scope, features tf.Output, min_features tf.Output, max_features tf.Output, optional ...QuantizedReluAttr) (activations tf.Output, min_activations tf.Output, max_activations tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "QuantizedRelu", + Input: []tf.Input{ + features, min_features, max_features, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// Adds `bias` to `value`. +// +// This is a deprecated version of BiasAdd and will be soon removed. +// +// This is a special case of `tf.add` where `bias` is restricted to be 1-D. +// Broadcasting is supported, so `value` may have any number of dimensions. +// +// Arguments: +// +// value: Any number of dimensions. +// bias: 1-D with size the last dimension of `value`. +// +// Returns Broadcasted sum of `value` and `bias`. +func BiasAddV1(scope *Scope, value tf.Output, bias tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "BiasAddV1", + Input: []tf.Input{ + value, bias, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// EnqueueTPUEmbeddingSparseBatchAttr is an optional argument to EnqueueTPUEmbeddingSparseBatch. +type EnqueueTPUEmbeddingSparseBatchAttr func(optionalAttr) + +// EnqueueTPUEmbeddingSparseBatchDeviceOrdinal sets the optional device_ordinal attribute to value. +// +// value: The TPU device to use. Should be >= 0 and less than the number +// of TPU cores in the task on which the node is placed. +// If not specified, defaults to -1 +func EnqueueTPUEmbeddingSparseBatchDeviceOrdinal(value int64) EnqueueTPUEmbeddingSparseBatchAttr { + return func(m optionalAttr) { + m["device_ordinal"] = value + } +} + +// EnqueueTPUEmbeddingSparseBatchCombiners sets the optional combiners attribute to value. +// +// value: A list of string scalars, one for each embedding table that specify +// how to normalize the embedding activations after weighted summation. +// Supported combiners are 'mean', 'sum', or 'sqrtn'. It is invalid to have +// the sum of the weights be 0 for 'mean' or the sum of the squared weights be +// 0 for 'sqrtn'. If combiners isn't passed, the default is to use 'sum' for +// all tables. +// If not specified, defaults to <> +func EnqueueTPUEmbeddingSparseBatchCombiners(value []string) EnqueueTPUEmbeddingSparseBatchAttr { + return func(m optionalAttr) { + m["combiners"] = value + } +} + +// An op that enqueues TPUEmbedding input indices from a SparseTensor. +// +// This Op eases the porting of code that uses embedding_lookup_sparse(), +// although some Python preprocessing of the SparseTensor arguments to +// embedding_lookup_sparse() is required to produce the arguments to this Op, +// since only a single EnqueueTPUEmbeddingSparseBatch Op is allowed per training +// step. +// +// The tensors at corresponding positions in the three input lists +// must have the same shape, i.e. rank 1 with dim_size() equal to the total +// number of lookups into the table described by the corresponding table_id. +// +// Arguments: +// +// sample_indices: A list of rank 1 Tensors specifying the training example and +// +// feature to which the corresponding embedding_indices and aggregation_weights +// values belong. sample_indices[i] must equal b * nf + f, where nf is the +// number of features from the corresponding table, f is in [0, nf), and +// b is in [0, batch size). +// +// embedding_indices: A list of rank 1 Tensors, indices into the embedding tables. +// aggregation_weights: A list of rank 1 Tensors containing per sample -- i.e. per +// +// (training example, feature) -- aggregation weights. +// +// mode_override: A string input that overrides the mode specified in the +// +// TPUEmbeddingConfiguration. Supported values are {'unspecified', 'inference', +// 'training', 'backward_pass_only'}. When set to 'unspecified', the mode set +// in TPUEmbeddingConfiguration is used, otherwise mode_override is used. +// +// Returns the created operation. +func EnqueueTPUEmbeddingSparseBatch(scope *Scope, sample_indices []tf.Output, embedding_indices []tf.Output, aggregation_weights []tf.Output, mode_override tf.Output, optional ...EnqueueTPUEmbeddingSparseBatchAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "EnqueueTPUEmbeddingSparseBatch", + Input: []tf.Input{ + tf.OutputList(sample_indices), tf.OutputList(embedding_indices), tf.OutputList(aggregation_weights), mode_override, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// ShuffleAndRepeatDatasetAttr is an optional argument to ShuffleAndRepeatDataset. +type ShuffleAndRepeatDatasetAttr func(optionalAttr) + +// ShuffleAndRepeatDatasetReshuffleEachIteration sets the optional reshuffle_each_iteration attribute to value. +// If not specified, defaults to true +func ShuffleAndRepeatDatasetReshuffleEachIteration(value bool) ShuffleAndRepeatDatasetAttr { + return func(m optionalAttr) { + m["reshuffle_each_iteration"] = value + } +} + +// ShuffleAndRepeatDatasetMetadata sets the optional metadata attribute to value. +// If not specified, defaults to "" +func ShuffleAndRepeatDatasetMetadata(value string) ShuffleAndRepeatDatasetAttr { + return func(m optionalAttr) { + m["metadata"] = value + } +} + +// Creates a dataset that shuffles and repeats elements from `input_dataset` +// +// pseudorandomly. +// +// Arguments: +// +// buffer_size: The number of output elements to buffer in an iterator over +// +// this dataset. Compare with the `min_after_dequeue` attr when creating a +// `RandomShuffleQueue`. +// +// seed: A scalar seed for the random number generator. If either `seed` or +// +// `seed2` is set to be non-zero, the random number generator is seeded +// by the given seed. Otherwise, a random seed is used. +// +// seed2: A second scalar seed to avoid seed collision. +// count: A scalar representing the number of times the underlying dataset +// +// should be repeated. The default is `-1`, which results in infinite repetition. +func ShuffleAndRepeatDataset(scope *Scope, input_dataset tf.Output, buffer_size tf.Output, seed tf.Output, seed2 tf.Output, count tf.Output, output_types []tf.DataType, output_shapes []tf.Shape, optional ...ShuffleAndRepeatDatasetAttr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ShuffleAndRepeatDataset", + Input: []tf.Input{ + input_dataset, buffer_size, seed, seed2, count, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns the next representable value of `x1` in the direction of `x2`, element-wise. +// +// This operation returns the same result as the C++ std::nextafter function. +// +// It can also return a subnormal number. +// +// @compatibility(cpp) +// Equivalent to C++ std::nextafter function. +// @end_compatibility +func NextAfter(scope *Scope, x1 tf.Output, x2 tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "NextAfter", + Input: []tf.Input{ + x1, x2, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Helper used to compute the gradient for `RaggedTensorToVariant`. +// +// Computes the gradient for the dense_values input to the RaggedTensorToVariant +// op, given the variant-encoded ragged gradients of the outputs, along with +// the outer row-splits and the shape of the dense-values that were provided as +// inputs to the RaggedTensorToVariant op. +// +// Arguments: +// +// encoded_ragged_grad: A `variant` Tensor containing encoded `RaggedTensor` gradients. +// row_splits: Outermost row-splits that were used as input to the RaggedTensorToVariant op. +// dense_values_shape: Shape of the dense_values that was used as an input to the +// +// RaggedTensorToVariant op. +// +// Returns Gradient for the dense_values of the RaggedTensorToVariant op. +func RaggedTensorToVariantGradient(scope *Scope, encoded_ragged_grad tf.Output, row_splits tf.Output, dense_values_shape tf.Output, Tvalues tf.DataType) (dense_values_grad tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"Tvalues": Tvalues} + opspec := tf.OpSpec{ + Type: "RaggedTensorToVariantGradient", + Input: []tf.Input{ + encoded_ragged_grad, row_splits, dense_values_shape, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Performs gradient updates of embedding tables. +// +// Arguments: +// +// inputs: A TensorList of gradients with which to update embedding tables. +// +// This argument has the same length and shapes as the return value of +// RecvTPUEmbeddingActivations, but contains gradients of the model's loss +// with respect to the embedding activations. The embedding tables are updated +// from these gradients via the optimizer specified in the TPU embedding +// configuration given to tpu.initialize_system. +// +// learning_rates: A TensorList of float32 scalars, one for each dynamic learning +// +// rate tag: see the comments in +// //third_party/tensorflow/core/protobuf/tpu/optimization_parameters.proto. +// Multiple tables can share the same dynamic learning rate tag as specified +// in the configuration. If the learning rates for all tables are constant, +// this list should be empty. +// +// config: Serialized TPUEmbeddingConfiguration proto. +// +// Returns the created operation. +func SendTPUEmbeddingGradients(scope *Scope, inputs []tf.Output, learning_rates []tf.Output, config string) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"config": config} + opspec := tf.OpSpec{ + Type: "SendTPUEmbeddingGradients", + Input: []tf.Input{ + tf.OutputList(inputs), tf.OutputList(learning_rates), + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// TPUPartitionedOutputAttr is an optional argument to TPUPartitionedOutput. +type TPUPartitionedOutputAttr func(optionalAttr) + +// TPUPartitionedOutputPartitionDim sets the optional partition_dim attribute to value. +// +// value: An integer describles which dimension is partitioned. +// If not specified, defaults to 0 +func TPUPartitionedOutputPartitionDim(value int64) TPUPartitionedOutputAttr { + return func(m optionalAttr) { + m["partition_dim"] = value + } +} + +// An op that demultiplexes a tensor to be sharded by XLA to a list of partitioned +// +// outputs outside the XLA computation. +// +// Arguments: +// +// inputs: A tensor which represents the full shape of partitioned tensors. +// +// Returns A list of partitioned inputs which must have the same shape. +func TPUPartitionedOutput(scope *Scope, inputs tf.Output, num_splits int64, optional ...TPUPartitionedOutputAttr) (output []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_splits": num_splits} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "TPUPartitionedOutput", + Input: []tf.Input{ + inputs, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if output, idx, err = makeOutputList(op, idx, "output"); err != nil { + scope.UpdateErr("TPUPartitionedOutput", err) + return + } + return output +} + +// Returns the element-wise max of two SparseTensors. +// +// Assumes the two SparseTensors have the same shape, i.e., no broadcasting. +// +// Arguments: +// +// a_indices: 2-D. `N x R` matrix with the indices of non-empty values in a +// +// SparseTensor, in the canonical lexicographic ordering. +// +// a_values: 1-D. `N` non-empty values corresponding to `a_indices`. +// a_shape: 1-D. Shape of the input SparseTensor. +// b_indices: counterpart to `a_indices` for the other operand. +// b_values: counterpart to `a_values` for the other operand; must be of the same dtype. +// b_shape: counterpart to `a_shape` for the other operand; the two shapes must be equal. +// +// Returns: +// +// output_indices: 2-D. The indices of the output SparseTensor. +// output_values: 1-D. The values of the output SparseTensor. +func SparseSparseMaximum(scope *Scope, a_indices tf.Output, a_values tf.Output, a_shape tf.Output, b_indices tf.Output, b_values tf.Output, b_shape tf.Output) (output_indices tf.Output, output_values tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "SparseSparseMaximum", + Input: []tf.Input{ + a_indices, a_values, a_shape, b_indices, b_values, b_shape, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// Computes hyperbolic cosine of x element-wise. +// +// Given an input tensor, this function computes hyperbolic cosine of every +// element in the tensor. Input range is `[-inf, inf]` and output range +// is `[1, inf]`. +// +// ```python +// x = tf.constant([-float("inf"), -9, -0.5, 1, 1.2, 2, 10, float("inf")]) +// tf.math.cosh(x) ==> [inf 4.0515420e+03 1.1276259e+00 1.5430807e+00 1.8106556e+00 3.7621956e+00 1.1013233e+04 inf] +// ``` +func Cosh(scope *Scope, x tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Cosh", + Input: []tf.Input{ + x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Conv3DAttr is an optional argument to Conv3D. +type Conv3DAttr func(optionalAttr) + +// Conv3DDataFormat sets the optional data_format attribute to value. +// +// value: The data format of the input and output data. With the +// default format "NDHWC", the data is stored in the order of: +// +// [batch, in_depth, in_height, in_width, in_channels]. +// +// Alternatively, the format could be "NCDHW", the data storage order is: +// +// [batch, in_channels, in_depth, in_height, in_width]. +// +// If not specified, defaults to "NDHWC" +func Conv3DDataFormat(value string) Conv3DAttr { + return func(m optionalAttr) { + m["data_format"] = value + } +} + +// Conv3DDilations sets the optional dilations attribute to value. +// +// value: 1-D tensor of length 5. The dilation factor for each dimension of +// `input`. If set to k > 1, there will be k-1 skipped cells between each +// filter element on that dimension. The dimension order is determined by the +// value of `data_format`, see above for details. Dilations in the batch and +// depth dimensions must be 1. +// If not specified, defaults to +func Conv3DDilations(value []int64) Conv3DAttr { + return func(m optionalAttr) { + m["dilations"] = value + } +} + +// Computes a 3-D convolution given 5-D `input` and `filter` tensors. +// +// In signal processing, cross-correlation is a measure of similarity of +// two waveforms as a function of a time-lag applied to one of them. This +// is also known as a sliding dot product or sliding inner-product. +// +// Our Conv3D implements a form of cross-correlation. +// +// Arguments: +// +// input: Shape `[batch, in_depth, in_height, in_width, in_channels]`. +// filter: Shape `[filter_depth, filter_height, filter_width, in_channels, +// +// out_channels]`. `in_channels` must match between `input` and `filter`. +// +// strides: 1-D tensor of length 5. The stride of the sliding window for each +// +// dimension of `input`. Must have `strides[0] = strides[4] = 1`. +// +// padding: The type of padding algorithm to use. +func Conv3D(scope *Scope, input tf.Output, filter tf.Output, strides []int64, padding string, optional ...Conv3DAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"strides": strides, "padding": padding} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Conv3D", + Input: []tf.Input{ + input, filter, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// DestroyResourceOpAttr is an optional argument to DestroyResourceOp. +type DestroyResourceOpAttr func(optionalAttr) + +// DestroyResourceOpIgnoreLookupError sets the optional ignore_lookup_error attribute to value. +// +// value: whether to ignore the error when the resource +// doesn't exist. +// If not specified, defaults to true +func DestroyResourceOpIgnoreLookupError(value bool) DestroyResourceOpAttr { + return func(m optionalAttr) { + m["ignore_lookup_error"] = value + } +} + +// Deletes the resource specified by the handle. +// +// All subsequent operations using the resource will result in a NotFound +// error status. +// +// Arguments: +// +// resource: handle to the resource to delete. +// +// Returns the created operation. +func DestroyResourceOp(scope *Scope, resource tf.Output, optional ...DestroyResourceOpAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "DestroyResourceOp", + Input: []tf.Input{ + resource, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// Updates the accumulator with a new value for global_step. +// +// Logs warning if the accumulator's value is already higher than +// new_global_step. +// +// Arguments: +// +// handle: The handle to an accumulator. +// new_global_step: The new global_step value to set. +// +// Returns the created operation. +func ResourceAccumulatorSetGlobalStep(scope *Scope, handle tf.Output, new_global_step tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "ResourceAccumulatorSetGlobalStep", + Input: []tf.Input{ + handle, new_global_step, + }, + } + return scope.AddOperation(opspec) +} + +// SparseSegmentSqrtNWithNumSegmentsAttr is an optional argument to SparseSegmentSqrtNWithNumSegments. +type SparseSegmentSqrtNWithNumSegmentsAttr func(optionalAttr) + +// SparseSegmentSqrtNWithNumSegmentsSparseGradient sets the optional sparse_gradient attribute to value. +// If not specified, defaults to false +func SparseSegmentSqrtNWithNumSegmentsSparseGradient(value bool) SparseSegmentSqrtNWithNumSegmentsAttr { + return func(m optionalAttr) { + m["sparse_gradient"] = value + } +} + +// Computes the sum along sparse segments of a tensor divided by the sqrt of N. +// +// N is the size of the segment being reduced. +// +// Like `SparseSegmentSqrtN`, but allows missing ids in `segment_ids`. If an id is +// missing, the `output` tensor at that position will be zeroed. +// +// Read +// [the section on segmentation](https://tensorflow.org/api_docs/python/tf/math#Segmentation) +// for an explanation of segments. +// +// Arguments: +// +// indices: A 1-D tensor. Has same rank as `segment_ids`. +// segment_ids: A 1-D tensor. Values should be sorted and can be repeated. +// num_segments: Should equal the number of distinct segment IDs. +// +// Returns Has same shape as data, except for dimension 0 which +// has size `k`, the number of segments. +func SparseSegmentSqrtNWithNumSegments(scope *Scope, data tf.Output, indices tf.Output, segment_ids tf.Output, num_segments tf.Output, optional ...SparseSegmentSqrtNWithNumSegmentsAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "SparseSegmentSqrtNWithNumSegments", + Input: []tf.Input{ + data, indices, segment_ids, num_segments, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Creates a dataset that changes the batch size. +// +// Creates a dataset that rebatches elements from `input_dataset` into new batch +// sizes. +// +// Arguments: +// +// input_dataset: A variant tensor representing the input dataset. +// batch_sizes: A vector of integers representing the size of batches to produce. These values +// +// are cycled through in order. +func RebatchDatasetV2(scope *Scope, input_dataset tf.Output, batch_sizes tf.Output, drop_remainder tf.Output, output_types []tf.DataType, output_shapes []tf.Shape) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + opspec := tf.OpSpec{ + Type: "RebatchDatasetV2", + Input: []tf.Input{ + input_dataset, batch_sizes, drop_remainder, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Converts the quantized `input` tensor into a lower-precision `output`. +// +// Converts the quantized `input` tensor into a lower-precision `output`, using the +// output range specified with `requested_output_min` and `requested_output_max`. +// +// `[input_min, input_max]` are scalar floats that specify the range for the float +// interpretation of the `input` data. For example, if `input_min` is -1.0f and +// `input_max` is 1.0f, and we are dealing with `quint16` quantized data, then a 0 +// value in the 16-bit data should be interpreted as -1.0f, and a 65535 means 1.0f. +// +// Arguments: +// +// input_min: The float value that the minimum quantized input value represents. +// input_max: The float value that the maximum quantized input value represents. +// requested_output_min: The float value that the minimum quantized output value represents. +// requested_output_max: The float value that the maximum quantized output value represents. +// out_type: The type of the output. Should be a lower bit depth than Tinput. +// +// Returns: +// +// output +// output_min: The requested_output_min value is copied into this output. +// output_max: The requested_output_max value is copied into this output. +func Requantize(scope *Scope, input tf.Output, input_min tf.Output, input_max tf.Output, requested_output_min tf.Output, requested_output_max tf.Output, out_type tf.DataType) (output tf.Output, output_min tf.Output, output_max tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"out_type": out_type} + opspec := tf.OpSpec{ + Type: "Requantize", + Input: []tf.Input{ + input, input_min, input_max, requested_output_min, requested_output_max, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// Computes gradients for SparseSegmentMean. +// +// Returns tensor "output" with same shape as grad, except for dimension 0 whose +// value is output_dim0. +// +// Arguments: +// +// grad: gradient propagated to the SparseSegmentMean op. +// indices: indices passed to the corresponding SparseSegmentMean op. +// segment_ids: segment_ids passed to the corresponding SparseSegmentMean op. +// output_dim0: dimension 0 of "data" passed to SparseSegmentMean op. +func SparseSegmentMeanGrad(scope *Scope, grad tf.Output, indices tf.Output, segment_ids tf.Output, output_dim0 tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "SparseSegmentMeanGrad", + Input: []tf.Input{ + grad, indices, segment_ids, output_dim0, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Writes the given dataset to the given file using the TFRecord format. +// +// Arguments: +// +// input_dataset: A variant tensor representing the dataset to write. +// filename: A scalar string tensor representing the filename to use. +// compression_type: A scalar string tensor containing either (i) the empty string (no +// +// compression), (ii) "ZLIB", or (iii) "GZIP". +// +// Returns the created operation. +func DatasetToTFRecord(scope *Scope, input_dataset tf.Output, filename tf.Output, compression_type tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "DatasetToTFRecord", + Input: []tf.Input{ + input_dataset, filename, compression_type, + }, + } + return scope.AddOperation(opspec) +} + +// PrelinearizeAttr is an optional argument to Prelinearize. +type PrelinearizeAttr func(optionalAttr) + +// PrelinearizeShape sets the optional shape attribute to value. +// +// value: The shape of the tensor. +// If not specified, defaults to <> +func PrelinearizeShape(value tf.Shape) PrelinearizeAttr { + return func(m optionalAttr) { + m["shape"] = value + } +} + +// PrelinearizeLayout sets the optional layout attribute to value. +// +// value: A vector holding the requested layout in minor-to-major sequence. If a layout +// attribute is passed but its values are all -1 the layout will be computed by +// the infeed operation. +// If not specified, defaults to <> +func PrelinearizeLayout(value []int64) PrelinearizeAttr { + return func(m optionalAttr) { + m["layout"] = value + } +} + +// An op which linearizes one Tensor value to an opaque variant tensor. +// +// Arguments: +// +// input: A tensor that will be linearized. +func Prelinearize(scope *Scope, input tf.Output, optional ...PrelinearizeAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Prelinearize", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Greedily selects a subset of bounding boxes in descending order of score, +// +// pruning away boxes that have high intersection-over-union (IOU) overlap +// with previously selected boxes. Bounding boxes are supplied as +// [y1, x1, y2, x2], where (y1, x1) and (y2, x2) are the coordinates of any +// diagonal pair of box corners and the coordinates can be provided as normalized +// (i.e., lying in the interval [0, 1]) or absolute. Note that this algorithm +// is agnostic to where the origin is in the coordinate system. Note that this +// algorithm is invariant to orthogonal transformations and translations +// of the coordinate system; thus translating or reflections of the coordinate +// system result in the same boxes being selected by the algorithm. +// +// The output of this operation is a set of integers indexing into the input +// collection of bounding boxes representing the selected boxes. The bounding +// box coordinates corresponding to the selected indices can then be obtained +// using the `tf.gather operation`. For example: +// +// selected_indices = tf.image.non_max_suppression_v2( +// boxes, scores, max_output_size, iou_threshold) +// selected_boxes = tf.gather(boxes, selected_indices) +// +// Arguments: +// +// boxes: A 2-D float tensor of shape `[num_boxes, 4]`. +// scores: A 1-D float tensor of shape `[num_boxes]` representing a single +// +// score corresponding to each box (each row of boxes). +// +// max_output_size: A scalar integer tensor representing the maximum number of +// +// boxes to be selected by non max suppression. +// +// iou_threshold: A 0-D float tensor representing the threshold for deciding whether +// +// boxes overlap too much with respect to IOU. +// +// Returns A 1-D integer tensor of shape `[M]` representing the selected +// indices from the boxes tensor, where `M <= max_output_size`. +func NonMaxSuppressionV2(scope *Scope, boxes tf.Output, scores tf.Output, max_output_size tf.Output, iou_threshold tf.Output) (selected_indices tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "NonMaxSuppressionV2", + Input: []tf.Input{ + boxes, scores, max_output_size, iou_threshold, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// SparseSegmentSqrtNAttr is an optional argument to SparseSegmentSqrtN. +type SparseSegmentSqrtNAttr func(optionalAttr) + +// SparseSegmentSqrtNSparseGradient sets the optional sparse_gradient attribute to value. +// If not specified, defaults to false +func SparseSegmentSqrtNSparseGradient(value bool) SparseSegmentSqrtNAttr { + return func(m optionalAttr) { + m["sparse_gradient"] = value + } +} + +// Computes the sum along sparse segments of a tensor divided by the sqrt of N. +// +// N is the size of the segment being reduced. +// +// See `tf.sparse.segment_sum` for usage examples. +// +// Arguments: +// +// indices: A 1-D tensor. Has same rank as `segment_ids`. +// segment_ids: A 1-D tensor. Values should be sorted and can be repeated. +// +// Returns Has same shape as data, except for dimension 0 which +// has size `k`, the number of segments. +func SparseSegmentSqrtN(scope *Scope, data tf.Output, indices tf.Output, segment_ids tf.Output, optional ...SparseSegmentSqrtNAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "SparseSegmentSqrtN", + Input: []tf.Input{ + data, indices, segment_ids, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// TFRecordReaderV2Attr is an optional argument to TFRecordReaderV2. +type TFRecordReaderV2Attr func(optionalAttr) + +// TFRecordReaderV2Container sets the optional container attribute to value. +// +// value: If non-empty, this reader is placed in the given container. +// Otherwise, a default container is used. +// If not specified, defaults to "" +func TFRecordReaderV2Container(value string) TFRecordReaderV2Attr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// TFRecordReaderV2SharedName sets the optional shared_name attribute to value. +// +// value: If non-empty, this reader is named in the given bucket +// with this shared_name. Otherwise, the node name is used instead. +// If not specified, defaults to "" +func TFRecordReaderV2SharedName(value string) TFRecordReaderV2Attr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// TFRecordReaderV2CompressionType sets the optional compression_type attribute to value. +// If not specified, defaults to "" +func TFRecordReaderV2CompressionType(value string) TFRecordReaderV2Attr { + return func(m optionalAttr) { + m["compression_type"] = value + } +} + +// A Reader that outputs the records from a TensorFlow Records file. +// +// Returns The handle to reference the Reader. +func TFRecordReaderV2(scope *Scope, optional ...TFRecordReaderV2Attr) (reader_handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "TFRecordReaderV2", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// DebugNanCountAttr is an optional argument to DebugNanCount. +type DebugNanCountAttr func(optionalAttr) + +// DebugNanCountDeviceName sets the optional device_name attribute to value. +// If not specified, defaults to "" +func DebugNanCountDeviceName(value string) DebugNanCountAttr { + return func(m optionalAttr) { + m["device_name"] = value + } +} + +// DebugNanCountTensorName sets the optional tensor_name attribute to value. +// +// value: Name of the input tensor. +// If not specified, defaults to "" +func DebugNanCountTensorName(value string) DebugNanCountAttr { + return func(m optionalAttr) { + m["tensor_name"] = value + } +} + +// DebugNanCountDebugUrls sets the optional debug_urls attribute to value. +// +// value: List of URLs to debug targets, e.g., +// +// file:///foo/tfdbg_dump, grpc:://localhost:11011. +// +// If not specified, defaults to <> +func DebugNanCountDebugUrls(value []string) DebugNanCountAttr { + return func(m optionalAttr) { + m["debug_urls"] = value + } +} + +// DebugNanCountGatedGrpc sets the optional gated_grpc attribute to value. +// +// value: Whether this op will be gated. If any of the debug_urls of this +// +// debug node is of the grpc:// scheme, when the value of this attribute is set +// to True, the data will not actually be sent via the grpc stream unless this +// debug op has been enabled at the debug_url. If all of the debug_urls of this +// debug node are of the grpc:// scheme and the debug op is enabled at none of +// them, the output will be an empty Tensor. +// +// If not specified, defaults to false +func DebugNanCountGatedGrpc(value bool) DebugNanCountAttr { + return func(m optionalAttr) { + m["gated_grpc"] = value + } +} + +// Debug NaN Value Counter Op. +// +// Counts number of NaNs in the input tensor, for debugging. +// +// Arguments: +// +// input: Input tensor, non-Reference type. +func DebugNanCount(scope *Scope, input tf.Output, optional ...DebugNanCountAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "DebugNanCount", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Fills empty rows in the input 2-D `SparseTensor` with a default value. +// +// The input `SparseTensor` is represented via the tuple of inputs +// (`indices`, `values`, `dense_shape`). The output `SparseTensor` has the +// same `dense_shape` but with indices `output_indices` and values +// `output_values`. +// +// This op inserts a single entry for every row that doesn't have any values. +// The index is created as `[row, 0, ..., 0]` and the inserted value +// is `default_value`. +// +// For example, suppose `sp_input` has shape `[5, 6]` and non-empty values: +// +// [0, 1]: a +// [0, 3]: b +// [2, 0]: c +// [3, 1]: d +// +// Rows 1 and 4 are empty, so the output will be of shape `[5, 6]` with values: +// +// [0, 1]: a +// [0, 3]: b +// [1, 0]: default_value +// [2, 0]: c +// [3, 1]: d +// [4, 0]: default_value +// +// The output `SparseTensor` will be in row-major order and will have the +// same shape as the input. +// +// This op also returns an indicator vector shaped `[dense_shape[0]]` such that +// +// empty_row_indicator[i] = True iff row i was an empty row. +// +// And a reverse index map vector shaped `[indices.shape[0]]` that is used during +// backpropagation, +// +// reverse_index_map[j] = out_j s.t. indices[j, :] == output_indices[out_j, :] +// +// Arguments: +// +// indices: 2-D. the indices of the sparse tensor. +// values: 1-D. the values of the sparse tensor. +// dense_shape: 1-D. the shape of the sparse tensor. +// default_value: 0-D. default value to insert into location `[row, 0, ..., 0]` +// for rows missing from the input sparse tensor. +// +// output indices: 2-D. the indices of the filled sparse tensor. +// +// Returns: +// +// output_indices +// output_values: 1-D. the values of the filled sparse tensor. +// empty_row_indicator: 1-D. whether the dense row was missing in the +// +// input sparse tensor. +// +// reverse_index_map: 1-D. a map from the input indices to the output indices. +func SparseFillEmptyRows(scope *Scope, indices tf.Output, values tf.Output, dense_shape tf.Output, default_value tf.Output) (output_indices tf.Output, output_values tf.Output, empty_row_indicator tf.Output, reverse_index_map tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "SparseFillEmptyRows", + Input: []tf.Input{ + indices, values, dense_shape, default_value, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2), op.Output(3) +} + +// Records the bytes size of each element of `input_dataset` in a StatsAggregator. +func ExperimentalBytesProducedStatsDataset(scope *Scope, input_dataset tf.Output, tag tf.Output, output_types []tf.DataType, output_shapes []tf.Shape) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + opspec := tf.OpSpec{ + Type: "ExperimentalBytesProducedStatsDataset", + Input: []tf.Input{ + input_dataset, tag, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ResourceApplyAdagradDAAttr is an optional argument to ResourceApplyAdagradDA. +type ResourceApplyAdagradDAAttr func(optionalAttr) + +// ResourceApplyAdagradDAUseLocking sets the optional use_locking attribute to value. +// +// value: If True, updating of the var and accum tensors will be protected by +// a lock; otherwise the behavior is undefined, but may exhibit less contention. +// If not specified, defaults to false +func ResourceApplyAdagradDAUseLocking(value bool) ResourceApplyAdagradDAAttr { + return func(m optionalAttr) { + m["use_locking"] = value + } +} + +// Update '*var' according to the proximal adagrad scheme. +// +// Arguments: +// +// var_: Should be from a Variable(). +// gradient_accumulator: Should be from a Variable(). +// gradient_squared_accumulator: Should be from a Variable(). +// grad: The gradient. +// lr: Scaling factor. Must be a scalar. +// l1: L1 regularization. Must be a scalar. +// l2: L2 regularization. Must be a scalar. +// global_step: Training step number. Must be a scalar. +// +// Returns the created operation. +func ResourceApplyAdagradDA(scope *Scope, var_ tf.Output, gradient_accumulator tf.Output, gradient_squared_accumulator tf.Output, grad tf.Output, lr tf.Output, l1 tf.Output, l2 tf.Output, global_step tf.Output, optional ...ResourceApplyAdagradDAAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ResourceApplyAdagradDA", + Input: []tf.Input{ + var_, gradient_accumulator, gradient_squared_accumulator, grad, lr, l1, l2, global_step, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// Runs multiple additive regression ensemble predictors on input instances and +// +// computes the update to cached logits. It is designed to be used during training. +// It traverses the trees starting from cached tree id and cached node id and +// calculates the updates to be pushed to the cache. +// +// Arguments: +// +// cached_tree_ids: Rank 1 Tensor containing cached tree ids which is the starting +// +// tree of prediction. +// +// cached_node_ids: Rank 1 Tensor containing cached node id which is the starting +// +// node of prediction. +// +// bucketized_features: A list of rank 1 Tensors containing bucket id for each +// +// feature. +// +// logits_dimension: scalar, dimension of the logits, to be used for partial logits +// +// shape. +// +// Returns: +// +// partial_logits: Rank 2 Tensor containing logits update (with respect to cached +// +// values stored) for each example. +// +// tree_ids: Rank 1 Tensor containing new tree ids for each example. +// node_ids: Rank 1 Tensor containing new node ids in the new tree_ids. +func BoostedTreesTrainingPredict(scope *Scope, tree_ensemble_handle tf.Output, cached_tree_ids tf.Output, cached_node_ids tf.Output, bucketized_features []tf.Output, logits_dimension int64) (partial_logits tf.Output, tree_ids tf.Output, node_ids tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"logits_dimension": logits_dimension} + opspec := tf.OpSpec{ + Type: "BoostedTreesTrainingPredict", + Input: []tf.Input{ + tree_ensemble_handle, cached_tree_ids, cached_node_ids, tf.OutputList(bucketized_features), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// ResizeNearestNeighborGradAttr is an optional argument to ResizeNearestNeighborGrad. +type ResizeNearestNeighborGradAttr func(optionalAttr) + +// ResizeNearestNeighborGradAlignCorners sets the optional align_corners attribute to value. +// +// value: If true, the centers of the 4 corner pixels of the input and grad tensors are +// aligned. Defaults to false. +// If not specified, defaults to false +func ResizeNearestNeighborGradAlignCorners(value bool) ResizeNearestNeighborGradAttr { + return func(m optionalAttr) { + m["align_corners"] = value + } +} + +// ResizeNearestNeighborGradHalfPixelCenters sets the optional half_pixel_centers attribute to value. +// If not specified, defaults to false +func ResizeNearestNeighborGradHalfPixelCenters(value bool) ResizeNearestNeighborGradAttr { + return func(m optionalAttr) { + m["half_pixel_centers"] = value + } +} + +// Computes the gradient of nearest neighbor interpolation. +// +// Arguments: +// +// grads: 4-D with shape `[batch, height, width, channels]`. +// size: = A 1-D int32 Tensor of 2 elements: `orig_height, orig_width`. The +// +// original input size. +// +// Returns 4-D with shape `[batch, orig_height, orig_width, channels]`. Gradients +// with respect to the input image. +func ResizeNearestNeighborGrad(scope *Scope, grads tf.Output, size tf.Output, optional ...ResizeNearestNeighborGradAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ResizeNearestNeighborGrad", + Input: []tf.Input{ + grads, size, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// MaxPool3DGradAttr is an optional argument to MaxPool3DGrad. +type MaxPool3DGradAttr func(optionalAttr) + +// MaxPool3DGradDataFormat sets the optional data_format attribute to value. +// +// value: The data format of the input and output data. With the +// default format "NDHWC", the data is stored in the order of: +// +// [batch, in_depth, in_height, in_width, in_channels]. +// +// Alternatively, the format could be "NCDHW", the data storage order is: +// +// [batch, in_channels, in_depth, in_height, in_width]. +// +// If not specified, defaults to "NDHWC" +func MaxPool3DGradDataFormat(value string) MaxPool3DGradAttr { + return func(m optionalAttr) { + m["data_format"] = value + } +} + +// Computes gradients of 3D max pooling function. +// +// Arguments: +// +// orig_input: The original input tensor. +// orig_output: The original output tensor. +// grad: Output backprop of shape `[batch, depth, rows, cols, channels]`. +// ksize: 1-D tensor of length 5. The size of the window for each dimension of +// +// the input tensor. Must have `ksize[0] = ksize[4] = 1`. +// +// strides: 1-D tensor of length 5. The stride of the sliding window for each +// +// dimension of `input`. Must have `strides[0] = strides[4] = 1`. +// +// padding: The type of padding algorithm to use. +func MaxPool3DGrad(scope *Scope, orig_input tf.Output, orig_output tf.Output, grad tf.Output, ksize []int64, strides []int64, padding string, optional ...MaxPool3DGradAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"ksize": ksize, "strides": strides, "padding": padding} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "MaxPool3DGrad", + Input: []tf.Input{ + orig_input, orig_output, grad, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// TPUPartitionedInputAttr is an optional argument to TPUPartitionedInput. +type TPUPartitionedInputAttr func(optionalAttr) + +// TPUPartitionedInputPartitionDim sets the optional partition_dim attribute to value. +// +// value: An integer describles which dimension is partitioned. -1 means +// those inputs are replicated. +// If not specified, defaults to 0 +func TPUPartitionedInputPartitionDim(value int64) TPUPartitionedInputAttr { + return func(m optionalAttr) { + m["partition_dim"] = value + } +} + +// An op that groups a list of partitioned inputs together. This op +// +// Arguments: +// +// inputs: A list of partitioned inputs which must have the same shape. +// +// Returns A handle which represents the full shape of partitioned tensors. +func TPUPartitionedInput(scope *Scope, inputs []tf.Output, optional ...TPUPartitionedInputAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "TPUPartitionedInput", + Input: []tf.Input{ + tf.OutputList(inputs), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Adds Tensor 'bias' to Tensor 'input' for Quantized types. +// +// Broadcasts the values of bias on dimensions 0..N-2 of 'input'. +// +// Arguments: +// +// bias: A 1D bias Tensor with size matching the last dimension of 'input'. +// min_input: The float value that the lowest quantized input value represents. +// max_input: The float value that the highest quantized input value represents. +// min_bias: The float value that the lowest quantized bias value represents. +// max_bias: The float value that the highest quantized bias value represents. +// +// Returns: +// +// output +// min_out: The float value that the lowest quantized output value represents. +// max_out: The float value that the highest quantized output value represents. +func QuantizedBiasAdd(scope *Scope, input tf.Output, bias tf.Output, min_input tf.Output, max_input tf.Output, min_bias tf.Output, max_bias tf.Output, out_type tf.DataType) (output tf.Output, min_out tf.Output, max_out tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"out_type": out_type} + opspec := tf.OpSpec{ + Type: "QuantizedBiasAdd", + Input: []tf.Input{ + input, bias, min_input, max_input, min_bias, max_bias, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// Pads a tensor with mirrored values. +// +// This operation pads a `input` with mirrored values according to the `paddings` +// you specify. `paddings` is an integer tensor with shape `[n, 2]`, where n is +// the rank of `input`. For each dimension D of `input`, `paddings[D, 0]` indicates +// how many values to add before the contents of `input` in that dimension, and +// `paddings[D, 1]` indicates how many values to add after the contents of `input` +// in that dimension. Both `paddings[D, 0]` and `paddings[D, 1]` must be no greater +// than `input.dim_size(D)` (or `input.dim_size(D) - 1`) if `copy_border` is true +// (if false, respectively). +// +// The padded size of each dimension D of the output is: +// +// `paddings(D, 0) + input.dim_size(D) + paddings(D, 1)` +// +// For example: +// +// ``` +// # 't' is [[1, 2, 3], [4, 5, 6]]. +// # 'paddings' is [[1, 1]], [2, 2]]. +// # 'mode' is SYMMETRIC. +// # rank of 't' is 2. +// pad(t, paddings) ==> [[2, 1, 1, 2, 3, 3, 2] +// +// [2, 1, 1, 2, 3, 3, 2] +// [5, 4, 4, 5, 6, 6, 5] +// [5, 4, 4, 5, 6, 6, 5]] +// +// ``` +// +// Arguments: +// +// input: The input tensor to be padded. +// paddings: A two-column matrix specifying the padding sizes. The number of +// +// rows must be the same as the rank of `input`. +// +// mode: Either `REFLECT` or `SYMMETRIC`. In reflect mode the padded regions +// +// do not include the borders, while in symmetric mode the padded regions +// do include the borders. For example, if `input` is `[1, 2, 3]` and `paddings` +// is `[0, 2]`, then the output is `[1, 2, 3, 2, 1]` in reflect mode, and +// it is `[1, 2, 3, 3, 2]` in symmetric mode. +// +// Returns The padded tensor. +func MirrorPad(scope *Scope, input tf.Output, paddings tf.Output, mode string) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"mode": mode} + opspec := tf.OpSpec{ + Type: "MirrorPad", + Input: []tf.Input{ + input, paddings, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes the Eigen Decomposition of a batch of square self-adjoint matrices. +// +// DEPRECATED at GraphDef version 11: Use SelfAdjointEigV2 instead. +// +// The input is a tensor of shape `[..., M, M]` whose inner-most 2 dimensions +// form square matrices, with the same constraints as the single matrix +// SelfAdjointEig. +// +// The result is a [..., M+1, M] matrix with [..., 0,:] containing the +// eigenvalues, and subsequent [...,1:, :] containing the eigenvectors. The eigenvalues +// are sorted in non-decreasing order. +// +// Arguments: +// +// input: Shape is `[..., M, M]`. +// +// Returns Shape is `[..., M+1, M]`. +func SelfAdjointEig(scope *Scope, input tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "SelfAdjointEig", + Input: []tf.Input{ + input, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// DecodeWavAttr is an optional argument to DecodeWav. +type DecodeWavAttr func(optionalAttr) + +// DecodeWavDesiredChannels sets the optional desired_channels attribute to value. +// +// value: Number of sample channels wanted. +// If not specified, defaults to -1 +func DecodeWavDesiredChannels(value int64) DecodeWavAttr { + return func(m optionalAttr) { + m["desired_channels"] = value + } +} + +// DecodeWavDesiredSamples sets the optional desired_samples attribute to value. +// +// value: Length of audio requested. +// If not specified, defaults to -1 +func DecodeWavDesiredSamples(value int64) DecodeWavAttr { + return func(m optionalAttr) { + m["desired_samples"] = value + } +} + +// Decode a 16-bit PCM WAV file to a float tensor. +// +// The -32768 to 32767 signed 16-bit values will be scaled to -1.0 to 1.0 in float. +// +// When desired_channels is set, if the input contains fewer channels than this +// then the last channel will be duplicated to give the requested number, else if +// the input has more channels than requested then the additional channels will be +// ignored. +// +// If desired_samples is set, then the audio will be cropped or padded with zeroes +// to the requested length. +// +// The first output contains a Tensor with the content of the audio samples. The +// lowest dimension will be the number of channels, and the second will be the +// number of samples. For example, a ten-sample-long stereo WAV file should give an +// output shape of [10, 2]. +// +// Arguments: +// +// contents: The WAV-encoded audio, usually from a file. +// +// Returns: +// +// audio: 2-D with shape `[length, channels]`. +// sample_rate: Scalar holding the sample rate found in the WAV header. +func DecodeWav(scope *Scope, contents tf.Output, optional ...DecodeWavAttr) (audio tf.Output, sample_rate tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "DecodeWav", + Input: []tf.Input{ + contents, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// Get the current size of the TensorArray. +// +// Arguments: +// +// handle: The handle to a TensorArray (output of TensorArray or TensorArrayGrad). +// flow_in: A float scalar that enforces proper chaining of operations. +// +// Returns The current size of the TensorArray. +func TensorArraySizeV3(scope *Scope, handle tf.Output, flow_in tf.Output) (size tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "TensorArraySizeV3", + Input: []tf.Input{ + handle, flow_in, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ResourceSparseApplyProximalAdagradAttr is an optional argument to ResourceSparseApplyProximalAdagrad. +type ResourceSparseApplyProximalAdagradAttr func(optionalAttr) + +// ResourceSparseApplyProximalAdagradUseLocking sets the optional use_locking attribute to value. +// +// value: If True, updating of the var and accum tensors will be protected by +// a lock; otherwise the behavior is undefined, but may exhibit less contention. +// If not specified, defaults to false +func ResourceSparseApplyProximalAdagradUseLocking(value bool) ResourceSparseApplyProximalAdagradAttr { + return func(m optionalAttr) { + m["use_locking"] = value + } +} + +// Sparse update entries in '*var' and '*accum' according to FOBOS algorithm. +// +// That is for rows we have grad for, we update var and accum as follows: +// accum += grad * grad +// prox_v = var +// prox_v -= lr * grad * (1 / sqrt(accum)) +// var = sign(prox_v)/(1+lr*l2) * max{|prox_v|-lr*l1,0} +// +// Arguments: +// +// var_: Should be from a Variable(). +// accum: Should be from a Variable(). +// lr: Learning rate. Must be a scalar. +// l1: L1 regularization. Must be a scalar. +// l2: L2 regularization. Must be a scalar. +// grad: The gradient. +// indices: A vector of indices into the first dimension of var and accum. +// +// Returns the created operation. +func ResourceSparseApplyProximalAdagrad(scope *Scope, var_ tf.Output, accum tf.Output, lr tf.Output, l1 tf.Output, l2 tf.Output, grad tf.Output, indices tf.Output, optional ...ResourceSparseApplyProximalAdagradAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ResourceSparseApplyProximalAdagrad", + Input: []tf.Input{ + var_, accum, lr, l1, l2, grad, indices, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// Gets the next output from the given iterator. +// +// This operation is a synchronous version IteratorGetNext. It should only be used +// in situations where the iterator does not block the calling thread, or where +// the calling thread is not a member of the thread pool used to execute parallel +// operations (e.g. in eager mode). +func IteratorGetNextSync(scope *Scope, iterator tf.Output, output_types []tf.DataType, output_shapes []tf.Shape) (components []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + opspec := tf.OpSpec{ + Type: "IteratorGetNextSync", + Input: []tf.Input{ + iterator, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if components, idx, err = makeOutputList(op, idx, "components"); err != nil { + scope.UpdateErr("IteratorGetNextSync", err) + return + } + return components +} + +// SparseReduceSumAttr is an optional argument to SparseReduceSum. +type SparseReduceSumAttr func(optionalAttr) + +// SparseReduceSumKeepDims sets the optional keep_dims attribute to value. +// +// value: If true, retain reduced dimensions with length 1. +// If not specified, defaults to false +func SparseReduceSumKeepDims(value bool) SparseReduceSumAttr { + return func(m optionalAttr) { + m["keep_dims"] = value + } +} + +// Computes the sum of elements across dimensions of a SparseTensor. +// +// This Op takes a SparseTensor and is the sparse counterpart to +// `tf.reduce_sum()`. In particular, this Op also returns a dense `Tensor` +// instead of a sparse one. +// +// Reduces `sp_input` along the dimensions given in `reduction_axes`. Unless +// `keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in +// `reduction_axes`. If `keep_dims` is true, the reduced dimensions are retained +// with length 1. +// +// If `reduction_axes` has no entries, all dimensions are reduced, and a tensor +// with a single element is returned. Additionally, the axes can be negative, +// which are interpreted according to the indexing rules in Python. +// +// Arguments: +// +// input_indices: 2-D. `N x R` matrix with the indices of non-empty values in a +// +// SparseTensor, possibly not in canonical ordering. +// +// input_values: 1-D. `N` non-empty values corresponding to `input_indices`. +// input_shape: 1-D. Shape of the input SparseTensor. +// reduction_axes: 1-D. Length-`K` vector containing the reduction axes. +// +// Returns `R-K`-D. The reduced Tensor. +func SparseReduceSum(scope *Scope, input_indices tf.Output, input_values tf.Output, input_shape tf.Output, reduction_axes tf.Output, optional ...SparseReduceSumAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "SparseReduceSum", + Input: []tf.Input{ + input_indices, input_values, input_shape, reduction_axes, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Helper operator for performing XLA-style broadcasts +// +// Broadcasts `lhs` and `rhs` to the same rank, by adding size 1 dimensions to +// whichever of `lhs` and `rhs` has the lower rank, using XLA's broadcasting rules +// for binary operators. +// +// Arguments: +// +// lhs: the LHS input tensor +// rhs: the RHS input tensor +// broadcast_dims: an XLA-style broadcast dimension specification +// +// Returns: +// +// lhs_output: the broadcasted LHS tensor +// rhs_output: the broadcasted RHS tensor +func XlaBroadcastHelper(scope *Scope, lhs tf.Output, rhs tf.Output, broadcast_dims tf.Output) (lhs_output tf.Output, rhs_output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "XlaBroadcastHelper", + Input: []tf.Input{ + lhs, rhs, broadcast_dims, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// ParseExampleDatasetV2Attr is an optional argument to ParseExampleDatasetV2. +type ParseExampleDatasetV2Attr func(optionalAttr) + +// ParseExampleDatasetV2Deterministic sets the optional deterministic attribute to value. +// +// value: A string indicating the op-level determinism to use. Deterministic controls +// whether the dataset is allowed to return elements out of order if the next +// element to be returned isn't available, but a later element is. Options are +// "true", "false", and "default". "default" indicates that determinism should be +// decided by the `experimental_deterministic` parameter of `tf.data.Options`. +// If not specified, defaults to "default" +func ParseExampleDatasetV2Deterministic(value string) ParseExampleDatasetV2Attr { + return func(m optionalAttr) { + m["deterministic"] = value + } +} + +// ParseExampleDatasetV2RaggedKeys sets the optional ragged_keys attribute to value. +// If not specified, defaults to <> +// +// REQUIRES: len(value) >= 0 +func ParseExampleDatasetV2RaggedKeys(value []string) ParseExampleDatasetV2Attr { + return func(m optionalAttr) { + m["ragged_keys"] = value + } +} + +// ParseExampleDatasetV2RaggedValueTypes sets the optional ragged_value_types attribute to value. +// If not specified, defaults to <> +// +// REQUIRES: len(value) >= 0 +func ParseExampleDatasetV2RaggedValueTypes(value []tf.DataType) ParseExampleDatasetV2Attr { + return func(m optionalAttr) { + m["ragged_value_types"] = value + } +} + +// ParseExampleDatasetV2RaggedSplitTypes sets the optional ragged_split_types attribute to value. +// If not specified, defaults to <> +// +// REQUIRES: len(value) >= 0 +func ParseExampleDatasetV2RaggedSplitTypes(value []tf.DataType) ParseExampleDatasetV2Attr { + return func(m optionalAttr) { + m["ragged_split_types"] = value + } +} + +// Transforms `input_dataset` containing `Example` protos as vectors of DT_STRING into a dataset of `Tensor` or `SparseTensor` objects representing the parsed features. +// +// Arguments: +// +// dense_defaults: A dict mapping string keys to `Tensor`s. +// +// The keys of the dict must match the dense_keys of the feature. +// +// sparse_keys: A list of string keys in the examples features. +// +// The results for these keys will be returned as `SparseTensor` objects. +// +// dense_keys: A list of Ndense string Tensors (scalars). +// +// The keys expected in the Examples features associated with dense values. +// +// sparse_types: A list of `DTypes` of the same length as `sparse_keys`. +// +// Only `tf.float32` (`FloatList`), `tf.int64` (`Int64List`), +// and `tf.string` (`BytesList`) are supported. +// +// dense_shapes: List of tuples with the same length as `dense_keys`. +// +// The shape of the data for each dense feature referenced by `dense_keys`. +// Required for any input tensors identified by `dense_keys`. Must be +// either fully defined, or may contain an unknown first dimension. +// An unknown first dimension means the feature is treated as having +// a variable number of blocks, and the output shape along this dimension +// is considered unknown at graph build time. Padding is applied for +// minibatch elements smaller than the maximum number of blocks for the +// given feature along this dimension. +// +// output_types: The type list for the return values. +// output_shapes: The list of shapes being produced. +func ParseExampleDatasetV2(scope *Scope, input_dataset tf.Output, num_parallel_calls tf.Output, dense_defaults []tf.Output, sparse_keys []string, dense_keys []string, sparse_types []tf.DataType, dense_shapes []tf.Shape, output_types []tf.DataType, output_shapes []tf.Shape, optional ...ParseExampleDatasetV2Attr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"sparse_keys": sparse_keys, "dense_keys": dense_keys, "sparse_types": sparse_types, "dense_shapes": dense_shapes, "output_types": output_types, "output_shapes": output_shapes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ParseExampleDatasetV2", + Input: []tf.Input{ + input_dataset, num_parallel_calls, tf.OutputList(dense_defaults), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// BatchAttr is an optional argument to Batch. +type BatchAttr func(optionalAttr) + +// BatchMaxEnqueuedBatches sets the optional max_enqueued_batches attribute to value. +// If not specified, defaults to 10 +func BatchMaxEnqueuedBatches(value int64) BatchAttr { + return func(m optionalAttr) { + m["max_enqueued_batches"] = value + } +} + +// BatchAllowedBatchSizes sets the optional allowed_batch_sizes attribute to value. +// If not specified, defaults to <> +func BatchAllowedBatchSizes(value []int64) BatchAttr { + return func(m optionalAttr) { + m["allowed_batch_sizes"] = value + } +} + +// BatchContainer sets the optional container attribute to value. +// If not specified, defaults to "" +func BatchContainer(value string) BatchAttr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// BatchSharedName sets the optional shared_name attribute to value. +// If not specified, defaults to "" +func BatchSharedName(value string) BatchAttr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// BatchBatchingQueue sets the optional batching_queue attribute to value. +// If not specified, defaults to "" +func BatchBatchingQueue(value string) BatchAttr { + return func(m optionalAttr) { + m["batching_queue"] = value + } +} + +// Batches all input tensors nondeterministically. +// +// When many instances of this Op are being run concurrently with the same +// container/shared_name in the same device, some will output zero-shaped Tensors +// and others will output Tensors of size up to max_batch_size. +// +// All Tensors in in_tensors are batched together (so, for example, labels and +// features should be batched with a single instance of this operation. +// +// Each invocation of batch emits an `id` scalar which will be used to identify +// this particular invocation when doing unbatch or its gradient. +// +// Each op which emits a non-empty batch will also emit a non-empty batch_index +// Tensor, which, is a [K, 3] matrix where each row contains the invocation's id, +// start, and length of elements of each set of Tensors present in batched_tensors. +// +// Batched tensors are concatenated along the first dimension, and all tensors in +// in_tensors must have the first dimension of the same size. +// +// in_tensors: The tensors to be batched. +// num_batch_threads: Number of scheduling threads for processing batches of work. +// +// Determines the number of batches processed in parallel. +// +// max_batch_size: Batch sizes will never be bigger than this. +// batch_timeout_micros: Maximum number of microseconds to wait before outputting +// +// an incomplete batch. +// +// allowed_batch_sizes: Optional list of allowed batch sizes. If left empty, does +// +// nothing. Otherwise, supplies a list of batch sizes, causing the op to pad +// batches up to one of those sizes. The entries must increase monotonically, and +// the final entry must equal max_batch_size. +// +// grad_timeout_micros: The timeout to use for the gradient. See Unbatch. +// batched_tensors: Either empty tensors or a batch of concatenated Tensors. +// batch_index: If out_tensors is non-empty, has information to invert it. +// container: Controls the scope of sharing of this batch. +// id: always contains a scalar with a unique ID for this invocation of Batch. +// shared_name: Concurrently running instances of batch in the same device with the +// +// same container and shared_name will batch their elements together. If left +// empty, the op name will be used as the shared name. +// +// T: the types of tensors to be batched. +func Batch(scope *Scope, in_tensors []tf.Output, num_batch_threads int64, max_batch_size int64, batch_timeout_micros int64, grad_timeout_micros int64, optional ...BatchAttr) (batched_tensors []tf.Output, batch_index tf.Output, id tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_batch_threads": num_batch_threads, "max_batch_size": max_batch_size, "batch_timeout_micros": batch_timeout_micros, "grad_timeout_micros": grad_timeout_micros} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Batch", + Input: []tf.Input{ + tf.OutputList(in_tensors), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if batched_tensors, idx, err = makeOutputList(op, idx, "batched_tensors"); err != nil { + scope.UpdateErr("Batch", err) + return + } + batch_index = op.Output(idx) + id = op.Output(idx) + return batched_tensors, batch_index, id +} + +// RandomStandardNormalAttr is an optional argument to RandomStandardNormal. +type RandomStandardNormalAttr func(optionalAttr) + +// RandomStandardNormalSeed sets the optional seed attribute to value. +// +// value: If either `seed` or `seed2` are set to be non-zero, the random number +// generator is seeded by the given seed. Otherwise, it is seeded by a +// random seed. +// If not specified, defaults to 0 +func RandomStandardNormalSeed(value int64) RandomStandardNormalAttr { + return func(m optionalAttr) { + m["seed"] = value + } +} + +// RandomStandardNormalSeed2 sets the optional seed2 attribute to value. +// +// value: A second seed to avoid seed collision. +// If not specified, defaults to 0 +func RandomStandardNormalSeed2(value int64) RandomStandardNormalAttr { + return func(m optionalAttr) { + m["seed2"] = value + } +} + +// Outputs random values from a normal distribution. +// +// The generated values will have mean 0 and standard deviation 1. +// +// Arguments: +// +// shape: The shape of the output tensor. +// dtype: The type of the output. +// +// Returns A tensor of the specified shape filled with random normal values. +func RandomStandardNormal(scope *Scope, shape tf.Output, dtype tf.DataType, optional ...RandomStandardNormalAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtype": dtype} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "RandomStandardNormal", + Input: []tf.Input{ + shape, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Creates a TensorArray for storing the gradients of values in the given handle. +// +// If the given TensorArray gradient already exists, returns a reference to it. +// +// Locks the size of the original TensorArray by disabling its dynamic size flag. +// +// **A note about the input flow_in:** +// +// The handle flow_in forces the execution of the gradient lookup to occur +// only after certain other operations have occurred. For example, when +// the forward TensorArray is dynamically sized, writes to this TensorArray +// may resize the object. The gradient TensorArray is statically sized based +// on the size of the forward TensorArray when this operation executes. +// Furthermore, the size of the forward TensorArray is frozen by this call. +// As a result, the flow is used to ensure that the call to generate the gradient +// TensorArray only happens after all writes are executed. +// +// In the case of dynamically sized TensorArrays, gradient computation should +// only be performed on read operations that have themselves been chained via +// flow to occur only after all writes have executed. That way the final size +// of the forward TensorArray is known when this operation is called. +// +// **A note about the source attribute:** +// +// TensorArray gradient calls use an accumulator TensorArray object. If +// multiple gradients are calculated and run in the same session, the multiple +// gradient nodes may accidentally flow through the same accumulator TensorArray. +// This double counts and generally breaks the TensorArray gradient flow. +// +// The solution is to identify which gradient call this particular +// TensorArray gradient is being called in. This is performed by identifying +// a unique string (e.g. "gradients", "gradients_1", ...) from the input +// gradient Tensor's name. This string is used as a suffix when creating +// the TensorArray gradient object here (the attribute `source`). +// +// The attribute `source` is added as a suffix to the forward TensorArray's +// name when performing the creation / lookup, so that each separate gradient +// calculation gets its own TensorArray accumulator. +// +// Arguments: +// +// handle: The handle to the forward TensorArray. +// flow_in: A float scalar that enforces proper chaining of operations. +// source: The gradient source string, used to decide which gradient TensorArray +// +// to return. +func TensorArrayGradV3(scope *Scope, handle tf.Output, flow_in tf.Output, source string) (grad_handle tf.Output, flow_out tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"source": source} + opspec := tf.OpSpec{ + Type: "TensorArrayGradV3", + Input: []tf.Input{ + handle, flow_in, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// Returns which elements of x are NaN. +// +// @compatibility(numpy) +// Equivalent to np.isnan +// @end_compatibility +// +// Example: +// +// ```python +// x = tf.constant([5.0, np.nan, 6.8, np.nan, np.inf]) +// tf.math.is_nan(x) ==> [False, True, False, True, False] +// ``` +func IsNan(scope *Scope, x tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "IsNan", + Input: []tf.Input{ + x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// DecodeProtoV2Attr is an optional argument to DecodeProtoV2. +type DecodeProtoV2Attr func(optionalAttr) + +// DecodeProtoV2DescriptorSource sets the optional descriptor_source attribute to value. +// +// value: Either the special value `local://` or a path to a file containing +// a serialized `FileDescriptorSet`. +// If not specified, defaults to "local://" +func DecodeProtoV2DescriptorSource(value string) DecodeProtoV2Attr { + return func(m optionalAttr) { + m["descriptor_source"] = value + } +} + +// DecodeProtoV2MessageFormat sets the optional message_format attribute to value. +// +// value: Either `binary` or `text`. +// If not specified, defaults to "binary" +func DecodeProtoV2MessageFormat(value string) DecodeProtoV2Attr { + return func(m optionalAttr) { + m["message_format"] = value + } +} + +// DecodeProtoV2Sanitize sets the optional sanitize attribute to value. +// +// value: Whether to sanitize the result or not. +// If not specified, defaults to false +func DecodeProtoV2Sanitize(value bool) DecodeProtoV2Attr { + return func(m optionalAttr) { + m["sanitize"] = value + } +} + +// The op extracts fields from a serialized protocol buffers message into tensors. +// +// The `decode_proto` op extracts fields from a serialized protocol buffers +// message into tensors. The fields in `field_names` are decoded and converted +// to the corresponding `output_types` if possible. +// +// A `message_type` name must be provided to give context for the field names. +// The actual message descriptor can be looked up either in the linked-in +// descriptor pool or a filename provided by the caller using the +// `descriptor_source` attribute. +// +// Each output tensor is a dense tensor. This means that it is padded to hold +// the largest number of repeated elements seen in the input minibatch. (The +// shape is also padded by one to prevent zero-sized dimensions). The actual +// repeat counts for each example in the minibatch can be found in the `sizes` +// output. In many cases the output of `decode_proto` is fed immediately into +// tf.squeeze if missing values are not a concern. When using tf.squeeze, always +// pass the squeeze dimension explicitly to avoid surprises. +// +// For the most part, the mapping between Proto field types and TensorFlow dtypes +// is straightforward. However, there are a few special cases: +// +// - A proto field that contains a submessage or group can only be converted +// to `DT_STRING` (the serialized submessage). This is to reduce the complexity +// of the API. The resulting string can be used as input to another instance of +// the decode_proto op. +// +// - TensorFlow lacks support for unsigned integers. The ops represent uint64 +// types as a `DT_INT64` with the same twos-complement bit pattern (the obvious +// way). Unsigned int32 values can be represented exactly by specifying type +// `DT_INT64`, or using twos-complement if the caller specifies `DT_INT32` in +// the `output_types` attribute. +// +// Both binary and text proto serializations are supported, and can be +// chosen using the `format` attribute. +// +// The `descriptor_source` attribute selects the source of protocol +// descriptors to consult when looking up `message_type`. This may be: +// +// - An empty string or "local://", in which case protocol descriptors are +// created for C++ (not Python) proto definitions linked to the binary. +// +// - A file, in which case protocol descriptors are created from the file, +// which is expected to contain a `FileDescriptorSet` serialized as a string. +// NOTE: You can build a `descriptor_source` file using the `--descriptor_set_out` +// and `--include_imports` options to the protocol compiler `protoc`. +// +// - A "bytes://", in which protocol descriptors are created from ``, +// which is expected to be a `FileDescriptorSet` serialized as a string. +// +// Arguments: +// +// bytes: Tensor of serialized protos with shape `batch_shape`. +// message_type: Name of the proto message type to decode. +// field_names: List of strings containing proto field names. An extension field can be decoded +// +// by using its full name, e.g. EXT_PACKAGE.EXT_FIELD_NAME. +// +// output_types: List of TF types to use for the respective field in field_names. +// +// Returns: +// +// sizes: Tensor of int32 with shape `[batch_shape, len(field_names)]`. +// +// Each entry is the number of values found for the corresponding field. +// Optional fields may have 0 or 1 values. +// +// values: List of tensors containing values for the corresponding field. +// +// `values[i]` has datatype `output_types[i]` +// and shape `[batch_shape, max(sizes[...,i])]`. +func DecodeProtoV2(scope *Scope, bytes tf.Output, message_type string, field_names []string, output_types []tf.DataType, optional ...DecodeProtoV2Attr) (sizes tf.Output, values []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"message_type": message_type, "field_names": field_names, "output_types": output_types} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "DecodeProtoV2", + Input: []tf.Input{ + bytes, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + sizes = op.Output(idx) + if values, idx, err = makeOutputList(op, idx, "values"); err != nil { + scope.UpdateErr("DecodeProtoV2", err) + return + } + return sizes, values +} + +// TruncatedNormalAttr is an optional argument to TruncatedNormal. +type TruncatedNormalAttr func(optionalAttr) + +// TruncatedNormalSeed sets the optional seed attribute to value. +// +// value: If either `seed` or `seed2` are set to be non-zero, the random number +// generator is seeded by the given seed. Otherwise, it is seeded by a +// random seed. +// If not specified, defaults to 0 +func TruncatedNormalSeed(value int64) TruncatedNormalAttr { + return func(m optionalAttr) { + m["seed"] = value + } +} + +// TruncatedNormalSeed2 sets the optional seed2 attribute to value. +// +// value: A second seed to avoid seed collision. +// If not specified, defaults to 0 +func TruncatedNormalSeed2(value int64) TruncatedNormalAttr { + return func(m optionalAttr) { + m["seed2"] = value + } +} + +// Outputs random values from a truncated normal distribution. +// +// The generated values follow a normal distribution with mean 0 and standard +// deviation 1, except that values whose magnitude is more than 2 standard +// deviations from the mean are dropped and re-picked. +// +// Arguments: +// +// shape: The shape of the output tensor. +// dtype: The type of the output. +// +// Returns A tensor of the specified shape filled with random truncated normal +// values. +func TruncatedNormal(scope *Scope, shape tf.Output, dtype tf.DataType, optional ...TruncatedNormalAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtype": dtype} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "TruncatedNormal", + Input: []tf.Input{ + shape, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Makes the summary of accumulated stats for the batch. +// +// The summary stats contains gradients and hessians accumulated into the corresponding node and bucket for each example. +// +// Arguments: +// +// node_ids: int32 Rank 1 Tensor containing node ids, which each example falls into for the requested layer. +// gradients: float32; Rank 2 Tensor (shape=[#examples, 1]) for gradients. +// hessians: float32; Rank 2 Tensor (shape=[#examples, 1]) for hessians. +// bucketized_features_list: int32 list of Rank 1 Tensors, each containing the bucketized feature (for each feature column). +// max_splits: int; the maximum number of splits possible in the whole tree. +// num_buckets: int; equals to the maximum possible value of bucketized feature. +// +// Returns output Rank 4 Tensor (shape=[#features, #splits, #buckets, 2]) containing accumulated stats put into the corresponding node and bucket. The first index of 4th dimension refers to gradients, and the second to hessians. +func BoostedTreesMakeStatsSummary(scope *Scope, node_ids tf.Output, gradients tf.Output, hessians tf.Output, bucketized_features_list []tf.Output, max_splits int64, num_buckets int64) (stats_summary tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"max_splits": max_splits, "num_buckets": num_buckets} + opspec := tf.OpSpec{ + Type: "BoostedTreesMakeStatsSummary", + Input: []tf.Input{ + node_ids, gradients, hessians, tf.OutputList(bucketized_features_list), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// A container for an iterator resource. +// +// Arguments: +// +// handle: A handle to the iterator to delete. +// deleter: A variant deleter. +// +// Returns the created operation. +func DeleteIterator(scope *Scope, handle tf.Output, deleter tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "DeleteIterator", + Input: []tf.Input{ + handle, deleter, + }, + } + return scope.AddOperation(opspec) +} + +// NonMaxSuppressionV5Attr is an optional argument to NonMaxSuppressionV5. +type NonMaxSuppressionV5Attr func(optionalAttr) + +// NonMaxSuppressionV5PadToMaxOutputSize sets the optional pad_to_max_output_size attribute to value. +// +// value: If true, the output `selected_indices` is padded to be of length +// `max_output_size`. Defaults to false. +// If not specified, defaults to false +func NonMaxSuppressionV5PadToMaxOutputSize(value bool) NonMaxSuppressionV5Attr { + return func(m optionalAttr) { + m["pad_to_max_output_size"] = value + } +} + +// Greedily selects a subset of bounding boxes in descending order of score, +// +// pruning away boxes that have high intersection-over-union (IOU) overlap +// with previously selected boxes. Bounding boxes with score less than +// `score_threshold` are removed. Bounding boxes are supplied as +// [y1, x1, y2, x2], where (y1, x1) and (y2, x2) are the coordinates of any +// diagonal pair of box corners and the coordinates can be provided as normalized +// (i.e., lying in the interval [0, 1]) or absolute. Note that this algorithm +// is agnostic to where the origin is in the coordinate system and more +// generally is invariant to orthogonal transformations and translations +// of the coordinate system; thus translating or reflections of the coordinate +// system result in the same boxes being selected by the algorithm. +// The output of this operation is a set of integers indexing into the input +// collection of bounding boxes representing the selected boxes. The bounding +// box coordinates corresponding to the selected indices can then be obtained +// using the `tf.gather operation`. For example: +// +// selected_indices = tf.image.non_max_suppression_v2( +// boxes, scores, max_output_size, iou_threshold, score_threshold) +// selected_boxes = tf.gather(boxes, selected_indices) +// +// This op also supports a Soft-NMS (with Gaussian weighting) mode (c.f. +// Bodla et al, https://arxiv.org/abs/1704.04503) where boxes reduce the score +// of other overlapping boxes instead of directly causing them to be pruned. +// To enable this Soft-NMS mode, set the `soft_nms_sigma` parameter to be +// larger than 0. +// +// Arguments: +// +// boxes: A 2-D float tensor of shape `[num_boxes, 4]`. +// scores: A 1-D float tensor of shape `[num_boxes]` representing a single +// +// score corresponding to each box (each row of boxes). +// +// max_output_size: A scalar integer tensor representing the maximum number of +// +// boxes to be selected by non max suppression. +// +// iou_threshold: A 0-D float tensor representing the threshold for deciding whether +// +// boxes overlap too much with respect to IOU. +// +// score_threshold: A 0-D float tensor representing the threshold for deciding when to remove +// +// boxes based on score. +// +// soft_nms_sigma: A 0-D float tensor representing the sigma parameter for Soft NMS; see Bodla et +// +// al (c.f. https://arxiv.org/abs/1704.04503). When `soft_nms_sigma=0.0` (which +// is default), we fall back to standard (hard) NMS. +// +// Returns: +// +// selected_indices: A 1-D integer tensor of shape `[M]` representing the selected +// +// indices from the boxes tensor, where `M <= max_output_size`. +// +// selected_scores: A 1-D float tensor of shape `[M]` representing the corresponding +// +// scores for each selected box, where `M <= max_output_size`. Scores only differ +// from corresponding input scores when using Soft NMS (i.e. when +// `soft_nms_sigma>0`) +// +// valid_outputs: A 0-D integer tensor representing the number of valid elements in +// +// `selected_indices`, with the valid elements appearing first. +func NonMaxSuppressionV5(scope *Scope, boxes tf.Output, scores tf.Output, max_output_size tf.Output, iou_threshold tf.Output, score_threshold tf.Output, soft_nms_sigma tf.Output, optional ...NonMaxSuppressionV5Attr) (selected_indices tf.Output, selected_scores tf.Output, valid_outputs tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "NonMaxSuppressionV5", + Input: []tf.Input{ + boxes, scores, max_output_size, iou_threshold, score_threshold, soft_nms_sigma, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// AssertAttr is an optional argument to Assert. +type AssertAttr func(optionalAttr) + +// AssertSummarize sets the optional summarize attribute to value. +// +// value: Print this many entries of each tensor. +// If not specified, defaults to 3 +func AssertSummarize(value int64) AssertAttr { + return func(m optionalAttr) { + m["summarize"] = value + } +} + +// Asserts that the given condition is true. +// +// If `condition` evaluates to false, print the list of tensors in `data`. +// `summarize` determines how many entries of the tensors to print. +// +// Arguments: +// +// condition: The condition to evaluate. +// data: The tensors to print out when condition is false. +// +// Returns the created operation. +func Assert(scope *Scope, condition tf.Output, data []tf.Output, optional ...AssertAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Assert", + Input: []tf.Input{ + condition, tf.OutputList(data), + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// LuAttr is an optional argument to Lu. +type LuAttr func(optionalAttr) + +// LuOutputIdxType sets the optional output_idx_type attribute to value. +// If not specified, defaults to DT_INT32 +func LuOutputIdxType(value tf.DataType) LuAttr { + return func(m optionalAttr) { + m["output_idx_type"] = value + } +} + +// Computes the LU decomposition of one or more square matrices. +// +// The input is a tensor of shape `[..., M, M]` whose inner-most 2 dimensions +// form square matrices. +// +// The input has to be invertible. +// +// The output consists of two tensors LU and P containing the LU decomposition +// of all input submatrices `[..., :, :]`. LU encodes the lower triangular and +// upper triangular factors. +// +// For each input submatrix of shape `[M, M]`, L is a lower triangular matrix of +// shape `[M, M]` with unit diagonal whose entries correspond to the strictly lower +// triangular part of LU. U is a upper triangular matrix of shape `[M, M]` whose +// entries correspond to the upper triangular part, including the diagonal, of LU. +// +// P represents a permutation matrix encoded as a list of indices each between `0` +// and `M-1`, inclusive. If P_mat denotes the permutation matrix corresponding to +// P, then the L, U and P satisfies P_mat * input = L * U. +// +// Arguments: +// +// input: A tensor of shape `[..., M, M]` whose inner-most 2 dimensions form matrices of +// +// size `[M, M]`. +// +// Returns: +// +// lu: A tensor of shape `[..., M, M]` whose strictly lower triangular part denotes the +// +// lower triangular factor `L` with unit diagonal, and whose upper triangular part +// denotes the upper triangular factor `U`. +// +// p: Permutation of the rows encoded as a list of indices in `0..M-1`. Shape is +// +// `[..., M]`. +// @compatibility(scipy) +// Similar to `scipy.linalg.lu`, except the triangular factors `L` and `U` are +// packed into a single tensor, the permutation is applied to `input` instead of +// the right hand side and the permutation `P` is returned as a list of indices +// instead of a permutation matrix. +// @end_compatibility +func Lu(scope *Scope, input tf.Output, optional ...LuAttr) (lu tf.Output, p tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Lu", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// SparseSegmentSumAttr is an optional argument to SparseSegmentSum. +type SparseSegmentSumAttr func(optionalAttr) + +// SparseSegmentSumSparseGradient sets the optional sparse_gradient attribute to value. +// If not specified, defaults to false +func SparseSegmentSumSparseGradient(value bool) SparseSegmentSumAttr { + return func(m optionalAttr) { + m["sparse_gradient"] = value + } +} + +// Computes the sum along sparse segments of a tensor. +// +// Read +// [the section on segmentation](https://tensorflow.org/api_docs/python/tf/math#Segmentation) +// for an explanation of segments. +// +// Like `SegmentSum`, but `segment_ids` can have rank less than `data`'s first +// dimension, selecting a subset of dimension 0, specified by `indices`. +// +// For example: +// +// ```python +// c = tf.constant([[1,2,3,4], [-1,-2,-3,-4], [5,6,7,8]]) +// +// # Select two rows, one segment. +// tf.sparse_segment_sum(c, tf.constant([0, 1]), tf.constant([0, 0])) +// # => [[0 0 0 0]] +// +// # Select two rows, two segment. +// tf.sparse_segment_sum(c, tf.constant([0, 1]), tf.constant([0, 1])) +// # => [[ 1 2 3 4] +// # [-1 -2 -3 -4]] +// +// # Select all rows, two segments. +// tf.sparse_segment_sum(c, tf.constant([0, 1, 2]), tf.constant([0, 0, 1])) +// # => [[0 0 0 0] +// # [5 6 7 8]] +// +// # Which is equivalent to: +// tf.segment_sum(c, tf.constant([0, 0, 1])) +// ``` +// +// Arguments: +// +// indices: A 1-D tensor. Has same rank as `segment_ids`. +// segment_ids: A 1-D tensor. Values should be sorted and can be repeated. +// +// Returns Has same shape as data, except for dimension 0 which +// has size `k`, the number of segments. +func SparseSegmentSum(scope *Scope, data tf.Output, indices tf.Output, segment_ids tf.Output, optional ...SparseSegmentSumAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "SparseSegmentSum", + Input: []tf.Input{ + data, indices, segment_ids, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// QuantizedDepthwiseConv2DWithBiasAndReluAttr is an optional argument to QuantizedDepthwiseConv2DWithBiasAndRelu. +type QuantizedDepthwiseConv2DWithBiasAndReluAttr func(optionalAttr) + +// QuantizedDepthwiseConv2DWithBiasAndReluOutType sets the optional out_type attribute to value. +// +// value: The type of the output. +// If not specified, defaults to DT_QINT32 +func QuantizedDepthwiseConv2DWithBiasAndReluOutType(value tf.DataType) QuantizedDepthwiseConv2DWithBiasAndReluAttr { + return func(m optionalAttr) { + m["out_type"] = value + } +} + +// QuantizedDepthwiseConv2DWithBiasAndReluDilations sets the optional dilations attribute to value. +// +// value: List of dilation values. +// If not specified, defaults to +func QuantizedDepthwiseConv2DWithBiasAndReluDilations(value []int64) QuantizedDepthwiseConv2DWithBiasAndReluAttr { + return func(m optionalAttr) { + m["dilations"] = value + } +} + +// QuantizedDepthwiseConv2DWithBiasAndReluPaddingList sets the optional padding_list attribute to value. +// If not specified, defaults to <> +func QuantizedDepthwiseConv2DWithBiasAndReluPaddingList(value []int64) QuantizedDepthwiseConv2DWithBiasAndReluAttr { + return func(m optionalAttr) { + m["padding_list"] = value + } +} + +// Computes quantized depthwise Conv2D with Bias and Relu. +// +// Arguments: +// +// input: The original input tensor. +// filter: The original filter tensor. +// bias: The original bias tensor. +// min_input: The float value that the minimum quantized input value represents. +// max_input: The float value that the maximum quantized input value represents. +// min_filter: The float value that the minimum quantized filter value represents. +// max_filter: The float value that the maximum quantized filter value represents. +// strides: List of stride values. +// +// Returns: +// +// output: The output tensor. +// min_output: The float value that the minimum quantized output value represents. +// max_output: The float value that the maximum quantized output value represents. +func QuantizedDepthwiseConv2DWithBiasAndRelu(scope *Scope, input tf.Output, filter tf.Output, bias tf.Output, min_input tf.Output, max_input tf.Output, min_filter tf.Output, max_filter tf.Output, strides []int64, padding string, optional ...QuantizedDepthwiseConv2DWithBiasAndReluAttr) (output tf.Output, min_output tf.Output, max_output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"strides": strides, "padding": padding} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "QuantizedDepthwiseConv2DWithBiasAndRelu", + Input: []tf.Input{ + input, filter, bias, min_input, max_input, min_filter, max_filter, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// RandomPoissonAttr is an optional argument to RandomPoisson. +type RandomPoissonAttr func(optionalAttr) + +// RandomPoissonSeed sets the optional seed attribute to value. +// If not specified, defaults to 0 +func RandomPoissonSeed(value int64) RandomPoissonAttr { + return func(m optionalAttr) { + m["seed"] = value + } +} + +// RandomPoissonSeed2 sets the optional seed2 attribute to value. +// If not specified, defaults to 0 +func RandomPoissonSeed2(value int64) RandomPoissonAttr { + return func(m optionalAttr) { + m["seed2"] = value + } +} + +// Use RandomPoissonV2 instead. +// +// DEPRECATED at GraphDef version 25: Replaced by RandomPoissonV2 +func RandomPoisson(scope *Scope, shape tf.Output, rate tf.Output, optional ...RandomPoissonAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "RandomPoisson", + Input: []tf.Input{ + shape, rate, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Creates a tensor filled with a scalar value. +// +// This operation creates a tensor of shape `dims` and fills it with `value`. +// +// For example: +// +// ``` +// # Output tensor has shape [2, 3]. +// fill([2, 3], 9) ==> [[9, 9, 9] +// +// [9, 9, 9]] +// +// ``` +// +// `tf.fill` differs from `tf.constant` in a few ways: +// +// - `tf.fill` only supports scalar contents, whereas `tf.constant` supports +// Tensor values. +// - `tf.fill` creates an Op in the computation graph that constructs the actual +// Tensor value at runtime. This is in contrast to `tf.constant` which embeds +// the entire Tensor into the graph with a `Const` node. +// - Because `tf.fill` evaluates at graph runtime, it supports dynamic shapes +// based on other runtime Tensors, unlike `tf.constant`. +// +// Arguments: +// +// dims: 1-D. Represents the shape of the output tensor. +// value: 0-D (scalar). Value to fill the returned tensor. +// +// @compatibility(numpy) +// Equivalent to np.full +// @end_compatibility +func Fill(scope *Scope, dims tf.Output, value tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Fill", + Input: []tf.Input{ + dims, value, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ArgMinAttr is an optional argument to ArgMin. +type ArgMinAttr func(optionalAttr) + +// ArgMinOutputType sets the optional output_type attribute to value. +// If not specified, defaults to DT_INT64 +func ArgMinOutputType(value tf.DataType) ArgMinAttr { + return func(m optionalAttr) { + m["output_type"] = value + } +} + +// Returns the index with the smallest value across dimensions of a tensor. +// +// Note that in case of ties the identity of the return value is not guaranteed. +// +// Usage: +// +// ```python +// import tensorflow as tf +// a = [1, 10, 26.9, 2.8, 166.32, 62.3] +// b = tf.math.argmin(input = a) +// c = tf.keras.backend.eval(b) +// # c = 0 +// # here a[0] = 1 which is the smallest element of a across axis 0 +// ``` +// +// Arguments: +// +// dimension: int32 or int64, must be in the range `[-rank(input), rank(input))`. +// +// Describes which dimension of the input Tensor to reduce across. For vectors, +// use dimension = 0. +func ArgMin(scope *Scope, input tf.Output, dimension tf.Output, optional ...ArgMinAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ArgMin", + Input: []tf.Input{ + input, dimension, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Element-wise multiplication of a sparse matrix with a dense tensor. +// +// Returns a sparse matrix. +// +// The dense tensor `b` may be either a scalar; otherwise `a` must be a rank-3 +// `SparseMatrix`; in this case `b` must be shaped `[batch_size, 1, 1]` and the +// multiply operation broadcasts. +// +// **NOTE** even if `b` is zero, the sparsity structure of the output does not +// change. +// +// Arguments: +// +// a: A CSRSparseMatrix. +// b: A dense tensor. +// +// Returns A dense output tensor. +func SparseMatrixMul(scope *Scope, a tf.Output, b tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "SparseMatrixMul", + Input: []tf.Input{ + a, b, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// AddManySparseToTensorsMapAttr is an optional argument to AddManySparseToTensorsMap. +type AddManySparseToTensorsMapAttr func(optionalAttr) + +// AddManySparseToTensorsMapContainer sets the optional container attribute to value. +// +// value: The container name for the `SparseTensorsMap` created by this op. +// If not specified, defaults to "" +func AddManySparseToTensorsMapContainer(value string) AddManySparseToTensorsMapAttr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// AddManySparseToTensorsMapSharedName sets the optional shared_name attribute to value. +// +// value: The shared name for the `SparseTensorsMap` created by this op. +// If blank, the new Operation's unique name is used. +// If not specified, defaults to "" +func AddManySparseToTensorsMapSharedName(value string) AddManySparseToTensorsMapAttr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// Add an `N`-minibatch `SparseTensor` to a `SparseTensorsMap`, return `N` handles. +// +// A `SparseTensor` of rank `R` is represented by three tensors: `sparse_indices`, +// `sparse_values`, and `sparse_shape`, where +// +// ```sparse_indices.shape[1] == sparse_shape.shape[0] == R``` +// +// An `N`-minibatch of `SparseTensor` objects is represented as a `SparseTensor` +// having a first `sparse_indices` column taking values between `[0, N)`, where +// the minibatch size `N == sparse_shape[0]`. +// +// The input `SparseTensor` must have rank `R` greater than 1, and the first +// dimension is treated as the minibatch dimension. Elements of the `SparseTensor` +// must be sorted in increasing order of this first dimension. The stored +// `SparseTensor` objects pointed to by each row of the output `sparse_handles` +// will have rank `R-1`. +// +// The `SparseTensor` values can then be read out as part of a minibatch by passing +// the given keys as vector elements to `TakeManySparseFromTensorsMap`. To ensure +// the correct `SparseTensorsMap` is accessed, ensure that the same +// `container` and `shared_name` are passed to that Op. If no `shared_name` +// is provided here, instead use the *name* of the Operation created by calling +// `AddManySparseToTensorsMap` as the `shared_name` passed to +// `TakeManySparseFromTensorsMap`. Ensure the Operations are colocated. +// +// Arguments: +// +// sparse_indices: 2-D. The `indices` of the minibatch `SparseTensor`. +// +// `sparse_indices[:, 0]` must be ordered values in `[0, N)`. +// +// sparse_values: 1-D. The `values` of the minibatch `SparseTensor`. +// sparse_shape: 1-D. The `shape` of the minibatch `SparseTensor`. +// +// The minibatch size `N == sparse_shape[0]`. +// +// Returns 1-D. The handles of the `SparseTensor` now stored in the +// `SparseTensorsMap`. Shape: `[N]`. +func AddManySparseToTensorsMap(scope *Scope, sparse_indices tf.Output, sparse_values tf.Output, sparse_shape tf.Output, optional ...AddManySparseToTensorsMapAttr) (sparse_handles tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "AddManySparseToTensorsMap", + Input: []tf.Input{ + sparse_indices, sparse_values, sparse_shape, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// 3D fast Fourier transform. +// +// Computes the 3-dimensional discrete Fourier transform over the inner-most 3 +// dimensions of `input`. +// +// Arguments: +// +// input: A complex tensor. +// +// Returns A complex tensor of the same shape as `input`. The inner-most 3 +// +// dimensions of `input` are replaced with their 3D Fourier transform. +// +// @compatibility(numpy) +// Equivalent to np.fft.fftn with 3 dimensions. +// @end_compatibility +func FFT3D(scope *Scope, input tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "FFT3D", + Input: []tf.Input{ + input, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Converts each string in the input Tensor to its hash mod by a number of buckets. +// +// The hash function is deterministic on the content of the string within the +// process. +// +// Note that the hash function may change from time to time. +// This functionality will be deprecated and it's recommended to use +// `tf.string_to_hash_bucket_fast()` or `tf.string_to_hash_bucket_strong()`. +// +// Arguments: +// +// num_buckets: The number of buckets. +// +// Returns A Tensor of the same shape as the input `string_tensor`. +func StringToHashBucket(scope *Scope, string_tensor tf.Output, num_buckets int64) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_buckets": num_buckets} + opspec := tf.OpSpec{ + Type: "StringToHashBucket", + Input: []tf.Input{ + string_tensor, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// LoadTPUEmbeddingCenteredRMSPropParametersAttr is an optional argument to LoadTPUEmbeddingCenteredRMSPropParameters. +type LoadTPUEmbeddingCenteredRMSPropParametersAttr func(optionalAttr) + +// LoadTPUEmbeddingCenteredRMSPropParametersTableId sets the optional table_id attribute to value. +// If not specified, defaults to -1 +func LoadTPUEmbeddingCenteredRMSPropParametersTableId(value int64) LoadTPUEmbeddingCenteredRMSPropParametersAttr { + return func(m optionalAttr) { + m["table_id"] = value + } +} + +// LoadTPUEmbeddingCenteredRMSPropParametersTableName sets the optional table_name attribute to value. +// If not specified, defaults to "" +func LoadTPUEmbeddingCenteredRMSPropParametersTableName(value string) LoadTPUEmbeddingCenteredRMSPropParametersAttr { + return func(m optionalAttr) { + m["table_name"] = value + } +} + +// LoadTPUEmbeddingCenteredRMSPropParametersConfig sets the optional config attribute to value. +// If not specified, defaults to "" +func LoadTPUEmbeddingCenteredRMSPropParametersConfig(value string) LoadTPUEmbeddingCenteredRMSPropParametersAttr { + return func(m optionalAttr) { + m["config"] = value + } +} + +// Load centered RMSProp embedding parameters. +// +// An op that loads optimization parameters into HBM for embedding. Must be +// preceded by a ConfigureTPUEmbeddingHost op that sets up the correct +// embedding table configuration. For example, this op is used to install +// parameters that are loaded from a checkpoint before a training loop is +// executed. +// +// Arguments: +// +// parameters: Value of parameters used in the centered RMSProp optimization algorithm. +// ms: Value of ms used in the centered RMSProp optimization algorithm. +// mom: Value of mom used in the centered RMSProp optimization algorithm. +// mg: Value of mg used in the centered RMSProp optimization algorithm. +// +// Returns the created operation. +func LoadTPUEmbeddingCenteredRMSPropParameters(scope *Scope, parameters tf.Output, ms tf.Output, mom tf.Output, mg tf.Output, num_shards int64, shard_id int64, optional ...LoadTPUEmbeddingCenteredRMSPropParametersAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_shards": num_shards, "shard_id": shard_id} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "LoadTPUEmbeddingCenteredRMSPropParameters", + Input: []tf.Input{ + parameters, ms, mom, mg, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// Transforms a Tensor into a serialized TensorProto proto. +// +// Arguments: +// +// tensor: A Tensor of type `T`. +// +// Returns A serialized TensorProto proto of the input tensor. +func SerializeTensor(scope *Scope, tensor tf.Output) (serialized tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "SerializeTensor", + Input: []tf.Input{ + tensor, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes the gradient of morphological 2-D dilation with respect to the filter. +// +// Arguments: +// +// input: 4-D with shape `[batch, in_height, in_width, depth]`. +// filter: 3-D with shape `[filter_height, filter_width, depth]`. +// out_backprop: 4-D with shape `[batch, out_height, out_width, depth]`. +// strides: 1-D of length 4. The stride of the sliding window for each dimension of +// +// the input tensor. Must be: `[1, stride_height, stride_width, 1]`. +// +// rates: 1-D of length 4. The input stride for atrous morphological dilation. +// +// Must be: `[1, rate_height, rate_width, 1]`. +// +// padding: The type of padding algorithm to use. +// +// Returns 3-D with shape `[filter_height, filter_width, depth]`. +func Dilation2DBackpropFilter(scope *Scope, input tf.Output, filter tf.Output, out_backprop tf.Output, strides []int64, rates []int64, padding string) (filter_backprop tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"strides": strides, "rates": rates, "padding": padding} + opspec := tf.OpSpec{ + Type: "Dilation2DBackpropFilter", + Input: []tf.Input{ + input, filter, out_backprop, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns the result of a TPU compilation. +// +// This operation returns the result of a TPU compilation as a serialized +// CompilationResultProto, which holds a status and an error message if an error +// occurred during compilation. +func TPUCompilationResult(scope *Scope) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "TPUCompilationResult", + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns the TopK unique values in the array in sorted order. The +// +// running time is proportional to the product of K and the input +// size. Sorting the whole array is more efficient for sufficiently large +// values of K. The median-of-medians algorithm is probably faster, but +// difficult to implement efficiently in XLA. If there are fewer than K +// unique numbers (not NANs), the results are padded with negative +// infinity. NaNs are never returned. Subnormal numbers are flushed to +// zero. If an element appears at multiple indices, the highest index is +// returned. If a TopK element never appears in the input due to padding +// values, the indices are padded with negative one. If a padding value +// appears in the input and padding is needed, the highest index of the +// padding value will be returned. The semantics are not the same as +// kth_order_statistic. +func TopKUnique(scope *Scope, input tf.Output, k int64) (topk tf.Output, topk_indices tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"k": k} + opspec := tf.OpSpec{ + Type: "TopKUnique", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// EncodePngAttr is an optional argument to EncodePng. +type EncodePngAttr func(optionalAttr) + +// EncodePngCompression sets the optional compression attribute to value. +// +// value: Compression level. +// If not specified, defaults to -1 +func EncodePngCompression(value int64) EncodePngAttr { + return func(m optionalAttr) { + m["compression"] = value + } +} + +// PNG-encode an image. +// +// `image` is a 3-D uint8 or uint16 Tensor of shape `[height, width, channels]` +// where `channels` is: +// +// * 1: for grayscale. +// * 2: for grayscale + alpha. +// * 3: for RGB. +// * 4: for RGBA. +// +// The ZLIB compression level, `compression`, can be -1 for the PNG-encoder +// default or a value from 0 to 9. 9 is the highest compression level, generating +// the smallest output, but is slower. +// +// Arguments: +// +// image: 3-D with shape `[height, width, channels]`. +// +// Returns 0-D. PNG-encoded image. +func EncodePng(scope *Scope, image tf.Output, optional ...EncodePngAttr) (contents tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "EncodePng", + Input: []tf.Input{ + image, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Component-wise multiplies a SparseTensor by a dense Tensor. +// +// The output locations corresponding to the implicitly zero elements in the sparse +// tensor will be zero (i.e., will not take up storage space), regardless of the +// contents of the dense tensor (even if it's +/-INF and that INF*0 == NaN). +// +// *Limitation*: this Op only broadcasts the dense side to the sparse side, but not +// the other direction. +// +// Arguments: +// +// sp_indices: 2-D. `N x R` matrix with the indices of non-empty values in a +// +// SparseTensor, possibly not in canonical ordering. +// +// sp_values: 1-D. `N` non-empty values corresponding to `sp_indices`. +// sp_shape: 1-D. Shape of the input SparseTensor. +// dense: `R`-D. The dense Tensor operand. +// +// Returns 1-D. The `N` values that are operated on. +func SparseDenseCwiseMul(scope *Scope, sp_indices tf.Output, sp_values tf.Output, sp_shape tf.Output, dense tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "SparseDenseCwiseMul", + Input: []tf.Input{ + sp_indices, sp_values, sp_shape, dense, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// StatelessMultinomialAttr is an optional argument to StatelessMultinomial. +type StatelessMultinomialAttr func(optionalAttr) + +// StatelessMultinomialOutputDtype sets the optional output_dtype attribute to value. +// If not specified, defaults to DT_INT64 +func StatelessMultinomialOutputDtype(value tf.DataType) StatelessMultinomialAttr { + return func(m optionalAttr) { + m["output_dtype"] = value + } +} + +// Draws samples from a multinomial distribution. +// +// Arguments: +// +// logits: 2-D Tensor with shape `[batch_size, num_classes]`. Each slice `[i, :]` +// +// represents the unnormalized log probabilities for all classes. +// +// num_samples: 0-D. Number of independent samples to draw for each row slice. +// seed: 2 seeds (shape [2]). +// +// Returns 2-D Tensor with shape `[batch_size, num_samples]`. Each slice `[i, :]` +// contains the drawn class labels with range `[0, num_classes)`. +func StatelessMultinomial(scope *Scope, logits tf.Output, num_samples tf.Output, seed tf.Output, optional ...StatelessMultinomialAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "StatelessMultinomial", + Input: []tf.Input{ + logits, num_samples, seed, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// EditDistanceAttr is an optional argument to EditDistance. +type EditDistanceAttr func(optionalAttr) + +// EditDistanceNormalize sets the optional normalize attribute to value. +// +// value: boolean (if true, edit distances are normalized by length of truth). +// +// The output is: +// If not specified, defaults to true +func EditDistanceNormalize(value bool) EditDistanceAttr { + return func(m optionalAttr) { + m["normalize"] = value + } +} + +// Computes the (possibly normalized) Levenshtein Edit Distance. +// +// The inputs are variable-length sequences provided by SparseTensors +// +// (hypothesis_indices, hypothesis_values, hypothesis_shape) +// +// and +// +// (truth_indices, truth_values, truth_shape). +// +// The inputs are: +// +// Arguments: +// +// hypothesis_indices: The indices of the hypothesis list SparseTensor. +// +// This is an N x R int64 matrix. +// +// hypothesis_values: The values of the hypothesis list SparseTensor. +// +// This is an N-length vector. +// +// hypothesis_shape: The shape of the hypothesis list SparseTensor. +// +// This is an R-length vector. +// +// truth_indices: The indices of the truth list SparseTensor. +// +// This is an M x R int64 matrix. +// +// truth_values: The values of the truth list SparseTensor. +// +// This is an M-length vector. +// +// truth_shape: truth indices, vector. +// +// Returns A dense float tensor with rank R - 1. +// +// For the example input: +// +// // hypothesis represents a 2x1 matrix with variable-length values: +// // (0,0) = ["a"] +// // (1,0) = ["b"] +// hypothesis_indices = [[0, 0, 0], +// [1, 0, 0]] +// hypothesis_values = ["a", "b"] +// hypothesis_shape = [2, 1, 1] +// +// // truth represents a 2x2 matrix with variable-length values: +// // (0,0) = [] +// // (0,1) = ["a"] +// // (1,0) = ["b", "c"] +// // (1,1) = ["a"] +// truth_indices = [[0, 1, 0], +// [1, 0, 0], +// [1, 0, 1], +// [1, 1, 0]] +// truth_values = ["a", "b", "c", "a"] +// truth_shape = [2, 2, 2] +// normalize = true +// +// The output will be: +// +// // output is a 2x2 matrix with edit distances normalized by truth lengths. +// output = [[inf, 1.0], // (0,0): no truth, (0,1): no hypothesis +// [0.5, 1.0]] // (1,0): addition, (1,1): no hypothesis +func EditDistance(scope *Scope, hypothesis_indices tf.Output, hypothesis_values tf.Output, hypothesis_shape tf.Output, truth_indices tf.Output, truth_values tf.Output, truth_shape tf.Output, optional ...EditDistanceAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "EditDistance", + Input: []tf.Input{ + hypothesis_indices, hypothesis_values, hypothesis_shape, truth_indices, truth_values, truth_shape, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Rounds the values of a tensor to the nearest integer, element-wise. +// +// Rounds half to even. Also known as bankers rounding. If you want to round +// according to the current system rounding mode use std::cint. +func Round(scope *Scope, x tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Round", + Input: []tf.Input{ + x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes the Gauss error function of `x` element-wise. +func Erf(scope *Scope, x tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Erf", + Input: []tf.Input{ + x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// TakeDatasetAttr is an optional argument to TakeDataset. +type TakeDatasetAttr func(optionalAttr) + +// TakeDatasetMetadata sets the optional metadata attribute to value. +// If not specified, defaults to "" +func TakeDatasetMetadata(value string) TakeDatasetAttr { + return func(m optionalAttr) { + m["metadata"] = value + } +} + +// Creates a dataset that contains `count` elements from the `input_dataset`. +// +// Arguments: +// +// count: A scalar representing the number of elements from the `input_dataset` +// +// that should be taken. A value of `-1` indicates that all of `input_dataset` +// is taken. +func TakeDataset(scope *Scope, input_dataset tf.Output, count tf.Output, output_types []tf.DataType, output_shapes []tf.Shape, optional ...TakeDatasetAttr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "TakeDataset", + Input: []tf.Input{ + input_dataset, count, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Return the shape of s0 op s1 with broadcast. +// +// Given `s0` and `s1`, tensors that represent shapes, compute `r0`, the +// broadcasted shape. `s0`, `s1` and `r0` are all integer vectors. +func BroadcastArgs(scope *Scope, s0 tf.Output, s1 tf.Output) (r0 tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "BroadcastArgs", + Input: []tf.Input{ + s0, s1, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Subtracts `v` into specified rows of `x`. +// +// Computes y = x; y[i, :] -= v; return y. +// +// Arguments: +// +// x: A `Tensor` of type T. +// i: A vector. Indices into the left-most dimension of `x`. +// v: A `Tensor` of type T. Same dimension sizes as x except the first dimension, which must be the same as i's size. +// +// Returns A `Tensor` of type T. An alias of `x`. The content of `y` is undefined if there are duplicates in `i`. +func InplaceSub(scope *Scope, x tf.Output, i tf.Output, v tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "InplaceSub", + Input: []tf.Input{ + x, i, v, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Convert JSON-encoded Example records to binary protocol buffer strings. +// +// This op translates a tensor containing Example records, encoded using +// the [standard JSON +// mapping](https://developers.google.com/protocol-buffers/docs/proto3#json), +// into a tensor containing the same records encoded as binary protocol +// buffers. The resulting tensor can then be fed to any of the other +// Example-parsing ops. +// +// Arguments: +// +// json_examples: Each string is a JSON object serialized according to the JSON +// +// mapping of the Example proto. +// +// Returns Each string is a binary Example protocol buffer corresponding +// to the respective element of `json_examples`. +func DecodeJSONExample(scope *Scope, json_examples tf.Output) (binary_examples tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "DecodeJSONExample", + Input: []tf.Input{ + json_examples, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// LoadTPUEmbeddingProximalAdagradParametersAttr is an optional argument to LoadTPUEmbeddingProximalAdagradParameters. +type LoadTPUEmbeddingProximalAdagradParametersAttr func(optionalAttr) + +// LoadTPUEmbeddingProximalAdagradParametersTableId sets the optional table_id attribute to value. +// If not specified, defaults to -1 +func LoadTPUEmbeddingProximalAdagradParametersTableId(value int64) LoadTPUEmbeddingProximalAdagradParametersAttr { + return func(m optionalAttr) { + m["table_id"] = value + } +} + +// LoadTPUEmbeddingProximalAdagradParametersTableName sets the optional table_name attribute to value. +// If not specified, defaults to "" +func LoadTPUEmbeddingProximalAdagradParametersTableName(value string) LoadTPUEmbeddingProximalAdagradParametersAttr { + return func(m optionalAttr) { + m["table_name"] = value + } +} + +// LoadTPUEmbeddingProximalAdagradParametersConfig sets the optional config attribute to value. +// If not specified, defaults to "" +func LoadTPUEmbeddingProximalAdagradParametersConfig(value string) LoadTPUEmbeddingProximalAdagradParametersAttr { + return func(m optionalAttr) { + m["config"] = value + } +} + +// Load proximal Adagrad embedding parameters. +// +// An op that loads optimization parameters into HBM for embedding. Must be +// preceded by a ConfigureTPUEmbeddingHost op that sets up the correct +// embedding table configuration. For example, this op is used to install +// parameters that are loaded from a checkpoint before a training loop is +// executed. +// +// Arguments: +// +// parameters: Value of parameters used in the proximal Adagrad optimization algorithm. +// accumulators: Value of accumulators used in the proximal Adagrad optimization algorithm. +// +// Returns the created operation. +func LoadTPUEmbeddingProximalAdagradParameters(scope *Scope, parameters tf.Output, accumulators tf.Output, num_shards int64, shard_id int64, optional ...LoadTPUEmbeddingProximalAdagradParametersAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_shards": num_shards, "shard_id": shard_id} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "LoadTPUEmbeddingProximalAdagradParameters", + Input: []tf.Input{ + parameters, accumulators, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// Computes the derivative of a Gamma random sample w.r.t. `alpha`. +func RandomGammaGrad(scope *Scope, alpha tf.Output, sample tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "RandomGammaGrad", + Input: []tf.Input{ + alpha, sample, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Takes the packed uint32 input and unpacks the input to uint8 to do +// +// Dequantization on device. +// +// Arguments: +// +// input: Input tensors whose types is uint32, shape is [d0, ..., dn]. +// min_range: The minimum scalar value possibly produced for the input. +// max_range: The maximum scalar value possibly produced for the input. +// mode: String to determine the dequantize mode in {"MIN_COMBINED", "MIN_FIRST", "SCALED"}. +// transpose_output: Boolean to determine if output is transposed. transpose_output +// +// is faster when input is large and rank of input is higher than 1. +// +// Returns Output tensors whose types is bfloat16. If transpose_output is true, +// output shape is [dn * 4, dn-1, ..., d1, d0]. If transpose_output +// is false, output shape is [d0,..., dn * 4]. +func XlaDequantize(scope *Scope, input tf.Output, min_range float32, max_range float32, mode string, transpose_output bool) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"min_range": min_range, "max_range": max_range, "mode": mode, "transpose_output": transpose_output} + opspec := tf.OpSpec{ + Type: "XlaDequantize", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes the maximum along segments of a tensor. +// +// Read +// [the section on segmentation](https://tensorflow.org/api_docs/python/tf/math#Segmentation) +// for an explanation of segments. +// +// Computes a tensor such that +// \\(output_i = \max_j(data_j)\\) where `max` is over `j` such +// that `segment_ids[j] == i`. +// +// If the max is empty for a given segment ID `i`, `output[i] = 0`. +// +//
+// +//
+// +// For example: +// +// ``` +// c = tf.constant([[1,2,3,4], [4, 3, 2, 1], [5,6,7,8]]) +// tf.segment_max(c, tf.constant([0, 0, 1])) +// # ==> [[4, 3, 3, 4], +// # [5, 6, 7, 8]] +// ``` +// +// Arguments: +// +// segment_ids: A 1-D tensor whose size is equal to the size of `data`'s +// +// first dimension. Values should be sorted and can be repeated. +// +// Returns Has same shape as data, except for dimension 0 which +// has size `k`, the number of segments. +func SegmentMax(scope *Scope, data tf.Output, segment_ids tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "SegmentMax", + Input: []tf.Input{ + data, segment_ids, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Transforms a tf.Example proto (as a string) into typed tensors. +// +// Arguments: +// +// serialized: A vector containing a batch of binary serialized Example protos. +// dense_defaults: A list of Tensors (some may be empty), whose length matches +// +// the length of `dense_keys`. dense_defaults[j] provides default values +// when the example's feature_map lacks dense_key[j]. If an empty Tensor is +// provided for dense_defaults[j], then the Feature dense_keys[j] is required. +// The input type is inferred from dense_defaults[j], even when it's empty. +// If dense_defaults[j] is not empty, and dense_shapes[j] is fully defined, +// then the shape of dense_defaults[j] must match that of dense_shapes[j]. +// If dense_shapes[j] has an undefined major dimension (variable strides dense +// feature), dense_defaults[j] must contain a single element: +// the padding element. +// +// num_sparse: The number of sparse features to be parsed from the example. This +// +// must match the lengths of `sparse_keys` and `sparse_types`. +// +// sparse_keys: A list of `num_sparse` strings. +// +// The keys expected in the Examples' features associated with sparse values. +// +// dense_keys: The keys expected in the Examples' features associated with dense +// +// values. +// +// sparse_types: A list of `num_sparse` types; the data types of data in each +// +// Feature given in sparse_keys. +// Currently the ParseSingleExample op supports DT_FLOAT (FloatList), +// DT_INT64 (Int64List), and DT_STRING (BytesList). +// +// dense_shapes: The shapes of data in each Feature given in dense_keys. +// +// The length of this list must match the length of `dense_keys`. The +// number of elements in the Feature corresponding to dense_key[j] must +// always equal dense_shapes[j].NumEntries(). If dense_shapes[j] == +// (D0, D1, ..., DN) then the shape of output Tensor dense_values[j] +// will be (D0, D1, ..., DN): In the case dense_shapes[j] = (-1, D1, +// ..., DN), the shape of the output Tensor dense_values[j] will be (M, +// D1, .., DN), where M is the number of blocks of elements of length +// D1 * .... * DN, in the input. +func ParseSingleExample(scope *Scope, serialized tf.Output, dense_defaults []tf.Output, num_sparse int64, sparse_keys []string, dense_keys []string, sparse_types []tf.DataType, dense_shapes []tf.Shape) (sparse_indices []tf.Output, sparse_values []tf.Output, sparse_shapes []tf.Output, dense_values []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_sparse": num_sparse, "sparse_keys": sparse_keys, "dense_keys": dense_keys, "sparse_types": sparse_types, "dense_shapes": dense_shapes} + opspec := tf.OpSpec{ + Type: "ParseSingleExample", + Input: []tf.Input{ + serialized, tf.OutputList(dense_defaults), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if sparse_indices, idx, err = makeOutputList(op, idx, "sparse_indices"); err != nil { + scope.UpdateErr("ParseSingleExample", err) + return + } + if sparse_values, idx, err = makeOutputList(op, idx, "sparse_values"); err != nil { + scope.UpdateErr("ParseSingleExample", err) + return + } + if sparse_shapes, idx, err = makeOutputList(op, idx, "sparse_shapes"); err != nil { + scope.UpdateErr("ParseSingleExample", err) + return + } + if dense_values, idx, err = makeOutputList(op, idx, "dense_values"); err != nil { + scope.UpdateErr("ParseSingleExample", err) + return + } + return sparse_indices, sparse_values, sparse_shapes, dense_values +} + +// Check if the input matches the regex pattern. +// +// The input is a string tensor of any shape. The pattern is the +// regular expression to be matched with every element of the input tensor. +// The boolean values (True or False) of the output tensor indicate +// if the input matches the regex pattern provided. +// +// The pattern follows the re2 syntax (https://github.com/google/re2/wiki/Syntax) +// +// Arguments: +// +// input: A string tensor of the text to be processed. +// pattern: The regular expression to match the input. +// +// Returns A bool tensor with the same shape as `input`. +func StaticRegexFullMatch(scope *Scope, input tf.Output, pattern string) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"pattern": pattern} + opspec := tf.OpSpec{ + Type: "StaticRegexFullMatch", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Divides sparse updates into the variable referenced by `resource`. +// +// This operation computes +// +// # Scalar indices +// ref[indices, ...] /= updates[...] +// +// # Vector indices (for each i) +// ref[indices[i], ...] /= updates[i, ...] +// +// # High rank indices (for each i, ..., j) +// ref[indices[i, ..., j], ...] /= updates[i, ..., j, ...] +// +// Duplicate entries are handled correctly: if multiple `indices` reference +// the same location, their contributions multiply. +// +// Requires `updates.shape = indices.shape + ref.shape[1:]` or `updates.shape = []`. +// +//
+// +//
+// +// Arguments: +// +// resource: Should be from a `Variable` node. +// indices: A tensor of indices into the first dimension of `ref`. +// updates: A tensor of updated values to add to `ref`. +// +// Returns the created operation. +func ResourceScatterDiv(scope *Scope, resource tf.Output, indices tf.Output, updates tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "ResourceScatterDiv", + Input: []tf.Input{ + resource, indices, updates, + }, + } + return scope.AddOperation(opspec) +} + +// Shuffle dimensions of x according to a permutation and conjugate the result. +// +// The output `y` has the same rank as `x`. The shapes of `x` and `y` satisfy: +// +// `y.shape[i] == x.shape[perm[i]] for i in [0, 1, ..., rank(x) - 1]` +// `y[i,j,k,...,s,t,u] == conj(x[perm[i], perm[j], perm[k],...,perm[s], perm[t], perm[u]])` +func ConjugateTranspose(scope *Scope, x tf.Output, perm tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "ConjugateTranspose", + Input: []tf.Input{ + x, perm, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes the gradient for the inverse of `x` wrt its input. +// +// Specifically, `grad = -dy * y*y`, where `y = 1/x`, and `dy` +// is the corresponding input gradient. +func InvGrad(scope *Scope, y tf.Output, dy tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "InvGrad", + Input: []tf.Input{ + y, dy, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Enqueue multiple Tensor values on the computation outfeed. +// +// Arguments: +// +// inputs: A list of tensors that will be inserted into the outfeed queue as an +// +// XLA tuple. +// +// Returns the created operation. +func OutfeedEnqueueTuple(scope *Scope, inputs []tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "OutfeedEnqueueTuple", + Input: []tf.Input{ + tf.OutputList(inputs), + }, + } + return scope.AddOperation(opspec) +} + +// Store the input tensor in the state of the current session. +// +// Arguments: +// +// value: The tensor to be stored. +// +// Returns The handle for the tensor stored in the session state, represented +// as a ResourceHandle object. +func GetSessionHandleV2(scope *Scope, value tf.Output) (handle tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "GetSessionHandleV2", + Input: []tf.Input{ + value, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Advance the counter of a counter-based RNG. +// +// The state of the RNG after +// `rng_skip(n)` will be the same as that after `stateful_uniform([n])` +// (or any other distribution). The actual increment added to the +// counter is an unspecified implementation detail. +// +// Arguments: +// +// resource: The handle of the resource variable that stores the state of the RNG. +// algorithm: The RNG algorithm. +// delta: The amount of advancement. +// +// Returns the created operation. +func RngSkip(scope *Scope, resource tf.Output, algorithm tf.Output, delta tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "RngSkip", + Input: []tf.Input{ + resource, algorithm, delta, + }, + } + return scope.AddOperation(opspec) +} + +// Makes a copy of `x`. +// +// Arguments: +// +// x: The source tensor of type `T`. +// +// Returns y: A `Tensor` of type `T`. A copy of `x`. Guaranteed that `y` +// +// is not an alias of `x`. +func DeepCopy(scope *Scope, x tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "DeepCopy", + Input: []tf.Input{ + x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// StringSplitAttr is an optional argument to StringSplit. +type StringSplitAttr func(optionalAttr) + +// StringSplitSkipEmpty sets the optional skip_empty attribute to value. +// +// value: A `bool`. If `True`, skip the empty strings from the result. +// If not specified, defaults to true +func StringSplitSkipEmpty(value bool) StringSplitAttr { + return func(m optionalAttr) { + m["skip_empty"] = value + } +} + +// Split elements of `input` based on `delimiter` into a `SparseTensor`. +// +// Let N be the size of source (typically N will be the batch size). Split each +// element of `input` based on `delimiter` and return a `SparseTensor` +// containing the splitted tokens. Empty tokens are ignored. +// +// `delimiter` can be empty, or a string of split characters. If `delimiter` is an +// +// empty string, each element of `input` is split into individual single-byte +// character strings, including splitting of UTF-8 multibyte sequences. Otherwise +// every character of `delimiter` is a potential split point. +// +// For example: +// +// N = 2, input[0] is 'hello world' and input[1] is 'a b c', then the output +// will be +// +// indices = [0, 0; +// 0, 1; +// 1, 0; +// 1, 1; +// 1, 2] +// shape = [2, 3] +// values = ['hello', 'world', 'a', 'b', 'c'] +// +// Arguments: +// +// input: 1-D. Strings to split. +// delimiter: 0-D. Delimiter characters (bytes), or empty string. +// +// Returns: +// +// indices: A dense matrix of int64 representing the indices of the sparse tensor. +// values: A vector of strings corresponding to the splited values. +// shape: a length-2 vector of int64 representing the shape of the sparse +// +// tensor, where the first value is N and the second value is the maximum number +// of tokens in a single input entry. +func StringSplit(scope *Scope, input tf.Output, delimiter tf.Output, optional ...StringSplitAttr) (indices tf.Output, values tf.Output, shape tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "StringSplit", + Input: []tf.Input{ + input, delimiter, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// Compresses a dataset element. +func CompressElement(scope *Scope, components []tf.Output) (compressed tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "CompressElement", + Input: []tf.Input{ + tf.OutputList(components), + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Outputs deterministic pseudorandom random integers from a uniform distribution. +// +// The generated values follow a uniform distribution in the range `[minval, maxval)`. +// +// The outputs are a deterministic function of `shape`, `key`, `counter`, `alg`, `minval` and `maxval`. +// +// Arguments: +// +// shape: The shape of the output tensor. +// key: Key for the counter-based RNG algorithm (shape uint64[1]). +// counter: Initial counter for the counter-based RNG algorithm (shape uint64[2] or uint64[1] depending on the algorithm). If a larger vector is given, only the needed portion on the left (i.e. [:N]) will be used. +// alg: The RNG algorithm (shape int32[]). +// minval: Minimum value (inclusive, scalar). +// maxval: Maximum value (exclusive, scalar). +// +// Returns Random values with specified shape. +func StatelessRandomUniformIntV2(scope *Scope, shape tf.Output, key tf.Output, counter tf.Output, alg tf.Output, minval tf.Output, maxval tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "StatelessRandomUniformIntV2", + Input: []tf.Input{ + shape, key, counter, alg, minval, maxval, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// SpaceToBatch for N-D tensors of type T. +// +// This operation divides "spatial" dimensions `[1, ..., M]` of the input into a +// grid of blocks of shape `block_shape`, and interleaves these blocks with the +// "batch" dimension (0) such that in the output, the spatial dimensions +// `[1, ..., M]` correspond to the position within the grid, and the batch +// dimension combines both the position within a spatial block and the original +// batch position. Prior to division into blocks, the spatial dimensions of the +// input are optionally zero padded according to `paddings`. See below for a +// precise description. +// +// Arguments: +// +// input: N-D with shape `input_shape = [batch] + spatial_shape + remaining_shape`, +// +// where spatial_shape has `M` dimensions. +// +// block_shape: 1-D with shape `[M]`, all values must be >= 1. +// paddings: 2-D with shape `[M, 2]`, all values must be >= 0. +// `paddings[i] = [pad_start, pad_end]` specifies the padding for input dimension +// `i + 1`, which corresponds to spatial dimension `i`. It is required that +// `block_shape[i]` divides `input_shape[i + 1] + pad_start + pad_end`. +// +// This operation is equivalent to the following steps: +// +// 1. Zero-pad the start and end of dimensions `[1, ..., M]` of the +// input according to `paddings` to produce `padded` of shape `padded_shape`. +// +// 2. Reshape `padded` to `reshaped_padded` of shape: +// +// [batch] + +// [padded_shape[1] / block_shape[0], +// block_shape[0], +// ..., +// padded_shape[M] / block_shape[M-1], +// block_shape[M-1]] + +// remaining_shape +// +// 3. Permute dimensions of `reshaped_padded` to produce +// `permuted_reshaped_padded` of shape: +// +// block_shape + +// [batch] + +// [padded_shape[1] / block_shape[0], +// ..., +// padded_shape[M] / block_shape[M-1]] + +// remaining_shape +// +// 4. Reshape `permuted_reshaped_padded` to flatten `block_shape` into the batch +// dimension, producing an output tensor of shape: +// +// [batch * prod(block_shape)] + +// [padded_shape[1] / block_shape[0], +// ..., +// padded_shape[M] / block_shape[M-1]] + +// remaining_shape +// +// Some examples: +// +// (1) For the following input of shape `[1, 2, 2, 1]`, `block_shape = [2, 2]`, and +// +// `paddings = [[0, 0], [0, 0]]`: +// +// ``` +// x = [[[[1], [2]], [[3], [4]]]] +// ``` +// +// The output tensor has shape `[4, 1, 1, 1]` and value: +// +// ``` +// [[[[1]]], [[[2]]], [[[3]]], [[[4]]]] +// ``` +// +// (2) For the following input of shape `[1, 2, 2, 3]`, `block_shape = [2, 2]`, and +// +// `paddings = [[0, 0], [0, 0]]`: +// +// ``` +// x = [[[[1, 2, 3], [4, 5, 6]], +// +// [[7, 8, 9], [10, 11, 12]]]] +// +// ``` +// +// The output tensor has shape `[4, 1, 1, 3]` and value: +// +// ``` +// [[[[1, 2, 3]]], [[[4, 5, 6]]], [[[7, 8, 9]]], [[[10, 11, 12]]]] +// ``` +// +// (3) For the following input of shape `[1, 4, 4, 1]`, `block_shape = [2, 2]`, and +// +// `paddings = [[0, 0], [0, 0]]`: +// +// ``` +// x = [[[[1], [2], [3], [4]], +// +// [[5], [6], [7], [8]], +// [[9], [10], [11], [12]], +// [[13], [14], [15], [16]]]] +// +// ``` +// +// The output tensor has shape `[4, 2, 2, 1]` and value: +// +// ``` +// x = [[[[1], [3]], [[9], [11]]], +// +// [[[2], [4]], [[10], [12]]], +// [[[5], [7]], [[13], [15]]], +// [[[6], [8]], [[14], [16]]]] +// +// ``` +// +// (4) For the following input of shape `[2, 2, 4, 1]`, block_shape = `[2, 2]`, and +// +// paddings = `[[0, 0], [2, 0]]`: +// +// ``` +// x = [[[[1], [2], [3], [4]], +// +// [[5], [6], [7], [8]]], +// [[[9], [10], [11], [12]], +// [[13], [14], [15], [16]]]] +// +// ``` +// +// The output tensor has shape `[8, 1, 3, 1]` and value: +// +// ``` +// x = [[[[0], [1], [3]]], [[[0], [9], [11]]], +// +// [[[0], [2], [4]]], [[[0], [10], [12]]], +// [[[0], [5], [7]]], [[[0], [13], [15]]], +// [[[0], [6], [8]]], [[[0], [14], [16]]]] +// +// ``` +// +// Among others, this operation is useful for reducing atrous convolution into +// regular convolution. +func SpaceToBatchND(scope *Scope, input tf.Output, block_shape tf.Output, paddings tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "SpaceToBatchND", + Input: []tf.Input{ + input, block_shape, paddings, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// DecodeBmpAttr is an optional argument to DecodeBmp. +type DecodeBmpAttr func(optionalAttr) + +// DecodeBmpChannels sets the optional channels attribute to value. +// If not specified, defaults to 0 +func DecodeBmpChannels(value int64) DecodeBmpAttr { + return func(m optionalAttr) { + m["channels"] = value + } +} + +// Decode the first frame of a BMP-encoded image to a uint8 tensor. +// +// The attr `channels` indicates the desired number of color channels for the +// decoded image. +// +// Accepted values are: +// +// * 0: Use the number of channels in the BMP-encoded image. +// * 3: output an RGB image. +// * 4: output an RGBA image. +// +// Arguments: +// +// contents: 0-D. The BMP-encoded image. +// +// Returns 3-D with shape `[height, width, channels]`. RGB order +func DecodeBmp(scope *Scope, contents tf.Output, optional ...DecodeBmpAttr) (image tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "DecodeBmp", + Input: []tf.Input{ + contents, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Quantized Batch normalization. +// +// This op is deprecated and will be removed in the future. Prefer +// `tf.nn.batch_normalization`. +// +// Arguments: +// +// t: A 4D input Tensor. +// t_min: The value represented by the lowest quantized input. +// t_max: The value represented by the highest quantized input. +// m: A 1D mean Tensor with size matching the last dimension of t. +// +// This is the first output from tf.nn.moments, +// or a saved moving average thereof. +// +// m_min: The value represented by the lowest quantized mean. +// m_max: The value represented by the highest quantized mean. +// v: A 1D variance Tensor with size matching the last dimension of t. +// +// This is the second output from tf.nn.moments, +// or a saved moving average thereof. +// +// v_min: The value represented by the lowest quantized variance. +// v_max: The value represented by the highest quantized variance. +// beta: A 1D beta Tensor with size matching the last dimension of t. +// +// An offset to be added to the normalized tensor. +// +// beta_min: The value represented by the lowest quantized offset. +// beta_max: The value represented by the highest quantized offset. +// gamma: A 1D gamma Tensor with size matching the last dimension of t. +// +// If "scale_after_normalization" is true, this tensor will be multiplied +// with the normalized tensor. +// +// gamma_min: The value represented by the lowest quantized gamma. +// gamma_max: The value represented by the highest quantized gamma. +// +// variance_epsilon: A small float number to avoid dividing by 0. +// scale_after_normalization: A bool indicating whether the resulted tensor +// +// needs to be multiplied with gamma. +func QuantizedBatchNormWithGlobalNormalization(scope *Scope, t tf.Output, t_min tf.Output, t_max tf.Output, m tf.Output, m_min tf.Output, m_max tf.Output, v tf.Output, v_min tf.Output, v_max tf.Output, beta tf.Output, beta_min tf.Output, beta_max tf.Output, gamma tf.Output, gamma_min tf.Output, gamma_max tf.Output, out_type tf.DataType, variance_epsilon float32, scale_after_normalization bool) (result tf.Output, result_min tf.Output, result_max tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"out_type": out_type, "variance_epsilon": variance_epsilon, "scale_after_normalization": scale_after_normalization} + opspec := tf.OpSpec{ + Type: "QuantizedBatchNormWithGlobalNormalization", + Input: []tf.Input{ + t, t_min, t_max, m, m_min, m_max, v, v_min, v_max, beta, beta_min, beta_max, gamma, gamma_min, gamma_max, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// Applies a gradient to a given accumulator. +// +// Does not add if local_step is lesser than the accumulator's global_step. +// +// Arguments: +// +// handle: The handle to a accumulator. +// local_step: The local_step value at which the gradient was computed. +// gradient: A tensor of the gradient to be accumulated. +// +// Returns the created operation. +func ResourceAccumulatorApplyGradient(scope *Scope, handle tf.Output, local_step tf.Output, gradient tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "ResourceAccumulatorApplyGradient", + Input: []tf.Input{ + handle, local_step, gradient, + }, + } + return scope.AddOperation(opspec) +} + +// StridedSliceGradAttr is an optional argument to StridedSliceGrad. +type StridedSliceGradAttr func(optionalAttr) + +// StridedSliceGradBeginMask sets the optional begin_mask attribute to value. +// If not specified, defaults to 0 +func StridedSliceGradBeginMask(value int64) StridedSliceGradAttr { + return func(m optionalAttr) { + m["begin_mask"] = value + } +} + +// StridedSliceGradEndMask sets the optional end_mask attribute to value. +// If not specified, defaults to 0 +func StridedSliceGradEndMask(value int64) StridedSliceGradAttr { + return func(m optionalAttr) { + m["end_mask"] = value + } +} + +// StridedSliceGradEllipsisMask sets the optional ellipsis_mask attribute to value. +// If not specified, defaults to 0 +func StridedSliceGradEllipsisMask(value int64) StridedSliceGradAttr { + return func(m optionalAttr) { + m["ellipsis_mask"] = value + } +} + +// StridedSliceGradNewAxisMask sets the optional new_axis_mask attribute to value. +// If not specified, defaults to 0 +func StridedSliceGradNewAxisMask(value int64) StridedSliceGradAttr { + return func(m optionalAttr) { + m["new_axis_mask"] = value + } +} + +// StridedSliceGradShrinkAxisMask sets the optional shrink_axis_mask attribute to value. +// If not specified, defaults to 0 +func StridedSliceGradShrinkAxisMask(value int64) StridedSliceGradAttr { + return func(m optionalAttr) { + m["shrink_axis_mask"] = value + } +} + +// Returns the gradient of `StridedSlice`. +// +// Since `StridedSlice` cuts out pieces of its `input` which is size +// `shape`, its gradient will have the same shape (which is passed here +// as `shape`). The gradient will be zero in any element that the slice +// does not select. +// +// Arguments are the same as StridedSliceGrad with the exception that +// `dy` is the input gradient to be propagated and `shape` is the +// shape of `StridedSlice`'s `input`. +func StridedSliceGrad(scope *Scope, shape tf.Output, begin tf.Output, end tf.Output, strides tf.Output, dy tf.Output, optional ...StridedSliceGradAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "StridedSliceGrad", + Input: []tf.Input{ + shape, begin, end, strides, dy, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns 0 if x == 0, and x * log(y) otherwise, elementwise. +func Xlogy(scope *Scope, x tf.Output, y tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Xlogy", + Input: []tf.Input{ + x, y, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// UniqueAttr is an optional argument to Unique. +type UniqueAttr func(optionalAttr) + +// UniqueOutIdx sets the optional out_idx attribute to value. +// If not specified, defaults to DT_INT32 +func UniqueOutIdx(value tf.DataType) UniqueAttr { + return func(m optionalAttr) { + m["out_idx"] = value + } +} + +// Finds unique elements in a 1-D tensor. +// +// This operation returns a tensor `y` containing all of the unique elements of `x` +// sorted in the same order that they occur in `x`; `x` does not need to be sorted. +// This operation also returns a tensor `idx` the same size as `x` that contains +// the index of each value of `x` in the unique output `y`. In other words: +// +// `y[idx[i]] = x[i] for i in [0, 1,...,rank(x) - 1]` +// +// Examples: +// +// ``` +// # tensor 'x' is [1, 1, 2, 4, 4, 4, 7, 8, 8] +// y, idx = unique(x) +// y ==> [1, 2, 4, 7, 8] +// idx ==> [0, 0, 1, 2, 2, 2, 3, 4, 4] +// ``` +// +// ``` +// # tensor 'x' is [4, 5, 1, 2, 3, 3, 4, 5] +// y, idx = unique(x) +// y ==> [4, 5, 1, 2, 3] +// idx ==> [0, 1, 2, 3, 4, 4, 0, 1] +// ``` +// +// Arguments: +// +// x: 1-D. +// +// Returns: +// +// y: 1-D. +// idx: 1-D. +func Unique(scope *Scope, x tf.Output, optional ...UniqueAttr) (y tf.Output, idx tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Unique", + Input: []tf.Input{ + x, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// ArgMaxAttr is an optional argument to ArgMax. +type ArgMaxAttr func(optionalAttr) + +// ArgMaxOutputType sets the optional output_type attribute to value. +// If not specified, defaults to DT_INT64 +func ArgMaxOutputType(value tf.DataType) ArgMaxAttr { + return func(m optionalAttr) { + m["output_type"] = value + } +} + +// Returns the index with the largest value across dimensions of a tensor. +// +// Note that in case of ties the identity of the return value is not guaranteed. +// +// Usage: +// +// ```python +// import tensorflow as tf +// a = [1, 10, 26.9, 2.8, 166.32, 62.3] +// b = tf.math.argmax(input = a) +// c = tf.keras.backend.eval(b) +// # c = 4 +// # here a[4] = 166.32 which is the largest element of a across axis 0 +// ``` +// +// Arguments: +// +// dimension: int32 or int64, must be in the range `[-rank(input), rank(input))`. +// +// Describes which dimension of the input Tensor to reduce across. For vectors, +// use dimension = 0. +func ArgMax(scope *Scope, input tf.Output, dimension tf.Output, optional ...ArgMaxAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ArgMax", + Input: []tf.Input{ + input, dimension, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ResourceApplyKerasMomentumAttr is an optional argument to ResourceApplyKerasMomentum. +type ResourceApplyKerasMomentumAttr func(optionalAttr) + +// ResourceApplyKerasMomentumUseLocking sets the optional use_locking attribute to value. +// +// value: If `True`, updating of the var and accum tensors will be protected +// by a lock; otherwise the behavior is undefined, but may exhibit less +// contention. +// If not specified, defaults to false +func ResourceApplyKerasMomentumUseLocking(value bool) ResourceApplyKerasMomentumAttr { + return func(m optionalAttr) { + m["use_locking"] = value + } +} + +// ResourceApplyKerasMomentumUseNesterov sets the optional use_nesterov attribute to value. +// +// value: If `True`, the tensor passed to compute grad will be +// var + momentum * accum, so in the end, the var you get is actually +// var + momentum * accum. +// If not specified, defaults to false +func ResourceApplyKerasMomentumUseNesterov(value bool) ResourceApplyKerasMomentumAttr { + return func(m optionalAttr) { + m["use_nesterov"] = value + } +} + +// Update '*var' according to the momentum scheme. +// +// Set use_nesterov = True if you want to use Nesterov momentum. +// +// accum = accum * momentum - lr * grad +// var += accum +// +// Arguments: +// +// var_: Should be from a Variable(). +// accum: Should be from a Variable(). +// lr: Scaling factor. Must be a scalar. +// grad: The gradient. +// momentum: Momentum. Must be a scalar. +// +// Returns the created operation. +func ResourceApplyKerasMomentum(scope *Scope, var_ tf.Output, accum tf.Output, lr tf.Output, grad tf.Output, momentum tf.Output, optional ...ResourceApplyKerasMomentumAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ResourceApplyKerasMomentum", + Input: []tf.Input{ + var_, accum, lr, grad, momentum, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// EnterAttr is an optional argument to Enter. +type EnterAttr func(optionalAttr) + +// EnterIsConstant sets the optional is_constant attribute to value. +// +// value: If true, the output is constant within the child frame. +// If not specified, defaults to false +func EnterIsConstant(value bool) EnterAttr { + return func(m optionalAttr) { + m["is_constant"] = value + } +} + +// EnterParallelIterations sets the optional parallel_iterations attribute to value. +// +// value: The number of iterations allowed to run in parallel. +// If not specified, defaults to 10 +func EnterParallelIterations(value int64) EnterAttr { + return func(m optionalAttr) { + m["parallel_iterations"] = value + } +} + +// Creates or finds a child frame, and makes `data` available to the child frame. +// +// This op is used together with `Exit` to create loops in the graph. +// The unique `frame_name` is used by the `Executor` to identify frames. If +// `is_constant` is true, `output` is a constant in the child frame; otherwise +// it may be changed in the child frame. At most `parallel_iterations` iterations +// are run in parallel in the child frame. +// +// Arguments: +// +// data: The tensor to be made available to the child frame. +// frame_name: The name of the child frame. +// +// Returns The same tensor as `data`. +func Enter(scope *Scope, data tf.Output, frame_name string, optional ...EnterAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"frame_name": frame_name} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Enter", + Input: []tf.Input{ + data, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// DenseCountSparseOutputAttr is an optional argument to DenseCountSparseOutput. +type DenseCountSparseOutputAttr func(optionalAttr) + +// DenseCountSparseOutputMinlength sets the optional minlength attribute to value. +// +// value: Minimum value to count. Can be set to -1 for no minimum. +// If not specified, defaults to -1 +// +// REQUIRES: value >= -1 +func DenseCountSparseOutputMinlength(value int64) DenseCountSparseOutputAttr { + return func(m optionalAttr) { + m["minlength"] = value + } +} + +// DenseCountSparseOutputMaxlength sets the optional maxlength attribute to value. +// +// value: Maximum value to count. Can be set to -1 for no maximum. +// If not specified, defaults to -1 +// +// REQUIRES: value >= -1 +func DenseCountSparseOutputMaxlength(value int64) DenseCountSparseOutputAttr { + return func(m optionalAttr) { + m["maxlength"] = value + } +} + +// Performs sparse-output bin counting for a tf.tensor input. +// +// Counts the number of times each value occurs in the input. +// +// Arguments: +// +// values: Tensor containing data to count. +// weights: A Tensor of the same shape as indices containing per-index weight values. May +// +// also be the empty tensor if no weights are used. +// +// binary_output: Whether to output the number of occurrences of each value or 1. +// +// Returns: +// +// output_indices: Indices tensor for the resulting sparse tensor object. +// output_values: Values tensor for the resulting sparse tensor object. +// output_dense_shape: Shape tensor for the resulting sparse tensor object. +func DenseCountSparseOutput(scope *Scope, values tf.Output, weights tf.Output, binary_output bool, optional ...DenseCountSparseOutputAttr) (output_indices tf.Output, output_values tf.Output, output_dense_shape tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"binary_output": binary_output} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "DenseCountSparseOutput", + Input: []tf.Input{ + values, weights, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// DatasetCardinalityAttr is an optional argument to DatasetCardinality. +type DatasetCardinalityAttr func(optionalAttr) + +// DatasetCardinalityCardinalityOptions sets the optional cardinality_options attribute to value. +// If not specified, defaults to "" +func DatasetCardinalityCardinalityOptions(value string) DatasetCardinalityAttr { + return func(m optionalAttr) { + m["cardinality_options"] = value + } +} + +// Returns the cardinality of `input_dataset`. +// +// Returns the cardinality of `input_dataset`. +// +// Arguments: +// +// input_dataset: A variant tensor representing the dataset to return cardinality for. +// +// Returns The cardinality of `input_dataset`. Named constants are used to represent +// infinite and unknown cardinality. +func DatasetCardinality(scope *Scope, input_dataset tf.Output, optional ...DatasetCardinalityAttr) (cardinality tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "DatasetCardinality", + Input: []tf.Input{ + input_dataset, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Deserialize bucket boundaries and ready flag into current QuantileAccumulator. +// +// An op that deserializes bucket boundaries and are boundaries ready flag into current QuantileAccumulator. +// +// Arguments: +// +// quantile_stream_resource_handle: resource handle referring to a QuantileStreamResource. +// bucket_boundaries: float; List of Rank 1 Tensors each containing the bucket boundaries for a feature. +// +// Returns the created operation. +func BoostedTreesQuantileStreamResourceDeserialize(scope *Scope, quantile_stream_resource_handle tf.Output, bucket_boundaries []tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "BoostedTreesQuantileStreamResourceDeserialize", + Input: []tf.Input{ + quantile_stream_resource_handle, tf.OutputList(bucket_boundaries), + }, + } + return scope.AddOperation(opspec) +} + +// Returns the name of the device on which `resource` has been placed. +func ExperimentalIteratorGetDevice(scope *Scope, resource tf.Output) (device tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "ExperimentalIteratorGetDevice", + Input: []tf.Input{ + resource, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// MapSizeAttr is an optional argument to MapSize. +type MapSizeAttr func(optionalAttr) + +// MapSizeCapacity sets the optional capacity attribute to value. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func MapSizeCapacity(value int64) MapSizeAttr { + return func(m optionalAttr) { + m["capacity"] = value + } +} + +// MapSizeMemoryLimit sets the optional memory_limit attribute to value. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func MapSizeMemoryLimit(value int64) MapSizeAttr { + return func(m optionalAttr) { + m["memory_limit"] = value + } +} + +// MapSizeContainer sets the optional container attribute to value. +// If not specified, defaults to "" +func MapSizeContainer(value string) MapSizeAttr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// MapSizeSharedName sets the optional shared_name attribute to value. +// If not specified, defaults to "" +func MapSizeSharedName(value string) MapSizeAttr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// Op returns the number of elements in the underlying container. +func MapSize(scope *Scope, dtypes []tf.DataType, optional ...MapSizeAttr) (size tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtypes": dtypes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "MapSize", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns up to `num_records` (key, value) pairs produced by a Reader. +// +// Will dequeue from the input queue if necessary (e.g. when the +// Reader needs to start reading from a new file since it has finished +// with the previous file). +// It may return less than `num_records` even before the last batch. +// +// Arguments: +// +// reader_handle: Handle to a `Reader`. +// queue_handle: Handle to a `Queue`, with string work items. +// num_records: number of records to read from `Reader`. +// +// Returns: +// +// keys: A 1-D tensor. +// values: A 1-D tensor. +func ReaderReadUpToV2(scope *Scope, reader_handle tf.Output, queue_handle tf.Output, num_records tf.Output) (keys tf.Output, values tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "ReaderReadUpToV2", + Input: []tf.Input{ + reader_handle, queue_handle, num_records, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// Computes the Kth order statistic of a data set. The current +// +// implementation uses a binary search requiring exactly 32 passes over +// the input data. The running time is linear with respect to input +// size. The median-of-medians algorithm is probably faster, but is +// difficult to implement efficiently in XLA. The implementation imposes +// a total ordering on floats. The ordering is consistent with the usual +// partial order. Positive NaNs are greater than positive +// infinity. Negative NaNs are less than negative infinity. NaNs with +// distinct payloads are treated as distinct. Subnormal numbers are +// preserved (not flushed to zero). Positive infinity is greater than all +// numbers. Negative infinity is less than all numbers. Positive is +// greater than negative zero. There are less than k values greater than +// the kth order statistic. There are at least k values greater than or +// equal to the Kth order statistic. The semantics are not the same as +// top_k_unique. +func KthOrderStatistic(scope *Scope, input tf.Output, k int64) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"k": k} + opspec := tf.OpSpec{ + Type: "KthOrderStatistic", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// QuantizedMatMulAttr is an optional argument to QuantizedMatMul. +type QuantizedMatMulAttr func(optionalAttr) + +// QuantizedMatMulToutput sets the optional Toutput attribute to value. +// If not specified, defaults to DT_QINT32 +func QuantizedMatMulToutput(value tf.DataType) QuantizedMatMulAttr { + return func(m optionalAttr) { + m["Toutput"] = value + } +} + +// QuantizedMatMulTransposeA sets the optional transpose_a attribute to value. +// +// value: If true, `a` is transposed before multiplication. +// If not specified, defaults to false +func QuantizedMatMulTransposeA(value bool) QuantizedMatMulAttr { + return func(m optionalAttr) { + m["transpose_a"] = value + } +} + +// QuantizedMatMulTransposeB sets the optional transpose_b attribute to value. +// +// value: If true, `b` is transposed before multiplication. +// If not specified, defaults to false +func QuantizedMatMulTransposeB(value bool) QuantizedMatMulAttr { + return func(m optionalAttr) { + m["transpose_b"] = value + } +} + +// QuantizedMatMulTactivation sets the optional Tactivation attribute to value. +// +// value: The type of output produced by activation function +// following this operation. +// If not specified, defaults to DT_QUINT8 +func QuantizedMatMulTactivation(value tf.DataType) QuantizedMatMulAttr { + return func(m optionalAttr) { + m["Tactivation"] = value + } +} + +// Perform a quantized matrix multiplication of `a` by the matrix `b`. +// +// The inputs must be two-dimensional matrices and the inner dimension of +// `a` (after being transposed if `transpose_a` is non-zero) must match the +// outer dimension of `b` (after being transposed if `transposed_b` is +// non-zero). +// +// Arguments: +// +// a: Must be a two-dimensional tensor. +// b: Must be a two-dimensional tensor. +// min_a: The float value that the lowest quantized `a` value represents. +// max_a: The float value that the highest quantized `a` value represents. +// min_b: The float value that the lowest quantized `b` value represents. +// max_b: The float value that the highest quantized `b` value represents. +// +// Returns: +// +// out +// min_out: The float value that the lowest quantized output value represents. +// max_out: The float value that the highest quantized output value represents. +func QuantizedMatMul(scope *Scope, a tf.Output, b tf.Output, min_a tf.Output, max_a tf.Output, min_b tf.Output, max_b tf.Output, optional ...QuantizedMatMulAttr) (out tf.Output, min_out tf.Output, max_out tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "QuantizedMatMul", + Input: []tf.Input{ + a, b, min_a, max_a, min_b, max_b, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// Computes the gradient for the rsqrt of `x` wrt its input. +// +// Specifically, `grad = dy * -0.5 * y^3`, where `y = rsqrt(x)`, and `dy` +// is the corresponding input gradient. +func RsqrtGrad(scope *Scope, y tf.Output, dy tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "RsqrtGrad", + Input: []tf.Input{ + y, dy, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ResourceScatterNdSubAttr is an optional argument to ResourceScatterNdSub. +type ResourceScatterNdSubAttr func(optionalAttr) + +// ResourceScatterNdSubUseLocking sets the optional use_locking attribute to value. +// +// value: An optional bool. Defaults to True. If True, the assignment will +// be protected by a lock; otherwise the behavior is undefined, +// but may exhibit less contention. +// If not specified, defaults to true +func ResourceScatterNdSubUseLocking(value bool) ResourceScatterNdSubAttr { + return func(m optionalAttr) { + m["use_locking"] = value + } +} + +// ResourceScatterNdSubBadIndicesPolicy sets the optional bad_indices_policy attribute to value. +// If not specified, defaults to "" +func ResourceScatterNdSubBadIndicesPolicy(value string) ResourceScatterNdSubAttr { + return func(m optionalAttr) { + m["bad_indices_policy"] = value + } +} + +// Applies sparse subtraction to individual values or slices in a Variable. +// +// `ref` is a `Tensor` with rank `P` and `indices` is a `Tensor` of rank `Q`. +// +// `indices` must be integer tensor, containing indices into `ref`. +// It must be shape `[d_0, ..., d_{Q-2}, K]` where `0 < K <= P`. +// +// The innermost dimension of `indices` (with length `K`) corresponds to +// indices into elements (if `K = P`) or slices (if `K < P`) along the `K`th +// dimension of `ref`. +// +// `updates` is `Tensor` of rank `Q-1+P-K` with shape: +// +// ``` +// [d_0, ..., d_{Q-2}, ref.shape[K], ..., ref.shape[P-1]] +// ``` +// +// For example, say we want to subtract 4 scattered elements from a rank-1 tensor +// with 8 elements. In Python, that subtraction would look like this: +// +// ```python +// ref = tf.Variable([1, 2, 3, 4, 5, 6, 7, 8], use_resource=True) +// indices = tf.constant([[4], [3], [1], [7]]) +// updates = tf.constant([9, 10, 11, 12]) +// sub = tf.scatter_nd_sub(ref, indices, updates) +// with tf.Session() as sess: +// +// print sess.run(sub) +// +// ``` +// +// The resulting update to ref would look like this: +// +// [1, -9, 3, -6, -4, 6, 7, -4] +// +// See `tf.scatter_nd` for more details about how to make updates to +// slices. +// +// Arguments: +// +// ref: A resource handle. Must be from a VarHandleOp. +// indices: A Tensor. Must be one of the following types: int32, int64. +// +// A tensor of indices into ref. +// +// updates: A Tensor. Must have the same type as ref. A tensor of +// +// values to add to ref. +// +// Returns the created operation. +func ResourceScatterNdSub(scope *Scope, ref tf.Output, indices tf.Output, updates tf.Output, optional ...ResourceScatterNdSubAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ResourceScatterNdSub", + Input: []tf.Input{ + ref, indices, updates, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// Return the reduction indices for computing gradients of s0 op s1 with broadcast. +// +// This is typically used by gradient computations for a broadcasting operation. +func BroadcastGradientArgs(scope *Scope, s0 tf.Output, s1 tf.Output) (r0 tf.Output, r1 tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "BroadcastGradientArgs", + Input: []tf.Input{ + s0, s1, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// Saves input tensors slices to disk. +// +// This is like `Save` except that tensors can be listed in the saved file as being +// a slice of a larger tensor. `shapes_and_slices` specifies the shape of the +// larger tensor and the slice that this tensor covers. `shapes_and_slices` must +// have as many elements as `tensor_names`. +// +// Elements of the `shapes_and_slices` input must either be: +// +// - The empty string, in which case the corresponding tensor is +// saved normally. +// - A string of the form `dim0 dim1 ... dimN-1 slice-spec` where the +// `dimI` are the dimensions of the larger tensor and `slice-spec` +// specifies what part is covered by the tensor to save. +// +// `slice-spec` itself is a `:`-separated list: `slice0:slice1:...:sliceN-1` +// where each `sliceI` is either: +// +// - The string `-` meaning that the slice covers all indices of this dimension +// - `start,length` where `start` and `length` are integers. In that +// case the slice covers `length` indices starting at `start`. +// +// See also `Save`. +// +// Arguments: +// +// filename: Must have a single element. The name of the file to which we write the +// +// tensor. +// +// tensor_names: Shape `[N]`. The names of the tensors to be saved. +// shapes_and_slices: Shape `[N]`. The shapes and slice specifications to use when +// +// saving the tensors. +// +// data: `N` tensors to save. +// +// Returns the created operation. +func SaveSlices(scope *Scope, filename tf.Output, tensor_names tf.Output, shapes_and_slices tf.Output, data []tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "SaveSlices", + Input: []tf.Input{ + filename, tensor_names, shapes_and_slices, tf.OutputList(data), + }, + } + return scope.AddOperation(opspec) +} + +// Returns x // y element-wise. +// +// *NOTE*: `FloorDiv` supports broadcasting. More about broadcasting +// [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) +func FloorDiv(scope *Scope, x tf.Output, y tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "FloorDiv", + Input: []tf.Input{ + x, y, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// SparseBincountAttr is an optional argument to SparseBincount. +type SparseBincountAttr func(optionalAttr) + +// SparseBincountBinaryOutput sets the optional binary_output attribute to value. +// +// value: bool; Whether the kernel should count the appearance or number of occurrences. +// If not specified, defaults to false +func SparseBincountBinaryOutput(value bool) SparseBincountAttr { + return func(m optionalAttr) { + m["binary_output"] = value + } +} + +// Counts the number of occurrences of each value in an integer array. +// +// Outputs a vector with length `size` and the same dtype as `weights`. If +// `weights` are empty, then index `i` stores the number of times the value `i` is +// counted in `arr`. If `weights` are non-empty, then index `i` stores the sum of +// the value in `weights` at each index where the corresponding value in `arr` is +// `i`. +// +// Values in `arr` outside of the range [0, size) are ignored. +// +// Arguments: +// +// indices: 2D int64 `Tensor`. +// values: 1D int `Tensor`. +// dense_shape: 1D int64 `Tensor`. +// size: non-negative int scalar `Tensor`. +// weights: is an int32, int64, float32, or float64 `Tensor` with the same +// +// shape as `input`, or a length-0 `Tensor`, in which case it acts as all weights +// equal to 1. +// +// Returns 1D `Tensor` with length equal to `size` or 2D `Tensor` with [batch_size, `size`]. +// The counts or summed weights for each value in the range [0, size). +func SparseBincount(scope *Scope, indices tf.Output, values tf.Output, dense_shape tf.Output, size tf.Output, weights tf.Output, optional ...SparseBincountAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "SparseBincount", + Input: []tf.Input{ + indices, values, dense_shape, size, weights, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// QuantizedMatMulWithBiasAndReluAttr is an optional argument to QuantizedMatMulWithBiasAndRelu. +type QuantizedMatMulWithBiasAndReluAttr func(optionalAttr) + +// QuantizedMatMulWithBiasAndReluToutput sets the optional Toutput attribute to value. +// If not specified, defaults to DT_QINT32 +func QuantizedMatMulWithBiasAndReluToutput(value tf.DataType) QuantizedMatMulWithBiasAndReluAttr { + return func(m optionalAttr) { + m["Toutput"] = value + } +} + +// QuantizedMatMulWithBiasAndReluTransposeA sets the optional transpose_a attribute to value. +// +// value: If true, `a` is transposed before multiplication. +// If not specified, defaults to false +func QuantizedMatMulWithBiasAndReluTransposeA(value bool) QuantizedMatMulWithBiasAndReluAttr { + return func(m optionalAttr) { + m["transpose_a"] = value + } +} + +// QuantizedMatMulWithBiasAndReluTransposeB sets the optional transpose_b attribute to value. +// +// value: If true, `b` is transposed before multiplication. +// If not specified, defaults to false +func QuantizedMatMulWithBiasAndReluTransposeB(value bool) QuantizedMatMulWithBiasAndReluAttr { + return func(m optionalAttr) { + m["transpose_b"] = value + } +} + +// QuantizedMatMulWithBiasAndReluInputQuantMode sets the optional input_quant_mode attribute to value. +// +// value: Input data quantization mode. Either MIN_FIRST(default) or SCALED. +// If not specified, defaults to "MIN_FIRST" +func QuantizedMatMulWithBiasAndReluInputQuantMode(value string) QuantizedMatMulWithBiasAndReluAttr { + return func(m optionalAttr) { + m["input_quant_mode"] = value + } +} + +// Perform a quantized matrix multiplication of `a` by the matrix `b` with bias +// add and relu fusion. +// +// The inputs must be two-dimensional matrices and 1D bias vector. And the inner +// dimension of `a` (after being transposed if `transpose_a` is non-zero) must +// match the outer dimension of `b` (after being transposed if `transposed_b` is +// non-zero). Then do broadcast add operation with bias values on the matrix +// multiplication result. The bias size must match inner dimension of `b`. Then do +// relu activation to get non-negative result. +// +// Arguments: +// +// a: A matrix to be multiplied. Must be a two-dimensional tensor of type `quint8`. +// b: A matrix to be multiplied and must be a two-dimensional tensor of type `qint8`. +// bias: A 1D bias tensor with size matching with inner dimension of `b` (after being +// +// transposed if `transposed_b` is non-zero). +// +// min_a: The float value that the lowest quantized `a` value represents. +// max_a: The float value that the highest quantized `a` value represents. +// min_b: The float value that the lowest quantized `b` value represents. +// max_b: The float value that the highest quantized `b` value represents. +// +// Returns: +// +// out +// min_out: The float value that the lowest quantized output value represents. +// max_out: The float value that the highest quantized output value represents. +func QuantizedMatMulWithBiasAndRelu(scope *Scope, a tf.Output, b tf.Output, bias tf.Output, min_a tf.Output, max_a tf.Output, min_b tf.Output, max_b tf.Output, optional ...QuantizedMatMulWithBiasAndReluAttr) (out tf.Output, min_out tf.Output, max_out tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "QuantizedMatMulWithBiasAndRelu", + Input: []tf.Input{ + a, b, bias, min_a, max_a, min_b, max_b, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// Returns a batched diagonal tensor with given batched diagonal values. +// +// Returns a tensor with the contents in `diagonal` as `k[0]`-th to `k[1]`-th +// diagonals of a matrix, with everything else padded with `padding`. `num_rows` +// and `num_cols` specify the dimension of the innermost matrix of the output. If +// both are not specified, the op assumes the innermost matrix is square and infers +// its size from `k` and the innermost dimension of `diagonal`. If only one of them +// is specified, the op assumes the unspecified value is the smallest possible +// based on other criteria. +// +// Let `diagonal` have `r` dimensions `[I, J, ..., L, M, N]`. The output tensor has +// rank `r+1` with shape `[I, J, ..., L, M, num_rows, num_cols]` when only one +// diagonal is given (`k` is an integer or `k[0] == k[1]`). Otherwise, it has rank +// `r` with shape `[I, J, ..., L, num_rows, num_cols]`. +// +// The second innermost dimension of `diagonal` has double meaning. +// When `k` is scalar or `k[0] == k[1]`, `M` is part of the batch size +// [I, J, ..., M], and the output tensor is: +// +// ``` +// output[i, j, ..., l, m, n] +// +// = diagonal[i, j, ..., l, n-max(d_upper, 0)] ; if n - m == d_upper +// padding_value ; otherwise +// +// ``` +// +// Otherwise, `M` is treated as the number of diagonals for the matrix in the +// same batch (`M = k[1]-k[0]+1`), and the output tensor is: +// +// ``` +// output[i, j, ..., l, m, n] +// +// = diagonal[i, j, ..., l, diag_index, index_in_diag] ; if k[0] <= d <= k[1] +// padding_value ; otherwise +// +// ``` +// where `d = n - m`, `diag_index = k[1] - d`, and `index_in_diag = n - max(d, 0)`. +// +// For example: +// +// ``` +// # The main diagonal. +// diagonal = np.array([[1, 2, 3, 4], # Input shape: (2, 4) +// +// [5, 6, 7, 8]]) +// +// tf.matrix_diag(diagonal) ==> [[[1, 0, 0, 0], # Output shape: (2, 4, 4) +// +// [0, 2, 0, 0], +// [0, 0, 3, 0], +// [0, 0, 0, 4]], +// [[5, 0, 0, 0], +// [0, 6, 0, 0], +// [0, 0, 7, 0], +// [0, 0, 0, 8]]] +// +// # A superdiagonal (per batch). +// diagonal = np.array([[1, 2, 3], # Input shape: (2, 3) +// +// [4, 5, 6]]) +// +// tf.matrix_diag(diagonal, k = 1) +// +// ==> [[[0, 1, 0, 0], # Output shape: (2, 4, 4) +// [0, 0, 2, 0], +// [0, 0, 0, 3], +// [0, 0, 0, 0]], +// [[0, 4, 0, 0], +// [0, 0, 5, 0], +// [0, 0, 0, 6], +// [0, 0, 0, 0]]] +// +// # A band of diagonals. +// diagonals = np.array([[[1, 2, 3], # Input shape: (2, 2, 3) +// +// [4, 5, 0]], +// [[6, 7, 9], +// [9, 1, 0]]]) +// +// tf.matrix_diag(diagonals, k = (-1, 0)) +// +// ==> [[[1, 0, 0], # Output shape: (2, 3, 3) +// [4, 2, 0], +// [0, 5, 3]], +// [[6, 0, 0], +// [9, 7, 0], +// [0, 1, 9]]] +// +// # Rectangular matrix. +// diagonal = np.array([1, 2]) # Input shape: (2) +// tf.matrix_diag(diagonal, k = -1, num_rows = 3, num_cols = 4) +// +// ==> [[0, 0, 0, 0], # Output shape: (3, 4) +// [1, 0, 0, 0], +// [0, 2, 0, 0]] +// +// # Rectangular matrix with inferred num_cols and padding_value = 9. +// tf.matrix_diag(diagonal, k = -1, num_rows = 3, padding_value = 9) +// +// ==> [[9, 9], # Output shape: (3, 2) +// [1, 9], +// [9, 2]] +// +// ``` +// +// Arguments: +// +// diagonal: Rank `r`, where `r >= 1` +// k: Diagonal offset(s). Positive value means superdiagonal, 0 refers to the main +// +// diagonal, and negative value means subdiagonals. `k` can be a single integer +// (for a single diagonal) or a pair of integers specifying the low and high ends +// of a matrix band. `k[0]` must not be larger than `k[1]`. +// +// num_rows: The number of rows of the output matrix. If it is not provided, the op assumes +// +// the output matrix is a square matrix and infers the matrix size from k and the +// innermost dimension of `diagonal`. +// +// num_cols: The number of columns of the output matrix. If it is not provided, the op +// +// assumes the output matrix is a square matrix and infers the matrix size from +// k and the innermost dimension of `diagonal`. +// +// padding_value: The number to fill the area outside the specified diagonal band with. +// +// Default is 0. +// +// Returns Has rank `r+1` when `k` is an integer or `k[0] == k[1]`, rank `r` otherwise. +func MatrixDiagV2(scope *Scope, diagonal tf.Output, k tf.Output, num_rows tf.Output, num_cols tf.Output, padding_value tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "MatrixDiagV2", + Input: []tf.Input{ + diagonal, k, num_rows, num_cols, padding_value, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// CollectiveGatherV2Attr is an optional argument to CollectiveGatherV2. +type CollectiveGatherV2Attr func(optionalAttr) + +// CollectiveGatherV2CommunicationHint sets the optional communication_hint attribute to value. +// If not specified, defaults to "auto" +func CollectiveGatherV2CommunicationHint(value string) CollectiveGatherV2Attr { + return func(m optionalAttr) { + m["communication_hint"] = value + } +} + +// CollectiveGatherV2TimeoutSeconds sets the optional timeout_seconds attribute to value. +// If not specified, defaults to 0 +func CollectiveGatherV2TimeoutSeconds(value float32) CollectiveGatherV2Attr { + return func(m optionalAttr) { + m["timeout_seconds"] = value + } +} + +// CollectiveGatherV2IsStateless sets the optional is_stateless attribute to value. +// If not specified, defaults to false +func CollectiveGatherV2IsStateless(value bool) CollectiveGatherV2Attr { + return func(m optionalAttr) { + m["is_stateless"] = value + } +} + +// Mutually accumulates multiple tensors of identical type and shape. +func CollectiveGatherV2(scope *Scope, input tf.Output, group_size tf.Output, group_key tf.Output, instance_key tf.Output, ordering_token []tf.Output, optional ...CollectiveGatherV2Attr) (data tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "CollectiveGatherV2", + Input: []tf.Input{ + input, group_size, group_key, instance_key, tf.OutputList(ordering_token), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ResizeNearestNeighborAttr is an optional argument to ResizeNearestNeighbor. +type ResizeNearestNeighborAttr func(optionalAttr) + +// ResizeNearestNeighborAlignCorners sets the optional align_corners attribute to value. +// +// value: If true, the centers of the 4 corner pixels of the input and output tensors are +// aligned, preserving the values at the corner pixels. Defaults to false. +// If not specified, defaults to false +func ResizeNearestNeighborAlignCorners(value bool) ResizeNearestNeighborAttr { + return func(m optionalAttr) { + m["align_corners"] = value + } +} + +// ResizeNearestNeighborHalfPixelCenters sets the optional half_pixel_centers attribute to value. +// If not specified, defaults to false +func ResizeNearestNeighborHalfPixelCenters(value bool) ResizeNearestNeighborAttr { + return func(m optionalAttr) { + m["half_pixel_centers"] = value + } +} + +// Resize `images` to `size` using nearest neighbor interpolation. +// +// Arguments: +// +// images: 4-D with shape `[batch, height, width, channels]`. +// size: = A 1-D int32 Tensor of 2 elements: `new_height, new_width`. The +// +// new size for the images. +// +// Returns 4-D with shape +// `[batch, new_height, new_width, channels]`. +func ResizeNearestNeighbor(scope *Scope, images tf.Output, size tf.Output, optional ...ResizeNearestNeighborAttr) (resized_images tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ResizeNearestNeighbor", + Input: []tf.Input{ + images, size, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// WholeFileReaderV2Attr is an optional argument to WholeFileReaderV2. +type WholeFileReaderV2Attr func(optionalAttr) + +// WholeFileReaderV2Container sets the optional container attribute to value. +// +// value: If non-empty, this reader is placed in the given container. +// Otherwise, a default container is used. +// If not specified, defaults to "" +func WholeFileReaderV2Container(value string) WholeFileReaderV2Attr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// WholeFileReaderV2SharedName sets the optional shared_name attribute to value. +// +// value: If non-empty, this reader is named in the given bucket +// with this shared_name. Otherwise, the node name is used instead. +// If not specified, defaults to "" +func WholeFileReaderV2SharedName(value string) WholeFileReaderV2Attr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// A Reader that outputs the entire contents of a file as a value. +// +// To use, enqueue filenames in a Queue. The output of ReaderRead will +// be a filename (key) and the contents of that file (value). +// +// Returns The handle to reference the Reader. +func WholeFileReaderV2(scope *Scope, optional ...WholeFileReaderV2Attr) (reader_handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "WholeFileReaderV2", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// QrAttr is an optional argument to Qr. +type QrAttr func(optionalAttr) + +// QrFullMatrices sets the optional full_matrices attribute to value. +// +// value: If true, compute full-sized `q` and `r`. If false +// (the default), compute only the leading `P` columns of `q`. +// If not specified, defaults to false +func QrFullMatrices(value bool) QrAttr { + return func(m optionalAttr) { + m["full_matrices"] = value + } +} + +// Computes the QR decompositions of one or more matrices. +// +// Computes the QR decomposition of each inner matrix in `tensor` such that +// `tensor[..., :, :] = q[..., :, :] * r[..., :,:])` +// +// Currently, the gradient for the QR decomposition is well-defined only when +// the first `P` columns of the inner matrix are linearly independent, where +// `P` is the minimum of `M` and `N`, the 2 inner-most dimmensions of `tensor`. +// +// ```python +// # a is a tensor. +// # q is a tensor of orthonormal matrices. +// # r is a tensor of upper triangular matrices. +// q, r = qr(a) +// q_full, r_full = qr(a, full_matrices=True) +// ``` +// +// Arguments: +// +// input: A tensor of shape `[..., M, N]` whose inner-most 2 dimensions +// +// form matrices of size `[M, N]`. Let `P` be the minimum of `M` and `N`. +// +// Returns: +// +// q: Orthonormal basis for range of `a`. If `full_matrices` is `False` then +// +// shape is `[..., M, P]`; if `full_matrices` is `True` then shape is +// `[..., M, M]`. +// +// r: Triangular factor. If `full_matrices` is `False` then shape is +// +// `[..., P, N]`. If `full_matrices` is `True` then shape is `[..., M, N]`. +func Qr(scope *Scope, input tf.Output, optional ...QrAttr) (q tf.Output, r tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Qr", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// Rolls the elements of a tensor along an axis. +// +// The elements are shifted positively (towards larger indices) by the offset of +// `shift` along the dimension of `axis`. Negative `shift` values will shift +// elements in the opposite direction. Elements that roll passed the last position +// will wrap around to the first and vice versa. Multiple shifts along multiple +// axes may be specified. +// +// For example: +// +// ``` +// # 't' is [0, 1, 2, 3, 4] +// roll(t, shift=2, axis=0) ==> [3, 4, 0, 1, 2] +// +// # shifting along multiple dimensions +// # 't' is [[0, 1, 2, 3, 4], [5, 6, 7, 8, 9]] +// roll(t, shift=[1, -2], axis=[0, 1]) ==> [[7, 8, 9, 5, 6], [2, 3, 4, 0, 1]] +// +// # shifting along the same axis multiple times +// # 't' is [[0, 1, 2, 3, 4], [5, 6, 7, 8, 9]] +// roll(t, shift=[2, -3], axis=[1, 1]) ==> [[1, 2, 3, 4, 0], [6, 7, 8, 9, 5]] +// ``` +// +// Arguments: +// +// shift: Dimension must be 0-D or 1-D. `shift[i]` specifies the number of places by which +// +// elements are shifted positively (towards larger indices) along the dimension +// specified by `axis[i]`. Negative shifts will roll the elements in the opposite +// direction. +// +// axis: Dimension must be 0-D or 1-D. `axis[i]` specifies the dimension that the shift +// +// `shift[i]` should occur. If the same axis is referenced more than once, the +// total shift for that axis will be the sum of all the shifts that belong to that +// axis. +// +// Returns Has the same shape and size as the input. The elements are shifted +// positively (towards larger indices) by the offsets of `shift` along the +// dimensions of `axis`. +func Roll(scope *Scope, input tf.Output, shift tf.Output, axis tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Roll", + Input: []tf.Input{ + input, shift, axis, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// CTCGreedyDecoderAttr is an optional argument to CTCGreedyDecoder. +type CTCGreedyDecoderAttr func(optionalAttr) + +// CTCGreedyDecoderMergeRepeated sets the optional merge_repeated attribute to value. +// +// value: If True, merge repeated classes in output. +// If not specified, defaults to false +func CTCGreedyDecoderMergeRepeated(value bool) CTCGreedyDecoderAttr { + return func(m optionalAttr) { + m["merge_repeated"] = value + } +} + +// CTCGreedyDecoderBlankIndex sets the optional blank_index attribute to value. +// If not specified, defaults to -1 +func CTCGreedyDecoderBlankIndex(value int64) CTCGreedyDecoderAttr { + return func(m optionalAttr) { + m["blank_index"] = value + } +} + +// Performs greedy decoding on the logits given in inputs. +// +// A note about the attribute merge_repeated: if enabled, when +// consecutive logits' maximum indices are the same, only the first of +// these is emitted. Labeling the blank '*', the sequence "A B B * B B" +// becomes "A B B" if merge_repeated = True and "A B B B B" if +// merge_repeated = False. +// +// Regardless of the value of merge_repeated, if the maximum index of a given +// time and batch corresponds to the blank, index `(num_classes - 1)`, no new +// element is emitted. +// +// Arguments: +// +// inputs: 3-D, shape: `(max_time x batch_size x num_classes)`, the logits. +// sequence_length: A vector containing sequence lengths, size `(batch_size)`. +// +// Returns: +// +// decoded_indices: Indices matrix, size `(total_decoded_outputs x 2)`, +// +// of a `SparseTensor`. The rows store: [batch, time]. +// +// decoded_values: Values vector, size: `(total_decoded_outputs)`, +// +// of a `SparseTensor`. The vector stores the decoded classes. +// +// decoded_shape: Shape vector, size `(2)`, of the decoded SparseTensor. +// +// Values are: `[batch_size, max_decoded_length]`. +// +// log_probability: Matrix, size `(batch_size x 1)`, containing sequence +// +// log-probabilities. +func CTCGreedyDecoder(scope *Scope, inputs tf.Output, sequence_length tf.Output, optional ...CTCGreedyDecoderAttr) (decoded_indices tf.Output, decoded_values tf.Output, decoded_shape tf.Output, log_probability tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "CTCGreedyDecoder", + Input: []tf.Input{ + inputs, sequence_length, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2), op.Output(3) +} + +// BatchMatMulV2Attr is an optional argument to BatchMatMulV2. +type BatchMatMulV2Attr func(optionalAttr) + +// BatchMatMulV2AdjX sets the optional adj_x attribute to value. +// +// value: If `True`, adjoint the slices of `x`. Defaults to `False`. +// If not specified, defaults to false +func BatchMatMulV2AdjX(value bool) BatchMatMulV2Attr { + return func(m optionalAttr) { + m["adj_x"] = value + } +} + +// BatchMatMulV2AdjY sets the optional adj_y attribute to value. +// +// value: If `True`, adjoint the slices of `y`. Defaults to `False`. +// If not specified, defaults to false +func BatchMatMulV2AdjY(value bool) BatchMatMulV2Attr { + return func(m optionalAttr) { + m["adj_y"] = value + } +} + +// BatchMatMulV2GradX sets the optional grad_x attribute to value. +// If not specified, defaults to false +func BatchMatMulV2GradX(value bool) BatchMatMulV2Attr { + return func(m optionalAttr) { + m["grad_x"] = value + } +} + +// BatchMatMulV2GradY sets the optional grad_y attribute to value. +// If not specified, defaults to false +func BatchMatMulV2GradY(value bool) BatchMatMulV2Attr { + return func(m optionalAttr) { + m["grad_y"] = value + } +} + +// Multiplies slices of two tensors in batches. +// +// Multiplies all slices of `Tensor` `x` and `y` (each slice can be +// viewed as an element of a batch), and arranges the individual results +// in a single output tensor of the same batch size. Each of the +// individual slices can optionally be adjointed (to adjoint a matrix +// means to transpose and conjugate it) before multiplication by setting +// the `adj_x` or `adj_y` flag to `True`, which are by default `False`. +// +// The input tensors `x` and `y` are 2-D or higher with shape `[..., r_x, c_x]` +// and `[..., r_y, c_y]`. +// +// The output tensor is 2-D or higher with shape `[..., r_o, c_o]`, where: +// +// r_o = c_x if adj_x else r_x +// c_o = r_y if adj_y else c_y +// +// It is computed as: +// +// output[..., :, :] = matrix(x[..., :, :]) * matrix(y[..., :, :]) +// +// *NOTE*: `BatchMatMulV2` supports broadcasting in the batch dimensions. More +// about broadcasting +// [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html). +// +// Arguments: +// +// x: 2-D or higher with shape `[..., r_x, c_x]`. +// y: 2-D or higher with shape `[..., r_y, c_y]`. +// +// Returns 3-D or higher with shape `[..., r_o, c_o]` +func BatchMatMulV2(scope *Scope, x tf.Output, y tf.Output, optional ...BatchMatMulV2Attr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "BatchMatMulV2", + Input: []tf.Input{ + x, y, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Produces the average pool of the input tensor for quantized types. +// +// Arguments: +// +// input: 4-D with shape `[batch, height, width, channels]`. +// min_input: The float value that the lowest quantized input value represents. +// max_input: The float value that the highest quantized input value represents. +// ksize: The size of the window for each dimension of the input tensor. +// +// The length must be 4 to match the number of dimensions of the input. +// +// strides: The stride of the sliding window for each dimension of the input +// +// tensor. The length must be 4 to match the number of dimensions of the input. +// +// padding: The type of padding algorithm to use. +// +// Returns: +// +// output +// min_output: The float value that the lowest quantized output value represents. +// max_output: The float value that the highest quantized output value represents. +func QuantizedAvgPool(scope *Scope, input tf.Output, min_input tf.Output, max_input tf.Output, ksize []int64, strides []int64, padding string) (output tf.Output, min_output tf.Output, max_output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"ksize": ksize, "strides": strides, "padding": padding} + opspec := tf.OpSpec{ + Type: "QuantizedAvgPool", + Input: []tf.Input{ + input, min_input, max_input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// ResourceGatherAttr is an optional argument to ResourceGather. +type ResourceGatherAttr func(optionalAttr) + +// ResourceGatherBatchDims sets the optional batch_dims attribute to value. +// If not specified, defaults to 0 +func ResourceGatherBatchDims(value int64) ResourceGatherAttr { + return func(m optionalAttr) { + m["batch_dims"] = value + } +} + +// ResourceGatherValidateIndices sets the optional validate_indices attribute to value. +// If not specified, defaults to true +func ResourceGatherValidateIndices(value bool) ResourceGatherAttr { + return func(m optionalAttr) { + m["validate_indices"] = value + } +} + +// Gather slices from the variable pointed to by `resource` according to `indices`. +// +// `indices` must be an integer tensor of any dimension (usually 0-D or 1-D). +// Produces an output tensor with shape `indices.shape + params.shape[1:]` where: +// +// ```python +// +// # Scalar indices +// output[:, ..., :] = params[indices, :, ... :] +// +// # Vector indices +// output[i, :, ..., :] = params[indices[i], :, ... :] +// +// # Higher rank indices +// output[i, ..., j, :, ... :] = params[indices[i, ..., j], :, ..., :] +// +// ``` +func ResourceGather(scope *Scope, resource tf.Output, indices tf.Output, dtype tf.DataType, optional ...ResourceGatherAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtype": dtype} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ResourceGather", + Input: []tf.Input{ + resource, indices, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes the sum along segments of a tensor. +// +// Read +// [the section on segmentation](https://tensorflow.org/api_docs/python/tf/math#Segmentation) +// for an explanation of segments. +// +// Computes a tensor such that +// \\(output[i] = \sum_{j...} data[j...]\\) where the sum is over tuples `j...` such +// that `segment_ids[j...] == i`. Unlike `SegmentSum`, `segment_ids` +// need not be sorted and need not cover all values in the full +// range of valid values. +// +// If the sum is empty for a given segment ID `i`, `output[i] = 0`. +// If the given segment ID `i` is negative, the value is dropped and will not be +// added to the sum of the segment. +// +// `num_segments` should equal the number of distinct segment IDs. +// +//
+// +//
+// +// ``` python +// c = tf.constant([[1,2,3,4], [5,6,7,8], [4,3,2,1]]) +// tf.unsorted_segment_sum(c, tf.constant([0, 1, 0]), num_segments=2) +// # ==> [[ 5, 5, 5, 5], +// # [5, 6, 7, 8]] +// ``` +// +// Arguments: +// +// segment_ids: A tensor whose shape is a prefix of `data.shape`. +// +// Returns Has same shape as data, except for the first `segment_ids.rank` +// dimensions, which are replaced with a single dimension which has size +// `num_segments`. +func UnsortedSegmentSum(scope *Scope, data tf.Output, segment_ids tf.Output, num_segments tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "UnsortedSegmentSum", + Input: []tf.Input{ + data, segment_ids, num_segments, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes exponential of x element-wise. \\(y = e^x\\). +// +// This function computes the exponential of every element in the input tensor. +// i.e. `exp(x)` or `e^(x)`, where `x` is the input tensor. +// `e` denotes Euler's number and is approximately equal to 2.718281. +// Output is positive for any real input. +// +// ```python +// x = tf.constant(2.0) +// tf.math.exp(x) ==> 7.389056 +// +// x = tf.constant([2.0, 8.0]) +// tf.math.exp(x) ==> array([7.389056, 2980.958], dtype=float32) +// ``` +// +// For complex numbers, the exponential value is calculated as follows: +// +// ``` +// e^(x+iy) = e^x * e^iy = e^x * (cos y + i sin y) +// ``` +// +// Let's consider complex number 1+1j as an example. +// e^1 * (cos 1 + i sin 1) = 2.7182818284590 * (0.54030230586+0.8414709848j) +// +// ```python +// x = tf.constant(1 + 1j) +// tf.math.exp(x) ==> 1.4686939399158851+2.2873552871788423j +// ``` +func Exp(scope *Scope, x tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Exp", + Input: []tf.Input{ + x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Inverse of XlaSetDynamicDimensionSize. +// +// Make an xla bounded dynamic dimension into a static dimension. The bound of the +// size of dimension `dim_index` becomes the static dimension size. +func XlaRemoveDynamicDimensionSize(scope *Scope, input tf.Output, dim_index tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "XlaRemoveDynamicDimensionSize", + Input: []tf.Input{ + input, dim_index, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ResourceSparseApplyAdagradDAAttr is an optional argument to ResourceSparseApplyAdagradDA. +type ResourceSparseApplyAdagradDAAttr func(optionalAttr) + +// ResourceSparseApplyAdagradDAUseLocking sets the optional use_locking attribute to value. +// +// value: If True, updating of the var and accum tensors will be protected by +// a lock; otherwise the behavior is undefined, but may exhibit less contention. +// If not specified, defaults to false +func ResourceSparseApplyAdagradDAUseLocking(value bool) ResourceSparseApplyAdagradDAAttr { + return func(m optionalAttr) { + m["use_locking"] = value + } +} + +// Update entries in '*var' and '*accum' according to the proximal adagrad scheme. +// +// Arguments: +// +// var_: Should be from a Variable(). +// gradient_accumulator: Should be from a Variable(). +// gradient_squared_accumulator: Should be from a Variable(). +// grad: The gradient. +// indices: A vector of indices into the first dimension of var and accum. +// lr: Learning rate. Must be a scalar. +// l1: L1 regularization. Must be a scalar. +// l2: L2 regularization. Must be a scalar. +// global_step: Training step number. Must be a scalar. +// +// Returns the created operation. +func ResourceSparseApplyAdagradDA(scope *Scope, var_ tf.Output, gradient_accumulator tf.Output, gradient_squared_accumulator tf.Output, grad tf.Output, indices tf.Output, lr tf.Output, l1 tf.Output, l2 tf.Output, global_step tf.Output, optional ...ResourceSparseApplyAdagradDAAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ResourceSparseApplyAdagradDA", + Input: []tf.Input{ + var_, gradient_accumulator, gradient_squared_accumulator, grad, indices, lr, l1, l2, global_step, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// ComputeAccidentalHitsAttr is an optional argument to ComputeAccidentalHits. +type ComputeAccidentalHitsAttr func(optionalAttr) + +// ComputeAccidentalHitsSeed sets the optional seed attribute to value. +// +// value: If either seed or seed2 are set to be non-zero, the random number +// generator is seeded by the given seed. Otherwise, it is seeded by a +// random seed. +// If not specified, defaults to 0 +func ComputeAccidentalHitsSeed(value int64) ComputeAccidentalHitsAttr { + return func(m optionalAttr) { + m["seed"] = value + } +} + +// ComputeAccidentalHitsSeed2 sets the optional seed2 attribute to value. +// +// value: An second seed to avoid seed collision. +// If not specified, defaults to 0 +func ComputeAccidentalHitsSeed2(value int64) ComputeAccidentalHitsAttr { + return func(m optionalAttr) { + m["seed2"] = value + } +} + +// Computes the ids of the positions in sampled_candidates that match true_labels. +// +// When doing log-odds NCE, the result of this op should be passed through a +// SparseToDense op, then added to the logits of the sampled candidates. This has +// the effect of 'removing' the sampled labels that match the true labels by +// making the classifier sure that they are sampled labels. +// +// Arguments: +// +// true_classes: The true_classes output of UnpackSparseLabels. +// sampled_candidates: The sampled_candidates output of CandidateSampler. +// num_true: Number of true labels per context. +// +// Returns: +// +// indices: A vector of indices corresponding to rows of true_candidates. +// ids: A vector of IDs of positions in sampled_candidates that match a true_label +// +// for the row with the corresponding index in indices. +// +// weights: A vector of the same length as indices and ids, in which each element +// +// is -FLOAT_MAX. +func ComputeAccidentalHits(scope *Scope, true_classes tf.Output, sampled_candidates tf.Output, num_true int64, optional ...ComputeAccidentalHitsAttr) (indices tf.Output, ids tf.Output, weights tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_true": num_true} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ComputeAccidentalHits", + Input: []tf.Input{ + true_classes, sampled_candidates, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// Creates an Optional variant with no value. +func OptionalNone(scope *Scope) (optional tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "OptionalNone", + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Creates a dataset that executes a SQL query and emits rows of the result set. +// +// Arguments: +// +// driver_name: The database type. Currently, the only supported type is 'sqlite'. +// data_source_name: A connection string to connect to the database. +// query: A SQL query to execute. +func ExperimentalSqlDataset(scope *Scope, driver_name tf.Output, data_source_name tf.Output, query tf.Output, output_types []tf.DataType, output_shapes []tf.Shape) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + opspec := tf.OpSpec{ + Type: "ExperimentalSqlDataset", + Input: []tf.Input{ + driver_name, data_source_name, query, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Creates a dataset that overrides the maximum intra-op parallelism. +// +// Arguments: +// +// max_intra_op_parallelism: Identifies the maximum intra-op parallelism to use. +func ExperimentalMaxIntraOpParallelismDataset(scope *Scope, input_dataset tf.Output, max_intra_op_parallelism tf.Output, output_types []tf.DataType, output_shapes []tf.Shape) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + opspec := tf.OpSpec{ + Type: "ExperimentalMaxIntraOpParallelismDataset", + Input: []tf.Input{ + input_dataset, max_intra_op_parallelism, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ShapeAttr is an optional argument to Shape. +type ShapeAttr func(optionalAttr) + +// ShapeOutType sets the optional out_type attribute to value. +// If not specified, defaults to DT_INT32 +func ShapeOutType(value tf.DataType) ShapeAttr { + return func(m optionalAttr) { + m["out_type"] = value + } +} + +// Returns the shape of a tensor. +// +// This operation returns a 1-D integer tensor representing the shape of `input`. +// +// For example: +// +// ``` +// # 't' is [[[1, 1, 1], [2, 2, 2]], [[3, 3, 3], [4, 4, 4]]] +// shape(t) ==> [2, 2, 3] +// ``` +func Shape(scope *Scope, input tf.Output, optional ...ShapeAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Shape", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ExperimentalStatsAggregatorHandleAttr is an optional argument to ExperimentalStatsAggregatorHandle. +type ExperimentalStatsAggregatorHandleAttr func(optionalAttr) + +// ExperimentalStatsAggregatorHandleContainer sets the optional container attribute to value. +// If not specified, defaults to "" +func ExperimentalStatsAggregatorHandleContainer(value string) ExperimentalStatsAggregatorHandleAttr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// ExperimentalStatsAggregatorHandleSharedName sets the optional shared_name attribute to value. +// If not specified, defaults to "" +func ExperimentalStatsAggregatorHandleSharedName(value string) ExperimentalStatsAggregatorHandleAttr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// Creates a statistics manager resource. +func ExperimentalStatsAggregatorHandle(scope *Scope, optional ...ExperimentalStatsAggregatorHandleAttr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ExperimentalStatsAggregatorHandle", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Creates a TensorList which, when stacked, has the value of `tensor`. +// +// Each tensor in the result list corresponds to one row of the input tensor. +// +// tensor: The input tensor. +// output_handle: The list. +func TensorListFromTensor(scope *Scope, tensor tf.Output, element_shape tf.Output) (output_handle tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "TensorListFromTensor", + Input: []tf.Input{ + tensor, element_shape, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns the element-wise sum of a list of tensors. +// +// `tf.accumulate_n_v2` performs the same operation as `tf.add_n`, but does not +// wait for all of its inputs to be ready before beginning to sum. This can +// save memory if inputs are ready at different times, since minimum temporary +// storage is proportional to the output size rather than the inputs size. +// +// Unlike the original `accumulate_n`, `accumulate_n_v2` is differentiable. +// +// Returns a `Tensor` of same shape and type as the elements of `inputs`. +// +// Arguments: +// +// inputs: A list of `Tensor` objects, each with same shape and type. +// shape: Shape of elements of `inputs`. +func AccumulateNV2(scope *Scope, inputs []tf.Output, shape tf.Shape) (sum tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"shape": shape} + opspec := tf.OpSpec{ + Type: "AccumulateNV2", + Input: []tf.Input{ + tf.OutputList(inputs), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes the gradient of the sigmoid of `x` wrt its input. +// +// Specifically, `grad = dy * y * (1 - y)`, where `y = sigmoid(x)`, and +// `dy` is the corresponding input gradient. +func SigmoidGrad(scope *Scope, y tf.Output, dy tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "SigmoidGrad", + Input: []tf.Input{ + y, dy, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns immutable tensor from memory region. +// +// The current implementation memmaps the tensor from a file. +// +// Arguments: +// +// dtype: Type of the returned tensor. +// shape: Shape of the returned tensor. +// memory_region_name: Name of readonly memory region used by the tensor, see +// +// NewReadOnlyMemoryRegionFromFile in tensorflow::Env. +func ImmutableConst(scope *Scope, dtype tf.DataType, shape tf.Shape, memory_region_name string) (tensor tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtype": dtype, "shape": shape, "memory_region_name": memory_region_name} + opspec := tf.OpSpec{ + Type: "ImmutableConst", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// EuclideanNormAttr is an optional argument to EuclideanNorm. +type EuclideanNormAttr func(optionalAttr) + +// EuclideanNormKeepDims sets the optional keep_dims attribute to value. +// +// value: If true, retain reduced dimensions with length 1. +// If not specified, defaults to false +func EuclideanNormKeepDims(value bool) EuclideanNormAttr { + return func(m optionalAttr) { + m["keep_dims"] = value + } +} + +// Computes the euclidean norm of elements across dimensions of a tensor. +// +// Reduces `input` along the dimensions given in `axis`. Unless +// `keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in +// `axis`. If `keep_dims` is true, the reduced dimensions are +// retained with length 1. +// +// Arguments: +// +// input: The tensor to reduce. +// axis: The dimensions to reduce. Must be in the range +// +// `[-rank(input), rank(input))`. +// +// Returns The reduced tensor. +func EuclideanNorm(scope *Scope, input tf.Output, axis tf.Output, optional ...EuclideanNormAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "EuclideanNorm", + Input: []tf.Input{ + input, axis, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns the value stored in an Optional variant or raises an error if none exists. +func OptionalGetValue(scope *Scope, optional tf.Output, output_types []tf.DataType, output_shapes []tf.Shape) (components []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + opspec := tf.OpSpec{ + Type: "OptionalGetValue", + Input: []tf.Input{ + optional, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if components, idx, err = makeOutputList(op, idx, "components"); err != nil { + scope.UpdateErr("OptionalGetValue", err) + return + } + return components +} + +// FixedLengthRecordDatasetAttr is an optional argument to FixedLengthRecordDataset. +type FixedLengthRecordDatasetAttr func(optionalAttr) + +// FixedLengthRecordDatasetMetadata sets the optional metadata attribute to value. +// If not specified, defaults to "" +func FixedLengthRecordDatasetMetadata(value string) FixedLengthRecordDatasetAttr { + return func(m optionalAttr) { + m["metadata"] = value + } +} + +// Creates a dataset that emits the records from one or more binary files. +// +// Arguments: +// +// filenames: A scalar or a vector containing the name(s) of the file(s) to be +// +// read. +// +// header_bytes: A scalar representing the number of bytes to skip at the +// +// beginning of a file. +// +// record_bytes: A scalar representing the number of bytes in each record. +// footer_bytes: A scalar representing the number of bytes to skip at the end +// +// of a file. +// +// buffer_size: A scalar representing the number of bytes to buffer. Must be > 0. +func FixedLengthRecordDataset(scope *Scope, filenames tf.Output, header_bytes tf.Output, record_bytes tf.Output, footer_bytes tf.Output, buffer_size tf.Output, optional ...FixedLengthRecordDatasetAttr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "FixedLengthRecordDataset", + Input: []tf.Input{ + filenames, header_bytes, record_bytes, footer_bytes, buffer_size, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Outputs random integers from a uniform distribution. +// +// The generated values are uniform integers in the range `[minval, maxval)`. +// The lower bound `minval` is included in the range, while the upper bound +// `maxval` is excluded. +// +// The random integers are slightly biased unless `maxval - minval` is an exact +// power of two. The bias is small for values of `maxval - minval` significantly +// smaller than the range of the output (either `2^32` or `2^64`). +// +// Arguments: +// +// resource: The handle of the resource variable that stores the state of the RNG. +// algorithm: The RNG algorithm. +// shape: The shape of the output tensor. +// minval: Minimum value (inclusive, scalar). +// maxval: Maximum value (exclusive, scalar). +// +// Returns Random values with specified shape. +func StatefulUniformInt(scope *Scope, resource tf.Output, algorithm tf.Output, shape tf.Output, minval tf.Output, maxval tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "StatefulUniformInt", + Input: []tf.Input{ + resource, algorithm, shape, minval, maxval, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// SkipgramAttr is an optional argument to Skipgram. +type SkipgramAttr func(optionalAttr) + +// SkipgramWindowSize sets the optional window_size attribute to value. +// +// value: The number of words to predict to the left and right of the target. +// If not specified, defaults to 5 +func SkipgramWindowSize(value int64) SkipgramAttr { + return func(m optionalAttr) { + m["window_size"] = value + } +} + +// SkipgramMinCount sets the optional min_count attribute to value. +// +// value: The minimum number of word occurrences for it to be included in the +// vocabulary. +// If not specified, defaults to 5 +func SkipgramMinCount(value int64) SkipgramAttr { + return func(m optionalAttr) { + m["min_count"] = value + } +} + +// SkipgramSubsample sets the optional subsample attribute to value. +// +// value: Threshold for word occurrence. Words that appear with higher +// frequency will be randomly down-sampled. Set to 0 to disable. +// If not specified, defaults to 0.001 +func SkipgramSubsample(value float32) SkipgramAttr { + return func(m optionalAttr) { + m["subsample"] = value + } +} + +// Parses a text file and creates a batch of examples. +// +// DEPRECATED at GraphDef version 19: Moving word2vec into tensorflow_models/tutorials and deprecating its ops here as a result +// +// Arguments: +// +// filename: The corpus's text file name. +// batch_size: The size of produced batch. +// +// Returns: +// +// vocab_word: A vector of words in the corpus. +// vocab_freq: Frequencies of words. Sorted in the non-ascending order. +// words_per_epoch: Number of words per epoch in the data file. +// current_epoch: The current epoch number. +// total_words_processed: The total number of words processed so far. +// examples: A vector of word ids. +// labels: A vector of word ids. +func Skipgram(scope *Scope, filename string, batch_size int64, optional ...SkipgramAttr) (vocab_word tf.Output, vocab_freq tf.Output, words_per_epoch tf.Output, current_epoch tf.Output, total_words_processed tf.Output, examples tf.Output, labels tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"filename": filename, "batch_size": batch_size} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Skipgram", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2), op.Output(3), op.Output(4), op.Output(5), op.Output(6) +} + +// ResourceApplyFtrlAttr is an optional argument to ResourceApplyFtrl. +type ResourceApplyFtrlAttr func(optionalAttr) + +// ResourceApplyFtrlUseLocking sets the optional use_locking attribute to value. +// +// value: If `True`, updating of the var and accum tensors will be protected +// by a lock; otherwise the behavior is undefined, but may exhibit less +// contention. +// If not specified, defaults to false +func ResourceApplyFtrlUseLocking(value bool) ResourceApplyFtrlAttr { + return func(m optionalAttr) { + m["use_locking"] = value + } +} + +// ResourceApplyFtrlMultiplyLinearByLr sets the optional multiply_linear_by_lr attribute to value. +// If not specified, defaults to false +func ResourceApplyFtrlMultiplyLinearByLr(value bool) ResourceApplyFtrlAttr { + return func(m optionalAttr) { + m["multiply_linear_by_lr"] = value + } +} + +// Update '*var' according to the Ftrl-proximal scheme. +// +// accum_new = accum + grad * grad +// linear += grad - (accum_new^(-lr_power) - accum^(-lr_power)) / lr * var +// quadratic = 1.0 / (accum_new^(lr_power) * lr) + 2 * l2 +// var = (sign(linear) * l1 - linear) / quadratic if |linear| > l1 else 0.0 +// accum = accum_new +// +// Arguments: +// +// var_: Should be from a Variable(). +// accum: Should be from a Variable(). +// linear: Should be from a Variable(). +// grad: The gradient. +// lr: Scaling factor. Must be a scalar. +// l1: L1 regularization. Must be a scalar. +// l2: L2 regularization. Must be a scalar. +// lr_power: Scaling factor. Must be a scalar. +// +// Returns the created operation. +func ResourceApplyFtrl(scope *Scope, var_ tf.Output, accum tf.Output, linear tf.Output, grad tf.Output, lr tf.Output, l1 tf.Output, l2 tf.Output, lr_power tf.Output, optional ...ResourceApplyFtrlAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ResourceApplyFtrl", + Input: []tf.Input{ + var_, accum, linear, grad, lr, l1, l2, lr_power, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// Reverses specific dimensions of a tensor. +// +// Given a `tensor`, and a `bool` tensor `dims` representing the dimensions +// of `tensor`, this operation reverses each dimension i of `tensor` where +// `dims[i]` is `True`. +// +// `tensor` can have up to 8 dimensions. The number of dimensions +// of `tensor` must equal the number of elements in `dims`. In other words: +// +// `rank(tensor) = size(dims)` +// +// For example: +// +// ``` +// # tensor 't' is [[[[ 0, 1, 2, 3], +// # [ 4, 5, 6, 7], +// # [ 8, 9, 10, 11]], +// # [[12, 13, 14, 15], +// # [16, 17, 18, 19], +// # [20, 21, 22, 23]]]] +// # tensor 't' shape is [1, 2, 3, 4] +// +// # 'dims' is [False, False, False, True] +// reverse(t, dims) ==> [[[[ 3, 2, 1, 0], +// +// [ 7, 6, 5, 4], +// [ 11, 10, 9, 8]], +// [[15, 14, 13, 12], +// [19, 18, 17, 16], +// [23, 22, 21, 20]]]] +// +// # 'dims' is [False, True, False, False] +// reverse(t, dims) ==> [[[[12, 13, 14, 15], +// +// [16, 17, 18, 19], +// [20, 21, 22, 23] +// [[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11]]]] +// +// # 'dims' is [False, False, True, False] +// reverse(t, dims) ==> [[[[8, 9, 10, 11], +// +// [4, 5, 6, 7], +// [0, 1, 2, 3]] +// [[20, 21, 22, 23], +// [16, 17, 18, 19], +// [12, 13, 14, 15]]]] +// +// ``` +// +// Arguments: +// +// tensor: Up to 8-D. +// dims: 1-D. The dimensions to reverse. +// +// Returns The same shape as `tensor`. +func Reverse(scope *Scope, tensor tf.Output, dims tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Reverse", + Input: []tf.Input{ + tensor, dims, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Make a static dimension into a xla bounded dynamic dimension. +// +// The current static dimension size will become the bound and the second +// operand becomes the dynamic size of the dimension. +func XlaSetDynamicDimensionSize(scope *Scope, input tf.Output, dim_index tf.Output, size tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "XlaSetDynamicDimensionSize", + Input: []tf.Input{ + input, dim_index, size, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Bucketize each feature based on bucket boundaries. +// +// An op that returns a list of float tensors, where each tensor represents the +// bucketized values for a single feature. +// +// Arguments: +// +// float_values: float; List of Rank 1 Tensor each containing float values for a single feature. +// bucket_boundaries: float; List of Rank 1 Tensors each containing the bucket boundaries for a single +// +// feature. +// +// Returns int; List of Rank 1 Tensors each containing the bucketized values for a single feature. +func BoostedTreesBucketize(scope *Scope, float_values []tf.Output, bucket_boundaries []tf.Output) (buckets []tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "BoostedTreesBucketize", + Input: []tf.Input{ + tf.OutputList(float_values), tf.OutputList(bucket_boundaries), + }, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if buckets, idx, err = makeOutputList(op, idx, "buckets"); err != nil { + scope.UpdateErr("BoostedTreesBucketize", err) + return + } + return buckets +} + +// Computes the sum along segments of a tensor. +// +// Read +// [the section on segmentation](https://tensorflow.org/api_docs/python/tf/math#Segmentation) +// for an explanation of segments. +// +// Computes a tensor such that +// \\(output_i = \sum_j data_j\\) where sum is over `j` such +// that `segment_ids[j] == i`. +// +// If the sum is empty for a given segment ID `i`, `output[i] = 0`. +// +//
+// +//
+// +// For example: +// +// ``` +// c = tf.constant([[1,2,3,4], [4, 3, 2, 1], [5,6,7,8]]) +// tf.segment_sum(c, tf.constant([0, 0, 1])) +// # ==> [[5, 5, 5, 5], +// # [5, 6, 7, 8]] +// ``` +// +// Arguments: +// +// segment_ids: A 1-D tensor whose size is equal to the size of `data`'s +// +// first dimension. Values should be sorted and can be repeated. +// +// Returns Has same shape as data, except for dimension 0 which +// has size `k`, the number of segments. +func SegmentSum(scope *Scope, data tf.Output, segment_ids tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "SegmentSum", + Input: []tf.Input{ + data, segment_ids, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Bucketizes 'input' based on 'boundaries'. +// +// For example, if the inputs are +// +// boundaries = [0, 10, 100] +// input = [[-5, 10000] +// [150, 10] +// [5, 100]] +// +// then the output will be +// +// output = [[0, 3] +// [3, 2] +// [1, 3]] +// +// Arguments: +// +// input: Any shape of Tensor contains with int or float type. +// boundaries: A sorted list of floats gives the boundary of the buckets. +// +// Returns Same shape with 'input', each value of input replaced with bucket index. +// +// @compatibility(numpy) +// Equivalent to np.digitize. +// @end_compatibility +func Bucketize(scope *Scope, input tf.Output, boundaries []float32) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"boundaries": boundaries} + opspec := tf.OpSpec{ + Type: "Bucketize", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes softsign gradients for a softsign operation. +// +// Arguments: +// +// gradients: The backpropagated gradients to the corresponding softsign operation. +// features: The features passed as input to the corresponding softsign operation. +// +// Returns The gradients: `gradients / (1 + abs(features)) ** 2`. +func SoftsignGrad(scope *Scope, gradients tf.Output, features tf.Output) (backprops tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "SoftsignGrad", + Input: []tf.Input{ + gradients, features, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes natural logarithm of x element-wise. +// +// I.e., \\(y = \log_e x\\). +// +// Example: +// +// ```python +// x = tf.constant([0, 0.5, 1, 5]) +// tf.math.log(x) ==> [-inf, -0.6931472, 0. , 1.609438] +// ``` +func Log(scope *Scope, x tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Log", + Input: []tf.Input{ + x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// MinAttr is an optional argument to Min. +type MinAttr func(optionalAttr) + +// MinKeepDims sets the optional keep_dims attribute to value. +// +// value: If true, retain reduced dimensions with length 1. +// If not specified, defaults to false +func MinKeepDims(value bool) MinAttr { + return func(m optionalAttr) { + m["keep_dims"] = value + } +} + +// Computes the minimum of elements across dimensions of a tensor. +// +// Reduces `input` along the dimensions given in `axis`. Unless +// `keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in +// `axis`. If `keep_dims` is true, the reduced dimensions are +// retained with length 1. +// +// Arguments: +// +// input: The tensor to reduce. +// axis: The dimensions to reduce. Must be in the range +// +// `[-rank(input), rank(input))`. +// +// Returns The reduced tensor. +func Min(scope *Scope, input tf.Output, axis tf.Output, optional ...MinAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Min", + Input: []tf.Input{ + input, axis, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ResourceSparseApplyMomentumAttr is an optional argument to ResourceSparseApplyMomentum. +type ResourceSparseApplyMomentumAttr func(optionalAttr) + +// ResourceSparseApplyMomentumUseLocking sets the optional use_locking attribute to value. +// +// value: If `True`, updating of the var and accum tensors will be protected +// by a lock; otherwise the behavior is undefined, but may exhibit less +// contention. +// If not specified, defaults to false +func ResourceSparseApplyMomentumUseLocking(value bool) ResourceSparseApplyMomentumAttr { + return func(m optionalAttr) { + m["use_locking"] = value + } +} + +// ResourceSparseApplyMomentumUseNesterov sets the optional use_nesterov attribute to value. +// +// value: If `True`, the tensor passed to compute grad will be +// var - lr * momentum * accum, so in the end, the var you get is actually +// var - lr * momentum * accum. +// If not specified, defaults to false +func ResourceSparseApplyMomentumUseNesterov(value bool) ResourceSparseApplyMomentumAttr { + return func(m optionalAttr) { + m["use_nesterov"] = value + } +} + +// Update relevant entries in '*var' and '*accum' according to the momentum scheme. +// +// Set use_nesterov = True if you want to use Nesterov momentum. +// +// That is for rows we have grad for, we update var and accum as follows: +// +// accum = accum * momentum + grad +// var -= lr * accum +// +// Arguments: +// +// var_: Should be from a Variable(). +// accum: Should be from a Variable(). +// lr: Learning rate. Must be a scalar. +// grad: The gradient. +// indices: A vector of indices into the first dimension of var and accum. +// momentum: Momentum. Must be a scalar. +// +// Returns the created operation. +func ResourceSparseApplyMomentum(scope *Scope, var_ tf.Output, accum tf.Output, lr tf.Output, grad tf.Output, indices tf.Output, momentum tf.Output, optional ...ResourceSparseApplyMomentumAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ResourceSparseApplyMomentum", + Input: []tf.Input{ + var_, accum, lr, grad, indices, momentum, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// RandomUniformIntAttr is an optional argument to RandomUniformInt. +type RandomUniformIntAttr func(optionalAttr) + +// RandomUniformIntSeed sets the optional seed attribute to value. +// +// value: If either `seed` or `seed2` are set to be non-zero, the random number +// generator is seeded by the given seed. Otherwise, it is seeded by a +// random seed. +// If not specified, defaults to 0 +func RandomUniformIntSeed(value int64) RandomUniformIntAttr { + return func(m optionalAttr) { + m["seed"] = value + } +} + +// RandomUniformIntSeed2 sets the optional seed2 attribute to value. +// +// value: A second seed to avoid seed collision. +// If not specified, defaults to 0 +func RandomUniformIntSeed2(value int64) RandomUniformIntAttr { + return func(m optionalAttr) { + m["seed2"] = value + } +} + +// Outputs random integers from a uniform distribution. +// +// The generated values are uniform integers in the range `[minval, maxval)`. +// The lower bound `minval` is included in the range, while the upper bound +// `maxval` is excluded. +// +// The random integers are slightly biased unless `maxval - minval` is an exact +// power of two. The bias is small for values of `maxval - minval` significantly +// smaller than the range of the output (either `2^32` or `2^64`). +// +// Arguments: +// +// shape: The shape of the output tensor. +// minval: 0-D. Inclusive lower bound on the generated integers. +// maxval: 0-D. Exclusive upper bound on the generated integers. +// +// Returns A tensor of the specified shape filled with uniform random integers. +func RandomUniformInt(scope *Scope, shape tf.Output, minval tf.Output, maxval tf.Output, optional ...RandomUniformIntAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "RandomUniformInt", + Input: []tf.Input{ + shape, minval, maxval, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Restore a Reader to its initial clean state. +// +// Arguments: +// +// reader_handle: Handle to a Reader. +// +// Returns the created operation. +func ReaderResetV2(scope *Scope, reader_handle tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "ReaderResetV2", + Input: []tf.Input{ + reader_handle, + }, + } + return scope.AddOperation(opspec) +} + +// CollectiveReduceAttr is an optional argument to CollectiveReduce. +type CollectiveReduceAttr func(optionalAttr) + +// CollectiveReduceWaitFor sets the optional wait_for attribute to value. +// If not specified, defaults to <> +func CollectiveReduceWaitFor(value []int64) CollectiveReduceAttr { + return func(m optionalAttr) { + m["wait_for"] = value + } +} + +// CollectiveReduceCommunicationHint sets the optional communication_hint attribute to value. +// If not specified, defaults to "auto" +func CollectiveReduceCommunicationHint(value string) CollectiveReduceAttr { + return func(m optionalAttr) { + m["communication_hint"] = value + } +} + +// CollectiveReduceTimeoutSeconds sets the optional timeout_seconds attribute to value. +// If not specified, defaults to 0 +func CollectiveReduceTimeoutSeconds(value float32) CollectiveReduceAttr { + return func(m optionalAttr) { + m["timeout_seconds"] = value + } +} + +// Mutually reduces multiple tensors of identical type and shape. +func CollectiveReduce(scope *Scope, input tf.Output, group_size int64, group_key int64, instance_key int64, merge_op string, final_op string, subdiv_offsets []int64, optional ...CollectiveReduceAttr) (data tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"group_size": group_size, "group_key": group_key, "instance_key": instance_key, "merge_op": merge_op, "final_op": final_op, "subdiv_offsets": subdiv_offsets} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "CollectiveReduce", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// The gradient operator for the SparseSlice op. +// +// This op takes in the upstream gradient w.r.t. non-empty values of +// the sliced `SparseTensor`, and outputs the gradients w.r.t. +// the non-empty values of input `SparseTensor`. +// +// Arguments: +// +// backprop_val_grad: 1-D. The gradient with respect to +// +// the non-empty values of the sliced `SparseTensor`. +// +// input_indices: 2-D. The `indices` of the input `SparseTensor`. +// input_start: 1-D. tensor represents the start of the slice. +// output_indices: 2-D. The `indices` of the sliced `SparseTensor`. +// +// Returns 1-D. The gradient with respect to the non-empty values of input `SparseTensor`. +func SparseSliceGrad(scope *Scope, backprop_val_grad tf.Output, input_indices tf.Output, input_start tf.Output, output_indices tf.Output) (val_grad tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "SparseSliceGrad", + Input: []tf.Input{ + backprop_val_grad, input_indices, input_start, output_indices, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// TensorArrayConcatV3Attr is an optional argument to TensorArrayConcatV3. +type TensorArrayConcatV3Attr func(optionalAttr) + +// TensorArrayConcatV3ElementShapeExcept0 sets the optional element_shape_except0 attribute to value. +// +// value: The expected shape of an element, if known, +// excluding the first dimension. Used to validate the shapes of +// TensorArray elements. If this shape is not fully specified, concatenating +// zero-size TensorArrays is an error. +// If not specified, defaults to +func TensorArrayConcatV3ElementShapeExcept0(value tf.Shape) TensorArrayConcatV3Attr { + return func(m optionalAttr) { + m["element_shape_except0"] = value + } +} + +// Concat the elements from the TensorArray into value `value`. +// +// Takes `T` elements of shapes +// +// ``` +// (n0 x d0 x d1 x ...), (n1 x d0 x d1 x ...), ..., (n(T-1) x d0 x d1 x ...) +// ``` +// +// and concatenates them into a Tensor of shape: +// +// ```(n0 + n1 + ... + n(T-1) x d0 x d1 x ...)``` +// +// All elements must have the same shape (excepting the first dimension). +// +// Arguments: +// +// handle: The handle to a TensorArray. +// flow_in: A float scalar that enforces proper chaining of operations. +// dtype: The type of the elem that is returned. +// +// Returns: +// +// value: All of the elements in the TensorArray, concatenated along the first +// +// axis. +// +// lengths: A vector of the row sizes of the original T elements in the +// +// value output. In the example above, this would be the values: +// `(n1, n2, ..., n(T-1))`. +func TensorArrayConcatV3(scope *Scope, handle tf.Output, flow_in tf.Output, dtype tf.DataType, optional ...TensorArrayConcatV3Attr) (value tf.Output, lengths tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtype": dtype} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "TensorArrayConcatV3", + Input: []tf.Input{ + handle, flow_in, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// Creates a TensorList by indexing into a Tensor. +// +// Each member of the TensorList corresponds to one row of the input tensor, +// specified by the given index (see `tf.gather`). +// +// tensor: The input tensor. +// indices: The indices used to index into the list. +// element_shape: The shape of the elements in the list (can be less specified than +// +// the shape of the tensor). +// +// output_handle: The TensorList. +func TensorListScatter(scope *Scope, tensor tf.Output, indices tf.Output, element_shape tf.Output) (output_handle tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "TensorListScatter", + Input: []tf.Input{ + tensor, indices, element_shape, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Copy a tensor setting everything outside a central band in each innermost matrix to zero. +// +// The `band` part is computed as follows: +// Assume `input` has `k` dimensions `[I, J, K, ..., M, N]`, then the output is a +// tensor with the same shape where +// +// `band[i, j, k, ..., m, n] = in_band(m, n) * input[i, j, k, ..., m, n]`. +// +// # The indicator function +// +// `in_band(m, n) = (num_lower < 0 || (m-n) <= num_lower)) && +// +// (num_upper < 0 || (n-m) <= num_upper)`. +// +// For example: +// +// ``` +// # if 'input' is [[ 0, 1, 2, 3] +// +// [-1, 0, 1, 2] +// [-2, -1, 0, 1] +// [-3, -2, -1, 0]], +// +// tf.matrix_band_part(input, 1, -1) ==> [[ 0, 1, 2, 3] +// +// [-1, 0, 1, 2] +// [ 0, -1, 0, 1] +// [ 0, 0, -1, 0]], +// +// tf.matrix_band_part(input, 2, 1) ==> [[ 0, 1, 0, 0] +// +// [-1, 0, 1, 0] +// [-2, -1, 0, 1] +// [ 0, -2, -1, 0]] +// +// ``` +// +// Useful special cases: +// +// ``` +// +// tf.matrix_band_part(input, 0, -1) ==> Upper triangular part. +// tf.matrix_band_part(input, -1, 0) ==> Lower triangular part. +// tf.matrix_band_part(input, 0, 0) ==> Diagonal. +// +// ``` +// +// Arguments: +// +// input: Rank `k` tensor. +// num_lower: 0-D tensor. Number of subdiagonals to keep. If negative, keep entire +// +// lower triangle. +// +// num_upper: 0-D tensor. Number of superdiagonals to keep. If negative, keep +// +// entire upper triangle. +// +// Returns Rank `k` tensor of the same shape as input. The extracted banded tensor. +func MatrixBandPart(scope *Scope, input tf.Output, num_lower tf.Output, num_upper tf.Output) (band tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "MatrixBandPart", + Input: []tf.Input{ + input, num_lower, num_upper, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// CudnnRNNV3Attr is an optional argument to CudnnRNNV3. +type CudnnRNNV3Attr func(optionalAttr) + +// CudnnRNNV3RnnMode sets the optional rnn_mode attribute to value. +// If not specified, defaults to "lstm" +func CudnnRNNV3RnnMode(value string) CudnnRNNV3Attr { + return func(m optionalAttr) { + m["rnn_mode"] = value + } +} + +// CudnnRNNV3InputMode sets the optional input_mode attribute to value. +// If not specified, defaults to "linear_input" +func CudnnRNNV3InputMode(value string) CudnnRNNV3Attr { + return func(m optionalAttr) { + m["input_mode"] = value + } +} + +// CudnnRNNV3Direction sets the optional direction attribute to value. +// If not specified, defaults to "unidirectional" +func CudnnRNNV3Direction(value string) CudnnRNNV3Attr { + return func(m optionalAttr) { + m["direction"] = value + } +} + +// CudnnRNNV3Dropout sets the optional dropout attribute to value. +// If not specified, defaults to 0 +func CudnnRNNV3Dropout(value float32) CudnnRNNV3Attr { + return func(m optionalAttr) { + m["dropout"] = value + } +} + +// CudnnRNNV3Seed sets the optional seed attribute to value. +// If not specified, defaults to 0 +func CudnnRNNV3Seed(value int64) CudnnRNNV3Attr { + return func(m optionalAttr) { + m["seed"] = value + } +} + +// CudnnRNNV3Seed2 sets the optional seed2 attribute to value. +// If not specified, defaults to 0 +func CudnnRNNV3Seed2(value int64) CudnnRNNV3Attr { + return func(m optionalAttr) { + m["seed2"] = value + } +} + +// CudnnRNNV3NumProj sets the optional num_proj attribute to value. +// If not specified, defaults to 0 +func CudnnRNNV3NumProj(value int64) CudnnRNNV3Attr { + return func(m optionalAttr) { + m["num_proj"] = value + } +} + +// CudnnRNNV3IsTraining sets the optional is_training attribute to value. +// If not specified, defaults to true +func CudnnRNNV3IsTraining(value bool) CudnnRNNV3Attr { + return func(m optionalAttr) { + m["is_training"] = value + } +} + +// CudnnRNNV3TimeMajor sets the optional time_major attribute to value. +// If not specified, defaults to true +func CudnnRNNV3TimeMajor(value bool) CudnnRNNV3Attr { + return func(m optionalAttr) { + m["time_major"] = value + } +} + +// A RNN backed by cuDNN. +// +// Computes the RNN from the input and initial states, with respect to the params +// buffer. Accepts one extra input "sequence_lengths" than CudnnRNN. +// +// rnn_mode: Indicates the type of the RNN model. +// input_mode: Indicates whether there is a linear projection between the input and +// +// the actual computation before the first layer. 'skip_input' is only allowed +// when input_size == num_units; 'auto_select' implies 'skip_input' when +// input_size == num_units; otherwise, it implies 'linear_input'. +// +// direction: Indicates whether a bidirectional model will be used. Should be +// +// "unidirectional" or "bidirectional". +// +// dropout: Dropout probability. When set to 0., dropout is disabled. +// seed: The 1st part of a seed to initialize dropout. +// seed2: The 2nd part of a seed to initialize dropout. +// input: If time_major is true, this is a 3-D tensor with the shape of +// +// [seq_length, batch_size, input_size]. If time_major is false, the shape is +// [batch_size, seq_length, input_size]. +// +// input_h: If time_major is true, this is a 3-D tensor with the shape of +// +// [num_layer * dir, batch_size, num_units]. If time_major is false, the shape +// is [batch_size, num_layer * dir, num_units]. +// +// input_c: For LSTM, a 3-D tensor with the shape of +// +// [num_layer * dir, batch, num_units]. For other models, it is ignored. +// +// params: A 1-D tensor that contains the weights and biases in an opaque layout. +// +// The size must be created through CudnnRNNParamsSize, and initialized +// separately. Note that they might not be compatible across different +// generations. So it is a good idea to save and restore +// +// sequence_lengths: a vector of lengths of each input sequence. +// output: If time_major is true, this is a 3-D tensor with the shape of +// +// [seq_length, batch_size, dir * num_units]. If time_major is false, the +// shape is [batch_size, seq_length, dir * num_units]. +// +// output_h: The same shape has input_h. +// output_c: The same shape as input_c for LSTM. An empty tensor for other models. +// is_training: Indicates whether this operation is used for inference or +// +// training. +// +// time_major: Indicates whether the input/output format is time major or batch +// +// major. +// +// reserve_space: An opaque tensor that can be used in backprop calculation. It +// +// is only produced if is_training is true. +func CudnnRNNV3(scope *Scope, input tf.Output, input_h tf.Output, input_c tf.Output, params tf.Output, sequence_lengths tf.Output, optional ...CudnnRNNV3Attr) (output tf.Output, output_h tf.Output, output_c tf.Output, reserve_space tf.Output, host_reserved tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "CudnnRNNV3", + Input: []tf.Input{ + input, input_h, input_c, params, sequence_lengths, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2), op.Output(3), op.Output(4) +} + +// LowerBoundAttr is an optional argument to LowerBound. +type LowerBoundAttr func(optionalAttr) + +// LowerBoundOutType sets the optional out_type attribute to value. +// If not specified, defaults to DT_INT32 +func LowerBoundOutType(value tf.DataType) LowerBoundAttr { + return func(m optionalAttr) { + m["out_type"] = value + } +} + +// Applies lower_bound(sorted_search_values, values) along each row. +// +// Each set of rows with the same index in (sorted_inputs, values) is treated +// independently. The resulting row is the equivalent of calling +// `np.searchsorted(sorted_inputs, values, side='left')`. +// +// The result is not a global index to the entire +// `Tensor`, but rather just the index in the last dimension. +// +// A 2-D example: +// +// sorted_sequence = [[0, 3, 9, 9, 10], +// [1, 2, 3, 4, 5]] +// values = [[2, 4, 9], +// [0, 2, 6]] +// +// result = LowerBound(sorted_sequence, values) +// +// result == [[1, 2, 2], +// [0, 1, 5]] +// +// Arguments: +// +// sorted_inputs: 2-D Tensor where each row is ordered. +// values: 2-D Tensor with the same numbers of rows as `sorted_search_values`. Contains +// +// the values that will be searched for in `sorted_search_values`. +// +// Returns A `Tensor` with the same shape as `values`. It contains the first scalar index +// into the last dimension where values can be inserted without changing the +// ordered property. +func LowerBound(scope *Scope, sorted_inputs tf.Output, values tf.Output, optional ...LowerBoundAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "LowerBound", + Input: []tf.Input{ + sorted_inputs, values, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// EigAttr is an optional argument to Eig. +type EigAttr func(optionalAttr) + +// EigComputeV sets the optional compute_v attribute to value. +// +// value: If `True` then eigenvectors will be computed and returned in `v`. +// Otherwise, only the eigenvalues will be computed. +// If not specified, defaults to true +func EigComputeV(value bool) EigAttr { + return func(m optionalAttr) { + m["compute_v"] = value + } +} + +// Computes the eigen decomposition of one or more square matrices. +// +// Computes the eigenvalues and (optionally) right eigenvectors of each inner matrix in +// `input` such that `input[..., :, :] = v[..., :, :] * diag(e[..., :])`. The eigenvalues +// are sorted in non-decreasing order. +// +// ```python +// # a is a tensor. +// # e is a tensor of eigenvalues. +// # v is a tensor of eigenvectors. +// e, v = eig(a) +// e = eig(a, compute_v=False) +// ``` +// +// Arguments: +// +// input: `Tensor` input of shape `[N, N]`. +// +// Returns: +// +// e: Eigenvalues. Shape is `[N]`. +// v: Eigenvectors. Shape is `[N, N]`. +func Eig(scope *Scope, input tf.Output, Tout tf.DataType, optional ...EigAttr) (e tf.Output, v tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"Tout": Tout} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Eig", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// Computes the LSTM cell backward propagation for the entire time sequence. +// +// This implementation is to be used in conjunction of BlockLSTMV2. +// +// Arguments: +// +// seq_len_max: Maximum time length actually used by this input. Outputs are padded +// +// with zeros beyond this length. +// +// x: The sequence input to the LSTM, shape (timelen, batch_size, num_inputs). +// cs_prev: Value of the initial cell state. +// h_prev: Initial output of cell (to be used for peephole). +// w: The weight matrix. +// wci: The weight matrix for input gate peephole connection. +// wcf: The weight matrix for forget gate peephole connection. +// wco: The weight matrix for output gate peephole connection. +// b: The bias vector. +// i: The input gate over the whole time sequence. +// cs: The cell state before the tanh over the whole time sequence. +// f: The forget gate over the whole time sequence. +// o: The output gate over the whole time sequence. +// ci: The cell input over the whole time sequence. +// co: The cell after the tanh over the whole time sequence. +// h: The output h vector over the whole time sequence. +// cs_grad: The current gradient of cs. +// h_grad: The gradient of h vector. +// use_peephole: Whether to use peephole weights. +// +// Returns: +// +// x_grad: The gradient of x to be back-propped. +// cs_prev_grad: The gradient of cs_prev to be back-propped. +// h_prev_grad: The gradient of h_prev to be back-propped. +// w_grad: The gradient for w to be back-propped. +// wci_grad: The gradient for wci to be back-propped. +// wcf_grad: The gradient for wcf to be back-propped. +// wco_grad: The gradient for wco to be back-propped. +// b_grad: The gradient for w to be back-propped. +func BlockLSTMGradV2(scope *Scope, seq_len_max tf.Output, x tf.Output, cs_prev tf.Output, h_prev tf.Output, w tf.Output, wci tf.Output, wcf tf.Output, wco tf.Output, b tf.Output, i tf.Output, cs tf.Output, f tf.Output, o tf.Output, ci tf.Output, co tf.Output, h tf.Output, cs_grad tf.Output, h_grad tf.Output, use_peephole bool) (x_grad tf.Output, cs_prev_grad tf.Output, h_prev_grad tf.Output, w_grad tf.Output, wci_grad tf.Output, wcf_grad tf.Output, wco_grad tf.Output, b_grad tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"use_peephole": use_peephole} + opspec := tf.OpSpec{ + Type: "BlockLSTMGradV2", + Input: []tf.Input{ + seq_len_max, x, cs_prev, h_prev, w, wci, wcf, wco, b, i, cs, f, o, ci, co, h, cs_grad, h_grad, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2), op.Output(3), op.Output(4), op.Output(5), op.Output(6), op.Output(7) +} + +// Creates a tree ensemble model and returns a handle to it. +// +// Arguments: +// +// tree_ensemble_handle: Handle to the tree ensemble resource to be created. +// stamp_token: Token to use as the initial value of the resource stamp. +// tree_ensemble_serialized: Serialized proto of the tree ensemble. +// +// Returns the created operation. +func BoostedTreesCreateEnsemble(scope *Scope, tree_ensemble_handle tf.Output, stamp_token tf.Output, tree_ensemble_serialized tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "BoostedTreesCreateEnsemble", + Input: []tf.Input{ + tree_ensemble_handle, stamp_token, tree_ensemble_serialized, + }, + } + return scope.AddOperation(opspec) +} + +// QueueCloseV2Attr is an optional argument to QueueCloseV2. +type QueueCloseV2Attr func(optionalAttr) + +// QueueCloseV2CancelPendingEnqueues sets the optional cancel_pending_enqueues attribute to value. +// +// value: If true, all pending enqueue requests that are +// blocked on the given queue will be canceled. +// If not specified, defaults to false +func QueueCloseV2CancelPendingEnqueues(value bool) QueueCloseV2Attr { + return func(m optionalAttr) { + m["cancel_pending_enqueues"] = value + } +} + +// Closes the given queue. +// +// This operation signals that no more elements will be enqueued in the +// given queue. Subsequent Enqueue(Many) operations will fail. +// Subsequent Dequeue(Many) operations will continue to succeed if +// sufficient elements remain in the queue. Subsequent Dequeue(Many) +// operations that would block will fail immediately. +// +// Arguments: +// +// handle: The handle to a queue. +// +// Returns the created operation. +func QueueCloseV2(scope *Scope, handle tf.Output, optional ...QueueCloseV2Attr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "QueueCloseV2", + Input: []tf.Input{ + handle, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// Returns the min of x and y (i.e. x < y ? x : y) element-wise. +// +// *NOTE*: `Minimum` supports broadcasting. More about broadcasting +// [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) +func Minimum(scope *Scope, x tf.Output, y tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Minimum", + Input: []tf.Input{ + x, y, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Set a bound for the given input value as a hint to Xla compiler, +// +// returns the same value. +func XlaSetBound(scope *Scope, input tf.Output, bound tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "XlaSetBound", + Input: []tf.Input{ + input, bound, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// RebatchDatasetAttr is an optional argument to RebatchDataset. +type RebatchDatasetAttr func(optionalAttr) + +// RebatchDatasetUseFallback sets the optional use_fallback attribute to value. +// If not specified, defaults to true +func RebatchDatasetUseFallback(value bool) RebatchDatasetAttr { + return func(m optionalAttr) { + m["use_fallback"] = value + } +} + +// Creates a dataset that changes the batch size. +// +// Creates a dataset that changes the batch size of the dataset to current batch +// size // num_workers. +// +// Arguments: +// +// input_dataset: A variant tensor representing the input dataset. +// num_replicas: A scalar representing the number of replicas to distribute this batch across. As +// +// a result of this transformation the current batch size would end up being +// divided by this parameter. +func RebatchDataset(scope *Scope, input_dataset tf.Output, num_replicas tf.Output, output_types []tf.DataType, output_shapes []tf.Shape, optional ...RebatchDatasetAttr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "RebatchDataset", + Input: []tf.Input{ + input_dataset, num_replicas, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes Psi, the derivative of Lgamma (the log of the absolute value of +// +// `Gamma(x)`), element-wise. +func Digamma(scope *Scope, x tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Digamma", + Input: []tf.Input{ + x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Increments variable pointed to by 'resource' until it reaches 'limit'. +// +// Arguments: +// +// resource: Should be from a scalar `Variable` node. +// limit: If incrementing ref would bring it above limit, instead generates an +// +// 'OutOfRange' error. +// +// Returns A copy of the input before increment. If nothing else modifies the +// input, the values produced will all be distinct. +func ResourceCountUpTo(scope *Scope, resource tf.Output, limit int64, T tf.DataType) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"limit": limit, "T": T} + opspec := tf.OpSpec{ + Type: "ResourceCountUpTo", + Input: []tf.Input{ + resource, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// StatefulTruncatedNormalAttr is an optional argument to StatefulTruncatedNormal. +type StatefulTruncatedNormalAttr func(optionalAttr) + +// StatefulTruncatedNormalDtype sets the optional dtype attribute to value. +// +// value: The type of the output. +// If not specified, defaults to DT_FLOAT +func StatefulTruncatedNormalDtype(value tf.DataType) StatefulTruncatedNormalAttr { + return func(m optionalAttr) { + m["dtype"] = value + } +} + +// Outputs random values from a truncated normal distribution. +// +// The generated values follow a normal distribution with mean 0 and standard +// deviation 1, except that values whose magnitude is more than 2 standard +// deviations from the mean are dropped and re-picked. +// +// Arguments: +// +// resource: The handle of the resource variable that stores the state of the RNG. +// algorithm: The RNG algorithm. +// shape: The shape of the output tensor. +// +// Returns Random values with specified shape. +func StatefulTruncatedNormal(scope *Scope, resource tf.Output, algorithm tf.Output, shape tf.Output, optional ...StatefulTruncatedNormalAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "StatefulTruncatedNormal", + Input: []tf.Input{ + resource, algorithm, shape, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// CopyHostAttr is an optional argument to CopyHost. +type CopyHostAttr func(optionalAttr) + +// CopyHostTensorName sets the optional tensor_name attribute to value. +// +// value: The name of the input tensor. +// If not specified, defaults to "" +func CopyHostTensorName(value string) CopyHostAttr { + return func(m optionalAttr) { + m["tensor_name"] = value + } +} + +// CopyHostDebugOpsSpec sets the optional debug_ops_spec attribute to value. +// +// value: A list of debug op spec (op, url, gated_grpc) for attached debug +// ops. Each element of the list has the format +// ;;, wherein gated_grpc is boolean represented +// as 0/1. E.g., "DebugIdentity;grpc://foo:3333;1", +// "DebugIdentity;file:///tmp/tfdbg_1;0". +// If not specified, defaults to <> +func CopyHostDebugOpsSpec(value []string) CopyHostAttr { + return func(m optionalAttr) { + m["debug_ops_spec"] = value + } +} + +// Copy a tensor to host. +// +// Performs CPU-to-CPU deep-copying of tensor. +// N.B.: If the all downstream attached debug ops are disabled given the current +// gRPC gating status, the output will simply forward the input tensor without +// deep-copying. See the documentation of Debug* ops for more details. +// +// Unlike the Copy Op, this op has HostMemory constraint on its input or output. +// +// Arguments: +// +// input: Input tensor. +func CopyHost(scope *Scope, input tf.Output, optional ...CopyHostAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "CopyHost", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// TridiagonalSolveAttr is an optional argument to TridiagonalSolve. +type TridiagonalSolveAttr func(optionalAttr) + +// TridiagonalSolvePartialPivoting sets the optional partial_pivoting attribute to value. +// +// value: Whether to apply partial pivoting. Partial pivoting makes the procedure more +// stable, but slower. +// If not specified, defaults to true +func TridiagonalSolvePartialPivoting(value bool) TridiagonalSolveAttr { + return func(m optionalAttr) { + m["partial_pivoting"] = value + } +} + +// TridiagonalSolvePerturbSingular sets the optional perturb_singular attribute to value. +// If not specified, defaults to false +func TridiagonalSolvePerturbSingular(value bool) TridiagonalSolveAttr { + return func(m optionalAttr) { + m["perturb_singular"] = value + } +} + +// Solves tridiagonal systems of equations. +// +// Solves tridiagonal systems of equations. +// Supports batch dimensions and multiple right-hand sides per each left-hand +// side. +// On CPU, solution is computed via Gaussian elimination with or without partial +// pivoting, depending on `partial_pivoting` attribute. On GPU, Nvidia's cuSPARSE +// library is used: https://docs.nvidia.com/cuda/cusparse/index.html#gtsv +// Partial pivoting is not yet supported by XLA backends. +// +// Arguments: +// +// diagonals: Tensor of shape `[..., 3, M]` whose innermost 2 dimensions represent the +// +// tridiagonal matrices with three rows being the superdiagonal, diagonals, and +// subdiagonals, in order. The last element of the superdiagonal and the first +// element of the subdiagonal is ignored. +// +// rhs: Tensor of shape `[..., M, K]`, representing K right-hand sides per each +// +// left-hand side. +// +// Returns Tensor of shape `[..., M, K]` containing the solutions +func TridiagonalSolve(scope *Scope, diagonals tf.Output, rhs tf.Output, optional ...TridiagonalSolveAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "TridiagonalSolve", + Input: []tf.Input{ + diagonals, rhs, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Scatters tensor at indices in an input list. +// +// Each member of the TensorList corresponds to one row of the input tensor, +// specified by the given index (see `tf.gather`). +// +// input_handle: The list to scatter into. +// tensor: The input tensor. +// indices: The indices used to index into the list. +// output_handle: The TensorList. +func TensorListScatterIntoExistingList(scope *Scope, input_handle tf.Output, tensor tf.Output, indices tf.Output) (output_handle tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "TensorListScatterIntoExistingList", + Input: []tf.Input{ + input_handle, tensor, indices, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ResourceSparseApplyAdadeltaAttr is an optional argument to ResourceSparseApplyAdadelta. +type ResourceSparseApplyAdadeltaAttr func(optionalAttr) + +// ResourceSparseApplyAdadeltaUseLocking sets the optional use_locking attribute to value. +// +// value: If True, updating of the var and accum tensors will be protected by +// a lock; otherwise the behavior is undefined, but may exhibit less contention. +// If not specified, defaults to false +func ResourceSparseApplyAdadeltaUseLocking(value bool) ResourceSparseApplyAdadeltaAttr { + return func(m optionalAttr) { + m["use_locking"] = value + } +} + +// var: Should be from a Variable(). +// +// Arguments: +// +// accum: Should be from a Variable(). +// accum_update: : Should be from a Variable(). +// lr: Learning rate. Must be a scalar. +// rho: Decay factor. Must be a scalar. +// epsilon: Constant factor. Must be a scalar. +// grad: The gradient. +// indices: A vector of indices into the first dimension of var and accum. +// +// Returns the created operation. +func ResourceSparseApplyAdadelta(scope *Scope, var_ tf.Output, accum tf.Output, accum_update tf.Output, lr tf.Output, rho tf.Output, epsilon tf.Output, grad tf.Output, indices tf.Output, optional ...ResourceSparseApplyAdadeltaAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ResourceSparseApplyAdadelta", + Input: []tf.Input{ + var_, accum, accum_update, lr, rho, epsilon, grad, indices, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// ResourceApplyAdaMaxAttr is an optional argument to ResourceApplyAdaMax. +type ResourceApplyAdaMaxAttr func(optionalAttr) + +// ResourceApplyAdaMaxUseLocking sets the optional use_locking attribute to value. +// +// value: If `True`, updating of the var, m, and v tensors will be protected +// by a lock; otherwise the behavior is undefined, but may exhibit less +// contention. +// If not specified, defaults to false +func ResourceApplyAdaMaxUseLocking(value bool) ResourceApplyAdaMaxAttr { + return func(m optionalAttr) { + m["use_locking"] = value + } +} + +// Update '*var' according to the AdaMax algorithm. +// +// m_t <- beta1 * m_{t-1} + (1 - beta1) * g +// v_t <- max(beta2 * v_{t-1}, abs(g)) +// variable <- variable - learning_rate / (1 - beta1^t) * m_t / (v_t + epsilon) +// +// Arguments: +// +// var_: Should be from a Variable(). +// m: Should be from a Variable(). +// v: Should be from a Variable(). +// beta1_power: Must be a scalar. +// lr: Scaling factor. Must be a scalar. +// beta1: Momentum factor. Must be a scalar. +// beta2: Momentum factor. Must be a scalar. +// epsilon: Ridge term. Must be a scalar. +// grad: The gradient. +// +// Returns the created operation. +func ResourceApplyAdaMax(scope *Scope, var_ tf.Output, m tf.Output, v tf.Output, beta1_power tf.Output, lr tf.Output, beta1 tf.Output, beta2 tf.Output, epsilon tf.Output, grad tf.Output, optional ...ResourceApplyAdaMaxAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ResourceApplyAdaMax", + Input: []tf.Input{ + var_, m, v, beta1_power, lr, beta1, beta2, epsilon, grad, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// MaxAttr is an optional argument to Max. +type MaxAttr func(optionalAttr) + +// MaxKeepDims sets the optional keep_dims attribute to value. +// +// value: If true, retain reduced dimensions with length 1. +// If not specified, defaults to false +func MaxKeepDims(value bool) MaxAttr { + return func(m optionalAttr) { + m["keep_dims"] = value + } +} + +// Computes the maximum of elements across dimensions of a tensor. +// +// Reduces `input` along the dimensions given in `axis`. Unless +// `keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in +// `axis`. If `keep_dims` is true, the reduced dimensions are +// retained with length 1. +// +// Arguments: +// +// input: The tensor to reduce. +// axis: The dimensions to reduce. Must be in the range +// +// `[-rank(input), rank(input))`. +// +// Returns The reduced tensor. +func Max(scope *Scope, input tf.Output, axis tf.Output, optional ...MaxAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Max", + Input: []tf.Input{ + input, axis, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// LoadTPUEmbeddingAdadeltaParametersAttr is an optional argument to LoadTPUEmbeddingAdadeltaParameters. +type LoadTPUEmbeddingAdadeltaParametersAttr func(optionalAttr) + +// LoadTPUEmbeddingAdadeltaParametersTableId sets the optional table_id attribute to value. +// If not specified, defaults to -1 +func LoadTPUEmbeddingAdadeltaParametersTableId(value int64) LoadTPUEmbeddingAdadeltaParametersAttr { + return func(m optionalAttr) { + m["table_id"] = value + } +} + +// LoadTPUEmbeddingAdadeltaParametersTableName sets the optional table_name attribute to value. +// If not specified, defaults to "" +func LoadTPUEmbeddingAdadeltaParametersTableName(value string) LoadTPUEmbeddingAdadeltaParametersAttr { + return func(m optionalAttr) { + m["table_name"] = value + } +} + +// LoadTPUEmbeddingAdadeltaParametersConfig sets the optional config attribute to value. +// If not specified, defaults to "" +func LoadTPUEmbeddingAdadeltaParametersConfig(value string) LoadTPUEmbeddingAdadeltaParametersAttr { + return func(m optionalAttr) { + m["config"] = value + } +} + +// Load Adadelta embedding parameters. +// +// An op that loads optimization parameters into HBM for embedding. Must be +// preceded by a ConfigureTPUEmbeddingHost op that sets up the correct +// embedding table configuration. For example, this op is used to install +// parameters that are loaded from a checkpoint before a training loop is +// executed. +// +// Arguments: +// +// parameters: Value of parameters used in the Adadelta optimization algorithm. +// accumulators: Value of accumulators used in the Adadelta optimization algorithm. +// updates: Value of updates used in the Adadelta optimization algorithm. +// +// Returns the created operation. +func LoadTPUEmbeddingAdadeltaParameters(scope *Scope, parameters tf.Output, accumulators tf.Output, updates tf.Output, num_shards int64, shard_id int64, optional ...LoadTPUEmbeddingAdadeltaParametersAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_shards": num_shards, "shard_id": shard_id} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "LoadTPUEmbeddingAdadeltaParameters", + Input: []tf.Input{ + parameters, accumulators, updates, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// RetrieveTPUEmbeddingRMSPropParametersAttr is an optional argument to RetrieveTPUEmbeddingRMSPropParameters. +type RetrieveTPUEmbeddingRMSPropParametersAttr func(optionalAttr) + +// RetrieveTPUEmbeddingRMSPropParametersTableId sets the optional table_id attribute to value. +// If not specified, defaults to -1 +func RetrieveTPUEmbeddingRMSPropParametersTableId(value int64) RetrieveTPUEmbeddingRMSPropParametersAttr { + return func(m optionalAttr) { + m["table_id"] = value + } +} + +// RetrieveTPUEmbeddingRMSPropParametersTableName sets the optional table_name attribute to value. +// If not specified, defaults to "" +func RetrieveTPUEmbeddingRMSPropParametersTableName(value string) RetrieveTPUEmbeddingRMSPropParametersAttr { + return func(m optionalAttr) { + m["table_name"] = value + } +} + +// RetrieveTPUEmbeddingRMSPropParametersConfig sets the optional config attribute to value. +// If not specified, defaults to "" +func RetrieveTPUEmbeddingRMSPropParametersConfig(value string) RetrieveTPUEmbeddingRMSPropParametersAttr { + return func(m optionalAttr) { + m["config"] = value + } +} + +// Retrieve RMSProp embedding parameters. +// +// An op that retrieves optimization parameters from embedding to host +// memory. Must be preceded by a ConfigureTPUEmbeddingHost op that sets up +// the correct embedding table configuration. For example, this op is +// used to retrieve updated parameters before saving a checkpoint. +// +// Returns: +// +// parameters: Parameter parameters updated by the RMSProp optimization algorithm. +// ms: Parameter ms updated by the RMSProp optimization algorithm. +// mom: Parameter mom updated by the RMSProp optimization algorithm. +func RetrieveTPUEmbeddingRMSPropParameters(scope *Scope, num_shards int64, shard_id int64, optional ...RetrieveTPUEmbeddingRMSPropParametersAttr) (parameters tf.Output, ms tf.Output, mom tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_shards": num_shards, "shard_id": shard_id} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "RetrieveTPUEmbeddingRMSPropParameters", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// ImageSummaryAttr is an optional argument to ImageSummary. +type ImageSummaryAttr func(optionalAttr) + +// ImageSummaryMaxImages sets the optional max_images attribute to value. +// +// value: Max number of batch elements to generate images for. +// If not specified, defaults to 3 +// +// REQUIRES: value >= 1 +func ImageSummaryMaxImages(value int64) ImageSummaryAttr { + return func(m optionalAttr) { + m["max_images"] = value + } +} + +// ImageSummaryBadColor sets the optional bad_color attribute to value. +// +// value: Color to use for pixels with non-finite values. +// If not specified, defaults to > int_val:255 int_val:0 int_val:0 int_val:255 > +func ImageSummaryBadColor(value tf.Tensor) ImageSummaryAttr { + return func(m optionalAttr) { + m["bad_color"] = value + } +} + +// Outputs a `Summary` protocol buffer with images. +// +// The summary has up to `max_images` summary values containing images. The +// images are built from `tensor` which must be 4-D with shape `[batch_size, +// height, width, channels]` and where `channels` can be: +// +// * 1: `tensor` is interpreted as Grayscale. +// * 3: `tensor` is interpreted as RGB. +// * 4: `tensor` is interpreted as RGBA. +// +// The images have the same number of channels as the input tensor. For float +// input, the values are normalized one image at a time to fit in the range +// `[0, 255]`. `uint8` values are unchanged. The op uses two different +// normalization algorithms: +// +// - If the input values are all positive, they are rescaled so the largest one +// is 255. +// +// - If any input value is negative, the values are shifted so input value 0.0 +// is at 127. They are then rescaled so that either the smallest value is 0, +// or the largest one is 255. +// +// The `tag` argument is a scalar `Tensor` of type `string`. It is used to +// build the `tag` of the summary values: +// +// - If `max_images` is 1, the summary value tag is '*tag*/image'. +// - If `max_images` is greater than 1, the summary value tags are +// generated sequentially as '*tag*/image/0', '*tag*/image/1', etc. +// +// The `bad_color` argument is the color to use in the generated images for +// non-finite input values. It is a `uint8` 1-D tensor of length `channels`. +// Each element must be in the range `[0, 255]` (It represents the value of a +// pixel in the output image). Non-finite values in the input tensor are +// replaced by this tensor in the output image. The default value is the color +// red. +// +// Arguments: +// +// tag: Scalar. Used to build the `tag` attribute of the summary values. +// tensor: 4-D of shape `[batch_size, height, width, channels]` where +// +// `channels` is 1, 3, or 4. +// +// Returns Scalar. Serialized `Summary` protocol buffer. +func ImageSummary(scope *Scope, tag tf.Output, tensor tf.Output, optional ...ImageSummaryAttr) (summary tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ImageSummary", + Input: []tf.Input{ + tag, tensor, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns a tensor of zeros with the same shape and type as x. +// +// Arguments: +// +// x: a tensor of type T. +// +// Returns a tensor of the same shape and type as x but filled with zeros. +func ZerosLike(scope *Scope, x tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "ZerosLike", + Input: []tf.Input{ + x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// TPUReplicatedInputAttr is an optional argument to TPUReplicatedInput. +type TPUReplicatedInputAttr func(optionalAttr) + +// TPUReplicatedInputIsMirroredVariable sets the optional is_mirrored_variable attribute to value. +// If not specified, defaults to false +func TPUReplicatedInputIsMirroredVariable(value bool) TPUReplicatedInputAttr { + return func(m optionalAttr) { + m["is_mirrored_variable"] = value + } +} + +// TPUReplicatedInputIndex sets the optional index attribute to value. +// If not specified, defaults to -1 +func TPUReplicatedInputIndex(value int64) TPUReplicatedInputAttr { + return func(m optionalAttr) { + m["index"] = value + } +} + +// TPUReplicatedInputIsPacked sets the optional is_packed attribute to value. +// If not specified, defaults to false +func TPUReplicatedInputIsPacked(value bool) TPUReplicatedInputAttr { + return func(m optionalAttr) { + m["is_packed"] = value + } +} + +// Connects N inputs to an N-way replicated TPU computation. +// +// This operation holds a replicated input to a `tpu.replicate()` computation subgraph. +// Each replicated input has the same shape and type alongside the output. +// +// For example: +// ``` +// %a = "tf.opA"() +// %b = "tf.opB"() +// %replicated_input = "tf.TPUReplicatedInput"(%a, %b) +// %computation = "tf.Computation"(%replicated_input) +// ``` +// The above computation has a replicated input of two replicas. +func TPUReplicatedInput(scope *Scope, inputs []tf.Output, optional ...TPUReplicatedInputAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "TPUReplicatedInput", + Input: []tf.Input{ + tf.OutputList(inputs), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Wraps an arbitrary MLIR computation expressed as a module with a main() function. +// +// This operation does not have an associated kernel and is not intended to be +// executed in a regular TensorFlow session. Instead it is intended to be used for +// testing or for special case where a user intends to pass custom MLIR computation +// through a TensorFlow graph with the intent of having custom tooling processing +// it downstream (when targeting a different environment, like TensorFlow lite for +// example). +// The MLIR module is expected to have a main() function that will be used as an +// entry point. The inputs to the operations will be passed as argument to the +// main() function and the returned values of the main function mapped to the +// outputs. +// Example usage: +// +// ``` +// import tensorflow as tf +// from tensorflow.compiler.mlir.tensorflow.gen_mlir_passthrough_op import mlir_passthrough_op +// +// mlir_module = ”'python +// +// func @main(%arg0 : tensor<10xf32>, %arg1 : tensor<10xf32>) -> tensor<10x10xf32> { +// %add = "magic.op"(%arg0, %arg1) : (tensor<10xf32>, tensor<10xf32>) -> tensor<10x10xf32> +// return %ret : tensor<10x10xf32> +// } +// +// ”' +// +// @tf.function +// def foo(x, y): +// +// return mlir_passthrough_op([x, y], mlir_module, Toutputs=[tf.float32]) +// +// graph_def = foo.get_concrete_function(tf.TensorSpec([10], tf.float32), tf.TensorSpec([10], tf.float32)).graph.as_graph_def() +// ``` +func MlirPassthroughOp(scope *Scope, inputs []tf.Output, mlir_module string, Toutputs []tf.DataType) (outputs []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"mlir_module": mlir_module, "Toutputs": Toutputs} + opspec := tf.OpSpec{ + Type: "MlirPassthroughOp", + Input: []tf.Input{ + tf.OutputList(inputs), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if outputs, idx, err = makeOutputList(op, idx, "outputs"); err != nil { + scope.UpdateErr("MlirPassthroughOp", err) + return + } + return outputs +} + +// Serializes the tree ensemble to a proto. +// +// Arguments: +// +// tree_ensemble_handle: Handle to the tree ensemble. +// +// Returns: +// +// stamp_token: Stamp token of the tree ensemble resource. +// tree_ensemble_serialized: Serialized proto of the ensemble. +func BoostedTreesSerializeEnsemble(scope *Scope, tree_ensemble_handle tf.Output) (stamp_token tf.Output, tree_ensemble_serialized tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "BoostedTreesSerializeEnsemble", + Input: []tf.Input{ + tree_ensemble_handle, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// DataFormatVecPermuteAttr is an optional argument to DataFormatVecPermute. +type DataFormatVecPermuteAttr func(optionalAttr) + +// DataFormatVecPermuteSrcFormat sets the optional src_format attribute to value. +// +// value: source data format. +// If not specified, defaults to "NHWC" +func DataFormatVecPermuteSrcFormat(value string) DataFormatVecPermuteAttr { + return func(m optionalAttr) { + m["src_format"] = value + } +} + +// DataFormatVecPermuteDstFormat sets the optional dst_format attribute to value. +// +// value: destination data format. +// If not specified, defaults to "NCHW" +func DataFormatVecPermuteDstFormat(value string) DataFormatVecPermuteAttr { + return func(m optionalAttr) { + m["dst_format"] = value + } +} + +// Permute input tensor from `src_format` to `dst_format`. +// +// Input tensor must be a vector of size 4, or a 4x2 tensor. +// +// For example, with `src_format` of `NHWC`, `dst_format` of `NCHW`, and inputs: +// ``` +// [1, 2, 3, 4] +// ``` +// and +// ``` +// [[1, 2, 3, 4], +// +// [5, 6, 7, 8]] +// +// ``` +// , the outputs will be (respectively): +// ``` +// [1, 4, 2, 3] +// ``` +// and +// ``` +// [[1, 4, 2, 3], +// +// [5, 8, 6, 7]] +// +// ``` +// +// Arguments: +// +// x: Vector of size 4 or Tensor of shape (4, 2) in source data format. +// +// Returns Vector of size 4 or Tensor of shape (4, 2) in destination data format. +func DataFormatVecPermute(scope *Scope, x tf.Output, optional ...DataFormatVecPermuteAttr) (y tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "DataFormatVecPermute", + Input: []tf.Input{ + x, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// DecodeRawAttr is an optional argument to DecodeRaw. +type DecodeRawAttr func(optionalAttr) + +// DecodeRawLittleEndian sets the optional little_endian attribute to value. +// +// value: Whether the input `bytes` are in little-endian order. +// Ignored for `out_type` values that are stored in a single byte like +// `uint8`. +// If not specified, defaults to true +func DecodeRawLittleEndian(value bool) DecodeRawAttr { + return func(m optionalAttr) { + m["little_endian"] = value + } +} + +// Reinterpret the bytes of a string as a vector of numbers. +// +// Arguments: +// +// bytes: All the elements must have the same length. +// +// Returns A Tensor with one more dimension than the input `bytes`. The +// added dimension will have size equal to the length of the elements +// of `bytes` divided by the number of bytes to represent `out_type`. +func DecodeRaw(scope *Scope, bytes tf.Output, out_type tf.DataType, optional ...DecodeRawAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"out_type": out_type} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "DecodeRaw", + Input: []tf.Input{ + bytes, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns a tensor of ones with the same shape and type as x. +// +// Arguments: +// +// x: a tensor of type T. +// +// Returns a tensor of the same shape and type as x but filled with ones. +func OnesLike(scope *Scope, x tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "OnesLike", + Input: []tf.Input{ + x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// SelfAdjointEigV2Attr is an optional argument to SelfAdjointEigV2. +type SelfAdjointEigV2Attr func(optionalAttr) + +// SelfAdjointEigV2ComputeV sets the optional compute_v attribute to value. +// +// value: If `True` then eigenvectors will be computed and returned in `v`. +// Otherwise, only the eigenvalues will be computed. +// If not specified, defaults to true +func SelfAdjointEigV2ComputeV(value bool) SelfAdjointEigV2Attr { + return func(m optionalAttr) { + m["compute_v"] = value + } +} + +// Computes the eigen decomposition of one or more square self-adjoint matrices. +// +// Computes the eigenvalues and (optionally) eigenvectors of each inner matrix in +// `input` such that `input[..., :, :] = v[..., :, :] * diag(e[..., :])`. The eigenvalues +// are sorted in non-decreasing order. +// +// ```python +// # a is a tensor. +// # e is a tensor of eigenvalues. +// # v is a tensor of eigenvectors. +// e, v = self_adjoint_eig(a) +// e = self_adjoint_eig(a, compute_v=False) +// ``` +// +// Arguments: +// +// input: `Tensor` input of shape `[N, N]`. +// +// Returns: +// +// e: Eigenvalues. Shape is `[N]`. +// v: Eigenvectors. Shape is `[N, N]`. +func SelfAdjointEigV2(scope *Scope, input tf.Output, optional ...SelfAdjointEigV2Attr) (e tf.Output, v tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "SelfAdjointEigV2", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// Worker heartbeat op. +// +// Heartbeats may be sent periodically to indicate the coordinator is still active, +// to retrieve the current worker status and to expedite shutdown when necessary. +// +// Arguments: +// +// request: A string tensor containing a serialized WorkerHeartbeatRequest +// +// Returns A string tensor containing a serialized WorkerHeartbeatResponse +func WorkerHeartbeat(scope *Scope, request tf.Output) (response tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "WorkerHeartbeat", + Input: []tf.Input{ + request, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// StatefulUniformAttr is an optional argument to StatefulUniform. +type StatefulUniformAttr func(optionalAttr) + +// StatefulUniformDtype sets the optional dtype attribute to value. +// +// value: The type of the output. +// If not specified, defaults to DT_FLOAT +func StatefulUniformDtype(value tf.DataType) StatefulUniformAttr { + return func(m optionalAttr) { + m["dtype"] = value + } +} + +// Outputs random values from a uniform distribution. +// +// The generated values follow a uniform distribution in the range `[0, 1)`. The +// lower bound 0 is included in the range, while the upper bound 1 is excluded. +// +// Arguments: +// +// resource: The handle of the resource variable that stores the state of the RNG. +// algorithm: The RNG algorithm. +// shape: The shape of the output tensor. +// +// Returns Random values with specified shape. +func StatefulUniform(scope *Scope, resource tf.Output, algorithm tf.Output, shape tf.Output, optional ...StatefulUniformAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "StatefulUniform", + Input: []tf.Input{ + resource, algorithm, shape, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// LoadTPUEmbeddingStochasticGradientDescentParametersAttr is an optional argument to LoadTPUEmbeddingStochasticGradientDescentParameters. +type LoadTPUEmbeddingStochasticGradientDescentParametersAttr func(optionalAttr) + +// LoadTPUEmbeddingStochasticGradientDescentParametersTableId sets the optional table_id attribute to value. +// If not specified, defaults to -1 +func LoadTPUEmbeddingStochasticGradientDescentParametersTableId(value int64) LoadTPUEmbeddingStochasticGradientDescentParametersAttr { + return func(m optionalAttr) { + m["table_id"] = value + } +} + +// LoadTPUEmbeddingStochasticGradientDescentParametersTableName sets the optional table_name attribute to value. +// If not specified, defaults to "" +func LoadTPUEmbeddingStochasticGradientDescentParametersTableName(value string) LoadTPUEmbeddingStochasticGradientDescentParametersAttr { + return func(m optionalAttr) { + m["table_name"] = value + } +} + +// LoadTPUEmbeddingStochasticGradientDescentParametersConfig sets the optional config attribute to value. +// If not specified, defaults to "" +func LoadTPUEmbeddingStochasticGradientDescentParametersConfig(value string) LoadTPUEmbeddingStochasticGradientDescentParametersAttr { + return func(m optionalAttr) { + m["config"] = value + } +} + +// Load SGD embedding parameters. +// +// An op that loads optimization parameters into HBM for embedding. Must be +// preceded by a ConfigureTPUEmbeddingHost op that sets up the correct +// embedding table configuration. For example, this op is used to install +// parameters that are loaded from a checkpoint before a training loop is +// executed. +// +// Arguments: +// +// parameters: Value of parameters used in the stochastic gradient descent optimization algorithm. +// +// Returns the created operation. +func LoadTPUEmbeddingStochasticGradientDescentParameters(scope *Scope, parameters tf.Output, num_shards int64, shard_id int64, optional ...LoadTPUEmbeddingStochasticGradientDescentParametersAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_shards": num_shards, "shard_id": shard_id} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "LoadTPUEmbeddingStochasticGradientDescentParameters", + Input: []tf.Input{ + parameters, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// CastAttr is an optional argument to Cast. +type CastAttr func(optionalAttr) + +// CastTruncate sets the optional Truncate attribute to value. +// If not specified, defaults to false +func CastTruncate(value bool) CastAttr { + return func(m optionalAttr) { + m["Truncate"] = value + } +} + +// Cast x of type SrcT to y of DstT. +func Cast(scope *Scope, x tf.Output, DstT tf.DataType, optional ...CastAttr) (y tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"DstT": DstT} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Cast", + Input: []tf.Input{ + x, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Writes the given dataset to the given file using the TFRecord format. +// +// Arguments: +// +// input_dataset: A variant tensor representing the dataset to write. +// filename: A scalar string tensor representing the filename to use. +// compression_type: A scalar string tensor containing either (i) the empty string (no +// +// compression), (ii) "ZLIB", or (iii) "GZIP". +// +// Returns the created operation. +func ExperimentalDatasetToTFRecord(scope *Scope, input_dataset tf.Output, filename tf.Output, compression_type tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "ExperimentalDatasetToTFRecord", + Input: []tf.Input{ + input_dataset, filename, compression_type, + }, + } + return scope.AddOperation(opspec) +} + +// Deprecated. Use TensorArrayCloseV3 +// +// DEPRECATED at GraphDef version 26: Use TensorArrayCloseV3 +// +// Returns the created operation. +func TensorArrayCloseV2(scope *Scope, handle tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "TensorArrayCloseV2", + Input: []tf.Input{ + handle, + }, + } + return scope.AddOperation(opspec) +} + +// BatchDatasetAttr is an optional argument to BatchDataset. +type BatchDatasetAttr func(optionalAttr) + +// BatchDatasetMetadata sets the optional metadata attribute to value. +// If not specified, defaults to "" +func BatchDatasetMetadata(value string) BatchDatasetAttr { + return func(m optionalAttr) { + m["metadata"] = value + } +} + +// Creates a dataset that batches `batch_size` elements from `input_dataset`. +// +// Arguments: +// +// batch_size: A scalar representing the number of elements to accumulate in a +// +// batch. +func BatchDataset(scope *Scope, input_dataset tf.Output, batch_size tf.Output, output_types []tf.DataType, output_shapes []tf.Shape, optional ...BatchDatasetAttr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "BatchDataset", + Input: []tf.Input{ + input_dataset, batch_size, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Says whether the targets are in the top `K` predictions. +// +// This outputs a `batch_size` bool array, an entry `out[i]` is `true` if the +// prediction for the target class is among the top `k` predictions among +// all predictions for example `i`. Note that the behavior of `InTopK` differs +// from the `TopK` op in its handling of ties; if multiple classes have the +// same prediction value and straddle the top-`k` boundary, all of those +// classes are considered to be in the top `k`. +// +// More formally, let +// +// \\(predictions_i\\) be the predictions for all classes for example `i`, +// \\(targets_i\\) be the target class for example `i`, +// \\(out_i\\) be the output for example `i`, +// +// $$out_i = predictions_{i, targets_i} \in TopKIncludingTies(predictions_i)$$ +// +// Arguments: +// +// predictions: A `batch_size` x `classes` tensor. +// targets: A `batch_size` vector of class ids. +// k: Number of top elements to look at for computing precision. +// +// Returns Computed Precision at `k` as a `bool Tensor`. +func InTopK(scope *Scope, predictions tf.Output, targets tf.Output, k int64) (precision tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"k": k} + opspec := tf.OpSpec{ + Type: "InTopK", + Input: []tf.Input{ + predictions, targets, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Retrieves the tree ensemble resource stamp token, number of trees and growing statistics. +// +// Arguments: +// +// tree_ensemble_handle: Handle to the tree ensemble. +// +// Returns: +// +// stamp_token: Stamp token of the tree ensemble resource. +// num_trees: The number of trees in the tree ensemble resource. +// num_finalized_trees: The number of trees that were finished successfully. +// num_attempted_layers: The number of layers we attempted to build (but not necessarily succeeded). +// last_layer_nodes_range: Rank size 2 tensor that contains start and end ids of the nodes in the latest +// +// layer. +func BoostedTreesGetEnsembleStates(scope *Scope, tree_ensemble_handle tf.Output) (stamp_token tf.Output, num_trees tf.Output, num_finalized_trees tf.Output, num_attempted_layers tf.Output, last_layer_nodes_range tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "BoostedTreesGetEnsembleStates", + Input: []tf.Input{ + tree_ensemble_handle, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2), op.Output(3), op.Output(4) +} + +// Deprecated. Use TensorArraySizeV3 +// +// DEPRECATED at GraphDef version 26: Use TensorArraySizeV3 +func TensorArraySizeV2(scope *Scope, handle tf.Output, flow_in tf.Output) (size tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "TensorArraySizeV2", + Input: []tf.Input{ + handle, flow_in, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Store the input tensor in the state of the current session. +// +// Arguments: +// +// value: The tensor to be stored. +// +// Returns The handle for the tensor stored in the session state, represented +// as a string. +func GetSessionHandle(scope *Scope, value tf.Output) (handle tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "GetSessionHandle", + Input: []tf.Input{ + value, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// PaddedBatchDatasetAttr is an optional argument to PaddedBatchDataset. +type PaddedBatchDatasetAttr func(optionalAttr) + +// PaddedBatchDatasetMetadata sets the optional metadata attribute to value. +// If not specified, defaults to "" +func PaddedBatchDatasetMetadata(value string) PaddedBatchDatasetAttr { + return func(m optionalAttr) { + m["metadata"] = value + } +} + +// Creates a dataset that batches and pads `batch_size` elements from the input. +// +// Arguments: +// +// batch_size: A scalar representing the number of elements to accumulate in a +// +// batch. +// +// padded_shapes: A list of int64 tensors representing the desired padded shapes +// +// of the corresponding output components. These shapes may be partially +// specified, using `-1` to indicate that a particular dimension should be +// padded to the maximum size of all batch elements. +// +// padding_values: A list of scalars containing the padding value to use for +// +// each of the outputs. +func PaddedBatchDataset(scope *Scope, input_dataset tf.Output, batch_size tf.Output, padded_shapes []tf.Output, padding_values []tf.Output, output_shapes []tf.Shape, optional ...PaddedBatchDatasetAttr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_shapes": output_shapes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "PaddedBatchDataset", + Input: []tf.Input{ + input_dataset, batch_size, tf.OutputList(padded_shapes), tf.OutputList(padding_values), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Performs a padding as a preprocess during a convolution. +// +// Similar to FusedResizeAndPadConv2d, this op allows for an optimized +// implementation where the spatial padding transformation stage is fused with the +// im2col lookup, but in this case without the bilinear filtering required for +// resizing. Fusing the padding prevents the need to write out the intermediate +// results as whole tensors, reducing memory pressure, and we can get some latency +// gains by merging the transformation calculations. +// The data_format attribute for Conv2D isn't supported by this op, and 'NHWC' +// order is used instead. +// Internally this op uses a single per-graph scratch buffer, which means that it +// will block if multiple versions are being run in parallel. This is because this +// operator is primarily an optimization to minimize memory usage. +// +// Arguments: +// +// input: 4-D with shape `[batch, in_height, in_width, in_channels]`. +// paddings: A two-column matrix specifying the padding sizes. The number of +// +// rows must be the same as the rank of `input`. +// +// filter: 4-D with shape +// +// `[filter_height, filter_width, in_channels, out_channels]`. +// +// strides: 1-D of length 4. The stride of the sliding window for each dimension +// +// of `input`. Must be in the same order as the dimension specified with format. +// +// padding: The type of padding algorithm to use. +func FusedPadConv2D(scope *Scope, input tf.Output, paddings tf.Output, filter tf.Output, mode string, strides []int64, padding string) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"mode": mode, "strides": strides, "padding": padding} + opspec := tf.OpSpec{ + Type: "FusedPadConv2D", + Input: []tf.Input{ + input, paddings, filter, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// TopKV2Attr is an optional argument to TopKV2. +type TopKV2Attr func(optionalAttr) + +// TopKV2Sorted sets the optional sorted attribute to value. +// +// value: If true the resulting `k` elements will be sorted by the values in +// descending order. +// If not specified, defaults to true +func TopKV2Sorted(value bool) TopKV2Attr { + return func(m optionalAttr) { + m["sorted"] = value + } +} + +// TopKV2IndexType sets the optional index_type attribute to value. +// If not specified, defaults to DT_INT32 +func TopKV2IndexType(value tf.DataType) TopKV2Attr { + return func(m optionalAttr) { + m["index_type"] = value + } +} + +// Finds values and indices of the `k` largest elements for the last dimension. +// +// If the input is a vector (rank-1), finds the `k` largest entries in the vector +// and outputs their values and indices as vectors. Thus `values[j]` is the +// `j`-th largest entry in `input`, and its index is `indices[j]`. +// +// For matrices (resp. higher rank input), computes the top `k` entries in each +// row (resp. vector along the last dimension). Thus, +// +// values.shape = indices.shape = input.shape[:-1] + [k] +// +// If two elements are equal, the lower-index element appears first. +// +// Arguments: +// +// input: 1-D or higher with last dimension at least `k`. +// k: 0-D. Number of top elements to look for along the last dimension (along each +// +// row for matrices). +// +// Returns: +// +// values: The `k` largest elements along each last dimensional slice. +// indices: The indices of `values` within the last dimension of `input`. +func TopKV2(scope *Scope, input tf.Output, k tf.Output, optional ...TopKV2Attr) (values tf.Output, indices tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "TopKV2", + Input: []tf.Input{ + input, k, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// TensorListConcatAttr is an optional argument to TensorListConcat. +type TensorListConcatAttr func(optionalAttr) + +// TensorListConcatElementShape sets the optional element_shape attribute to value. +// If not specified, defaults to +func TensorListConcatElementShape(value tf.Shape) TensorListConcatAttr { + return func(m optionalAttr) { + m["element_shape"] = value + } +} + +// Concats all tensors in the list along the 0th dimension. +// +// Requires that all tensors have the same shape except the first dimension. +// +// input_handle: The input list. +// tensor: The concated result. +// lengths: Output tensor containing sizes of the 0th dimension of tensors in the list, used for computing the gradient. +func TensorListConcat(scope *Scope, input_handle tf.Output, element_dtype tf.DataType, optional ...TensorListConcatAttr) (tensor tf.Output, lengths tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"element_dtype": element_dtype} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "TensorListConcat", + Input: []tf.Input{ + input_handle, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// A container for a multi device iterator resource. +// +// Returns: +// +// handle: A handle to a multi device iterator that can be passed to a +// +// "MultiDeviceIteratorGetNextFromShard" op. In contrast to MultiDeviceIterator, +// AnonymousIterator prevents resource sharing by name, and does not keep a +// reference to the resource container. +// +// deleter: A variant deleter that should be passed into the op that deletes the iterator. +func AnonymousMultiDeviceIterator(scope *Scope, devices []string, output_types []tf.DataType, output_shapes []tf.Shape) (handle tf.Output, deleter tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"devices": devices, "output_types": output_types, "output_shapes": output_shapes} + opspec := tf.OpSpec{ + Type: "AnonymousMultiDeviceIterator", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// Computes the reciprocal of x element-wise. +// +// I.e., \\(y = 1 / x\\). +func Inv(scope *Scope, x tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Inv", + Input: []tf.Input{ + x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// SetSizeAttr is an optional argument to SetSize. +type SetSizeAttr func(optionalAttr) + +// SetSizeValidateIndices sets the optional validate_indices attribute to value. +// If not specified, defaults to true +func SetSizeValidateIndices(value bool) SetSizeAttr { + return func(m optionalAttr) { + m["validate_indices"] = value + } +} + +// Number of unique elements along last dimension of input `set`. +// +// Input `set` is a `SparseTensor` represented by `set_indices`, `set_values`, +// and `set_shape`. The last dimension contains values in a set, duplicates are +// allowed but ignored. +// +// If `validate_indices` is `True`, this op validates the order and range of `set` +// indices. +// +// Arguments: +// +// set_indices: 2D `Tensor`, indices of a `SparseTensor`. +// set_values: 1D `Tensor`, values of a `SparseTensor`. +// set_shape: 1D `Tensor`, shape of a `SparseTensor`. +// +// Returns For `set` ranked `n`, this is a `Tensor` with rank `n-1`, and the same 1st +// `n-1` dimensions as `set`. Each value is the number of unique elements in +// the corresponding `[0...n-1]` dimension of `set`. +func SetSize(scope *Scope, set_indices tf.Output, set_values tf.Output, set_shape tf.Output, optional ...SetSizeAttr) (size tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "SetSize", + Input: []tf.Input{ + set_indices, set_values, set_shape, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// SerializeSparseAttr is an optional argument to SerializeSparse. +type SerializeSparseAttr func(optionalAttr) + +// SerializeSparseOutType sets the optional out_type attribute to value. +// +// value: The `dtype` to use for serialization; the supported types are `string` +// (default) and `variant`. +// If not specified, defaults to DT_STRING +func SerializeSparseOutType(value tf.DataType) SerializeSparseAttr { + return func(m optionalAttr) { + m["out_type"] = value + } +} + +// Serialize a `SparseTensor` into a `[3]` `Tensor` object. +// +// Arguments: +// +// sparse_indices: 2-D. The `indices` of the `SparseTensor`. +// sparse_values: 1-D. The `values` of the `SparseTensor`. +// sparse_shape: 1-D. The `shape` of the `SparseTensor`. +func SerializeSparse(scope *Scope, sparse_indices tf.Output, sparse_values tf.Output, sparse_shape tf.Output, optional ...SerializeSparseAttr) (serialized_sparse tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "SerializeSparse", + Input: []tf.Input{ + sparse_indices, sparse_values, sparse_shape, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Conv2DBackpropFilterAttr is an optional argument to Conv2DBackpropFilter. +type Conv2DBackpropFilterAttr func(optionalAttr) + +// Conv2DBackpropFilterUseCudnnOnGpu sets the optional use_cudnn_on_gpu attribute to value. +// If not specified, defaults to true +func Conv2DBackpropFilterUseCudnnOnGpu(value bool) Conv2DBackpropFilterAttr { + return func(m optionalAttr) { + m["use_cudnn_on_gpu"] = value + } +} + +// Conv2DBackpropFilterExplicitPaddings sets the optional explicit_paddings attribute to value. +// +// value: If `padding` is `"EXPLICIT"`, the list of explicit padding amounts. For the ith +// dimension, the amount of padding inserted before and after the dimension is +// `explicit_paddings[2 * i]` and `explicit_paddings[2 * i + 1]`, respectively. If +// `padding` is not `"EXPLICIT"`, `explicit_paddings` must be empty. +// If not specified, defaults to <> +func Conv2DBackpropFilterExplicitPaddings(value []int64) Conv2DBackpropFilterAttr { + return func(m optionalAttr) { + m["explicit_paddings"] = value + } +} + +// Conv2DBackpropFilterDataFormat sets the optional data_format attribute to value. +// +// value: Specify the data format of the input and output data. With the +// default format "NHWC", the data is stored in the order of: +// +// [batch, in_height, in_width, in_channels]. +// +// Alternatively, the format could be "NCHW", the data storage order of: +// +// [batch, in_channels, in_height, in_width]. +// +// If not specified, defaults to "NHWC" +func Conv2DBackpropFilterDataFormat(value string) Conv2DBackpropFilterAttr { + return func(m optionalAttr) { + m["data_format"] = value + } +} + +// Conv2DBackpropFilterDilations sets the optional dilations attribute to value. +// +// value: 1-D tensor of length 4. The dilation factor for each dimension of +// `input`. If set to k > 1, there will be k-1 skipped cells between each filter +// element on that dimension. The dimension order is determined by the value of +// `data_format`, see above for details. Dilations in the batch and depth +// dimensions must be 1. +// If not specified, defaults to +func Conv2DBackpropFilterDilations(value []int64) Conv2DBackpropFilterAttr { + return func(m optionalAttr) { + m["dilations"] = value + } +} + +// Computes the gradients of convolution with respect to the filter. +// +// Arguments: +// +// input: 4-D with shape `[batch, in_height, in_width, in_channels]`. +// filter_sizes: An integer vector representing the tensor shape of `filter`, +// +// where `filter` is a 4-D +// `[filter_height, filter_width, in_channels, out_channels]` tensor. +// +// out_backprop: 4-D with shape `[batch, out_height, out_width, out_channels]`. +// +// Gradients w.r.t. the output of the convolution. +// +// strides: The stride of the sliding window for each dimension of the input +// +// of the convolution. Must be in the same order as the dimension specified with +// format. +// +// padding: The type of padding algorithm to use. +// +// Returns 4-D with shape +// `[filter_height, filter_width, in_channels, out_channels]`. Gradient w.r.t. +// the `filter` input of the convolution. +func Conv2DBackpropFilter(scope *Scope, input tf.Output, filter_sizes tf.Output, out_backprop tf.Output, strides []int64, padding string, optional ...Conv2DBackpropFilterAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"strides": strides, "padding": padding} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Conv2DBackpropFilter", + Input: []tf.Input{ + input, filter_sizes, out_backprop, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// BlockLSTMAttr is an optional argument to BlockLSTM. +type BlockLSTMAttr func(optionalAttr) + +// BlockLSTMForgetBias sets the optional forget_bias attribute to value. +// +// value: The forget gate bias. +// If not specified, defaults to 1 +func BlockLSTMForgetBias(value float32) BlockLSTMAttr { + return func(m optionalAttr) { + m["forget_bias"] = value + } +} + +// BlockLSTMCellClip sets the optional cell_clip attribute to value. +// +// value: Value to clip the 'cs' value to. +// If not specified, defaults to 3 +func BlockLSTMCellClip(value float32) BlockLSTMAttr { + return func(m optionalAttr) { + m["cell_clip"] = value + } +} + +// BlockLSTMUsePeephole sets the optional use_peephole attribute to value. +// +// value: Whether to use peephole weights. +// If not specified, defaults to false +func BlockLSTMUsePeephole(value bool) BlockLSTMAttr { + return func(m optionalAttr) { + m["use_peephole"] = value + } +} + +// Computes the LSTM cell forward propagation for all the time steps. +// +// This is equivalent to applying LSTMBlockCell in a loop, like so: +// +// ```python +// for x1 in unpack(x): +// +// i1, cs1, f1, o1, ci1, co1, h1 = LSTMBlock( +// x1, cs_prev, h_prev, w, wci, wcf, wco, b) +// cs_prev = cs1 +// h_prev = h1 +// i.append(i1) +// cs.append(cs1) +// f.append(f1) +// o.append(o1) +// ci.append(ci1) +// co.append(co1) +// h.append(h1) +// +// return pack(i), pack(cs), pack(f), pack(o), pack(ci), pack(ch), pack(h) +// ``` +// +// Arguments: +// +// seq_len_max: Maximum time length actually used by this input. Outputs are padded +// +// with zeros beyond this length. +// +// x: The sequence input to the LSTM, shape (timelen, batch_size, num_inputs). +// cs_prev: Value of the initial cell state. +// h_prev: Initial output of cell (to be used for peephole). +// w: The weight matrix. +// wci: The weight matrix for input gate peephole connection. +// wcf: The weight matrix for forget gate peephole connection. +// wco: The weight matrix for output gate peephole connection. +// b: The bias vector. +// +// Returns: +// +// i: The input gate over the whole time sequence. +// cs: The cell state before the tanh over the whole time sequence. +// f: The forget gate over the whole time sequence. +// o: The output gate over the whole time sequence. +// ci: The cell input over the whole time sequence. +// co: The cell after the tanh over the whole time sequence. +// h: The output h vector over the whole time sequence. +func BlockLSTM(scope *Scope, seq_len_max tf.Output, x tf.Output, cs_prev tf.Output, h_prev tf.Output, w tf.Output, wci tf.Output, wcf tf.Output, wco tf.Output, b tf.Output, optional ...BlockLSTMAttr) (i tf.Output, cs tf.Output, f tf.Output, o tf.Output, ci tf.Output, co tf.Output, h tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "BlockLSTM", + Input: []tf.Input{ + seq_len_max, x, cs_prev, h_prev, w, wci, wcf, wco, b, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2), op.Output(3), op.Output(4), op.Output(5), op.Output(6) +} + +// A placeholder op that passes through `input` when its output is not fed. +// +// Arguments: +// +// input: The default value to produce when `output` is not fed. +// shape: The (possibly partial) shape of the tensor. +// +// Returns A placeholder tensor that defaults to `input` if it is not fed. +func PlaceholderWithDefault(scope *Scope, input tf.Output, shape tf.Shape) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"shape": shape} + opspec := tf.OpSpec{ + Type: "PlaceholderWithDefault", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ScatterNdNonAliasingAddAttr is an optional argument to ScatterNdNonAliasingAdd. +type ScatterNdNonAliasingAddAttr func(optionalAttr) + +// ScatterNdNonAliasingAddBadIndicesPolicy sets the optional bad_indices_policy attribute to value. +// If not specified, defaults to "" +func ScatterNdNonAliasingAddBadIndicesPolicy(value string) ScatterNdNonAliasingAddAttr { + return func(m optionalAttr) { + m["bad_indices_policy"] = value + } +} + +// Applies sparse addition to `input` using individual values or slices +// +// from `updates` according to indices `indices`. The updates are non-aliasing: +// `input` is only modified in-place if no other operations will use it. +// Otherwise, a copy of `input` is made. This operation has a gradient with +// respect to both `input` and `updates`. +// +// `input` is a `Tensor` with rank `P` and `indices` is a `Tensor` of rank `Q`. +// +// `indices` must be integer tensor, containing indices into `input`. +// It must be shape \\([d_0, ..., d_{Q-2}, K]\\) where `0 < K <= P`. +// +// The innermost dimension of `indices` (with length `K`) corresponds to +// indices into elements (if `K = P`) or `(P-K)`-dimensional slices +// (if `K < P`) along the `K`th dimension of `input`. +// +// `updates` is `Tensor` of rank `Q-1+P-K` with shape: +// +// $$[d_0, ..., d_{Q-2}, input.shape[K], ..., input.shape[P-1]].$$ +// +// For example, say we want to add 4 scattered elements to a rank-1 tensor to 8 +// elements. In Python, that addition would look like this: +// +// input = tf.constant([1, 2, 3, 4, 5, 6, 7, 8]) +// indices = tf.constant([[4], [3], [1], [7]]) +// updates = tf.constant([9, 10, 11, 12]) +// output = tf.scatter_nd_non_aliasing_add(input, indices, updates) +// with tf.Session() as sess: +// print(sess.run(output)) +// +// The resulting value `output` would look like this: +// +// [1, 13, 3, 14, 14, 6, 7, 20] +// +// See `tf.scatter_nd` for more details about how to make updates to slices. +// +// Arguments: +// +// input: A Tensor. +// indices: A Tensor. Must be one of the following types: `int32`, `int64`. +// +// A tensor of indices into `input`. +// +// updates: A Tensor. Must have the same type as ref. A tensor of updated values +// +// to add to `input`. +// +// Returns A `Tensor` with the same shape as `input`, containing values of `input` +// updated with `updates`. +func ScatterNdNonAliasingAdd(scope *Scope, input tf.Output, indices tf.Output, updates tf.Output, optional ...ScatterNdNonAliasingAddAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ScatterNdNonAliasingAdd", + Input: []tf.Input{ + input, indices, updates, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Draw bounding boxes on a batch of images. +// +// Outputs a copy of `images` but draws on top of the pixels zero or more bounding +// boxes specified by the locations in `boxes`. The coordinates of the each +// bounding box in `boxes` are encoded as `[y_min, x_min, y_max, x_max]`. The +// bounding box coordinates are floats in `[0.0, 1.0]` relative to the width and +// height of the underlying image. +// +// For example, if an image is 100 x 200 pixels (height x width) and the bounding +// box is `[0.1, 0.2, 0.5, 0.9]`, the upper-left and bottom-right coordinates of +// the bounding box will be `(40, 10)` to `(180, 50)` (in (x,y) coordinates). +// +// Parts of the bounding box may fall outside the image. +// +// Arguments: +// +// images: 4-D with shape `[batch, height, width, depth]`. A batch of images. +// boxes: 3-D with shape `[batch, num_bounding_boxes, 4]` containing bounding +// +// boxes. +// +// Returns 4-D with the same shape as `images`. The batch of input images with +// bounding boxes drawn on the images. +func DrawBoundingBoxes(scope *Scope, images tf.Output, boxes tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "DrawBoundingBoxes", + Input: []tf.Input{ + images, boxes, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Adds up a SparseTensor and a dense Tensor, using these special rules: +// +// (1) Broadcasts the dense side to have the same shape as the sparse side, if +// +// eligible; +// +// (2) Then, only the dense values pointed to by the indices of the SparseTensor +// +// participate in the cwise addition. +// +// By these rules, the result is a logical SparseTensor with exactly the same +// indices and shape, but possibly with different non-zero values. The output of +// this Op is the resultant non-zero values. +// +// Arguments: +// +// sp_indices: 2-D. `N x R` matrix with the indices of non-empty values in a +// +// SparseTensor, possibly not in canonical ordering. +// +// sp_values: 1-D. `N` non-empty values corresponding to `sp_indices`. +// sp_shape: 1-D. Shape of the input SparseTensor. +// dense: `R`-D. The dense Tensor operand. +// +// Returns 1-D. The `N` values that are operated on. +func SparseDenseCwiseAdd(scope *Scope, sp_indices tf.Output, sp_values tf.Output, sp_shape tf.Output, dense tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "SparseDenseCwiseAdd", + Input: []tf.Input{ + sp_indices, sp_values, sp_shape, dense, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Assigns sparse updates to the variable referenced by `resource`. +// +// This operation computes +// +// # Scalar indices +// ref[indices, ...] = updates[...] +// +// # Vector indices (for each i) +// ref[indices[i], ...] = updates[i, ...] +// +// # High rank indices (for each i, ..., j) +// ref[indices[i, ..., j], ...] = updates[i, ..., j, ...] +// +// Arguments: +// +// resource: Should be from a `Variable` node. +// indices: A tensor of indices into the first dimension of `ref`. +// updates: A tensor of updated values to add to `ref`. +// +// Returns the created operation. +func ResourceScatterUpdate(scope *Scope, resource tf.Output, indices tf.Output, updates tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "ResourceScatterUpdate", + Input: []tf.Input{ + resource, indices, updates, + }, + } + return scope.AddOperation(opspec) +} + +// RetrieveTPUEmbeddingADAMParametersAttr is an optional argument to RetrieveTPUEmbeddingADAMParameters. +type RetrieveTPUEmbeddingADAMParametersAttr func(optionalAttr) + +// RetrieveTPUEmbeddingADAMParametersTableId sets the optional table_id attribute to value. +// If not specified, defaults to -1 +func RetrieveTPUEmbeddingADAMParametersTableId(value int64) RetrieveTPUEmbeddingADAMParametersAttr { + return func(m optionalAttr) { + m["table_id"] = value + } +} + +// RetrieveTPUEmbeddingADAMParametersTableName sets the optional table_name attribute to value. +// If not specified, defaults to "" +func RetrieveTPUEmbeddingADAMParametersTableName(value string) RetrieveTPUEmbeddingADAMParametersAttr { + return func(m optionalAttr) { + m["table_name"] = value + } +} + +// RetrieveTPUEmbeddingADAMParametersConfig sets the optional config attribute to value. +// If not specified, defaults to "" +func RetrieveTPUEmbeddingADAMParametersConfig(value string) RetrieveTPUEmbeddingADAMParametersAttr { + return func(m optionalAttr) { + m["config"] = value + } +} + +// Retrieve ADAM embedding parameters. +// +// An op that retrieves optimization parameters from embedding to host +// memory. Must be preceded by a ConfigureTPUEmbeddingHost op that sets up +// the correct embedding table configuration. For example, this op is +// used to retrieve updated parameters before saving a checkpoint. +// +// Returns: +// +// parameters: Parameter parameters updated by the ADAM optimization algorithm. +// momenta: Parameter momenta updated by the ADAM optimization algorithm. +// velocities: Parameter velocities updated by the ADAM optimization algorithm. +func RetrieveTPUEmbeddingADAMParameters(scope *Scope, num_shards int64, shard_id int64, optional ...RetrieveTPUEmbeddingADAMParametersAttr) (parameters tf.Output, momenta tf.Output, velocities tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_shards": num_shards, "shard_id": shard_id} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "RetrieveTPUEmbeddingADAMParameters", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// PrintV2Attr is an optional argument to PrintV2. +type PrintV2Attr func(optionalAttr) + +// PrintV2OutputStream sets the optional output_stream attribute to value. +// +// value: A string specifying the output stream or logging level to print to. +// If not specified, defaults to "stderr" +func PrintV2OutputStream(value string) PrintV2Attr { + return func(m optionalAttr) { + m["output_stream"] = value + } +} + +// PrintV2End sets the optional end attribute to value. +// If not specified, defaults to "\n" +func PrintV2End(value string) PrintV2Attr { + return func(m optionalAttr) { + m["end"] = value + } +} + +// Prints a string scalar. +// +// Prints a string scalar to the desired output_stream. +// +// Arguments: +// +// input: The string scalar to print. +// +// Returns the created operation. +func PrintV2(scope *Scope, input tf.Output, optional ...PrintV2Attr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "PrintV2", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// Computes the log of the absolute value of `Gamma(x)` element-wise. +// +// For positive numbers, this function computes log((input - 1)!) for every element in the tensor. +// `lgamma(5) = log((5-1)!) = log(4!) = log(24) = 3.1780539` +// +// Example: +// +// ```python +// x = tf.constant([0, 0.5, 1, 4.5, -4, -5.6]) +// tf.math.lgamma(x) ==> [inf, 0.5723649, 0., 2.4537368, inf, -4.6477685] +// ``` +func Lgamma(scope *Scope, x tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Lgamma", + Input: []tf.Input{ + x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// TFRecordDatasetAttr is an optional argument to TFRecordDataset. +type TFRecordDatasetAttr func(optionalAttr) + +// TFRecordDatasetMetadata sets the optional metadata attribute to value. +// If not specified, defaults to "" +func TFRecordDatasetMetadata(value string) TFRecordDatasetAttr { + return func(m optionalAttr) { + m["metadata"] = value + } +} + +// Creates a dataset that emits the records from one or more TFRecord files. +// +// Arguments: +// +// filenames: A scalar or vector containing the name(s) of the file(s) to be +// +// read. +// +// compression_type: A scalar containing either (i) the empty string (no +// +// compression), (ii) "ZLIB", or (iii) "GZIP". +// +// buffer_size: A scalar representing the number of bytes to buffer. A value of +// +// 0 means no buffering will be performed. +func TFRecordDataset(scope *Scope, filenames tf.Output, compression_type tf.Output, buffer_size tf.Output, optional ...TFRecordDatasetAttr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "TFRecordDataset", + Input: []tf.Input{ + filenames, compression_type, buffer_size, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Adjust the contrast of one or more images. +// +// `images` is a tensor of at least 3 dimensions. The last 3 dimensions are +// interpreted as `[height, width, channels]`. The other dimensions only +// represent a collection of images, such as `[batch, height, width, channels].` +// +// Contrast is adjusted independently for each channel of each image. +// +// For each channel, the Op first computes the mean of the image pixels in the +// channel and then adjusts each component of each pixel to +// `(x - mean) * contrast_factor + mean`. +// +// Arguments: +// +// images: Images to adjust. At least 3-D. +// contrast_factor: A float multiplier for adjusting contrast. +// +// Returns The contrast-adjusted image or images. +func AdjustContrastv2(scope *Scope, images tf.Output, contrast_factor tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "AdjustContrastv2", + Input: []tf.Input{ + images, contrast_factor, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns 0 if the denominator is zero. +// +// *NOTE*: `DivNoNan` supports broadcasting. More about broadcasting +// [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) +func DivNoNan(scope *Scope, x tf.Output, y tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "DivNoNan", + Input: []tf.Input{ + x, y, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Forwards the input to the output. +// +// This operator represents the loop termination condition used by the +// "pivot" switches of a loop. +// +// Arguments: +// +// input: A boolean scalar, representing the branch predicate of the Switch op. +// +// Returns The same tensor as `input`. +func LoopCond(scope *Scope, input tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "LoopCond", + Input: []tf.Input{ + input, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns the number of nonzeroes of `sparse_matrix`. +// +// Arguments: +// +// sparse_matrix: A CSRSparseMatrix. +// +// Returns The number of nonzeroes of `sparse_matrix`. +func SparseMatrixNNZ(scope *Scope, sparse_matrix tf.Output) (nnz tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "SparseMatrixNNZ", + Input: []tf.Input{ + sparse_matrix, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// AsStringAttr is an optional argument to AsString. +type AsStringAttr func(optionalAttr) + +// AsStringPrecision sets the optional precision attribute to value. +// +// value: The post-decimal precision to use for floating point numbers. +// Only used if precision > -1. +// If not specified, defaults to -1 +func AsStringPrecision(value int64) AsStringAttr { + return func(m optionalAttr) { + m["precision"] = value + } +} + +// AsStringScientific sets the optional scientific attribute to value. +// +// value: Use scientific notation for floating point numbers. +// If not specified, defaults to false +func AsStringScientific(value bool) AsStringAttr { + return func(m optionalAttr) { + m["scientific"] = value + } +} + +// AsStringShortest sets the optional shortest attribute to value. +// +// value: Use shortest representation (either scientific or standard) for +// floating point numbers. +// If not specified, defaults to false +func AsStringShortest(value bool) AsStringAttr { + return func(m optionalAttr) { + m["shortest"] = value + } +} + +// AsStringWidth sets the optional width attribute to value. +// +// value: Pad pre-decimal numbers to this width. +// Applies to both floating point and integer numbers. +// Only used if width > -1. +// If not specified, defaults to -1 +func AsStringWidth(value int64) AsStringAttr { + return func(m optionalAttr) { + m["width"] = value + } +} + +// AsStringFill sets the optional fill attribute to value. +// +// value: The value to pad if width > -1. If empty, pads with spaces. +// Another typical value is '0'. String cannot be longer than 1 character. +// If not specified, defaults to "" +func AsStringFill(value string) AsStringAttr { + return func(m optionalAttr) { + m["fill"] = value + } +} + +// Converts each entry in the given tensor to strings. +// +// Supports many numeric types and boolean. +// +// For Unicode, see the +// [https://www.tensorflow.org/tutorials/representation/unicode](Working with Unicode text) +// tutorial. +// +// Examples: +// +// >>> tf.strings.as_string([3, 2]) +// +// >>> tf.strings.as_string([3.1415926, 2.71828], precision=2).numpy() +// array([b'3.14', b'2.72'], dtype=object) +func AsString(scope *Scope, input tf.Output, optional ...AsStringAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "AsString", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ExtractJpegShapeAttr is an optional argument to ExtractJpegShape. +type ExtractJpegShapeAttr func(optionalAttr) + +// ExtractJpegShapeOutputType sets the optional output_type attribute to value. +// +// value: (Optional) The output type of the operation (int32 or int64). +// Defaults to int32. +// If not specified, defaults to DT_INT32 +func ExtractJpegShapeOutputType(value tf.DataType) ExtractJpegShapeAttr { + return func(m optionalAttr) { + m["output_type"] = value + } +} + +// Extract the shape information of a JPEG-encoded image. +// +// This op only parses the image header, so it is much faster than DecodeJpeg. +// +// Arguments: +// +// contents: 0-D. The JPEG-encoded image. +// +// Returns 1-D. The image shape with format [height, width, channels]. +func ExtractJpegShape(scope *Scope, contents tf.Output, optional ...ExtractJpegShapeAttr) (image_shape tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ExtractJpegShape", + Input: []tf.Input{ + contents, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// MultinomialAttr is an optional argument to Multinomial. +type MultinomialAttr func(optionalAttr) + +// MultinomialSeed sets the optional seed attribute to value. +// +// value: If either seed or seed2 is set to be non-zero, the internal random number +// generator is seeded by the given seed. Otherwise, a random seed is used. +// If not specified, defaults to 0 +func MultinomialSeed(value int64) MultinomialAttr { + return func(m optionalAttr) { + m["seed"] = value + } +} + +// MultinomialSeed2 sets the optional seed2 attribute to value. +// +// value: A second seed to avoid seed collision. +// If not specified, defaults to 0 +func MultinomialSeed2(value int64) MultinomialAttr { + return func(m optionalAttr) { + m["seed2"] = value + } +} + +// MultinomialOutputDtype sets the optional output_dtype attribute to value. +// If not specified, defaults to DT_INT64 +func MultinomialOutputDtype(value tf.DataType) MultinomialAttr { + return func(m optionalAttr) { + m["output_dtype"] = value + } +} + +// Draws samples from a multinomial distribution. +// +// Arguments: +// +// logits: 2-D Tensor with shape `[batch_size, num_classes]`. Each slice `[i, :]` +// +// represents the unnormalized log probabilities for all classes. +// +// num_samples: 0-D. Number of independent samples to draw for each row slice. +// +// Returns 2-D Tensor with shape `[batch_size, num_samples]`. Each slice `[i, :]` +// contains the drawn class labels with range `[0, num_classes)`. +func Multinomial(scope *Scope, logits tf.Output, num_samples tf.Output, optional ...MultinomialAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Multinomial", + Input: []tf.Input{ + logits, num_samples, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// CollectiveGatherAttr is an optional argument to CollectiveGather. +type CollectiveGatherAttr func(optionalAttr) + +// CollectiveGatherCommunicationHint sets the optional communication_hint attribute to value. +// If not specified, defaults to "auto" +func CollectiveGatherCommunicationHint(value string) CollectiveGatherAttr { + return func(m optionalAttr) { + m["communication_hint"] = value + } +} + +// CollectiveGatherTimeoutSeconds sets the optional timeout_seconds attribute to value. +// If not specified, defaults to 0 +func CollectiveGatherTimeoutSeconds(value float32) CollectiveGatherAttr { + return func(m optionalAttr) { + m["timeout_seconds"] = value + } +} + +// Mutually accumulates multiple tensors of identical type and shape. +func CollectiveGather(scope *Scope, input tf.Output, group_size int64, group_key int64, instance_key int64, shape tf.Shape, optional ...CollectiveGatherAttr) (data tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"group_size": group_size, "group_key": group_key, "instance_key": instance_key, "shape": shape} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "CollectiveGather", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// StaticRegexReplaceAttr is an optional argument to StaticRegexReplace. +type StaticRegexReplaceAttr func(optionalAttr) + +// StaticRegexReplaceReplaceGlobal sets the optional replace_global attribute to value. +// +// value: If True, the replacement is global, otherwise the replacement +// is done only on the first match. +// If not specified, defaults to true +func StaticRegexReplaceReplaceGlobal(value bool) StaticRegexReplaceAttr { + return func(m optionalAttr) { + m["replace_global"] = value + } +} + +// Replaces the match of pattern in input with rewrite. +// +// It follows the re2 syntax (https://github.com/google/re2/wiki/Syntax) +// +// Arguments: +// +// input: The text to be processed. +// pattern: The regular expression to match the input. +// rewrite: The rewrite to be applied to the matched expression. +// +// Returns The text after applying pattern and rewrite. +func StaticRegexReplace(scope *Scope, input tf.Output, pattern string, rewrite string, optional ...StaticRegexReplaceAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"pattern": pattern, "rewrite": rewrite} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "StaticRegexReplace", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// SpaceToDepthAttr is an optional argument to SpaceToDepth. +type SpaceToDepthAttr func(optionalAttr) + +// SpaceToDepthDataFormat sets the optional data_format attribute to value. +// If not specified, defaults to "NHWC" +func SpaceToDepthDataFormat(value string) SpaceToDepthAttr { + return func(m optionalAttr) { + m["data_format"] = value + } +} + +// SpaceToDepth for tensors of type T. +// +// Rearranges blocks of spatial data, into depth. More specifically, +// this op outputs a copy of the input tensor where values from the `height` +// and `width` dimensions are moved to the `depth` dimension. +// The attr `block_size` indicates the input block size. +// +// - Non-overlapping blocks of size `block_size x block size` are rearranged +// into depth at each location. +// - The depth of the output tensor is `block_size * block_size * input_depth`. +// - The Y, X coordinates within each block of the input become the high order +// component of the output channel index. +// - The input tensor's height and width must be divisible by block_size. +// +// The `data_format` attr specifies the layout of the input and output tensors +// with the following options: +// +// "NHWC": `[ batch, height, width, channels ]` +// "NCHW": `[ batch, channels, height, width ]` +// "NCHW_VECT_C": +// `qint8 [ batch, channels / 4, height, width, 4 ]` +// +// It is useful to consider the operation as transforming a 6-D Tensor. +// e.g. for data_format = NHWC, +// +// Each element in the input tensor can be specified via 6 coordinates, +// ordered by decreasing memory layout significance as: +// n,oY,bY,oX,bX,iC (where n=batch index, oX, oY means X or Y coordinates +// within the output image, bX, bY means coordinates +// within the input block, iC means input channels). +// The output would be a transpose to the following layout: +// n,oY,oX,bY,bX,iC +// +// This operation is useful for resizing the activations between convolutions +// (but keeping all data), e.g. instead of pooling. It is also useful for training +// purely convolutional models. +// +// For example, given an input of shape `[1, 2, 2, 1]`, data_format = "NHWC" and +// block_size = 2: +// +// ``` +// x = [[[[1], [2]], +// +// [[3], [4]]]] +// +// ``` +// +// This operation will output a tensor of shape `[1, 1, 1, 4]`: +// +// ``` +// [[[[1, 2, 3, 4]]]] +// ``` +// +// Here, the input has a batch of 1 and each batch element has shape `[2, 2, 1]`, +// the corresponding output will have a single element (i.e. width and height are +// both 1) and will have a depth of 4 channels (1 * block_size * block_size). +// The output element shape is `[1, 1, 4]`. +// +// For an input tensor with larger depth, here of shape `[1, 2, 2, 3]`, e.g. +// +// ``` +// x = [[[[1, 2, 3], [4, 5, 6]], +// +// [[7, 8, 9], [10, 11, 12]]]] +// +// ``` +// +// This operation, for block_size of 2, will return the following tensor of shape +// `[1, 1, 1, 12]` +// +// ``` +// [[[[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]]]] +// ``` +// +// Similarly, for the following input of shape `[1 4 4 1]`, and a block size of 2: +// +// ``` +// x = [[[[1], [2], [5], [6]], +// +// [[3], [4], [7], [8]], +// [[9], [10], [13], [14]], +// [[11], [12], [15], [16]]]] +// +// ``` +// +// the operator will return the following tensor of shape `[1 2 2 4]`: +// +// ``` +// x = [[[[1, 2, 3, 4], +// +// [5, 6, 7, 8]], +// [[9, 10, 11, 12], +// [13, 14, 15, 16]]]] +// +// ``` +// +// Arguments: +// +// block_size: The size of the spatial block. +func SpaceToDepth(scope *Scope, input tf.Output, block_size int64, optional ...SpaceToDepthAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"block_size": block_size} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "SpaceToDepth", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// A dataset that splits the elements of its input into multiple elements. +func ExperimentalUnbatchDataset(scope *Scope, input_dataset tf.Output, output_types []tf.DataType, output_shapes []tf.Shape) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + opspec := tf.OpSpec{ + Type: "ExperimentalUnbatchDataset", + Input: []tf.Input{ + input_dataset, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Delete the stack from its resource container. +// +// Arguments: +// +// handle: The handle to a stack. +// +// Returns the created operation. +func StackCloseV2(scope *Scope, handle tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "StackCloseV2", + Input: []tf.Input{ + handle, + }, + } + return scope.AddOperation(opspec) +} + +// Creates a TensorList by indexing into a Tensor. +// +// Each member of the TensorList corresponds to one row of the input tensor, +// specified by the given index (see `tf.gather`). +// +// tensor: The input tensor. +// indices: The indices used to index into the list. +// element_shape: The shape of the elements in the list (can be less specified than +// +// the shape of the tensor). +// +// num_elements: The size of the output list. Must be large enough to accommodate +// +// the largest index in indices. If -1, the list is just large enough to include +// the largest index in indices. +// +// output_handle: The TensorList. +func TensorListScatterV2(scope *Scope, tensor tf.Output, indices tf.Output, element_shape tf.Output, num_elements tf.Output) (output_handle tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "TensorListScatterV2", + Input: []tf.Input{ + tensor, indices, element_shape, num_elements, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// The shape of the elements of the given list, as a tensor. +// +// input_handle: the list +// element_shape: the shape of elements of the list +func TensorListElementShape(scope *Scope, input_handle tf.Output, shape_type tf.DataType) (element_shape tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"shape_type": shape_type} + opspec := tf.OpSpec{ + Type: "TensorListElementShape", + Input: []tf.Input{ + input_handle, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// SampleDistortedBoundingBoxAttr is an optional argument to SampleDistortedBoundingBox. +type SampleDistortedBoundingBoxAttr func(optionalAttr) + +// SampleDistortedBoundingBoxSeed sets the optional seed attribute to value. +// +// value: If either `seed` or `seed2` are set to non-zero, the random number +// generator is seeded by the given `seed`. Otherwise, it is seeded by a random +// seed. +// If not specified, defaults to 0 +func SampleDistortedBoundingBoxSeed(value int64) SampleDistortedBoundingBoxAttr { + return func(m optionalAttr) { + m["seed"] = value + } +} + +// SampleDistortedBoundingBoxSeed2 sets the optional seed2 attribute to value. +// +// value: A second seed to avoid seed collision. +// If not specified, defaults to 0 +func SampleDistortedBoundingBoxSeed2(value int64) SampleDistortedBoundingBoxAttr { + return func(m optionalAttr) { + m["seed2"] = value + } +} + +// SampleDistortedBoundingBoxMinObjectCovered sets the optional min_object_covered attribute to value. +// +// value: The cropped area of the image must contain at least this +// fraction of any bounding box supplied. The value of this parameter should be +// non-negative. In the case of 0, the cropped area does not need to overlap +// any of the bounding boxes supplied. +// If not specified, defaults to 0.1 +func SampleDistortedBoundingBoxMinObjectCovered(value float32) SampleDistortedBoundingBoxAttr { + return func(m optionalAttr) { + m["min_object_covered"] = value + } +} + +// SampleDistortedBoundingBoxAspectRatioRange sets the optional aspect_ratio_range attribute to value. +// +// value: The cropped area of the image must have an aspect ratio = +// width / height within this range. +// If not specified, defaults to +func SampleDistortedBoundingBoxAspectRatioRange(value []float32) SampleDistortedBoundingBoxAttr { + return func(m optionalAttr) { + m["aspect_ratio_range"] = value + } +} + +// SampleDistortedBoundingBoxAreaRange sets the optional area_range attribute to value. +// +// value: The cropped area of the image must contain a fraction of the +// supplied image within this range. +// If not specified, defaults to +func SampleDistortedBoundingBoxAreaRange(value []float32) SampleDistortedBoundingBoxAttr { + return func(m optionalAttr) { + m["area_range"] = value + } +} + +// SampleDistortedBoundingBoxMaxAttempts sets the optional max_attempts attribute to value. +// +// value: Number of attempts at generating a cropped region of the image +// of the specified constraints. After `max_attempts` failures, return the entire +// image. +// If not specified, defaults to 100 +func SampleDistortedBoundingBoxMaxAttempts(value int64) SampleDistortedBoundingBoxAttr { + return func(m optionalAttr) { + m["max_attempts"] = value + } +} + +// SampleDistortedBoundingBoxUseImageIfNoBoundingBoxes sets the optional use_image_if_no_bounding_boxes attribute to value. +// +// value: Controls behavior if no bounding boxes supplied. +// If true, assume an implicit bounding box covering the whole input. If false, +// raise an error. +// If not specified, defaults to false +func SampleDistortedBoundingBoxUseImageIfNoBoundingBoxes(value bool) SampleDistortedBoundingBoxAttr { + return func(m optionalAttr) { + m["use_image_if_no_bounding_boxes"] = value + } +} + +// Generate a single randomly distorted bounding box for an image. +// +// Bounding box annotations are often supplied in addition to ground-truth labels +// in image recognition or object localization tasks. A common technique for +// training such a system is to randomly distort an image while preserving +// its content, i.e. *data augmentation*. This Op outputs a randomly distorted +// localization of an object, i.e. bounding box, given an `image_size`, +// `bounding_boxes` and a series of constraints. +// +// The output of this Op is a single bounding box that may be used to crop the +// original image. The output is returned as 3 tensors: `begin`, `size` and +// `bboxes`. The first 2 tensors can be fed directly into `tf.slice` to crop the +// image. The latter may be supplied to `tf.image.draw_bounding_boxes` to visualize +// what the bounding box looks like. +// +// Bounding boxes are supplied and returned as `[y_min, x_min, y_max, x_max]`. The +// bounding box coordinates are floats in `[0.0, 1.0]` relative to the width and +// height of the underlying image. +// +// For example, +// +// ```python +// +// # Generate a single distorted bounding box. +// begin, size, bbox_for_draw = tf.image.sample_distorted_bounding_box( +// tf.shape(image), +// bounding_boxes=bounding_boxes) +// +// # Draw the bounding box in an image summary. +// image_with_box = tf.image.draw_bounding_boxes(tf.expand_dims(image, 0), +// bbox_for_draw) +// tf.summary.image('images_with_box', image_with_box) +// +// # Employ the bounding box to distort the image. +// distorted_image = tf.slice(image, begin, size) +// +// ``` +// +// Note that if no bounding box information is available, setting +// `use_image_if_no_bounding_boxes = true` will assume there is a single implicit +// bounding box covering the whole image. If `use_image_if_no_bounding_boxes` is +// false and no bounding boxes are supplied, an error is raised. +// +// Arguments: +// +// image_size: 1-D, containing `[height, width, channels]`. +// bounding_boxes: 3-D with shape `[batch, N, 4]` describing the N bounding boxes +// +// associated with the image. +// +// Returns: +// +// begin: 1-D, containing `[offset_height, offset_width, 0]`. Provide as input to +// +// `tf.slice`. +// +// size: 1-D, containing `[target_height, target_width, -1]`. Provide as input to +// +// `tf.slice`. +// +// bboxes: 3-D with shape `[1, 1, 4]` containing the distorted bounding box. +// +// Provide as input to `tf.image.draw_bounding_boxes`. +func SampleDistortedBoundingBox(scope *Scope, image_size tf.Output, bounding_boxes tf.Output, optional ...SampleDistortedBoundingBoxAttr) (begin tf.Output, size tf.Output, bboxes tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "SampleDistortedBoundingBox", + Input: []tf.Input{ + image_size, bounding_boxes, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// Computes `exp(x) - 1` element-wise. +// +// i.e. `exp(x) - 1` or `e^(x) - 1`, where `x` is the input tensor. +// `e` denotes Euler's number and is approximately equal to 2.718281. +// +// ```python +// x = tf.constant(2.0) +// tf.math.expm1(x) ==> 6.389056 +// +// x = tf.constant([2.0, 8.0]) +// tf.math.expm1(x) ==> array([6.389056, 2979.958], dtype=float32) +// +// x = tf.constant(1 + 1j) +// tf.math.expm1(x) ==> (0.46869393991588515+2.2873552871788423j) +// ``` +func Expm1(scope *Scope, x tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Expm1", + Input: []tf.Input{ + x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes the gradient of `igamma(a, x)` wrt `a`. +func IgammaGradA(scope *Scope, a tf.Output, x tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "IgammaGradA", + Input: []tf.Input{ + a, x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes the grayscale dilation of 4-D `input` and 3-D `filter` tensors. +// +// The `input` tensor has shape `[batch, in_height, in_width, depth]` and the +// `filter` tensor has shape `[filter_height, filter_width, depth]`, i.e., each +// input channel is processed independently of the others with its own structuring +// function. The `output` tensor has shape +// `[batch, out_height, out_width, depth]`. The spatial dimensions of the output +// tensor depend on the `padding` algorithm. We currently only support the default +// "NHWC" `data_format`. +// +// In detail, the grayscale morphological 2-D dilation is the max-sum correlation +// (for consistency with `conv2d`, we use unmirrored filters): +// +// output[b, y, x, c] = +// max_{dy, dx} input[b, +// strides[1] * y + rates[1] * dy, +// strides[2] * x + rates[2] * dx, +// c] + +// filter[dy, dx, c] +// +// Max-pooling is a special case when the filter has size equal to the pooling +// kernel size and contains all zeros. +// +// Note on duality: The dilation of `input` by the `filter` is equal to the +// negation of the erosion of `-input` by the reflected `filter`. +// +// Arguments: +// +// input: 4-D with shape `[batch, in_height, in_width, depth]`. +// filter: 3-D with shape `[filter_height, filter_width, depth]`. +// strides: The stride of the sliding window for each dimension of the input +// +// tensor. Must be: `[1, stride_height, stride_width, 1]`. +// +// rates: The input stride for atrous morphological dilation. Must be: +// +// `[1, rate_height, rate_width, 1]`. +// +// padding: The type of padding algorithm to use. +// +// Returns 4-D with shape `[batch, out_height, out_width, depth]`. +func Dilation2D(scope *Scope, input tf.Output, filter tf.Output, strides []int64, rates []int64, padding string) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"strides": strides, "rates": rates, "padding": padding} + opspec := tf.OpSpec{ + Type: "Dilation2D", + Input: []tf.Input{ + input, filter, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Pads a tensor with zeros. +// +// This operation pads a `input` with zeros according to the `paddings` you +// specify. `paddings` is an integer tensor with shape `[Dn, 2]`, where n is the +// rank of `input`. For each dimension D of `input`, `paddings[D, 0]` indicates +// how many zeros to add before the contents of `input` in that dimension, and +// `paddings[D, 1]` indicates how many zeros to add after the contents of `input` +// in that dimension. +// +// The padded size of each dimension D of the output is: +// +// `paddings(D, 0) + input.dim_size(D) + paddings(D, 1)` +// +// For example: +// +// ``` +// # 't' is [[1, 1], [2, 2]] +// # 'paddings' is [[1, 1], [2, 2]] +// # rank of 't' is 2 +// pad(t, paddings) ==> [[0, 0, 0, 0, 0, 0] +// +// [0, 0, 1, 1, 0, 0] +// [0, 0, 2, 2, 0, 0] +// [0, 0, 0, 0, 0, 0]] +// +// ``` +func Pad(scope *Scope, input tf.Output, paddings tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Pad", + Input: []tf.Input{ + input, paddings, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Records the bytes size of each element of `input_dataset` in a StatsAggregator. +func BytesProducedStatsDataset(scope *Scope, input_dataset tf.Output, tag tf.Output, output_types []tf.DataType, output_shapes []tf.Shape) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + opspec := tf.OpSpec{ + Type: "BytesProducedStatsDataset", + Input: []tf.Input{ + input_dataset, tag, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes the static batch size of a dataset sans partial batches. +func ComputeBatchSize(scope *Scope, input_dataset tf.Output) (batch_size tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "ComputeBatchSize", + Input: []tf.Input{ + input_dataset, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// DebugIdentityAttr is an optional argument to DebugIdentity. +type DebugIdentityAttr func(optionalAttr) + +// DebugIdentityDeviceName sets the optional device_name attribute to value. +// +// value: Name of the device on which the tensor resides. +// If not specified, defaults to "" +func DebugIdentityDeviceName(value string) DebugIdentityAttr { + return func(m optionalAttr) { + m["device_name"] = value + } +} + +// DebugIdentityTensorName sets the optional tensor_name attribute to value. +// +// value: Name of the input tensor. +// If not specified, defaults to "" +func DebugIdentityTensorName(value string) DebugIdentityAttr { + return func(m optionalAttr) { + m["tensor_name"] = value + } +} + +// DebugIdentityDebugUrls sets the optional debug_urls attribute to value. +// +// value: List of URLs to debug targets, e.g., +// +// file:///foo/tfdbg_dump, grpc:://localhost:11011 +// +// If not specified, defaults to <> +func DebugIdentityDebugUrls(value []string) DebugIdentityAttr { + return func(m optionalAttr) { + m["debug_urls"] = value + } +} + +// DebugIdentityGatedGrpc sets the optional gated_grpc attribute to value. +// +// value: Whether this op will be gated. If any of the debug_urls of this +// +// debug node is of the grpc:// scheme, when the value of this attribute is set +// to True, the data will not actually be sent via the grpc stream unless this +// debug op has been enabled at the debug_url. If all of the debug_urls of this +// debug node are of the grpc:// scheme and the debug op is enabled at none of +// them, the output will be an empty Tensor. +// +// If not specified, defaults to false +func DebugIdentityGatedGrpc(value bool) DebugIdentityAttr { + return func(m optionalAttr) { + m["gated_grpc"] = value + } +} + +// Provides an identity mapping of the non-Ref type input tensor for debugging. +// +// Provides an identity mapping of the non-Ref type input tensor for debugging. +// +// Arguments: +// +// input: Input tensor, non-Reference type +func DebugIdentity(scope *Scope, input tf.Output, optional ...DebugIdentityAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "DebugIdentity", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// BoostedTreesQuantileStreamResourceFlushAttr is an optional argument to BoostedTreesQuantileStreamResourceFlush. +type BoostedTreesQuantileStreamResourceFlushAttr func(optionalAttr) + +// BoostedTreesQuantileStreamResourceFlushGenerateQuantiles sets the optional generate_quantiles attribute to value. +// +// value: bool; If True, the output will be the num_quantiles for each stream where the ith +// entry is the ith quantile of the input with an approximation error of epsilon. +// Duplicate values may be present. +// If False, the output will be the points in the histogram that we got which roughly +// translates to 1/epsilon boundaries and without any duplicates. +// Default to False. +// If not specified, defaults to false +func BoostedTreesQuantileStreamResourceFlushGenerateQuantiles(value bool) BoostedTreesQuantileStreamResourceFlushAttr { + return func(m optionalAttr) { + m["generate_quantiles"] = value + } +} + +// Flush the summaries for a quantile stream resource. +// +// An op that flushes the summaries for a quantile stream resource. +// +// Arguments: +// +// quantile_stream_resource_handle: resource handle referring to a QuantileStreamResource. +// num_buckets: int; approximate number of buckets unless using generate_quantiles. +// +// Returns the created operation. +func BoostedTreesQuantileStreamResourceFlush(scope *Scope, quantile_stream_resource_handle tf.Output, num_buckets tf.Output, optional ...BoostedTreesQuantileStreamResourceFlushAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "BoostedTreesQuantileStreamResourceFlush", + Input: []tf.Input{ + quantile_stream_resource_handle, num_buckets, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// LSTMBlockCellAttr is an optional argument to LSTMBlockCell. +type LSTMBlockCellAttr func(optionalAttr) + +// LSTMBlockCellForgetBias sets the optional forget_bias attribute to value. +// +// value: The forget gate bias. +// If not specified, defaults to 1 +func LSTMBlockCellForgetBias(value float32) LSTMBlockCellAttr { + return func(m optionalAttr) { + m["forget_bias"] = value + } +} + +// LSTMBlockCellCellClip sets the optional cell_clip attribute to value. +// +// value: Value to clip the 'cs' value to. +// If not specified, defaults to 3 +func LSTMBlockCellCellClip(value float32) LSTMBlockCellAttr { + return func(m optionalAttr) { + m["cell_clip"] = value + } +} + +// LSTMBlockCellUsePeephole sets the optional use_peephole attribute to value. +// +// value: Whether to use peephole weights. +// If not specified, defaults to false +func LSTMBlockCellUsePeephole(value bool) LSTMBlockCellAttr { + return func(m optionalAttr) { + m["use_peephole"] = value + } +} + +// Computes the LSTM cell forward propagation for 1 time step. +// +// This implementation uses 1 weight matrix and 1 bias vector, and there's an +// optional peephole connection. +// +// This kernel op implements the following mathematical equations: +// +// ```python +// xh = [x, h_prev] +// [i, f, ci, o] = xh * w + b +// f = f + forget_bias +// +// if not use_peephole: +// +// wci = wcf = wco = 0 +// +// i = sigmoid(cs_prev * wci + i) +// f = sigmoid(cs_prev * wcf + f) +// ci = tanh(ci) +// +// cs = ci .* i + cs_prev .* f +// cs = clip(cs, cell_clip) +// +// o = sigmoid(cs * wco + o) +// co = tanh(cs) +// h = co .* o +// ``` +// +// Arguments: +// +// x: The input to the LSTM cell, shape (batch_size, num_inputs). +// cs_prev: Value of the cell state at previous time step. +// h_prev: Output of the previous cell at previous time step. +// w: The weight matrix. +// wci: The weight matrix for input gate peephole connection. +// wcf: The weight matrix for forget gate peephole connection. +// wco: The weight matrix for output gate peephole connection. +// b: The bias vector. +// +// Returns: +// +// i: The input gate. +// cs: The cell state before the tanh. +// f: The forget gate. +// o: The output gate. +// ci: The cell input. +// co: The cell after the tanh. +// h: The output h vector. +func LSTMBlockCell(scope *Scope, x tf.Output, cs_prev tf.Output, h_prev tf.Output, w tf.Output, wci tf.Output, wcf tf.Output, wco tf.Output, b tf.Output, optional ...LSTMBlockCellAttr) (i tf.Output, cs tf.Output, f tf.Output, o tf.Output, ci tf.Output, co tf.Output, h tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "LSTMBlockCell", + Input: []tf.Input{ + x, cs_prev, h_prev, w, wci, wcf, wco, b, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2), op.Output(3), op.Output(4), op.Output(5), op.Output(6) +} + +// EagerPyFuncAttr is an optional argument to EagerPyFunc. +type EagerPyFuncAttr func(optionalAttr) + +// EagerPyFuncIsAsync sets the optional is_async attribute to value. +// If not specified, defaults to false +func EagerPyFuncIsAsync(value bool) EagerPyFuncAttr { + return func(m optionalAttr) { + m["is_async"] = value + } +} + +// Eagerly executes a python function to compute func(input)->output. The +// +// semantics of the input, output, and attributes are the same as those for +// PyFunc. +func EagerPyFunc(scope *Scope, input []tf.Output, token string, Tout []tf.DataType, optional ...EagerPyFuncAttr) (output []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"token": token, "Tout": Tout} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "EagerPyFunc", + Input: []tf.Input{ + tf.OutputList(input), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if output, idx, err = makeOutputList(op, idx, "output"); err != nil { + scope.UpdateErr("EagerPyFunc", err) + return + } + return output +} + +// SlidingWindowDatasetAttr is an optional argument to SlidingWindowDataset. +type SlidingWindowDatasetAttr func(optionalAttr) + +// SlidingWindowDatasetDropRemainder sets the optional drop_remainder attribute to value. +// If not specified, defaults to true +func SlidingWindowDatasetDropRemainder(value bool) SlidingWindowDatasetAttr { + return func(m optionalAttr) { + m["drop_remainder"] = value + } +} + +// Creates a dataset that passes a sliding window over `input_dataset`. +// +// Arguments: +// +// window_size: A scalar representing the number of elements in the +// +// sliding window. +// +// window_shift: A scalar representing the steps moving the sliding window +// +// forward in one iteration. It must be positive. +// +// window_stride: A scalar representing the stride of the input elements of the sliding window. +// +// It must be positive. +func SlidingWindowDataset(scope *Scope, input_dataset tf.Output, window_size tf.Output, window_shift tf.Output, window_stride tf.Output, output_types []tf.DataType, output_shapes []tf.Shape, optional ...SlidingWindowDatasetAttr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "SlidingWindowDataset", + Input: []tf.Input{ + input_dataset, window_size, window_shift, window_stride, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Wraps the XLA Gather operator documented at +// +// https://www.tensorflow.org/xla/operation_semantics#gather +// +// Arguments: +// +// operand: The array we're gathering from. +// start_indices: Array containing the starting indices of the slices we gather. +// slice_sizes: slice_sizes[i] is the bounds for the slice on dimension i. +// dimension_numbers: A serialized xla::GatherDimensionNumbers proto. +// indices_are_sorted: Boolean indicating if the indices are sorted. +func XlaGather(scope *Scope, operand tf.Output, start_indices tf.Output, slice_sizes tf.Output, dimension_numbers string, indices_are_sorted bool) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dimension_numbers": dimension_numbers, "indices_are_sorted": indices_are_sorted} + opspec := tf.OpSpec{ + Type: "XlaGather", + Input: []tf.Input{ + operand, start_indices, slice_sizes, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// SubstrAttr is an optional argument to Substr. +type SubstrAttr func(optionalAttr) + +// SubstrUnit sets the optional unit attribute to value. +// +// value: The unit that is used to create the substring. One of: `"BYTE"` (for +// defining position and length by bytes) or `"UTF8_CHAR"` (for the UTF-8 +// encoded Unicode code points). The default is `"BYTE"`. Results are undefined if +// `unit=UTF8_CHAR` and the `input` strings do not contain structurally valid +// UTF-8. +// If not specified, defaults to "BYTE" +func SubstrUnit(value string) SubstrAttr { + return func(m optionalAttr) { + m["unit"] = value + } +} + +// Return substrings from `Tensor` of strings. +// +// For each string in the input `Tensor`, creates a substring starting at index +// `pos` with a total length of `len`. +// +// If `len` defines a substring that would extend beyond the length of the input +// string, or if `len` is negative, then as many characters as possible are used. +// +// A negative `pos` indicates distance within the string backwards from the end. +// +// If `pos` specifies an index which is out of range for any of the input strings, +// then an `InvalidArgumentError` is thrown. +// +// `pos` and `len` must have the same shape, otherwise a `ValueError` is thrown on +// Op creation. +// +// *NOTE*: `Substr` supports broadcasting up to two dimensions. More about +// broadcasting +// [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) +// +// --- +// +// # Examples +// +// Using scalar `pos` and `len`: +// +// ```python +// input = [b'Hello', b'World'] +// position = 1 +// length = 3 +// +// output = [b'ell', b'orl'] +// ``` +// +// Using `pos` and `len` with same shape as `input`: +// +// ```python +// input = [[b'ten', b'eleven', b'twelve'], +// +// [b'thirteen', b'fourteen', b'fifteen'], +// [b'sixteen', b'seventeen', b'eighteen']] +// +// position = [[1, 2, 3], +// +// [1, 2, 3], +// [1, 2, 3]] +// +// length = [[2, 3, 4], +// +// [4, 3, 2], +// [5, 5, 5]] +// +// output = [[b'en', b'eve', b'lve'], +// +// [b'hirt', b'urt', b'te'], +// [b'ixtee', b'vente', b'hteen']] +// +// ``` +// +// Broadcasting `pos` and `len` onto `input`: +// +// ``` +// input = [[b'ten', b'eleven', b'twelve'], +// +// [b'thirteen', b'fourteen', b'fifteen'], +// [b'sixteen', b'seventeen', b'eighteen'], +// [b'nineteen', b'twenty', b'twentyone']] +// +// position = [1, 2, 3] +// length = [1, 2, 3] +// +// output = [[b'e', b'ev', b'lve'], +// +// [b'h', b'ur', b'tee'], +// [b'i', b've', b'hte'], +// [b'i', b'en', b'nty']] +// +// ``` +// +// Broadcasting `input` onto `pos` and `len`: +// +// ``` +// input = b'thirteen' +// position = [1, 5, 7] +// length = [3, 2, 1] +// +// output = [b'hir', b'ee', b'n'] +// ``` +// +// Raises: +// +// - `ValueError`: If the first argument cannot be converted to a +// Tensor of `dtype string`. +// - `InvalidArgumentError`: If indices are out of range. +// - `ValueError`: If `pos` and `len` are not the same shape. +// +// Arguments: +// +// input: Tensor of strings +// pos: Scalar defining the position of first character in each substring +// len: Scalar defining the number of characters to include in each substring +// +// Returns Tensor of substrings +func Substr(scope *Scope, input tf.Output, pos tf.Output, len tf.Output, optional ...SubstrAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Substr", + Input: []tf.Input{ + input, pos, len, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// StageClearAttr is an optional argument to StageClear. +type StageClearAttr func(optionalAttr) + +// StageClearCapacity sets the optional capacity attribute to value. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func StageClearCapacity(value int64) StageClearAttr { + return func(m optionalAttr) { + m["capacity"] = value + } +} + +// StageClearMemoryLimit sets the optional memory_limit attribute to value. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func StageClearMemoryLimit(value int64) StageClearAttr { + return func(m optionalAttr) { + m["memory_limit"] = value + } +} + +// StageClearContainer sets the optional container attribute to value. +// If not specified, defaults to "" +func StageClearContainer(value string) StageClearAttr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// StageClearSharedName sets the optional shared_name attribute to value. +// If not specified, defaults to "" +func StageClearSharedName(value string) StageClearAttr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// Op removes all elements in the underlying container. +// +// Returns the created operation. +func StageClear(scope *Scope, dtypes []tf.DataType, optional ...StageClearAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtypes": dtypes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "StageClear", + + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// DataServiceDatasetAttr is an optional argument to DataServiceDataset. +type DataServiceDatasetAttr func(optionalAttr) + +// DataServiceDatasetTaskRefreshIntervalHintMs sets the optional task_refresh_interval_hint_ms attribute to value. +// If not specified, defaults to -1 +func DataServiceDatasetTaskRefreshIntervalHintMs(value int64) DataServiceDatasetAttr { + return func(m optionalAttr) { + m["task_refresh_interval_hint_ms"] = value + } +} + +// DataServiceDatasetDataTransferProtocol sets the optional data_transfer_protocol attribute to value. +// If not specified, defaults to "" +func DataServiceDatasetDataTransferProtocol(value string) DataServiceDatasetAttr { + return func(m optionalAttr) { + m["data_transfer_protocol"] = value + } +} + +// DataServiceDatasetTargetWorkers sets the optional target_workers attribute to value. +// If not specified, defaults to "AUTO" +func DataServiceDatasetTargetWorkers(value string) DataServiceDatasetAttr { + return func(m optionalAttr) { + m["target_workers"] = value + } +} + +// DataServiceDatasetCrossTrainerCacheOptions sets the optional cross_trainer_cache_options attribute to value. +// If not specified, defaults to "" +func DataServiceDatasetCrossTrainerCacheOptions(value string) DataServiceDatasetAttr { + return func(m optionalAttr) { + m["cross_trainer_cache_options"] = value + } +} + +// Creates a dataset that reads data from the tf.data service. +func DataServiceDataset(scope *Scope, dataset_id tf.Output, processing_mode tf.Output, address tf.Output, protocol tf.Output, job_name tf.Output, max_outstanding_requests tf.Output, iteration_counter tf.Output, output_types []tf.DataType, output_shapes []tf.Shape, optional ...DataServiceDatasetAttr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "DataServiceDataset", + Input: []tf.Input{ + dataset_id, processing_mode, address, protocol, job_name, max_outstanding_requests, iteration_counter, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Greedily selects a subset of bounding boxes in descending order of score, +// +// pruning away boxes that have high overlaps +// with previously selected boxes. Bounding boxes with score less than +// `score_threshold` are removed. N-by-n overlap values are supplied as square matrix, +// which allows for defining a custom overlap criterium (eg. intersection over union, +// intersection over area, etc.). +// +// The output of this operation is a set of integers indexing into the input +// collection of bounding boxes representing the selected boxes. The bounding +// box coordinates corresponding to the selected indices can then be obtained +// using the `tf.gather operation`. For example: +// +// selected_indices = tf.image.non_max_suppression_with_overlaps( +// overlaps, scores, max_output_size, overlap_threshold, score_threshold) +// selected_boxes = tf.gather(boxes, selected_indices) +// +// Arguments: +// +// overlaps: A 2-D float tensor of shape `[num_boxes, num_boxes]` representing +// +// the n-by-n box overlap values. +// +// scores: A 1-D float tensor of shape `[num_boxes]` representing a single +// +// score corresponding to each box (each row of boxes). +// +// max_output_size: A scalar integer tensor representing the maximum number of +// +// boxes to be selected by non max suppression. +// +// overlap_threshold: A 0-D float tensor representing the threshold for deciding whether +// +// boxes overlap too. +// +// score_threshold: A 0-D float tensor representing the threshold for deciding when to remove +// +// boxes based on score. +// +// Returns A 1-D integer tensor of shape `[M]` representing the selected +// indices from the boxes tensor, where `M <= max_output_size`. +func NonMaxSuppressionWithOverlaps(scope *Scope, overlaps tf.Output, scores tf.Output, max_output_size tf.Output, overlap_threshold tf.Output, score_threshold tf.Output) (selected_indices tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "NonMaxSuppressionWithOverlaps", + Input: []tf.Input{ + overlaps, scores, max_output_size, overlap_threshold, score_threshold, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Writes a graph summary. +// +// Writes TensorFlow graph `tensor` at `step` using summary `writer`. +// +// Returns the created operation. +func WriteGraphSummary(scope *Scope, writer tf.Output, step tf.Output, tensor tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "WriteGraphSummary", + Input: []tf.Input{ + writer, step, tensor, + }, + } + return scope.AddOperation(opspec) +} + +// Deserialize `SparseTensor` objects. +// +// The input `serialized_sparse` must have the shape `[?, ?, ..., ?, 3]` where +// the last dimension stores serialized `SparseTensor` objects and the other N +// dimensions (N >= 0) correspond to a batch. The ranks of the original +// `SparseTensor` objects must all match. When the final `SparseTensor` is +// created, its rank is the rank of the incoming `SparseTensor` objects plus N; +// the sparse tensors have been concatenated along new dimensions, one for each +// batch. +// +// The output `SparseTensor` object's shape values for the original dimensions +// are the max across the input `SparseTensor` objects' shape values for the +// corresponding dimensions. The new dimensions match the size of the batch. +// +// The input `SparseTensor` objects' indices are assumed ordered in +// standard lexicographic order. If this is not the case, after this +// step run `SparseReorder` to restore index ordering. +// +// For example, if the serialized input is a `[2 x 3]` matrix representing two +// original `SparseTensor` objects: +// +// index = [ 0] +// [10] +// [20] +// values = [1, 2, 3] +// shape = [50] +// +// and +// +// index = [ 2] +// [10] +// values = [4, 5] +// shape = [30] +// +// then the final deserialized `SparseTensor` will be: +// +// index = [0 0] +// [0 10] +// [0 20] +// [1 2] +// [1 10] +// values = [1, 2, 3, 4, 5] +// shape = [2 50] +// +// Arguments: +// +// serialized_sparse: The serialized `SparseTensor` objects. The last dimension +// +// must have 3 columns. +// +// dtype: The `dtype` of the serialized `SparseTensor` objects. +func DeserializeSparse(scope *Scope, serialized_sparse tf.Output, dtype tf.DataType) (sparse_indices tf.Output, sparse_values tf.Output, sparse_shape tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtype": dtype} + opspec := tf.OpSpec{ + Type: "DeserializeSparse", + Input: []tf.Input{ + serialized_sparse, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// WindowDatasetAttr is an optional argument to WindowDataset. +type WindowDatasetAttr func(optionalAttr) + +// WindowDatasetMetadata sets the optional metadata attribute to value. +// If not specified, defaults to "" +func WindowDatasetMetadata(value string) WindowDatasetAttr { + return func(m optionalAttr) { + m["metadata"] = value + } +} + +// Combines (nests of) input elements into a dataset of (nests of) windows. +// +// A "window" is a finite dataset of flat elements of size `size` (or possibly +// fewer if there are not enough input elements to fill the window and +// `drop_remainder` evaluates to false). +// +// The `shift` argument determines the number of input elements by which +// the window moves on each iteration. The first element in the `k`th window +// will be element +// +// ``` +// 1 + (k-1) * shift +// ``` +// +// of the input dataset. In particular, the first element of the first window +// will always be the first element of the input dataset. +// +// If the `stride` parameter is greater than 1, then each window will skip +// `(stride - 1)` input elements between each element that appears in the +// window. Output windows will still contain `size` elements regardless of +// the value of `stride`. +// +// The `stride` argument determines the stride of the input elements, and the +// `shift` argument determines the shift of the window. +// +// For example, letting `{...}` to represent a Dataset: +// +// - `tf.data.Dataset.range(7).window(2)` produces +// `{{0, 1}, {2, 3}, {4, 5}, {6}}` +// - `tf.data.Dataset.range(7).window(3, 2, 1, True)` produces +// `{{0, 1, 2}, {2, 3, 4}, {4, 5, 6}}` +// - `tf.data.Dataset.range(7).window(3, 1, 2, True)` produces +// `{{0, 2, 4}, {1, 3, 5}, {2, 4, 6}}` +// +// Note that when the `window` transformation is applied to a dataset of +// nested elements, it produces a dataset of nested windows. +// +// For example: +// +// - `tf.data.Dataset.from_tensor_slices((range(4), range(4))).window(2)` +// produces `{({0, 1}, {0, 1}), ({2, 3}, {2, 3})}` +// - `tf.data.Dataset.from_tensor_slices({"a": range(4)}).window(2)` +// produces `{{"a": {0, 1}}, {"a": {2, 3}}}` +// +// Arguments: +// +// size: An integer scalar, representing the number of elements +// +// of the input dataset to combine into a window. Must be positive. +// +// shift: An integer scalar, representing the number of input elements +// +// by which the window moves in each iteration. Defaults to `size`. +// Must be positive. +// +// stride: An integer scalar, representing the stride of the input elements +// +// in the sliding window. Must be positive. The default value of 1 means +// "retain every input element". +// +// drop_remainder: A Boolean scalar, representing whether the last window should be +// +// dropped if its size is smaller than `window_size`. +func WindowDataset(scope *Scope, input_dataset tf.Output, size tf.Output, shift tf.Output, stride tf.Output, drop_remainder tf.Output, output_types []tf.DataType, output_shapes []tf.Shape, optional ...WindowDatasetAttr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "WindowDataset", + Input: []tf.Input{ + input_dataset, size, shift, stride, drop_remainder, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// TensorArrayGatherV2Attr is an optional argument to TensorArrayGatherV2. +type TensorArrayGatherV2Attr func(optionalAttr) + +// TensorArrayGatherV2ElementShape sets the optional element_shape attribute to value. +// If not specified, defaults to +func TensorArrayGatherV2ElementShape(value tf.Shape) TensorArrayGatherV2Attr { + return func(m optionalAttr) { + m["element_shape"] = value + } +} + +// Deprecated. Use TensorArrayGatherV3 +// +// DEPRECATED at GraphDef version 26: Use TensorArrayGatherV3 +func TensorArrayGatherV2(scope *Scope, handle tf.Output, indices tf.Output, flow_in tf.Output, dtype tf.DataType, optional ...TensorArrayGatherV2Attr) (value tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtype": dtype} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "TensorArrayGatherV2", + Input: []tf.Input{ + handle, indices, flow_in, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// GatherAttr is an optional argument to Gather. +type GatherAttr func(optionalAttr) + +// GatherValidateIndices sets the optional validate_indices attribute to value. +// If not specified, defaults to true +func GatherValidateIndices(value bool) GatherAttr { + return func(m optionalAttr) { + m["validate_indices"] = value + } +} + +// Gather slices from `params` according to `indices`. +// +// `indices` must be an integer tensor of any dimension (usually 0-D or 1-D). +// Produces an output tensor with shape `indices.shape + params.shape[1:]` where: +// +// ```python +// +// # Scalar indices +// output[:, ..., :] = params[indices, :, ... :] +// +// # Vector indices +// output[i, :, ..., :] = params[indices[i], :, ... :] +// +// # Higher rank indices +// output[i, ..., j, :, ... :] = params[indices[i, ..., j], :, ..., :] +// +// ``` +// +// If `indices` is a permutation and `len(indices) == params.shape[0]` then +// this operation will permute `params` accordingly. +// +// `validate_indices`: DEPRECATED. If this operation is assigned to CPU, values in +// `indices` are always validated to be within range. If assigned to GPU, +// out-of-bound indices result in safe but unspecified behavior, which may include +// raising an error. +// +//
+// +//
+func Gather(scope *Scope, params tf.Output, indices tf.Output, optional ...GatherAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Gather", + Input: []tf.Input{ + params, indices, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Encode audio data using the WAV file format. +// +// This operation will generate a string suitable to be saved out to create a .wav +// audio file. It will be encoded in the 16-bit PCM format. It takes in float +// values in the range -1.0f to 1.0f, and any outside that value will be clamped to +// that range. +// +// `audio` is a 2-D float Tensor of shape `[length, channels]`. +// `sample_rate` is a scalar Tensor holding the rate to use (e.g. 44100). +// +// Arguments: +// +// audio: 2-D with shape `[length, channels]`. +// sample_rate: Scalar containing the sample frequency. +// +// Returns 0-D. WAV-encoded file contents. +func EncodeWav(scope *Scope, audio tf.Output, sample_rate tf.Output) (contents tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "EncodeWav", + Input: []tf.Input{ + audio, sample_rate, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes the number of elements in the given table. +// +// Arguments: +// +// table_handle: Handle to the table. +// +// Returns Scalar that contains number of elements in the table. +func LookupTableSizeV2(scope *Scope, table_handle tf.Output) (size tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "LookupTableSizeV2", + Input: []tf.Input{ + table_handle, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Compute the lower regularized incomplete Gamma function `P(a, x)`. +// +// The lower regularized incomplete Gamma function is defined as: +// +// \\(P(a, x) = gamma(a, x) / Gamma(a) = 1 - Q(a, x)\\) +// +// where +// +// \\(gamma(a, x) = \\int_{0}^{x} t^{a-1} exp(-t) dt\\) +// +// is the lower incomplete Gamma function. +// +// Note, above `Q(a, x)` (`Igammac`) is the upper regularized complete +// Gamma function. +func Igamma(scope *Scope, a tf.Output, x tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Igamma", + Input: []tf.Input{ + a, x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// GatherV2Attr is an optional argument to GatherV2. +type GatherV2Attr func(optionalAttr) + +// GatherV2BatchDims sets the optional batch_dims attribute to value. +// If not specified, defaults to 0 +func GatherV2BatchDims(value int64) GatherV2Attr { + return func(m optionalAttr) { + m["batch_dims"] = value + } +} + +// Gather slices from `params` axis `axis` according to `indices`. +// +// `indices` must be an integer tensor of any dimension (usually 0-D or 1-D). +// Produces an output tensor with shape `params.shape[:axis] + +// indices.shape[batch_dims:] + params.shape[axis + 1:]` where: +// +// ```python +// +// # Scalar indices (output is rank(params) - 1). +// output[a_0, ..., a_n, b_0, ..., b_n] = +// params[a_0, ..., a_n, indices, b_0, ..., b_n] +// +// # Vector indices (output is rank(params)). +// output[a_0, ..., a_n, i, b_0, ..., b_n] = +// params[a_0, ..., a_n, indices[i], b_0, ..., b_n] +// +// # Higher rank indices (output is rank(params) + rank(indices) - 1). +// output[a_0, ..., a_n, i, ..., j, b_0, ... b_n] = +// params[a_0, ..., a_n, indices[i, ..., j], b_0, ..., b_n] +// +// ``` +// +//
+// +//
+// +// Note that on CPU, if an out of bound index is found, an error is returned. +// On GPU, if an out of bound index is found, a 0 is stored in the +// corresponding output value. +// +// See also `tf.batch_gather` and `tf.gather_nd`. +// +// Arguments: +// +// params: The tensor from which to gather values. Must be at least rank +// +// `axis + 1`. +// +// indices: Index tensor. Must be in range `[0, params.shape[axis])`. +// axis: The axis in `params` to gather `indices` from. Defaults to the first +// +// dimension. Supports negative indexes. +// +// Returns Values from `params` gathered from indices given by `indices`, with +// shape `params.shape[:axis] + indices.shape + params.shape[axis + 1:]`. +func GatherV2(scope *Scope, params tf.Output, indices tf.Output, axis tf.Output, optional ...GatherV2Attr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "GatherV2", + Input: []tf.Input{ + params, indices, axis, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Gradients for batch normalization. +// +// DEPRECATED at GraphDef version 9: Use tf.nn.batch_normalization() +// +// This op is deprecated. See `tf.nn.batch_normalization`. +// +// Arguments: +// +// t: A 4D input Tensor. +// m: A 1D mean Tensor with size matching the last dimension of t. +// +// This is the first output from tf.nn.moments, +// or a saved moving average thereof. +// +// v: A 1D variance Tensor with size matching the last dimension of t. +// +// This is the second output from tf.nn.moments, +// or a saved moving average thereof. +// +// gamma: A 1D gamma Tensor with size matching the last dimension of t. +// +// If "scale_after_normalization" is true, this Tensor will be multiplied +// with the normalized Tensor. +// +// backprop: 4D backprop Tensor. +// variance_epsilon: A small float number to avoid dividing by 0. +// scale_after_normalization: A bool indicating whether the resulted tensor +// +// needs to be multiplied with gamma. +// +// Returns: +// +// dx: 4D backprop tensor for input. +// dm: 1D backprop tensor for mean. +// dv: 1D backprop tensor for variance. +// db: 1D backprop tensor for beta. +// dg: 1D backprop tensor for gamma. +func BatchNormWithGlobalNormalizationGrad(scope *Scope, t tf.Output, m tf.Output, v tf.Output, gamma tf.Output, backprop tf.Output, variance_epsilon float32, scale_after_normalization bool) (dx tf.Output, dm tf.Output, dv tf.Output, db tf.Output, dg tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"variance_epsilon": variance_epsilon, "scale_after_normalization": scale_after_normalization} + opspec := tf.OpSpec{ + Type: "BatchNormWithGlobalNormalizationGrad", + Input: []tf.Input{ + t, m, v, gamma, backprop, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2), op.Output(3), op.Output(4) +} + +// Elementwise computes the bitwise AND of `x` and `y`. +// +// The result will have those bits set, that are set in both `x` and `y`. The +// computation is performed on the underlying representations of `x` and `y`. +// +// For example: +// +// ```python +// import tensorflow as tf +// from tensorflow.python.ops import bitwise_ops +// dtype_list = [tf.int8, tf.int16, tf.int32, tf.int64, +// +// tf.uint8, tf.uint16, tf.uint32, tf.uint64] +// +// for dtype in dtype_list: +// +// lhs = tf.constant([0, 5, 3, 14], dtype=dtype) +// rhs = tf.constant([5, 0, 7, 11], dtype=dtype) +// exp = tf.constant([0, 0, 3, 10], dtype=tf.float32) +// +// res = bitwise_ops.bitwise_and(lhs, rhs) +// tf.assert_equal(tf.cast(res, tf.float32), exp) # TRUE +// +// ``` +func BitwiseAnd(scope *Scope, x tf.Output, y tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "BitwiseAnd", + Input: []tf.Input{ + x, y, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// UniqueV2Attr is an optional argument to UniqueV2. +type UniqueV2Attr func(optionalAttr) + +// UniqueV2OutIdx sets the optional out_idx attribute to value. +// If not specified, defaults to DT_INT32 +func UniqueV2OutIdx(value tf.DataType) UniqueV2Attr { + return func(m optionalAttr) { + m["out_idx"] = value + } +} + +// Finds unique elements along an axis of a tensor. +// +// This operation either returns a tensor `y` containing unique elements +// along the `axis` of a tensor. The returned unique elements is sorted +// in the same order as they occur along `axis` in `x`. +// This operation also returns a tensor `idx` that is the same size as +// the number of the elements in `x` along the `axis` dimension. It +// contains the index in the unique output `y`. +// In other words, for an `1-D` tensor `x` with `axis = None: +// +// `y[idx[i]] = x[i] for i in [0, 1,...,rank(x) - 1]` +// +// For example: +// +// ``` +// # tensor 'x' is [1, 1, 2, 4, 4, 4, 7, 8, 8] +// y, idx = unique(x) +// y ==> [1, 2, 4, 7, 8] +// idx ==> [0, 0, 1, 2, 2, 2, 3, 4, 4] +// ``` +// +// For an `2-D` tensor `x` with `axis = 0`: +// +// ``` +// # tensor 'x' is [[1, 0, 0], +// # [1, 0, 0], +// # [2, 0, 0]] +// y, idx = unique(x, axis=0) +// y ==> [[1, 0, 0], +// +// [2, 0, 0]] +// +// idx ==> [0, 0, 1] +// ``` +// +// For an `2-D` tensor `x` with `axis = 1`: +// +// ``` +// # tensor 'x' is [[1, 0, 0], +// # [1, 0, 0], +// # [2, 0, 0]] +// y, idx = unique(x, axis=1) +// y ==> [[1, 0], +// +// [1, 0], +// [2, 0]] +// +// idx ==> [0, 1, 1] +// ``` +// +// Arguments: +// +// x: A `Tensor`. +// axis: A `Tensor` of type `int32` (default: None). The axis of the Tensor to +// +// find the unique elements. +// +// Returns: +// +// y: A `Tensor`. Unique elements along the `axis` of `Tensor` x. +// idx: A 1-D Tensor. Has the same type as x that contains the index of each +// +// value of x in the output y. +func UniqueV2(scope *Scope, x tf.Output, axis tf.Output, optional ...UniqueV2Attr) (y tf.Output, idx tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "UniqueV2", + Input: []tf.Input{ + x, axis, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// ExperimentalIgnoreErrorsDatasetAttr is an optional argument to ExperimentalIgnoreErrorsDataset. +type ExperimentalIgnoreErrorsDatasetAttr func(optionalAttr) + +// ExperimentalIgnoreErrorsDatasetLogWarning sets the optional log_warning attribute to value. +// If not specified, defaults to false +func ExperimentalIgnoreErrorsDatasetLogWarning(value bool) ExperimentalIgnoreErrorsDatasetAttr { + return func(m optionalAttr) { + m["log_warning"] = value + } +} + +// Creates a dataset that contains the elements of `input_dataset` ignoring errors. +func ExperimentalIgnoreErrorsDataset(scope *Scope, input_dataset tf.Output, output_types []tf.DataType, output_shapes []tf.Shape, optional ...ExperimentalIgnoreErrorsDatasetAttr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ExperimentalIgnoreErrorsDataset", + Input: []tf.Input{ + input_dataset, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns the last element of the input list as well as a list with all but that element. +// +// Fails if the list is empty. +// +// input_handle: the input list +// tensor: the withdrawn last element of the list +// element_dtype: the type of elements in the list +// element_shape: the shape of the output tensor +func TensorListPopBack(scope *Scope, input_handle tf.Output, element_shape tf.Output, element_dtype tf.DataType) (output_handle tf.Output, tensor tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"element_dtype": element_dtype} + opspec := tf.OpSpec{ + Type: "TensorListPopBack", + Input: []tf.Input{ + input_handle, element_shape, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// Computes softmax activations. +// +// For each batch `i` and class `j` we have +// +// $$softmax[i, j] = exp(logits[i, j]) / sum_j(exp(logits[i, j]))$$ +// +// Arguments: +// +// logits: 2-D with shape `[batch_size, num_classes]`. +// +// Returns Same shape as `logits`. +func Softmax(scope *Scope, logits tf.Output) (softmax tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Softmax", + Input: []tf.Input{ + logits, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes the sign and the log of the absolute value of the determinant of +// +// one or more square matrices. +// +// The input is a tensor of shape `[N, M, M]` whose inner-most 2 dimensions +// form square matrices. The outputs are two tensors containing the signs and +// absolute values of the log determinants for all N input submatrices +// `[..., :, :]` such that `determinant = sign*exp(log_abs_determinant)`. +// The `log_abs_determinant` is computed as `det(P)*sum(log(diag(LU)))` where `LU` +// is the `LU` decomposition of the input and `P` is the corresponding +// permutation matrix. +// +// Arguments: +// +// input: Shape is `[N, M, M]`. +// +// Returns: +// +// sign: The signs of the log determinants of the inputs. Shape is `[N]`. +// log_abs_determinant: The logs of the absolute values of the determinants +// +// of the N input matrices. Shape is `[N]`. +func LogMatrixDeterminant(scope *Scope, input tf.Output) (sign tf.Output, log_abs_determinant tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "LogMatrixDeterminant", + Input: []tf.Input{ + input, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// MutableHashTableV2Attr is an optional argument to MutableHashTableV2. +type MutableHashTableV2Attr func(optionalAttr) + +// MutableHashTableV2Container sets the optional container attribute to value. +// +// value: If non-empty, this table is placed in the given container. +// Otherwise, a default container is used. +// If not specified, defaults to "" +func MutableHashTableV2Container(value string) MutableHashTableV2Attr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// MutableHashTableV2SharedName sets the optional shared_name attribute to value. +// +// value: If non-empty, this table is shared under the given name across +// multiple sessions. +// If not specified, defaults to "" +func MutableHashTableV2SharedName(value string) MutableHashTableV2Attr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// MutableHashTableV2UseNodeNameSharing sets the optional use_node_name_sharing attribute to value. +// +// value: If true and shared_name is empty, the table is shared +// using the node name. +// If not specified, defaults to false +func MutableHashTableV2UseNodeNameSharing(value bool) MutableHashTableV2Attr { + return func(m optionalAttr) { + m["use_node_name_sharing"] = value + } +} + +// Creates an empty hash table. +// +// This op creates a mutable hash table, specifying the type of its keys and +// values. Each value must be a scalar. Data can be inserted into the table using +// the insert operations. It does not support the initialization operation. +// +// Arguments: +// +// key_dtype: Type of the table keys. +// value_dtype: Type of the table values. +// +// Returns Handle to a table. +func MutableHashTableV2(scope *Scope, key_dtype tf.DataType, value_dtype tf.DataType, optional ...MutableHashTableV2Attr) (table_handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"key_dtype": key_dtype, "value_dtype": value_dtype} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "MutableHashTableV2", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Checks whether a resource handle-based variable has been initialized. +// +// Arguments: +// +// resource: the input resource handle. +// +// Returns a scalar boolean which is true if the variable has been +// initialized. +func VarIsInitializedOp(scope *Scope, resource tf.Output) (is_initialized tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "VarIsInitializedOp", + Input: []tf.Input{ + resource, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes fingerprints of the input strings. +// +// Arguments: +// +// input: vector of strings to compute fingerprints on. +// +// Returns a (N,2) shaped matrix where N is the number of elements in the input +// vector. Each row contains the low and high parts of the fingerprint. +func SdcaFprint(scope *Scope, input tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "SdcaFprint", + Input: []tf.Input{ + input, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Converts one or more images from RGB to HSV. +// +// Outputs a tensor of the same shape as the `images` tensor, containing the HSV +// value of the pixels. The output is only well defined if the value in `images` +// are in `[0,1]`. +// +// `output[..., 0]` contains hue, `output[..., 1]` contains saturation, and +// `output[..., 2]` contains value. All HSV values are in `[0,1]`. A hue of 0 +// corresponds to pure red, hue 1/3 is pure green, and 2/3 is pure blue. +// +// Usage Example: +// +// >>> blue_image = tf.stack([ +// ... tf.zeros([5,5]), +// ... tf.zeros([5,5]), +// ... tf.ones([5,5])], +// ... axis=-1) +// >>> blue_hsv_image = tf.image.rgb_to_hsv(blue_image) +// >>> blue_hsv_image[0,0].numpy() +// array([0.6666667, 1. , 1. ], dtype=float32) +// +// Arguments: +// +// images: 1-D or higher rank. RGB data to convert. Last dimension must be size 3. +// +// Returns `images` converted to HSV. +func RGBToHSV(scope *Scope, images tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "RGBToHSV", + Input: []tf.Input{ + images, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// SparseMatrixSparseMatMulAttr is an optional argument to SparseMatrixSparseMatMul. +type SparseMatrixSparseMatMulAttr func(optionalAttr) + +// SparseMatrixSparseMatMulTransposeA sets the optional transpose_a attribute to value. +// +// value: Indicates whether `a` should be transposed. +// If not specified, defaults to false +func SparseMatrixSparseMatMulTransposeA(value bool) SparseMatrixSparseMatMulAttr { + return func(m optionalAttr) { + m["transpose_a"] = value + } +} + +// SparseMatrixSparseMatMulTransposeB sets the optional transpose_b attribute to value. +// +// value: Indicates whether `b` should be transposed. +// If not specified, defaults to false +func SparseMatrixSparseMatMulTransposeB(value bool) SparseMatrixSparseMatMulAttr { + return func(m optionalAttr) { + m["transpose_b"] = value + } +} + +// SparseMatrixSparseMatMulAdjointA sets the optional adjoint_a attribute to value. +// +// value: Indicates whether `a` should be conjugate-transposed. +// If not specified, defaults to false +func SparseMatrixSparseMatMulAdjointA(value bool) SparseMatrixSparseMatMulAttr { + return func(m optionalAttr) { + m["adjoint_a"] = value + } +} + +// SparseMatrixSparseMatMulAdjointB sets the optional adjoint_b attribute to value. +// +// value: Indicates whether `b` should be conjugate-transposed. +// If not specified, defaults to false +func SparseMatrixSparseMatMulAdjointB(value bool) SparseMatrixSparseMatMulAttr { + return func(m optionalAttr) { + m["adjoint_b"] = value + } +} + +// Sparse-matrix-multiplies two CSR matrices `a` and `b`. +// +// Performs a matrix multiplication of a sparse matrix `a` with a sparse matrix +// `b`; returns a sparse matrix `a * b`, unless either `a` or `b` is transposed or +// adjointed. +// +// Each matrix may be transposed or adjointed (conjugated and transposed) +// according to the Boolean parameters `transpose_a`, `adjoint_a`, `transpose_b` +// and `adjoint_b`. At most one of `transpose_a` or `adjoint_a` may be True. +// Similarly, at most one of `transpose_b` or `adjoint_b` may be True. +// +// The inputs must have compatible shapes. That is, the inner dimension of `a` +// must be equal to the outer dimension of `b`. This requirement is adjusted +// according to whether either `a` or `b` is transposed or adjointed. +// +// The `type` parameter denotes the type of the matrix elements. Both `a` and `b` +// must have the same type. The supported types are: `float32`, `float64`, +// `complex64` and `complex128`. +// +// Both `a` and `b` must have the same rank. Broadcasting is not supported. If they +// have rank 3, each batch of 2D CSRSparseMatrices within `a` and `b` must have the +// same dense shape. +// +// The sparse matrix product may have numeric (non-structural) zeros. +// TODO(anudhyan): Consider adding a boolean attribute to control whether to prune +// zeros. +// +// Usage example: +// +// ```python +// +// from tensorflow.python.ops.linalg.sparse import sparse_csr_matrix_ops +// +// a_indices = np.array([[0, 0], [2, 3], [2, 4], [3, 0]]) +// a_values = np.array([1.0, 5.0, -1.0, -2.0], np.float32) +// a_dense_shape = [4, 5] +// +// b_indices = np.array([[0, 0], [3, 0], [3, 1]]) +// b_values = np.array([2.0, 7.0, 8.0], np.float32) +// b_dense_shape = [5, 3] +// +// with tf.Session() as sess: +// # Define (COO format) Sparse Tensors over Numpy arrays +// a_st = tf.sparse.SparseTensor(a_indices, a_values, a_dense_shape) +// b_st = tf.sparse.SparseTensor(b_indices, b_values, b_dense_shape) +// +// # Convert SparseTensors to CSR SparseMatrix +// a_sm = sparse_csr_matrix_ops.sparse_tensor_to_csr_sparse_matrix( +// a_st.indices, a_st.values, a_st.dense_shape) +// b_sm = sparse_csr_matrix_ops.sparse_tensor_to_csr_sparse_matrix( +// b_st.indices, b_st.values, b_st.dense_shape) +// +// # Compute the CSR SparseMatrix matrix multiplication +// c_sm = sparse_csr_matrix_ops.sparse_matrix_sparse_mat_mul( +// a=a_sm, b=b_sm, type=tf.float32) +// +// # Convert the CSR SparseMatrix product to a dense Tensor +// c_sm_dense = sparse_csr_matrix_ops.csr_sparse_matrix_to_dense( +// c_sm, tf.float32) +// # Evaluate the dense Tensor value +// c_sm_dense_value = sess.run(c_sm_dense) +// +// ``` +// +// `c_sm_dense_value` stores the dense matrix product: +// +// ``` +// +// [[ 2. 0. 0.] +// [ 0. 0. 0.] +// [ 35. 40. 0.] +// [ -4. 0. 0.]] +// +// ``` +// +// a: A `CSRSparseMatrix`. +// b: A `CSRSparseMatrix` with the same type and rank as `a`. +// type: The type of both `a` and `b`. +// transpose_a: If True, `a` transposed before multiplication. +// transpose_b: If True, `b` transposed before multiplication. +// adjoint_a: If True, `a` adjointed before multiplication. +// adjoint_b: If True, `b` adjointed before multiplication. +// +// Arguments: +// +// a: A CSRSparseMatrix. +// b: A CSRSparseMatrix. +// +// Returns A CSRSparseMatrix. +func SparseMatrixSparseMatMul(scope *Scope, a tf.Output, b tf.Output, type_ tf.DataType, optional ...SparseMatrixSparseMatMulAttr) (c tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"type": type_} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "SparseMatrixSparseMatMul", + Input: []tf.Input{ + a, b, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes gradients for SparseSegmentSqrtN. +// +// Returns tensor "output" with same shape as grad, except for dimension 0 whose +// value is output_dim0. +// +// Arguments: +// +// grad: gradient propagated to the SparseSegmentSqrtN op. +// indices: indices passed to the corresponding SparseSegmentSqrtN op. +// segment_ids: segment_ids passed to the corresponding SparseSegmentSqrtN op. +// output_dim0: dimension 0 of "data" passed to SparseSegmentSqrtN op. +func SparseSegmentSqrtNGrad(scope *Scope, grad tf.Output, indices tf.Output, segment_ids tf.Output, output_dim0 tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "SparseSegmentSqrtNGrad", + Input: []tf.Input{ + grad, indices, segment_ids, output_dim0, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns the value from a given key in a tensor map. +// +// input_handle: the input map +// key: the key to be looked up +// value: the value found from the given key +func TensorMapLookup(scope *Scope, input_handle tf.Output, key tf.Output, value_dtype tf.DataType) (value tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"value_dtype": value_dtype} + opspec := tf.OpSpec{ + Type: "TensorMapLookup", + Input: []tf.Input{ + input_handle, key, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// XlaRngBitGeneratorAttr is an optional argument to XlaRngBitGenerator. +type XlaRngBitGeneratorAttr func(optionalAttr) + +// XlaRngBitGeneratorDtype sets the optional dtype attribute to value. +// +// value: The type of the tensor. +// If not specified, defaults to DT_UINT64 +func XlaRngBitGeneratorDtype(value tf.DataType) XlaRngBitGeneratorAttr { + return func(m optionalAttr) { + m["dtype"] = value + } +} + +// Stateless PRNG bit generator. +// +// Wraps the XLA RngBitGenerator operator, documented at +// +// https://www.tensorflow.org/performance/xla/operation_semantics#rngbitgenerator. +// +// Arguments: +// +// algorithm: The PRNG algorithm to use, one of +// +// tf.random.Algorithm.{PHILOX, THREEFRY, AUTO_SELECT}. +// +// initial_state: Initial state for the PRNG algorithm. For THREEFRY, it should be +// +// a u64[2] and for PHILOX a u64[3]. +// +// shape: The output shape of the generated data. +func XlaRngBitGenerator(scope *Scope, algorithm tf.Output, initial_state tf.Output, shape tf.Output, optional ...XlaRngBitGeneratorAttr) (output_key tf.Output, output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "XlaRngBitGenerator", + Input: []tf.Input{ + algorithm, initial_state, shape, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// GenerateBoundingBoxProposalsAttr is an optional argument to GenerateBoundingBoxProposals. +type GenerateBoundingBoxProposalsAttr func(optionalAttr) + +// GenerateBoundingBoxProposalsPostNmsTopn sets the optional post_nms_topn attribute to value. +// +// value: An integer. Maximum number of rois in the output. +// If not specified, defaults to 300 +func GenerateBoundingBoxProposalsPostNmsTopn(value int64) GenerateBoundingBoxProposalsAttr { + return func(m optionalAttr) { + m["post_nms_topn"] = value + } +} + +// This op produces Region of Interests from given bounding boxes(bbox_deltas) encoded wrt anchors according to eq.2 in arXiv:1506.01497 +// +// The op selects top `pre_nms_topn` scoring boxes, decodes them with respect to anchors, +// applies non-maximal suppression on overlapping boxes with higher than +// `nms_threshold` intersection-over-union (iou) value, discarding boxes where shorter +// side is less than `min_size`. +// Inputs: +// `scores`: A 4D tensor of shape [Batch, Height, Width, Num Anchors] containing the scores per anchor at given position +// `bbox_deltas`: is a tensor of shape [Batch, Height, Width, 4 x Num Anchors] boxes encoded to each anchor +// `anchors`: A 1D tensor of shape [4 x Num Anchors], representing the anchors. +// Outputs: +// `rois`: output RoIs, a 3D tensor of shape [Batch, post_nms_topn, 4], padded by 0 if less than post_nms_topn candidates found. +// `roi_probabilities`: probability scores of each roi in 'rois', a 2D tensor of shape [Batch,post_nms_topn], padded with 0 if needed, sorted by scores. +// +// Arguments: +// +// scores: A 4-D float tensor of shape `[num_images, height, width, num_achors]` containing scores of the boxes for given anchors, can be unsorted. +// bbox_deltas: A 4-D float tensor of shape `[num_images, height, width, 4 x num_anchors]`. encoding boxes with respec to each anchor. +// +// Coordinates are given in the form [dy, dx, dh, dw]. +// +// image_info: A 2-D float tensor of shape `[num_images, 5]` containing image information Height, Width, Scale. +// anchors: A 2-D float tensor of shape `[num_anchors, 4]` describing the anchor boxes. Boxes are formatted in the form [y1, x1, y2, x2]. +// nms_threshold: A scalar float tensor for non-maximal-suppression threshold. +// pre_nms_topn: A scalar int tensor for the number of top scoring boxes to be used as input. +// min_size: A scalar float tensor. Any box that has a smaller size than min_size will be discarded. +// +// Returns: +// +// rois: A 3-D float tensor of shape `[num_images,post_nms_topn,4]` representing the selected +// +// region of interest boxes. Sorted in descending order in scores. +// +// roi_probabilities: A 2-D float tensor of shape `[num_images, post_nms_topn]` representing the score of the +// +// region of interest box in `rois` tensor at the same index. +func GenerateBoundingBoxProposals(scope *Scope, scores tf.Output, bbox_deltas tf.Output, image_info tf.Output, anchors tf.Output, nms_threshold tf.Output, pre_nms_topn tf.Output, min_size tf.Output, optional ...GenerateBoundingBoxProposalsAttr) (rois tf.Output, roi_probabilities tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "GenerateBoundingBoxProposals", + Input: []tf.Input{ + scores, bbox_deltas, image_info, anchors, nms_threshold, pre_nms_topn, min_size, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// Returns a tensor map with item from given key erased. +// +// input_handle: the original map +// output_handle: the map with value from given key removed +// key: the key of the value to be erased +func TensorMapErase(scope *Scope, input_handle tf.Output, key tf.Output, value_dtype tf.DataType) (output_handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"value_dtype": value_dtype} + opspec := tf.OpSpec{ + Type: "TensorMapErase", + Input: []tf.Input{ + input_handle, key, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// UnsortedSegmentJoinAttr is an optional argument to UnsortedSegmentJoin. +type UnsortedSegmentJoinAttr func(optionalAttr) + +// UnsortedSegmentJoinSeparator sets the optional separator attribute to value. +// +// value: The separator to use when joining. +// If not specified, defaults to "" +func UnsortedSegmentJoinSeparator(value string) UnsortedSegmentJoinAttr { + return func(m optionalAttr) { + m["separator"] = value + } +} + +// Joins the elements of `inputs` based on `segment_ids`. +// +// Computes the string join along segments of a tensor. +// Given `segment_ids` with rank `N` and `data` with rank `N+M`: +// +// `output[i, k1...kM] = strings.join([data[j1...jN, k1...kM])` +// +// where the join is over all [j1...jN] such that segment_ids[j1...jN] = i. +// Strings are joined in row-major order. +// +// For example: +// +// ```python +// inputs = [['Y', 'q', 'c'], ['Y', '6', '6'], ['p', 'G', 'a']] +// output_array = string_ops.unsorted_segment_join(inputs=inputs, +// +// segment_ids=[1, 0, 1], +// num_segments=2, +// separator=':')) +// +// # output_array ==> [['Y', '6', '6'], ['Y:p', 'q:G', 'c:a']] +// +// inputs = ['this', 'is', 'a', 'test'] +// output_array = string_ops.unsorted_segment_join(inputs=inputs, +// +// segment_ids=[0, 0, 0, 0], +// num_segments=1, +// separator=':')) +// +// # output_array ==> ['this:is:a:test'] +// ``` +// +// Arguments: +// +// inputs: The input to be joined. +// segment_ids: A tensor whose shape is a prefix of data.shape. Negative segment ids are not +// +// supported. +// +// num_segments: A scalar. +func UnsortedSegmentJoin(scope *Scope, inputs tf.Output, segment_ids tf.Output, num_segments tf.Output, optional ...UnsortedSegmentJoinAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "UnsortedSegmentJoin", + Input: []tf.Input{ + inputs, segment_ids, num_segments, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// DatasetToGraphAttr is an optional argument to DatasetToGraph. +type DatasetToGraphAttr func(optionalAttr) + +// DatasetToGraphStatefulWhitelist sets the optional stateful_whitelist attribute to value. +// If not specified, defaults to <> +// +// REQUIRES: len(value) >= 0 +func DatasetToGraphStatefulWhitelist(value []string) DatasetToGraphAttr { + return func(m optionalAttr) { + m["stateful_whitelist"] = value + } +} + +// DatasetToGraphAllowStateful sets the optional allow_stateful attribute to value. +// If not specified, defaults to false +func DatasetToGraphAllowStateful(value bool) DatasetToGraphAttr { + return func(m optionalAttr) { + m["allow_stateful"] = value + } +} + +// DatasetToGraphStripDeviceAssignment sets the optional strip_device_assignment attribute to value. +// If not specified, defaults to false +func DatasetToGraphStripDeviceAssignment(value bool) DatasetToGraphAttr { + return func(m optionalAttr) { + m["strip_device_assignment"] = value + } +} + +// Returns a serialized GraphDef representing `input_dataset`. +// +// Returns a graph representation for `input_dataset`. +// +// Arguments: +// +// input_dataset: A variant tensor representing the dataset to return the graph representation for. +// +// Returns The graph representation of the dataset (as serialized GraphDef). +func DatasetToGraph(scope *Scope, input_dataset tf.Output, optional ...DatasetToGraphAttr) (graph tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "DatasetToGraph", + Input: []tf.Input{ + input_dataset, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Concatenates quantized tensors along one dimension. +// +// Arguments: +// +// concat_dim: 0-D. The dimension along which to concatenate. Must be in the +// +// range [0, rank(values)). +// +// values: The `N` Tensors to concatenate. Their ranks and types must match, +// +// and their sizes must match in all dimensions except `concat_dim`. +// +// input_mins: The minimum scalar values for each of the input tensors. +// input_maxes: The maximum scalar values for each of the input tensors. +// +// Returns: +// +// output: A `Tensor` with the concatenation of values stacked along the +// +// `concat_dim` dimension. This tensor's shape matches that of `values` except +// in `concat_dim` where it has the sum of the sizes. +// +// output_min: The float value that the minimum quantized output value represents. +// output_max: The float value that the maximum quantized output value represents. +func QuantizedConcat(scope *Scope, concat_dim tf.Output, values []tf.Output, input_mins []tf.Output, input_maxes []tf.Output) (output tf.Output, output_min tf.Output, output_max tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "QuantizedConcat", + Input: []tf.Input{ + concat_dim, tf.OutputList(values), tf.OutputList(input_mins), tf.OutputList(input_maxes), + }, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// TensorListSetItemAttr is an optional argument to TensorListSetItem. +type TensorListSetItemAttr func(optionalAttr) + +// TensorListSetItemResizeIfIndexOutOfBounds sets the optional resize_if_index_out_of_bounds attribute to value. +// If not specified, defaults to false +func TensorListSetItemResizeIfIndexOutOfBounds(value bool) TensorListSetItemAttr { + return func(m optionalAttr) { + m["resize_if_index_out_of_bounds"] = value + } +} + +// Sets the index-th position of the list to contain the given tensor. +// +// input_handle: the list +// index: the position in the list to which the tensor will be assigned +// item: the element to be assigned to that position +// output_handle: the new list, with the element in the proper position +func TensorListSetItem(scope *Scope, input_handle tf.Output, index tf.Output, item tf.Output, optional ...TensorListSetItemAttr) (output_handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "TensorListSetItem", + Input: []tf.Input{ + input_handle, index, item, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Clips tensor values to a specified min and max. +// +// Given a tensor `t`, this operation returns a tensor of the same type and +// shape as `t` with its values clipped to `clip_value_min` and `clip_value_max`. +// Any values less than `clip_value_min` are set to `clip_value_min`. Any values +// greater than `clip_value_max` are set to `clip_value_max`. +// +// Arguments: +// +// t: A `Tensor`. +// clip_value_min: A 0-D (scalar) `Tensor`, or a `Tensor` with the same shape +// +// as `t`. The minimum value to clip by. +// +// clip_value_max: A 0-D (scalar) `Tensor`, or a `Tensor` with the same shape +// +// as `t`. The maximum value to clip by. +// +// Returns A clipped `Tensor` with the same shape as input 't'. +func ClipByValue(scope *Scope, t tf.Output, clip_value_min tf.Output, clip_value_max tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "ClipByValue", + Input: []tf.Input{ + t, clip_value_min, clip_value_max, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// MatrixSolveAttr is an optional argument to MatrixSolve. +type MatrixSolveAttr func(optionalAttr) + +// MatrixSolveAdjoint sets the optional adjoint attribute to value. +// +// value: Boolean indicating whether to solve with `matrix` or its (block-wise) +// adjoint. +// If not specified, defaults to false +func MatrixSolveAdjoint(value bool) MatrixSolveAttr { + return func(m optionalAttr) { + m["adjoint"] = value + } +} + +// Solves systems of linear equations. +// +// `Matrix` is a tensor of shape `[..., M, M]` whose inner-most 2 dimensions +// form square matrices. `Rhs` is a tensor of shape `[..., M, K]`. The `output` is +// a tensor shape `[..., M, K]`. If `adjoint` is `False` then each output matrix +// satisfies `matrix[..., :, :] * output[..., :, :] = rhs[..., :, :]`. +// If `adjoint` is `True` then each output matrix satisfies +// `adjoint(matrix[..., :, :]) * output[..., :, :] = rhs[..., :, :]`. +// +// Arguments: +// +// matrix: Shape is `[..., M, M]`. +// rhs: Shape is `[..., M, K]`. +// +// Returns Shape is `[..., M, K]`. +func MatrixSolve(scope *Scope, matrix tf.Output, rhs tf.Output, optional ...MatrixSolveAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "MatrixSolve", + Input: []tf.Input{ + matrix, rhs, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns an element-wise indication of the sign of a number. +// +// `y = sign(x) = -1` if `x < 0`; 0 if `x == 0`; 1 if `x > 0`. +// +// For complex numbers, `y = sign(x) = x / |x|` if `x != 0`, otherwise `y = 0`. +// +// Example usage: +// >>> tf.math.sign([0., 2., -3.]) +// +func Sign(scope *Scope, x tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Sign", + Input: []tf.Input{ + x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Outputs a tensor containing the reduction across all input tensors. +// +// Outputs a tensor containing the reduction across all input tensors passed to ops +// within the same `shared_name. +// +// The graph should be constructed so if one op runs with shared_name value `c`, +// then `num_devices` ops will run with shared_name value `c`. Failure to do so +// will cause the graph execution to fail to complete. +// +// input: the input to the reduction +// data: the value of the reduction across all `num_devices` devices. +// reduction: the reduction operation to perform. +// num_devices: The number of devices participating in this reduction. +// shared_name: Identifier that shared between ops of the same reduction. +func NcclAllReduce(scope *Scope, input tf.Output, reduction string, num_devices int64, shared_name string) (data tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"reduction": reduction, "num_devices": num_devices, "shared_name": shared_name} + opspec := tf.OpSpec{ + Type: "NcclAllReduce", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// DepthwiseConv2dNativeBackpropInputAttr is an optional argument to DepthwiseConv2dNativeBackpropInput. +type DepthwiseConv2dNativeBackpropInputAttr func(optionalAttr) + +// DepthwiseConv2dNativeBackpropInputExplicitPaddings sets the optional explicit_paddings attribute to value. +// If not specified, defaults to <> +func DepthwiseConv2dNativeBackpropInputExplicitPaddings(value []int64) DepthwiseConv2dNativeBackpropInputAttr { + return func(m optionalAttr) { + m["explicit_paddings"] = value + } +} + +// DepthwiseConv2dNativeBackpropInputDataFormat sets the optional data_format attribute to value. +// +// value: Specify the data format of the input and output data. With the +// default format "NHWC", the data is stored in the order of: +// +// [batch, height, width, channels]. +// +// Alternatively, the format could be "NCHW", the data storage order of: +// +// [batch, channels, height, width]. +// +// If not specified, defaults to "NHWC" +func DepthwiseConv2dNativeBackpropInputDataFormat(value string) DepthwiseConv2dNativeBackpropInputAttr { + return func(m optionalAttr) { + m["data_format"] = value + } +} + +// DepthwiseConv2dNativeBackpropInputDilations sets the optional dilations attribute to value. +// +// value: 1-D tensor of length 4. The dilation factor for each dimension of +// `input`. If set to k > 1, there will be k-1 skipped cells between each filter +// element on that dimension. The dimension order is determined by the value of +// `data_format`, see above for details. Dilations in the batch and depth +// dimensions must be 1. +// If not specified, defaults to +func DepthwiseConv2dNativeBackpropInputDilations(value []int64) DepthwiseConv2dNativeBackpropInputAttr { + return func(m optionalAttr) { + m["dilations"] = value + } +} + +// Computes the gradients of depthwise convolution with respect to the input. +// +// Arguments: +// +// input_sizes: An integer vector representing the shape of `input`, based +// +// on `data_format`. For example, if `data_format` is 'NHWC' then +// +// `input` is a 4-D `[batch, height, width, channels]` tensor. +// filter: 4-D with shape +// +// `[filter_height, filter_width, in_channels, depthwise_multiplier]`. +// +// out_backprop: 4-D with shape based on `data_format`. +// +// For example, if `data_format` is 'NHWC' then +// out_backprop shape is `[batch, out_height, out_width, out_channels]`. +// Gradients w.r.t. the output of the convolution. +// +// strides: The stride of the sliding window for each dimension of the input +// +// of the convolution. +// +// padding: The type of padding algorithm to use. +// +// Returns 4-D with shape according to `data_format`. For example, if +// `data_format` is 'NHWC', output shape is `[batch, in_height, +// in_width, in_channels]`. Gradient w.r.t. the input of the +// convolution. +func DepthwiseConv2dNativeBackpropInput(scope *Scope, input_sizes tf.Output, filter tf.Output, out_backprop tf.Output, strides []int64, padding string, optional ...DepthwiseConv2dNativeBackpropInputAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"strides": strides, "padding": padding} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "DepthwiseConv2dNativeBackpropInput", + Input: []tf.Input{ + input_sizes, filter, out_backprop, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// PriorityQueueV2Attr is an optional argument to PriorityQueueV2. +type PriorityQueueV2Attr func(optionalAttr) + +// PriorityQueueV2ComponentTypes sets the optional component_types attribute to value. +// +// value: The type of each component in a value. +// If not specified, defaults to <> +// +// REQUIRES: len(value) >= 0 +func PriorityQueueV2ComponentTypes(value []tf.DataType) PriorityQueueV2Attr { + return func(m optionalAttr) { + m["component_types"] = value + } +} + +// PriorityQueueV2Capacity sets the optional capacity attribute to value. +// +// value: The upper bound on the number of elements in this queue. +// Negative numbers mean no limit. +// If not specified, defaults to -1 +func PriorityQueueV2Capacity(value int64) PriorityQueueV2Attr { + return func(m optionalAttr) { + m["capacity"] = value + } +} + +// PriorityQueueV2Container sets the optional container attribute to value. +// +// value: If non-empty, this queue is placed in the given container. +// Otherwise, a default container is used. +// If not specified, defaults to "" +func PriorityQueueV2Container(value string) PriorityQueueV2Attr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// PriorityQueueV2SharedName sets the optional shared_name attribute to value. +// +// value: If non-empty, this queue will be shared under the given name +// across multiple sessions. +// If not specified, defaults to "" +func PriorityQueueV2SharedName(value string) PriorityQueueV2Attr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// A queue that produces elements sorted by the first component value. +// +// Note that the PriorityQueue requires the first component of any element +// to be a scalar int64, in addition to the other elements declared by +// component_types. Therefore calls to Enqueue and EnqueueMany (resp. Dequeue +// and DequeueMany) on a PriorityQueue will all require (resp. output) one extra +// entry in their input (resp. output) lists. +// +// Arguments: +// +// shapes: The shape of each component in a value. The length of this attr must +// +// be either 0 or the same as the length of component_types. If the length of +// this attr is 0, the shapes of queue elements are not constrained, and +// only one element may be dequeued at a time. +// +// Returns The handle to the queue. +func PriorityQueueV2(scope *Scope, shapes []tf.Shape, optional ...PriorityQueueV2Attr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"shapes": shapes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "PriorityQueueV2", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// StageAttr is an optional argument to Stage. +type StageAttr func(optionalAttr) + +// StageCapacity sets the optional capacity attribute to value. +// +// value: Maximum number of elements in the Staging Area. If > 0, inserts +// on the container will block when the capacity is reached. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func StageCapacity(value int64) StageAttr { + return func(m optionalAttr) { + m["capacity"] = value + } +} + +// StageMemoryLimit sets the optional memory_limit attribute to value. +// +// value: The maximum number of bytes allowed for Tensors in the Staging Area. +// If > 0, inserts will block until sufficient space is available. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func StageMemoryLimit(value int64) StageAttr { + return func(m optionalAttr) { + m["memory_limit"] = value + } +} + +// StageContainer sets the optional container attribute to value. +// +// value: If non-empty, this queue is placed in the given container. Otherwise, +// a default container is used. +// If not specified, defaults to "" +func StageContainer(value string) StageAttr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// StageSharedName sets the optional shared_name attribute to value. +// +// value: It is necessary to match this name to the matching Unstage Op. +// If not specified, defaults to "" +func StageSharedName(value string) StageAttr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// Stage values similar to a lightweight Enqueue. +// +// The basic functionality of this Op is similar to a queue with many +// fewer capabilities and options. This Op is optimized for performance. +// +// Arguments: +// +// values: a list of tensors +// +// dtypes A list of data types that inserted values should adhere to. +// +// Returns the created operation. +func Stage(scope *Scope, values []tf.Output, optional ...StageAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Stage", + Input: []tf.Input{ + tf.OutputList(values), + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// Selects elements from `x` or `y`, depending on `condition`. +// +// The `x`, and `y` tensors must all have the same shape, and the +// output will also have that shape. +// +// The `condition` tensor must be a scalar if `x` and `y` are scalars. +// If `x` and `y` are vectors or higher rank, then `condition` must be either a +// scalar, a vector with size matching the first dimension of `x`, or must have +// the same shape as `x`. +// +// The `condition` tensor acts as a mask that chooses, based on the value at each +// element, whether the corresponding element / row in the output should be +// taken from `x` (if true) or `y` (if false). +// +// If `condition` is a vector and `x` and `y` are higher rank matrices, then +// it chooses which row (outer dimension) to copy from `x` and `y`. +// If `condition` has the same shape as `x` and `y`, then it chooses which +// element to copy from `x` and `y`. +// +// For example: +// +// ```python +// # 'condition' tensor is [[True, False] +// # [False, True]] +// # 't' is [[1, 2], +// # [3, 4]] +// # 'e' is [[5, 6], +// # [7, 8]] +// select(condition, t, e) # => [[1, 6], [7, 4]] +// +// # 'condition' tensor is [True, False] +// # 't' is [[1, 2], +// # [3, 4]] +// # 'e' is [[5, 6], +// # [7, 8]] +// select(condition, t, e) ==> [[1, 2], +// +// [7, 8]] +// +// ``` +// +// Arguments: +// +// x: = A `Tensor` which may have the same shape as `condition`. +// +// If `condition` is rank 1, `x` may have higher rank, +// but its first dimension must match the size of `condition`. +// +// y: = A `Tensor` with the same type and shape as `x`. +// +// Returns = A `Tensor` with the same type and shape as `x` and `y`. +func Select(scope *Scope, condition tf.Output, x tf.Output, y tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Select", + Input: []tf.Input{ + condition, x, y, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Generates values in an interval. +// +// A sequence of `num` evenly-spaced values are generated beginning at `start`. +// If `num > 1`, the values in the sequence increase by `stop - start / num - 1`, +// so that the last one is exactly `stop`. +// +// For example: +// +// ``` +// tf.linspace(10.0, 12.0, 3, name="linspace") => [ 10.0 11.0 12.0] +// ``` +// +// Arguments: +// +// start: 0-D tensor. First entry in the range. +// stop: 0-D tensor. Last entry in the range. +// num: 0-D tensor. Number of values to generate. +// +// Returns 1-D. The generated values. +func LinSpace(scope *Scope, start tf.Output, stop tf.Output, num tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "LinSpace", + Input: []tf.Input{ + start, stop, num, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// FakeQuantWithMinMaxArgsAttr is an optional argument to FakeQuantWithMinMaxArgs. +type FakeQuantWithMinMaxArgsAttr func(optionalAttr) + +// FakeQuantWithMinMaxArgsMin sets the optional min attribute to value. +// If not specified, defaults to -6 +func FakeQuantWithMinMaxArgsMin(value float32) FakeQuantWithMinMaxArgsAttr { + return func(m optionalAttr) { + m["min"] = value + } +} + +// FakeQuantWithMinMaxArgsMax sets the optional max attribute to value. +// If not specified, defaults to 6 +func FakeQuantWithMinMaxArgsMax(value float32) FakeQuantWithMinMaxArgsAttr { + return func(m optionalAttr) { + m["max"] = value + } +} + +// FakeQuantWithMinMaxArgsNumBits sets the optional num_bits attribute to value. +// If not specified, defaults to 8 +func FakeQuantWithMinMaxArgsNumBits(value int64) FakeQuantWithMinMaxArgsAttr { + return func(m optionalAttr) { + m["num_bits"] = value + } +} + +// FakeQuantWithMinMaxArgsNarrowRange sets the optional narrow_range attribute to value. +// If not specified, defaults to false +func FakeQuantWithMinMaxArgsNarrowRange(value bool) FakeQuantWithMinMaxArgsAttr { + return func(m optionalAttr) { + m["narrow_range"] = value + } +} + +// Fake-quantize the 'inputs' tensor, type float to 'outputs' tensor of same type. +// +// # Attributes +// +// * `[min; max]` define the clamping range for the `inputs` data. +// * `inputs` values are quantized into the quantization range ( +// `[0; 2^num_bits - 1]` when `narrow_range` is false and `[1; 2^num_bits - 1]` +// when it is true) and then de-quantized and output as floats in `[min; max]` +// interval. +// * `num_bits` is the bitwidth of the quantization; between 2 and 16, inclusive. +// +// Before quantization, `min` and `max` values are adjusted with the following +// logic. +// It is suggested to have `min <= 0 <= max`. If `0` is not in the range of values, +// the behavior can be unexpected: +// +// * If `0 < min < max`: `min_adj = 0` and `max_adj = max - min`. +// * If `min < max < 0`: `min_adj = min - max` and `max_adj = 0`. +// * If `min <= 0 <= max`: `scale = (max - min) / (2^num_bits - 1) `, +// `min_adj = scale * round(min / scale)` and `max_adj = max + min_adj - min`. +// +// Quantization is called fake since the output is still in floating point. +func FakeQuantWithMinMaxArgs(scope *Scope, inputs tf.Output, optional ...FakeQuantWithMinMaxArgsAttr) (outputs tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "FakeQuantWithMinMaxArgs", + Input: []tf.Input{ + inputs, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ExperimentalAutoShardDatasetAttr is an optional argument to ExperimentalAutoShardDataset. +type ExperimentalAutoShardDatasetAttr func(optionalAttr) + +// ExperimentalAutoShardDatasetAutoShardPolicy sets the optional auto_shard_policy attribute to value. +// If not specified, defaults to 0 +func ExperimentalAutoShardDatasetAutoShardPolicy(value int64) ExperimentalAutoShardDatasetAttr { + return func(m optionalAttr) { + m["auto_shard_policy"] = value + } +} + +// Creates a dataset that shards the input dataset. +// +// Creates a dataset that shards the input dataset by num_workers, returning a +// sharded dataset for the index-th worker. This attempts to automatically shard +// a dataset by examining the Dataset graph and inserting a shard op before the +// inputs to a reader Dataset (e.g. CSVDataset, TFRecordDataset). +// +// This dataset will throw a NotFound error if we cannot shard the dataset +// automatically. +// +// Arguments: +// +// input_dataset: A variant tensor representing the input dataset. +// num_workers: A scalar representing the number of workers to distribute this dataset across. +// index: A scalar representing the index of the current worker out of num_workers. +func ExperimentalAutoShardDataset(scope *Scope, input_dataset tf.Output, num_workers tf.Output, index tf.Output, output_types []tf.DataType, output_shapes []tf.Shape, optional ...ExperimentalAutoShardDatasetAttr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ExperimentalAutoShardDataset", + Input: []tf.Input{ + input_dataset, num_workers, index, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// DenseBincountAttr is an optional argument to DenseBincount. +type DenseBincountAttr func(optionalAttr) + +// DenseBincountBinaryOutput sets the optional binary_output attribute to value. +// +// value: bool; Whether the kernel should count the appearance or number of occurrences. +// If not specified, defaults to false +func DenseBincountBinaryOutput(value bool) DenseBincountAttr { + return func(m optionalAttr) { + m["binary_output"] = value + } +} + +// Counts the number of occurrences of each value in an integer array. +// +// Outputs a vector with length `size` and the same dtype as `weights`. If +// `weights` are empty, then index `i` stores the number of times the value `i` is +// counted in `arr`. If `weights` are non-empty, then index `i` stores the sum of +// the value in `weights` at each index where the corresponding value in `arr` is +// `i`. +// +// Values in `arr` outside of the range [0, size) are ignored. +// +// Arguments: +// +// input: 1D or 2D int `Tensor`. +// size: non-negative int scalar `Tensor`. +// weights: is an int32, int64, float32, or float64 `Tensor` with the same +// +// shape as `arr`, or a length-0 `Tensor`, in which case it acts as all weights +// equal to 1. +// +// Returns 1D `Tensor` with length equal to `size` or 2D `Tensor` with [batch_size, `size`]. +// The counts or summed weights for each value in the range [0, size). +func DenseBincount(scope *Scope, input tf.Output, size tf.Output, weights tf.Output, optional ...DenseBincountAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "DenseBincount", + Input: []tf.Input{ + input, size, weights, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes the maximum along segments of a tensor. +// +// Read +// [the section on segmentation](https://tensorflow.org/api_docs/python/tf/math#Segmentation) +// for an explanation of segments. +// +// This operator is similar to the unsorted segment sum operator found +// [(here)](../../../api_docs/python/math_ops.md#UnsortedSegmentSum). +// Instead of computing the sum over segments, it computes the maximum such that: +// +// \\(output_i = \max_{j...} data[j...]\\) where max is over tuples `j...` such +// that `segment_ids[j...] == i`. +// +// If the maximum is empty for a given segment ID `i`, it outputs the smallest +// possible value for the specific numeric type, +// `output[i] = numeric_limits::lowest()`. +// +// If the given segment ID `i` is negative, then the corresponding value is +// dropped, and will not be included in the result. +// +//
+// +//
+// +// For example: +// +// ``` python +// c = tf.constant([[1,2,3,4], [5,6,7,8], [4,3,2,1]]) +// tf.unsorted_segment_max(c, tf.constant([0, 1, 0]), num_segments=2) +// # ==> [[ 4, 3, 3, 4], +// # [5, 6, 7, 8]] +// ``` +// +// Arguments: +// +// segment_ids: A tensor whose shape is a prefix of `data.shape`. +// +// Returns Has same shape as data, except for the first `segment_ids.rank` +// dimensions, which are replaced with a single dimension which has size +// `num_segments`. +func UnsortedSegmentMax(scope *Scope, data tf.Output, segment_ids tf.Output, num_segments tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "UnsortedSegmentMax", + Input: []tf.Input{ + data, segment_ids, num_segments, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// LearnedUnigramCandidateSamplerAttr is an optional argument to LearnedUnigramCandidateSampler. +type LearnedUnigramCandidateSamplerAttr func(optionalAttr) + +// LearnedUnigramCandidateSamplerSeed sets the optional seed attribute to value. +// +// value: If either seed or seed2 are set to be non-zero, the random number +// generator is seeded by the given seed. Otherwise, it is seeded by a +// random seed. +// If not specified, defaults to 0 +func LearnedUnigramCandidateSamplerSeed(value int64) LearnedUnigramCandidateSamplerAttr { + return func(m optionalAttr) { + m["seed"] = value + } +} + +// LearnedUnigramCandidateSamplerSeed2 sets the optional seed2 attribute to value. +// +// value: An second seed to avoid seed collision. +// If not specified, defaults to 0 +func LearnedUnigramCandidateSamplerSeed2(value int64) LearnedUnigramCandidateSamplerAttr { + return func(m optionalAttr) { + m["seed2"] = value + } +} + +// Generates labels for candidate sampling with a learned unigram distribution. +// +// See explanations of candidate sampling and the data formats at +// go/candidate-sampling. +// +// For each batch, this op picks a single set of sampled candidate labels. +// +// The advantages of sampling candidates per-batch are simplicity and the +// possibility of efficient dense matrix multiplication. The disadvantage is that +// the sampled candidates must be chosen independently of the context and of the +// true labels. +// +// Arguments: +// +// true_classes: A batch_size * num_true matrix, in which each row contains the +// +// IDs of the num_true target_classes in the corresponding original label. +// +// num_true: Number of true labels per context. +// num_sampled: Number of candidates to randomly sample. +// unique: If unique is true, we sample with rejection, so that all sampled +// +// candidates in a batch are unique. This requires some approximation to +// estimate the post-rejection sampling probabilities. +// +// range_max: The sampler will sample integers from the interval [0, range_max). +// +// Returns: +// +// sampled_candidates: A vector of length num_sampled, in which each element is +// +// the ID of a sampled candidate. +// +// true_expected_count: A batch_size * num_true matrix, representing +// +// the number of times each candidate is expected to occur in a batch +// of sampled candidates. If unique=true, then this is a probability. +// +// sampled_expected_count: A vector of length num_sampled, for each sampled +// +// candidate representing the number of times the candidate is expected +// to occur in a batch of sampled candidates. If unique=true, then this is a +// probability. +func LearnedUnigramCandidateSampler(scope *Scope, true_classes tf.Output, num_true int64, num_sampled int64, unique bool, range_max int64, optional ...LearnedUnigramCandidateSamplerAttr) (sampled_candidates tf.Output, true_expected_count tf.Output, sampled_expected_count tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_true": num_true, "num_sampled": num_sampled, "unique": unique, "range_max": range_max} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "LearnedUnigramCandidateSampler", + Input: []tf.Input{ + true_classes, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// StatelessRandomUniformFullIntV2Attr is an optional argument to StatelessRandomUniformFullIntV2. +type StatelessRandomUniformFullIntV2Attr func(optionalAttr) + +// StatelessRandomUniformFullIntV2Dtype sets the optional dtype attribute to value. +// +// value: The type of the output. +// If not specified, defaults to DT_UINT64 +func StatelessRandomUniformFullIntV2Dtype(value tf.DataType) StatelessRandomUniformFullIntV2Attr { + return func(m optionalAttr) { + m["dtype"] = value + } +} + +// Outputs deterministic pseudorandom random integers from a uniform distribution. +// +// The generated values are uniform integers covering the whole range of `dtype`. +// +// The outputs are a deterministic function of `shape`, `key`, `counter` and `alg`. +// +// Arguments: +// +// shape: The shape of the output tensor. +// key: Key for the counter-based RNG algorithm (shape uint64[1]). +// counter: Initial counter for the counter-based RNG algorithm (shape uint64[2] or uint64[1] depending on the algorithm). If a larger vector is given, only the needed portion on the left (i.e. [:N]) will be used. +// alg: The RNG algorithm (shape int32[]). +// +// Returns Random values with specified shape. +func StatelessRandomUniformFullIntV2(scope *Scope, shape tf.Output, key tf.Output, counter tf.Output, alg tf.Output, optional ...StatelessRandomUniformFullIntV2Attr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "StatelessRandomUniformFullIntV2", + Input: []tf.Input{ + shape, key, counter, alg, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// CudnnRNNParamsSizeAttr is an optional argument to CudnnRNNParamsSize. +type CudnnRNNParamsSizeAttr func(optionalAttr) + +// CudnnRNNParamsSizeRnnMode sets the optional rnn_mode attribute to value. +// If not specified, defaults to "lstm" +func CudnnRNNParamsSizeRnnMode(value string) CudnnRNNParamsSizeAttr { + return func(m optionalAttr) { + m["rnn_mode"] = value + } +} + +// CudnnRNNParamsSizeInputMode sets the optional input_mode attribute to value. +// If not specified, defaults to "linear_input" +func CudnnRNNParamsSizeInputMode(value string) CudnnRNNParamsSizeAttr { + return func(m optionalAttr) { + m["input_mode"] = value + } +} + +// CudnnRNNParamsSizeDirection sets the optional direction attribute to value. +// If not specified, defaults to "unidirectional" +func CudnnRNNParamsSizeDirection(value string) CudnnRNNParamsSizeAttr { + return func(m optionalAttr) { + m["direction"] = value + } +} + +// CudnnRNNParamsSizeDropout sets the optional dropout attribute to value. +// If not specified, defaults to 0 +func CudnnRNNParamsSizeDropout(value float32) CudnnRNNParamsSizeAttr { + return func(m optionalAttr) { + m["dropout"] = value + } +} + +// CudnnRNNParamsSizeSeed sets the optional seed attribute to value. +// If not specified, defaults to 0 +func CudnnRNNParamsSizeSeed(value int64) CudnnRNNParamsSizeAttr { + return func(m optionalAttr) { + m["seed"] = value + } +} + +// CudnnRNNParamsSizeSeed2 sets the optional seed2 attribute to value. +// If not specified, defaults to 0 +func CudnnRNNParamsSizeSeed2(value int64) CudnnRNNParamsSizeAttr { + return func(m optionalAttr) { + m["seed2"] = value + } +} + +// CudnnRNNParamsSizeNumProj sets the optional num_proj attribute to value. +// If not specified, defaults to 0 +func CudnnRNNParamsSizeNumProj(value int64) CudnnRNNParamsSizeAttr { + return func(m optionalAttr) { + m["num_proj"] = value + } +} + +// Computes size of weights that can be used by a Cudnn RNN model. +// +// Return the params size that can be used by the Cudnn RNN model. Subsequent +// weight allocation and initialization should use this size. +// +// num_layers: Specifies the number of layers in the RNN model. +// num_units: Specifies the size of the hidden state. +// input_size: Specifies the size of the input state. +// rnn_mode: Indicates the type of the RNN model. +// input_mode: Indicate whether there is a linear projection between the input and +// +// The actual computation before the first layer. 'skip_input' is only allowed +// when input_size == num_units; 'auto_select' implies 'skip_input' when +// input_size == num_units; otherwise, it implies 'linear_input'. +// +// direction: Indicates whether a bidirectional model will be used. +// +// dir = (direction == bidirectional) ? 2 : 1 +// +// dropout: dropout probability. When set to 0., dropout is disabled. +// seed: the 1st part of a seed to initialize dropout. +// seed2: the 2nd part of a seed to initialize dropout. +// params_size: The size of the params buffer that should be allocated and +// +// initialized for this RNN model. Note that this params buffer may not be +// compatible across GPUs. Please use CudnnRNNParamsWeights and +// CudnnRNNParamsBiases to save and restore them in a way that is compatible +// across different runs. +func CudnnRNNParamsSize(scope *Scope, num_layers tf.Output, num_units tf.Output, input_size tf.Output, T tf.DataType, S tf.DataType, optional ...CudnnRNNParamsSizeAttr) (params_size tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"T": T, "S": S} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "CudnnRNNParamsSize", + Input: []tf.Input{ + num_layers, num_units, input_size, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Deprecated. Use TensorArrayReadV3 +// +// DEPRECATED at GraphDef version 26: Use TensorArrayReadV3 +func TensorArrayReadV2(scope *Scope, handle tf.Output, index tf.Output, flow_in tf.Output, dtype tf.DataType) (value tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtype": dtype} + opspec := tf.OpSpec{ + Type: "TensorArrayReadV2", + Input: []tf.Input{ + handle, index, flow_in, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// FusedResizeAndPadConv2DAttr is an optional argument to FusedResizeAndPadConv2D. +type FusedResizeAndPadConv2DAttr func(optionalAttr) + +// FusedResizeAndPadConv2DResizeAlignCorners sets the optional resize_align_corners attribute to value. +// +// value: If true, the centers of the 4 corner pixels of the input and output tensors are +// aligned, preserving the values at the corner pixels. Defaults to false. +// If not specified, defaults to false +func FusedResizeAndPadConv2DResizeAlignCorners(value bool) FusedResizeAndPadConv2DAttr { + return func(m optionalAttr) { + m["resize_align_corners"] = value + } +} + +// Performs a resize and padding as a preprocess during a convolution. +// +// It's often possible to do spatial transformations more efficiently as part of +// the packing stage of a convolution, so this op allows for an optimized +// implementation where these stages are fused together. This prevents the need to +// write out the intermediate results as whole tensors, reducing memory pressure, +// and we can get some latency gains by merging the transformation calculations. +// The data_format attribute for Conv2D isn't supported by this op, and defaults to +// 'NHWC' order. +// Internally this op uses a single per-graph scratch buffer, which means that it +// will block if multiple versions are being run in parallel. This is because this +// operator is primarily an optimization to minimize memory usage. +// +// Arguments: +// +// input: 4-D with shape `[batch, in_height, in_width, in_channels]`. +// size: A 1-D int32 Tensor of 2 elements: `new_height, new_width`. The +// +// new size for the images. +// +// paddings: A two-column matrix specifying the padding sizes. The number of +// +// rows must be the same as the rank of `input`. +// +// filter: 4-D with shape +// +// `[filter_height, filter_width, in_channels, out_channels]`. +// +// strides: 1-D of length 4. The stride of the sliding window for each dimension +// +// of `input`. Must be in the same order as the dimension specified with format. +// +// padding: The type of padding algorithm to use. +func FusedResizeAndPadConv2D(scope *Scope, input tf.Output, size tf.Output, paddings tf.Output, filter tf.Output, mode string, strides []int64, padding string, optional ...FusedResizeAndPadConv2DAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"mode": mode, "strides": strides, "padding": padding} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "FusedResizeAndPadConv2D", + Input: []tf.Input{ + input, size, paddings, filter, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// TensorListStackAttr is an optional argument to TensorListStack. +type TensorListStackAttr func(optionalAttr) + +// TensorListStackNumElements sets the optional num_elements attribute to value. +// If not specified, defaults to -1 +func TensorListStackNumElements(value int64) TensorListStackAttr { + return func(m optionalAttr) { + m["num_elements"] = value + } +} + +// Stacks all tensors in the list. +// +// Requires that all tensors have the same shape. +// +// input_handle: the input list +// tensor: the gathered result +// num_elements: optional. If not -1, the number of elements in the list. +func TensorListStack(scope *Scope, input_handle tf.Output, element_shape tf.Output, element_dtype tf.DataType, optional ...TensorListStackAttr) (tensor tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"element_dtype": element_dtype} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "TensorListStack", + Input: []tf.Input{ + input_handle, element_shape, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns a Tensor stack of all keys in a tensor map. +// +// input_handle: the input map +// keys: the returned Tensor of all keys in the map +func TensorMapStackKeys(scope *Scope, input_handle tf.Output, key_dtype tf.DataType) (keys tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"key_dtype": key_dtype} + opspec := tf.OpSpec{ + Type: "TensorMapStackKeys", + Input: []tf.Input{ + input_handle, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// HistogramFixedWidthAttr is an optional argument to HistogramFixedWidth. +type HistogramFixedWidthAttr func(optionalAttr) + +// HistogramFixedWidthDtype sets the optional dtype attribute to value. +// If not specified, defaults to DT_INT32 +func HistogramFixedWidthDtype(value tf.DataType) HistogramFixedWidthAttr { + return func(m optionalAttr) { + m["dtype"] = value + } +} + +// Return histogram of values. +// +// Given the tensor `values`, this operation returns a rank 1 histogram counting +// the number of entries in `values` that fall into every bin. The bins are +// equal width and determined by the arguments `value_range` and `nbins`. +// +// ```python +// # Bins will be: (-inf, 1), [1, 2), [2, 3), [3, 4), [4, inf) +// nbins = 5 +// value_range = [0.0, 5.0] +// new_values = [-1.0, 0.0, 1.5, 2.0, 5.0, 15] +// +// with tf.get_default_session() as sess: +// +// hist = tf.histogram_fixed_width(new_values, value_range, nbins=5) +// variables.global_variables_initializer().run() +// sess.run(hist) => [2, 1, 1, 0, 2] +// +// ``` +// +// Arguments: +// +// values: Numeric `Tensor`. +// value_range: Shape [2] `Tensor` of same `dtype` as `values`. +// +// values <= value_range[0] will be mapped to hist[0], +// values >= value_range[1] will be mapped to hist[-1]. +// +// nbins: Scalar `int32 Tensor`. Number of histogram bins. +// +// Returns A 1-D `Tensor` holding histogram of values. +func HistogramFixedWidth(scope *Scope, values tf.Output, value_range tf.Output, nbins tf.Output, optional ...HistogramFixedWidthAttr) (out tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "HistogramFixedWidth", + Input: []tf.Input{ + values, value_range, nbins, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// BoostedTreesQuantileStreamResourceHandleOpAttr is an optional argument to BoostedTreesQuantileStreamResourceHandleOp. +type BoostedTreesQuantileStreamResourceHandleOpAttr func(optionalAttr) + +// BoostedTreesQuantileStreamResourceHandleOpContainer sets the optional container attribute to value. +// If not specified, defaults to "" +func BoostedTreesQuantileStreamResourceHandleOpContainer(value string) BoostedTreesQuantileStreamResourceHandleOpAttr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// BoostedTreesQuantileStreamResourceHandleOpSharedName sets the optional shared_name attribute to value. +// If not specified, defaults to "" +func BoostedTreesQuantileStreamResourceHandleOpSharedName(value string) BoostedTreesQuantileStreamResourceHandleOpAttr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// Creates a handle to a BoostedTreesQuantileStreamResource. +func BoostedTreesQuantileStreamResourceHandleOp(scope *Scope, optional ...BoostedTreesQuantileStreamResourceHandleOpAttr) (resource tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "BoostedTreesQuantileStreamResourceHandleOp", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Makes its input available to the next iteration. +// +// Arguments: +// +// data: The tensor to be made available to the next iteration. +// +// Returns The same tensor as `data`. +func NextIteration(scope *Scope, data tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "NextIteration", + Input: []tf.Input{ + data, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Generates a feature cross from a list of tensors, and returns it as a +// RaggedTensor. See `tf.ragged.cross` for more details. +// +// Arguments: +// +// ragged_values: The values tensor for each RaggedTensor input. +// ragged_row_splits: The row_splits tensor for each RaggedTensor input. +// sparse_indices: The indices tensor for each SparseTensor input. +// sparse_values: The values tensor for each SparseTensor input. +// sparse_shape: The dense_shape tensor for each SparseTensor input. +// dense_inputs: The tf.Tensor inputs. +// input_order: String specifying the tensor type for each input. The `i`th character in +// +// this string specifies the type of the `i`th input, and is one of: 'R' (ragged), +// 'D' (dense), or 'S' (sparse). This attr is used to ensure that the crossed +// values are combined in the order of the inputs from the call to tf.ragged.cross. +// +// Returns: +// +// output_values: The `values` for the returned `RaggedTensor`. +// output_row_splits: The `row_splits` for the returned `RaggedTensor`. +func RaggedCross(scope *Scope, ragged_values []tf.Output, ragged_row_splits []tf.Output, sparse_indices []tf.Output, sparse_values []tf.Output, sparse_shape []tf.Output, dense_inputs []tf.Output, input_order string, hashed_output bool, num_buckets int64, hash_key int64, out_values_type tf.DataType, out_row_splits_type tf.DataType) (output_values tf.Output, output_row_splits tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"input_order": input_order, "hashed_output": hashed_output, "num_buckets": num_buckets, "hash_key": hash_key, "out_values_type": out_values_type, "out_row_splits_type": out_row_splits_type} + opspec := tf.OpSpec{ + Type: "RaggedCross", + Input: []tf.Input{ + tf.OutputList(ragged_values), tf.OutputList(ragged_row_splits), tf.OutputList(sparse_indices), tf.OutputList(sparse_values), tf.OutputList(sparse_shape), tf.OutputList(dense_inputs), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// Converts a dense tensor to a (possibly batched) CSRSparseMatrix. +// +// Arguments: +// +// dense_input: A Dense tensor. +// indices: Indices of nonzero elements. +// +// Returns A (possibly batched) CSRSparseMatrix. +func DenseToCSRSparseMatrix(scope *Scope, dense_input tf.Output, indices tf.Output) (sparse_output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "DenseToCSRSparseMatrix", + Input: []tf.Input{ + dense_input, indices, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// StatelessTruncatedNormalV2Attr is an optional argument to StatelessTruncatedNormalV2. +type StatelessTruncatedNormalV2Attr func(optionalAttr) + +// StatelessTruncatedNormalV2Dtype sets the optional dtype attribute to value. +// +// value: The type of the output. +// If not specified, defaults to DT_FLOAT +func StatelessTruncatedNormalV2Dtype(value tf.DataType) StatelessTruncatedNormalV2Attr { + return func(m optionalAttr) { + m["dtype"] = value + } +} + +// Outputs deterministic pseudorandom values from a truncated normal distribution. +// +// The generated values follow a normal distribution with mean 0 and standard +// deviation 1, except that values whose magnitude is more than 2 standard +// deviations from the mean are dropped and re-picked. +// +// The outputs are a deterministic function of `shape`, `key`, `counter` and `alg`. +// +// Arguments: +// +// shape: The shape of the output tensor. +// key: Key for the counter-based RNG algorithm (shape uint64[1]). +// counter: Initial counter for the counter-based RNG algorithm (shape uint64[2] or uint64[1] depending on the algorithm). If a larger vector is given, only the needed portion on the left (i.e. [:N]) will be used. +// alg: The RNG algorithm (shape int32[]). +// +// Returns Random values with specified shape. +func StatelessTruncatedNormalV2(scope *Scope, shape tf.Output, key tf.Output, counter tf.Output, alg tf.Output, optional ...StatelessTruncatedNormalV2Attr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "StatelessTruncatedNormalV2", + Input: []tf.Input{ + shape, key, counter, alg, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// PrintAttr is an optional argument to Print. +type PrintAttr func(optionalAttr) + +// PrintMessage sets the optional message attribute to value. +// +// value: A string, prefix of the error message. +// If not specified, defaults to "" +func PrintMessage(value string) PrintAttr { + return func(m optionalAttr) { + m["message"] = value + } +} + +// PrintFirstN sets the optional first_n attribute to value. +// +// value: Only log `first_n` number of times. -1 disables logging. +// If not specified, defaults to -1 +func PrintFirstN(value int64) PrintAttr { + return func(m optionalAttr) { + m["first_n"] = value + } +} + +// PrintSummarize sets the optional summarize attribute to value. +// +// value: Only print this many entries of each tensor. +// If not specified, defaults to 3 +func PrintSummarize(value int64) PrintAttr { + return func(m optionalAttr) { + m["summarize"] = value + } +} + +// Prints a list of tensors. +// +// Passes `input` through to `output` and prints `data` when evaluating. +// +// Arguments: +// +// input: The tensor passed to `output` +// data: A list of tensors to print out when op is evaluated. +// +// Returns = The unmodified `input` tensor +func Print(scope *Scope, input tf.Output, data []tf.Output, optional ...PrintAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Print", + Input: []tf.Input{ + input, tf.OutputList(data), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ResourceSparseApplyAdagradV2Attr is an optional argument to ResourceSparseApplyAdagradV2. +type ResourceSparseApplyAdagradV2Attr func(optionalAttr) + +// ResourceSparseApplyAdagradV2UseLocking sets the optional use_locking attribute to value. +// +// value: If `True`, updating of the var and accum tensors will be protected +// by a lock; otherwise the behavior is undefined, but may exhibit less +// contention. +// If not specified, defaults to false +func ResourceSparseApplyAdagradV2UseLocking(value bool) ResourceSparseApplyAdagradV2Attr { + return func(m optionalAttr) { + m["use_locking"] = value + } +} + +// ResourceSparseApplyAdagradV2UpdateSlots sets the optional update_slots attribute to value. +// If not specified, defaults to true +func ResourceSparseApplyAdagradV2UpdateSlots(value bool) ResourceSparseApplyAdagradV2Attr { + return func(m optionalAttr) { + m["update_slots"] = value + } +} + +// Update relevant entries in '*var' and '*accum' according to the adagrad scheme. +// +// That is for rows we have grad for, we update var and accum as follows: +// accum += grad * grad +// var -= lr * grad * (1 / sqrt(accum)) +// +// Arguments: +// +// var_: Should be from a Variable(). +// accum: Should be from a Variable(). +// lr: Learning rate. Must be a scalar. +// epsilon: Constant factor. Must be a scalar. +// grad: The gradient. +// indices: A vector of indices into the first dimension of var and accum. +// +// Returns the created operation. +func ResourceSparseApplyAdagradV2(scope *Scope, var_ tf.Output, accum tf.Output, lr tf.Output, epsilon tf.Output, grad tf.Output, indices tf.Output, optional ...ResourceSparseApplyAdagradV2Attr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ResourceSparseApplyAdagradV2", + Input: []tf.Input{ + var_, accum, lr, epsilon, grad, indices, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// PaddedBatchDatasetV2Attr is an optional argument to PaddedBatchDatasetV2. +type PaddedBatchDatasetV2Attr func(optionalAttr) + +// PaddedBatchDatasetV2ParallelCopy sets the optional parallel_copy attribute to value. +// If not specified, defaults to false +func PaddedBatchDatasetV2ParallelCopy(value bool) PaddedBatchDatasetV2Attr { + return func(m optionalAttr) { + m["parallel_copy"] = value + } +} + +// PaddedBatchDatasetV2Metadata sets the optional metadata attribute to value. +// If not specified, defaults to "" +func PaddedBatchDatasetV2Metadata(value string) PaddedBatchDatasetV2Attr { + return func(m optionalAttr) { + m["metadata"] = value + } +} + +// Creates a dataset that batches and pads `batch_size` elements from the input. +// +// Arguments: +// +// batch_size: A scalar representing the number of elements to accumulate in a +// +// batch. +// +// padded_shapes: A list of int64 tensors representing the desired padded shapes +// +// of the corresponding output components. These shapes may be partially +// specified, using `-1` to indicate that a particular dimension should be +// padded to the maximum size of all batch elements. +// +// padding_values: A list of scalars containing the padding value to use for +// +// each of the outputs. +// +// drop_remainder: A scalar representing whether the last batch should be dropped in case its size +// +// is smaller than desired. +func PaddedBatchDatasetV2(scope *Scope, input_dataset tf.Output, batch_size tf.Output, padded_shapes []tf.Output, padding_values []tf.Output, drop_remainder tf.Output, output_shapes []tf.Shape, optional ...PaddedBatchDatasetV2Attr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_shapes": output_shapes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "PaddedBatchDatasetV2", + Input: []tf.Input{ + input_dataset, batch_size, tf.OutputList(padded_shapes), tf.OutputList(padding_values), drop_remainder, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns the truth value of (x <= y) element-wise. +// +// *NOTE*: `LessEqual` supports broadcasting. More about broadcasting +// [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) +// +// Example: +// +// ```python +// x = tf.constant([5, 4, 6]) +// y = tf.constant([5]) +// tf.math.less_equal(x, y) ==> [True, True, False] +// +// x = tf.constant([5, 4, 6]) +// y = tf.constant([5, 6, 6]) +// tf.math.less_equal(x, y) ==> [True, True, True] +// ``` +func LessEqual(scope *Scope, x tf.Output, y tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "LessEqual", + Input: []tf.Input{ + x, y, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// SendAttr is an optional argument to Send. +type SendAttr func(optionalAttr) + +// SendClientTerminated sets the optional client_terminated attribute to value. +// +// value: If set to true, this indicates that the node was added +// to the graph as a result of a client-side feed or fetch of Tensor data, +// in which case the corresponding send or recv is expected to be managed +// locally by the caller. +// If not specified, defaults to false +func SendClientTerminated(value bool) SendAttr { + return func(m optionalAttr) { + m["client_terminated"] = value + } +} + +// Sends the named tensor from send_device to recv_device. +// +// Arguments: +// +// tensor: The tensor to send. +// tensor_name: The name of the tensor to send. +// send_device: The name of the device sending the tensor. +// send_device_incarnation: The current incarnation of send_device. +// recv_device: The name of the device receiving the tensor. +// +// Returns the created operation. +func Send(scope *Scope, tensor tf.Output, tensor_name string, send_device string, send_device_incarnation int64, recv_device string, optional ...SendAttr) (o *tf.Operation) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"tensor_name": tensor_name, "send_device": send_device, "send_device_incarnation": send_device_incarnation, "recv_device": recv_device} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Send", + Input: []tf.Input{ + tensor, + }, + Attrs: attrs, + } + return scope.AddOperation(opspec) +} + +// Returns the number of work units this Reader has finished processing. +// +// Arguments: +// +// reader_handle: Handle to a Reader. +func ReaderNumWorkUnitsCompletedV2(scope *Scope, reader_handle tf.Output) (units_completed tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "ReaderNumWorkUnitsCompletedV2", + Input: []tf.Input{ + reader_handle, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// An op enabling differentiation of TPU Embeddings. +// +// This op simply returns its first input, which is assumed to have been sliced +// from the Tensors returned by TPUEmbeddingDequeueActivations. The presence of +// this op, and its first argument being a trainable Variable, enables automatic +// differentiation of graphs containing embeddings via the TPU Embedding Python +// libraries. +// +// Arguments: +// +// embedding_variable: A trainable variable, enabling optimizers to find this op. +// sliced_activations: The embedding activations Tensor to return. +// table_id: The id of the table in the embedding layer configuration from which +// +// these activations were computed. +// +// lookup_id: Identifier of the set of embedding indices which produced these +// +// activations. +func TPUEmbeddingActivations(scope *Scope, embedding_variable tf.Output, sliced_activations tf.Output, table_id int64, lookup_id int64) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"table_id": table_id, "lookup_id": lookup_id} + opspec := tf.OpSpec{ + Type: "TPUEmbeddingActivations", + Input: []tf.Input{ + embedding_variable, sliced_activations, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Adds up a `SparseTensor` and a dense `Tensor`, producing a dense `Tensor`. +// +// This Op does not require `a_indices` be sorted in standard lexicographic order. +// +// Arguments: +// +// a_indices: 2-D. The `indices` of the `SparseTensor`, with shape `[nnz, ndims]`. +// a_values: 1-D. The `values` of the `SparseTensor`, with shape `[nnz]`. +// a_shape: 1-D. The `shape` of the `SparseTensor`, with shape `[ndims]`. +// b: `ndims`-D Tensor. With shape `a_shape`. +func SparseTensorDenseAdd(scope *Scope, a_indices tf.Output, a_values tf.Output, a_shape tf.Output, b tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "SparseTensorDenseAdd", + Input: []tf.Input{ + a_indices, a_values, a_shape, b, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// An op to receive a tensor from the host. +// +// output: the tensor that will be received from the host. +// Toutput: element type for output. +// shape: shape for output. +// key: A unique identifier for this region used to match up host transfers. +func XlaRecvFromHost(scope *Scope, Toutput tf.DataType, shape tf.Shape, key string) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"Toutput": Toutput, "shape": shape, "key": key} + opspec := tf.OpSpec{ + Type: "XlaRecvFromHost", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// CopyAttr is an optional argument to Copy. +type CopyAttr func(optionalAttr) + +// CopyTensorName sets the optional tensor_name attribute to value. +// +// value: The name of the input tensor. +// If not specified, defaults to "" +func CopyTensorName(value string) CopyAttr { + return func(m optionalAttr) { + m["tensor_name"] = value + } +} + +// CopyDebugOpsSpec sets the optional debug_ops_spec attribute to value. +// +// value: A list of debug op spec (op, url, gated_grpc) for attached debug +// ops. Each element of the list has the format +// ;;, wherein gated_grpc is boolean represented +// as 0/1. E.g., "DebugIdentity;grpc://foo:3333;1", +// "DebugIdentity;file:///tmp/tfdbg_1;0". +// If not specified, defaults to <> +func CopyDebugOpsSpec(value []string) CopyAttr { + return func(m optionalAttr) { + m["debug_ops_spec"] = value + } +} + +// Copy a tensor from CPU-to-CPU or GPU-to-GPU. +// +// Performs CPU-to-CPU or GPU-to-GPU deep-copying of tensor, depending on the +// device on which the tensor is allocated. +// N.B.: If the all downstream attached debug ops are disabled given the current +// gRPC gating status, the output will simply forward the input tensor without +// deep-copying. See the documentation of Debug* ops for more details. +// +// Unlike the CopyHost Op, this op does not have HostMemory constraint on its +// input or output. +// +// Arguments: +// +// input: Input tensor. +func Copy(scope *Scope, input tf.Output, optional ...CopyAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Copy", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// TextLineReaderV2Attr is an optional argument to TextLineReaderV2. +type TextLineReaderV2Attr func(optionalAttr) + +// TextLineReaderV2SkipHeaderLines sets the optional skip_header_lines attribute to value. +// +// value: Number of lines to skip from the beginning of every file. +// If not specified, defaults to 0 +func TextLineReaderV2SkipHeaderLines(value int64) TextLineReaderV2Attr { + return func(m optionalAttr) { + m["skip_header_lines"] = value + } +} + +// TextLineReaderV2Container sets the optional container attribute to value. +// +// value: If non-empty, this reader is placed in the given container. +// Otherwise, a default container is used. +// If not specified, defaults to "" +func TextLineReaderV2Container(value string) TextLineReaderV2Attr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// TextLineReaderV2SharedName sets the optional shared_name attribute to value. +// +// value: If non-empty, this reader is named in the given bucket +// with this shared_name. Otherwise, the node name is used instead. +// If not specified, defaults to "" +func TextLineReaderV2SharedName(value string) TextLineReaderV2Attr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// A Reader that outputs the lines of a file delimited by '\n'. +// +// Returns The handle to reference the Reader. +func TextLineReaderV2(scope *Scope, optional ...TextLineReaderV2Attr) (reader_handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "TextLineReaderV2", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// FusedBatchNormAttr is an optional argument to FusedBatchNorm. +type FusedBatchNormAttr func(optionalAttr) + +// FusedBatchNormEpsilon sets the optional epsilon attribute to value. +// +// value: A small float number added to the variance of x. +// If not specified, defaults to 0.0001 +func FusedBatchNormEpsilon(value float32) FusedBatchNormAttr { + return func(m optionalAttr) { + m["epsilon"] = value + } +} + +// FusedBatchNormExponentialAvgFactor sets the optional exponential_avg_factor attribute to value. +// If not specified, defaults to 1 +func FusedBatchNormExponentialAvgFactor(value float32) FusedBatchNormAttr { + return func(m optionalAttr) { + m["exponential_avg_factor"] = value + } +} + +// FusedBatchNormDataFormat sets the optional data_format attribute to value. +// +// value: The data format for x and y. Either "NHWC" (default) or "NCHW". +// If not specified, defaults to "NHWC" +func FusedBatchNormDataFormat(value string) FusedBatchNormAttr { + return func(m optionalAttr) { + m["data_format"] = value + } +} + +// FusedBatchNormIsTraining sets the optional is_training attribute to value. +// +// value: A bool value to indicate the operation is for training (default) +// or inference. +// If not specified, defaults to true +func FusedBatchNormIsTraining(value bool) FusedBatchNormAttr { + return func(m optionalAttr) { + m["is_training"] = value + } +} + +// Batch normalization. +// +// Note that the size of 4D Tensors are defined by either "NHWC" or "NCHW". +// The size of 1D Tensors matches the dimension C of the 4D Tensors. +// +// Arguments: +// +// x: A 4D Tensor for input data. +// scale: A 1D Tensor for scaling factor, to scale the normalized x. +// offset: A 1D Tensor for offset, to shift to the normalized x. +// mean: A 1D Tensor for population mean. Used for inference only; +// +// must be empty for training. +// +// variance: A 1D Tensor for population variance. Used for inference only; +// +// must be empty for training. +// +// Returns: +// +// y: A 4D Tensor for output data. +// batch_mean: A 1D Tensor for the computed batch mean, to be used by TensorFlow +// +// to compute the running mean. +// +// batch_variance: A 1D Tensor for the computed batch variance, to be used by +// +// TensorFlow to compute the running variance. +// +// reserve_space_1: A 1D Tensor for the computed batch mean, to be reused +// +// in the gradient computation. +// +// reserve_space_2: A 1D Tensor for the computed batch variance (inverted variance +// +// in the cuDNN case), to be reused in the gradient computation. +func FusedBatchNorm(scope *Scope, x tf.Output, scale tf.Output, offset tf.Output, mean tf.Output, variance tf.Output, optional ...FusedBatchNormAttr) (y tf.Output, batch_mean tf.Output, batch_variance tf.Output, reserve_space_1 tf.Output, reserve_space_2 tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "FusedBatchNorm", + Input: []tf.Input{ + x, scale, offset, mean, variance, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2), op.Output(3), op.Output(4) +} + +// DecodePaddedRawAttr is an optional argument to DecodePaddedRaw. +type DecodePaddedRawAttr func(optionalAttr) + +// DecodePaddedRawLittleEndian sets the optional little_endian attribute to value. +// +// value: Whether the input `input_bytes` is in little-endian order. Ignored for +// `out_type` values that are stored in a single byte, like `uint8` +// If not specified, defaults to true +func DecodePaddedRawLittleEndian(value bool) DecodePaddedRawAttr { + return func(m optionalAttr) { + m["little_endian"] = value + } +} + +// Reinterpret the bytes of a string as a vector of numbers. +// +// Arguments: +// +// input_bytes: Tensor of string to be decoded. +// fixed_length: Length in bytes for each element of the decoded output. Must be a multiple +// +// of the size of the output type. +// +// Returns A Tensor with one more dimension than the input `bytes`. The added dimension +// will have size equal to the length of the elements of `bytes` divided by the +// number of bytes to represent `out_type`. +func DecodePaddedRaw(scope *Scope, input_bytes tf.Output, fixed_length tf.Output, out_type tf.DataType, optional ...DecodePaddedRawAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"out_type": out_type} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "DecodePaddedRaw", + Input: []tf.Input{ + input_bytes, fixed_length, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Draw bounding boxes on a batch of images. +// +// Outputs a copy of `images` but draws on top of the pixels zero or more bounding +// boxes specified by the locations in `boxes`. The coordinates of the each +// bounding box in `boxes` are encoded as `[y_min, x_min, y_max, x_max]`. The +// bounding box coordinates are floats in `[0.0, 1.0]` relative to the width and +// height of the underlying image. +// +// For example, if an image is 100 x 200 pixels (height x width) and the bounding +// box is `[0.1, 0.2, 0.5, 0.9]`, the upper-left and bottom-right coordinates of +// the bounding box will be `(40, 10)` to `(100, 50)` (in (x,y) coordinates). +// +// Parts of the bounding box may fall outside the image. +// +// Arguments: +// +// images: 4-D with shape `[batch, height, width, depth]`. A batch of images. +// boxes: 3-D with shape `[batch, num_bounding_boxes, 4]` containing bounding +// +// boxes. +// +// colors: 2-D. A list of RGBA colors to cycle through for the boxes. +// +// Returns 4-D with the same shape as `images`. The batch of input images with +// bounding boxes drawn on the images. +func DrawBoundingBoxesV2(scope *Scope, images tf.Output, boxes tf.Output, colors tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "DrawBoundingBoxesV2", + Input: []tf.Input{ + images, boxes, colors, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// SampleDistortedBoundingBoxV2Attr is an optional argument to SampleDistortedBoundingBoxV2. +type SampleDistortedBoundingBoxV2Attr func(optionalAttr) + +// SampleDistortedBoundingBoxV2Seed sets the optional seed attribute to value. +// +// value: If either `seed` or `seed2` are set to non-zero, the random number +// generator is seeded by the given `seed`. Otherwise, it is seeded by a random +// seed. +// If not specified, defaults to 0 +func SampleDistortedBoundingBoxV2Seed(value int64) SampleDistortedBoundingBoxV2Attr { + return func(m optionalAttr) { + m["seed"] = value + } +} + +// SampleDistortedBoundingBoxV2Seed2 sets the optional seed2 attribute to value. +// +// value: A second seed to avoid seed collision. +// If not specified, defaults to 0 +func SampleDistortedBoundingBoxV2Seed2(value int64) SampleDistortedBoundingBoxV2Attr { + return func(m optionalAttr) { + m["seed2"] = value + } +} + +// SampleDistortedBoundingBoxV2AspectRatioRange sets the optional aspect_ratio_range attribute to value. +// +// value: The cropped area of the image must have an aspect ratio = +// width / height within this range. +// If not specified, defaults to +func SampleDistortedBoundingBoxV2AspectRatioRange(value []float32) SampleDistortedBoundingBoxV2Attr { + return func(m optionalAttr) { + m["aspect_ratio_range"] = value + } +} + +// SampleDistortedBoundingBoxV2AreaRange sets the optional area_range attribute to value. +// +// value: The cropped area of the image must contain a fraction of the +// supplied image within this range. +// If not specified, defaults to +func SampleDistortedBoundingBoxV2AreaRange(value []float32) SampleDistortedBoundingBoxV2Attr { + return func(m optionalAttr) { + m["area_range"] = value + } +} + +// SampleDistortedBoundingBoxV2MaxAttempts sets the optional max_attempts attribute to value. +// +// value: Number of attempts at generating a cropped region of the image +// of the specified constraints. After `max_attempts` failures, return the entire +// image. +// If not specified, defaults to 100 +func SampleDistortedBoundingBoxV2MaxAttempts(value int64) SampleDistortedBoundingBoxV2Attr { + return func(m optionalAttr) { + m["max_attempts"] = value + } +} + +// SampleDistortedBoundingBoxV2UseImageIfNoBoundingBoxes sets the optional use_image_if_no_bounding_boxes attribute to value. +// +// value: Controls behavior if no bounding boxes supplied. +// If true, assume an implicit bounding box covering the whole input. If false, +// raise an error. +// If not specified, defaults to false +func SampleDistortedBoundingBoxV2UseImageIfNoBoundingBoxes(value bool) SampleDistortedBoundingBoxV2Attr { + return func(m optionalAttr) { + m["use_image_if_no_bounding_boxes"] = value + } +} + +// Generate a single randomly distorted bounding box for an image. +// +// Bounding box annotations are often supplied in addition to ground-truth labels +// in image recognition or object localization tasks. A common technique for +// training such a system is to randomly distort an image while preserving +// its content, i.e. *data augmentation*. This Op outputs a randomly distorted +// localization of an object, i.e. bounding box, given an `image_size`, +// `bounding_boxes` and a series of constraints. +// +// The output of this Op is a single bounding box that may be used to crop the +// original image. The output is returned as 3 tensors: `begin`, `size` and +// `bboxes`. The first 2 tensors can be fed directly into `tf.slice` to crop the +// image. The latter may be supplied to `tf.image.draw_bounding_boxes` to visualize +// what the bounding box looks like. +// +// Bounding boxes are supplied and returned as `[y_min, x_min, y_max, x_max]`. The +// bounding box coordinates are floats in `[0.0, 1.0]` relative to the width and +// height of the underlying image. +// +// For example, +// +// ```python +// +// # Generate a single distorted bounding box. +// begin, size, bbox_for_draw = tf.image.sample_distorted_bounding_box( +// tf.shape(image), +// bounding_boxes=bounding_boxes) +// +// # Draw the bounding box in an image summary. +// image_with_box = tf.image.draw_bounding_boxes(tf.expand_dims(image, 0), +// bbox_for_draw) +// tf.summary.image('images_with_box', image_with_box) +// +// # Employ the bounding box to distort the image. +// distorted_image = tf.slice(image, begin, size) +// +// ``` +// +// Note that if no bounding box information is available, setting +// `use_image_if_no_bounding_boxes = true` will assume there is a single implicit +// bounding box covering the whole image. If `use_image_if_no_bounding_boxes` is +// false and no bounding boxes are supplied, an error is raised. +// +// Arguments: +// +// image_size: 1-D, containing `[height, width, channels]`. +// bounding_boxes: 3-D with shape `[batch, N, 4]` describing the N bounding boxes +// +// associated with the image. +// +// min_object_covered: The cropped area of the image must contain at least this +// +// fraction of any bounding box supplied. The value of this parameter should be +// non-negative. In the case of 0, the cropped area does not need to overlap +// any of the bounding boxes supplied. +// +// Returns: +// +// begin: 1-D, containing `[offset_height, offset_width, 0]`. Provide as input to +// +// `tf.slice`. +// +// size: 1-D, containing `[target_height, target_width, -1]`. Provide as input to +// +// `tf.slice`. +// +// bboxes: 3-D with shape `[1, 1, 4]` containing the distorted bounding box. +// +// Provide as input to `tf.image.draw_bounding_boxes`. +func SampleDistortedBoundingBoxV2(scope *Scope, image_size tf.Output, bounding_boxes tf.Output, min_object_covered tf.Output, optional ...SampleDistortedBoundingBoxV2Attr) (begin tf.Output, size tf.Output, bboxes tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "SampleDistortedBoundingBoxV2", + Input: []tf.Input{ + image_size, bounding_boxes, min_object_covered, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// Returns 0 if x == 0, and x / y otherwise, elementwise. +func Xdivy(scope *Scope, x tf.Output, y tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Xdivy", + Input: []tf.Input{ + x, y, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes cos of x element-wise. +// +// Given an input tensor, this function computes cosine of every +// element in the tensor. Input range is `(-inf, inf)` and +// output range is `[-1,1]`. If input lies outside the boundary, `nan` +// is returned. +// +// ```python +// x = tf.constant([-float("inf"), -9, -0.5, 1, 1.2, 200, 10000, float("inf")]) +// tf.math.cos(x) ==> [nan -0.91113025 0.87758255 0.5403023 0.36235774 0.48718765 -0.95215535 nan] +// ``` +func Cos(scope *Scope, x tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Cos", + Input: []tf.Input{ + x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// QuantizedAddAttr is an optional argument to QuantizedAdd. +type QuantizedAddAttr func(optionalAttr) + +// QuantizedAddToutput sets the optional Toutput attribute to value. +// If not specified, defaults to DT_QINT32 +func QuantizedAddToutput(value tf.DataType) QuantizedAddAttr { + return func(m optionalAttr) { + m["Toutput"] = value + } +} + +// Returns x + y element-wise, working on quantized buffers. +// +// Arguments: +// +// min_x: The float value that the lowest quantized `x` value represents. +// max_x: The float value that the highest quantized `x` value represents. +// min_y: The float value that the lowest quantized `y` value represents. +// max_y: The float value that the highest quantized `y` value represents. +// +// Returns: +// +// z +// min_z: The float value that the lowest quantized output value represents. +// max_z: The float value that the highest quantized output value represents. +// +// *NOTE*: `QuantizedAdd` supports limited forms of broadcasting. More about +// broadcasting [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) +func QuantizedAdd(scope *Scope, x tf.Output, y tf.Output, min_x tf.Output, max_x tf.Output, min_y tf.Output, max_y tf.Output, optional ...QuantizedAddAttr) (z tf.Output, min_z tf.Output, max_z tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "QuantizedAdd", + Input: []tf.Input{ + x, y, min_x, max_x, min_y, max_y, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// UnicodeEncodeAttr is an optional argument to UnicodeEncode. +type UnicodeEncodeAttr func(optionalAttr) + +// UnicodeEncodeErrors sets the optional errors attribute to value. +// +// value: Error handling policy when there is invalid formatting found in the input. +// The value of 'strict' will cause the operation to produce a InvalidArgument +// error on any invalid input formatting. A value of 'replace' (the default) will +// cause the operation to replace any invalid formatting in the input with the +// `replacement_char` codepoint. A value of 'ignore' will cause the operation to +// skip any invalid formatting in the input and produce no corresponding output +// character. +// If not specified, defaults to "replace" +func UnicodeEncodeErrors(value string) UnicodeEncodeAttr { + return func(m optionalAttr) { + m["errors"] = value + } +} + +// UnicodeEncodeReplacementChar sets the optional replacement_char attribute to value. +// +// value: The replacement character codepoint to be used in place of any invalid +// formatting in the input when `errors='replace'`. Any valid unicode codepoint may +// be used. The default value is the default unicode replacement character is +// 0xFFFD (U+65533). +// If not specified, defaults to 65533 +func UnicodeEncodeReplacementChar(value int64) UnicodeEncodeAttr { + return func(m optionalAttr) { + m["replacement_char"] = value + } +} + +// Encode a tensor of ints into unicode strings. +// +// Returns a vector of strings, where `output[i]` is constructed by encoding the +// Unicode codepoints in `input_values[input_splits[i]:input_splits[i+1]]` +// using `output_encoding`. +// +// --- +// +// Example: +// +// ``` +// input_values = [72, 101, 108, 108, 111, 87, 111, 114, 108, 100] +// input_splits = [0, 5, 10] +// output_encoding = 'UTF-8' +// +// output = ['Hello', 'World'] +// ``` +// +// Arguments: +// +// input_values: A 1D tensor containing the unicode codepoints that should be encoded. +// input_splits: A 1D tensor specifying how the unicode codepoints should be split into strings. +// +// In particular, `output[i]` is constructed by encoding the codepoints in the +// slice `input_values[input_splits[i]:input_splits[i+1]]`. +// +// output_encoding: Unicode encoding of the output strings. Valid encodings are: `"UTF-8", +// +// "UTF-16-BE", and "UTF-32-BE"`. +// +// Returns The 1-D Tensor of strings encoded from the provided unicode codepoints. +func UnicodeEncode(scope *Scope, input_values tf.Output, input_splits tf.Output, output_encoding string, optional ...UnicodeEncodeAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_encoding": output_encoding} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "UnicodeEncode", + Input: []tf.Input{ + input_values, input_splits, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ScatterNdAttr is an optional argument to ScatterNd. +type ScatterNdAttr func(optionalAttr) + +// ScatterNdBadIndicesPolicy sets the optional bad_indices_policy attribute to value. +// If not specified, defaults to "" +func ScatterNdBadIndicesPolicy(value string) ScatterNdAttr { + return func(m optionalAttr) { + m["bad_indices_policy"] = value + } +} + +// Scatter `updates` into a new tensor according to `indices`. +// +// Creates a new tensor by applying sparse `updates` to individual values or +// slices within a tensor (initially zero for numeric, empty for string) of +// the given `shape` according to indices. This operator is the inverse of the +// `tf.gather_nd` operator which extracts values or slices from a given tensor. +// +// This operation is similar to tensor_scatter_add, except that the tensor is +// zero-initialized. Calling `tf.scatter_nd(indices, values, shape)` is identical +// to `tensor_scatter_add(tf.zeros(shape, values.dtype), indices, values)` +// +// If `indices` contains duplicates, then their updates are accumulated (summed). +// +// **WARNING**: The order in which updates are applied is nondeterministic, so the +// output will be nondeterministic if `indices` contains duplicates -- because +// of some numerical approximation issues, numbers summed in different order +// may yield different results. +// +// `indices` is an integer tensor containing indices into a new tensor of shape +// `shape`. The last dimension of `indices` can be at most the rank of `shape`: +// +// indices.shape[-1] <= shape.rank +// +// The last dimension of `indices` corresponds to indices into elements +// (if `indices.shape[-1] = shape.rank`) or slices +// (if `indices.shape[-1] < shape.rank`) along dimension `indices.shape[-1]` of +// `shape`. `updates` is a tensor with shape +// +// indices.shape[:-1] + shape[indices.shape[-1]:] +// +// The simplest form of scatter is to insert individual elements in a tensor by +// index. For example, say we want to insert 4 scattered elements in a rank-1 +// tensor with 8 elements. +// +//
+// +//
+// +// In Python, this scatter operation would look like this: +// +// ```python +// +// indices = tf.constant([[4], [3], [1], [7]]) +// updates = tf.constant([9, 10, 11, 12]) +// shape = tf.constant([8]) +// scatter = tf.scatter_nd(indices, updates, shape) +// print(scatter) +// +// ``` +// +// The resulting tensor would look like this: +// +// [0, 11, 0, 10, 9, 0, 0, 12] +// +// We can also, insert entire slices of a higher rank tensor all at once. For +// example, if we wanted to insert two slices in the first dimension of a +// rank-3 tensor with two matrices of new values. +// +//
+// +//
+// +// In Python, this scatter operation would look like this: +// +// ```python +// +// indices = tf.constant([[0], [2]]) +// updates = tf.constant([[[5, 5, 5, 5], [6, 6, 6, 6], +// [7, 7, 7, 7], [8, 8, 8, 8]], +// [[5, 5, 5, 5], [6, 6, 6, 6], +// [7, 7, 7, 7], [8, 8, 8, 8]]]) +// shape = tf.constant([4, 4, 4]) +// scatter = tf.scatter_nd(indices, updates, shape) +// print(scatter) +// +// ``` +// +// The resulting tensor would look like this: +// +// [[[5, 5, 5, 5], [6, 6, 6, 6], [7, 7, 7, 7], [8, 8, 8, 8]], +// [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], +// [[5, 5, 5, 5], [6, 6, 6, 6], [7, 7, 7, 7], [8, 8, 8, 8]], +// [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]] +// +// Note that on CPU, if an out of bound index is found, an error is returned. +// On GPU, if an out of bound index is found, the index is ignored. +// +// Arguments: +// +// indices: Index tensor. +// updates: Updates to scatter into output. +// shape: 1-D. The shape of the resulting tensor. +// +// Returns A new tensor with the given shape and updates applied according +// to the indices. +func ScatterNd(scope *Scope, indices tf.Output, updates tf.Output, shape tf.Output, optional ...ScatterNdAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ScatterNd", + Input: []tf.Input{ + indices, updates, shape, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// OneHotAttr is an optional argument to OneHot. +type OneHotAttr func(optionalAttr) + +// OneHotAxis sets the optional axis attribute to value. +// +// value: The axis to fill (default: -1, a new inner-most axis). +// If not specified, defaults to -1 +func OneHotAxis(value int64) OneHotAttr { + return func(m optionalAttr) { + m["axis"] = value + } +} + +// Returns a one-hot tensor. +// +// The locations represented by indices in `indices` take value `on_value`, +// while all other locations take value `off_value`. +// +// If the input `indices` is rank `N`, the output will have rank `N+1`, +// The new axis is created at dimension `axis` (default: the new axis is +// appended at the end). +// +// If `indices` is a scalar the output shape will be a vector of length `depth`. +// +// If `indices` is a vector of length `features`, the output shape will be: +// ``` +// +// features x depth if axis == -1 +// depth x features if axis == 0 +// +// ``` +// +// If `indices` is a matrix (batch) with shape `[batch, features]`, +// the output shape will be: +// ``` +// +// batch x features x depth if axis == -1 +// batch x depth x features if axis == 1 +// depth x batch x features if axis == 0 +// +// ``` +// +// Examples +// ========= +// +// Suppose that +// ``` +// +// indices = [0, 2, -1, 1] +// depth = 3 +// on_value = 5.0 +// off_value = 0.0 +// axis = -1 +// +// ``` +// +// Then output is `[4 x 3]`: +// ``` +// output = +// +// [5.0 0.0 0.0] // one_hot(0) +// [0.0 0.0 5.0] // one_hot(2) +// [0.0 0.0 0.0] // one_hot(-1) +// [0.0 5.0 0.0] // one_hot(1) +// +// ``` +// +// Suppose that +// ``` +// +// indices = [0, 2, -1, 1] +// depth = 3 +// on_value = 0.0 +// off_value = 3.0 +// axis = 0 +// +// ``` +// +// Then output is `[3 x 4]`: +// ``` +// output = +// +// [0.0 3.0 3.0 3.0] +// [3.0 3.0 3.0 0.0] +// [3.0 3.0 3.0 3.0] +// [3.0 0.0 3.0 3.0] +// +// // ^ one_hot(0) +// // ^ one_hot(2) +// // ^ one_hot(-1) +// // ^ one_hot(1) +// ``` +// +// Suppose that +// ``` +// +// indices = [[0, 2], [1, -1]] +// depth = 3 +// on_value = 1.0 +// off_value = 0.0 +// axis = -1 +// +// ``` +// +// Then output is `[2 x 2 x 3]`: +// ``` +// output = +// +// [ +// [1.0, 0.0, 0.0] // one_hot(0) +// [0.0, 0.0, 1.0] // one_hot(2) +// ][ +// [0.0, 1.0, 0.0] // one_hot(1) +// [0.0, 0.0, 0.0] // one_hot(-1) +// ] +// +// ``` +// +// Arguments: +// +// indices: A tensor of indices. +// depth: A scalar defining the depth of the one hot dimension. +// on_value: A scalar defining the value to fill in output when `indices[j] = i`. +// off_value: A scalar defining the value to fill in output when `indices[j] != i`. +// +// Returns The one-hot tensor. +func OneHot(scope *Scope, indices tf.Output, depth tf.Output, on_value tf.Output, off_value tf.Output, optional ...OneHotAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "OneHot", + Input: []tf.Input{ + indices, depth, on_value, off_value, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// A substitute for `InterleaveDataset` on a fixed list of `N` datasets. +// +// Arguments: +// +// selector_input_dataset: A dataset of scalar `DT_INT64` elements that determines which of the +// +// `N` data inputs should produce the next output element. +// +// data_input_datasets: `N` datasets with the same type that will be interleaved according to +// +// the values of `selector_input_dataset`. +func ExperimentalDirectedInterleaveDataset(scope *Scope, selector_input_dataset tf.Output, data_input_datasets []tf.Output, output_types []tf.DataType, output_shapes []tf.Shape) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + opspec := tf.OpSpec{ + Type: "ExperimentalDirectedInterleaveDataset", + Input: []tf.Input{ + selector_input_dataset, tf.OutputList(data_input_datasets), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Creates a dataset from the given `graph_def`. +// +// Creates a dataset from the provided `graph_def`. +// +// Arguments: +// +// graph_def: The graph representation of the dataset (as serialized GraphDef). +// +// Returns A variant tensor representing the dataset. +func DatasetFromGraph(scope *Scope, graph_def tf.Output) (handle tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "DatasetFromGraph", + Input: []tf.Input{ + graph_def, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes softmax cross entropy cost and gradients to backpropagate. +// +// Unlike `SoftmaxCrossEntropyWithLogits`, this operation does not accept +// a matrix of label probabilities, but rather a single label per row +// of features. This label is considered to have probability 1.0 for the +// given row. +// +// Inputs are the logits, not probabilities. +// +// Arguments: +// +// features: batch_size x num_classes matrix +// labels: batch_size vector with values in [0, num_classes). +// +// This is the label for the given minibatch entry. +// +// Returns: +// +// loss: Per example loss (batch_size vector). +// backprop: backpropagated gradients (batch_size x num_classes matrix). +func SparseSoftmaxCrossEntropyWithLogits(scope *Scope, features tf.Output, labels tf.Output) (loss tf.Output, backprop tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "SparseSoftmaxCrossEntropyWithLogits", + Input: []tf.Input{ + features, labels, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// IsotonicRegressionAttr is an optional argument to IsotonicRegression. +type IsotonicRegressionAttr func(optionalAttr) + +// IsotonicRegressionOutputDtype sets the optional output_dtype attribute to value. +// +// value: Dtype of output. +// If not specified, defaults to DT_FLOAT +func IsotonicRegressionOutputDtype(value tf.DataType) IsotonicRegressionAttr { + return func(m optionalAttr) { + m["output_dtype"] = value + } +} + +// Solves a batch of isotonic regression problems. +// +// Arguments: +// +// input: A (batch_size, dim)-tensor holding a batch of inputs. +// +// Returns: +// +// output: A (batch_size, dim)-tensor holding the per-batch element solutions. +// segments: An int32 (batch_size, dim)-tensor with the segments. +func IsotonicRegression(scope *Scope, input tf.Output, optional ...IsotonicRegressionAttr) (output tf.Output, segments tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "IsotonicRegression", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// RestoreAttr is an optional argument to Restore. +type RestoreAttr func(optionalAttr) + +// RestorePreferredShard sets the optional preferred_shard attribute to value. +// +// value: Index of file to open first if multiple files match +// `file_pattern`. +// If not specified, defaults to -1 +func RestorePreferredShard(value int64) RestoreAttr { + return func(m optionalAttr) { + m["preferred_shard"] = value + } +} + +// Restores a tensor from checkpoint files. +// +// Reads a tensor stored in one or several files. If there are several files (for +// instance because a tensor was saved as slices), `file_pattern` may contain +// wildcard symbols (`*` and `?`) in the filename portion only, not in the +// directory portion. +// +// If a `file_pattern` matches several files, `preferred_shard` can be used to hint +// in which file the requested tensor is likely to be found. This op will first +// open the file at index `preferred_shard` in the list of matching files and try +// to restore tensors from that file. Only if some tensors or tensor slices are +// not found in that first file, then the Op opens all the files. Setting +// `preferred_shard` to match the value passed as the `shard` input +// of a matching `Save` Op may speed up Restore. This attribute only affects +// performance, not correctness. The default value -1 means files are processed in +// order. +// +// See also `RestoreSlice`. +// +// Arguments: +// +// file_pattern: Must have a single element. The pattern of the files from +// +// which we read the tensor. +// +// tensor_name: Must have a single element. The name of the tensor to be +// +// restored. +// +// dt: The type of the tensor to be restored. +// +// Returns The restored tensor. +func Restore(scope *Scope, file_pattern tf.Output, tensor_name tf.Output, dt tf.DataType, optional ...RestoreAttr) (tensor tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dt": dt} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Restore", + Input: []tf.Input{ + file_pattern, tensor_name, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Adds a value to the current value of a variable. +// +// Any ReadVariableOp with a control dependency on this op is guaranteed to +// see the incremented value or a subsequent newer one. +// +// Arguments: +// +// resource: handle to the resource in which to store the variable. +// value: the value by which the variable will be incremented. +// +// Returns the created operation. +func AssignAddVariableOp(scope *Scope, resource tf.Output, value tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "AssignAddVariableOp", + Input: []tf.Input{ + resource, value, + }, + } + return scope.AddOperation(opspec) +} + +// DequantizeAttr is an optional argument to Dequantize. +type DequantizeAttr func(optionalAttr) + +// DequantizeMode sets the optional mode attribute to value. +// If not specified, defaults to "MIN_COMBINED" +func DequantizeMode(value string) DequantizeAttr { + return func(m optionalAttr) { + m["mode"] = value + } +} + +// DequantizeNarrowRange sets the optional narrow_range attribute to value. +// If not specified, defaults to false +func DequantizeNarrowRange(value bool) DequantizeAttr { + return func(m optionalAttr) { + m["narrow_range"] = value + } +} + +// DequantizeAxis sets the optional axis attribute to value. +// If not specified, defaults to -1 +func DequantizeAxis(value int64) DequantizeAttr { + return func(m optionalAttr) { + m["axis"] = value + } +} + +// DequantizeDtype sets the optional dtype attribute to value. +// +// value: Type of the output tensor. Currently Dequantize supports float and bfloat16. +// If 'dtype' is 'bfloat16', it only supports 'MIN_COMBINED' mode. +// If not specified, defaults to DT_FLOAT +func DequantizeDtype(value tf.DataType) DequantizeAttr { + return func(m optionalAttr) { + m["dtype"] = value + } +} + +// Dequantize the 'input' tensor into a float or bfloat16 Tensor. +// +// [min_range, max_range] are scalar floats that specify the range for +// the output. The 'mode' attribute controls exactly which calculations are +// used to convert the float values to their quantized equivalents. +// +// In 'MIN_COMBINED' mode, each value of the tensor will undergo the following: +// +// ``` +// if T == qint8: in[i] += (range(T) + 1)/ 2.0 +// out[i] = min_range + (in[i]* (max_range - min_range) / range(T)) +// ``` +// here `range(T) = numeric_limits::max() - numeric_limits::min()` +// +// *MIN_COMBINED Mode Example* +// +// If the input comes from a QuantizedRelu6, the output type is +// quint8 (range of 0-255) but the possible range of QuantizedRelu6 is +// 0-6. The min_range and max_range values are therefore 0.0 and 6.0. +// Dequantize on quint8 will take each value, cast to float, and multiply +// by 6 / 255. +// Note that if quantizedtype is qint8, the operation will additionally add +// each value by 128 prior to casting. +// +// If the mode is 'MIN_FIRST', then this approach is used: +// +// ```c++ +// num_discrete_values = 1 << (# of bits in T) +// range_adjust = num_discrete_values / (num_discrete_values - 1) +// range = (range_max - range_min) * range_adjust +// range_scale = range / num_discrete_values +// const double offset_input = static_cast(input) - lowest_quantized; +// result = range_min + ((input - numeric_limits::min()) * range_scale) +// ``` +// +// If the mode is `SCALED`, dequantization is performed by multiplying each +// input value by a scaling_factor. (Thus an input of 0 always maps to 0.0). +// +// The scaling_factor is determined from `min_range`, `max_range`, and +// `narrow_range` in a way that is compatible with `QuantizeAndDequantize{V2|V3}` +// and `QuantizeV2`, using the following algorithm: +// +// ```c++ +// +// const int min_expected_T = std::numeric_limits::min() + +// (narrow_range ? 1 : 0); +// const int max_expected_T = std::numeric_limits::max(); +// const float max_expected_T = std::numeric_limits::max(); +// +// const float scale_factor = +// (std::numeric_limits::min() == 0) ? (max_range / max_expected_T) +// : std::max(min_range / min_expected_T, +// max_range / max_expected_T); +// +// ``` +// +// Arguments: +// +// min_range: The minimum scalar value possibly produced for the input. +// max_range: The maximum scalar value possibly produced for the input. +func Dequantize(scope *Scope, input tf.Output, min_range tf.Output, max_range tf.Output, optional ...DequantizeAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Dequantize", + Input: []tf.Input{ + input, min_range, max_range, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// FractionalMaxPoolAttr is an optional argument to FractionalMaxPool. +type FractionalMaxPoolAttr func(optionalAttr) + +// FractionalMaxPoolPseudoRandom sets the optional pseudo_random attribute to value. +// +// value: When set to True, generates the pooling sequence in a +// pseudorandom fashion, otherwise, in a random fashion. Check paper [Benjamin +// Graham, Fractional Max-Pooling](http://arxiv.org/abs/1412.6071) for +// difference between pseudorandom and random. +// If not specified, defaults to false +func FractionalMaxPoolPseudoRandom(value bool) FractionalMaxPoolAttr { + return func(m optionalAttr) { + m["pseudo_random"] = value + } +} + +// FractionalMaxPoolOverlapping sets the optional overlapping attribute to value. +// +// value: When set to True, it means when pooling, the values at the boundary +// of adjacent pooling cells are used by both cells. For example: +// +// `index 0 1 2 3 4` +// +// `value 20 5 16 3 7` +// +// If the pooling sequence is [0, 2, 4], then 16, at index 2 will be used twice. +// The result would be [20, 16] for fractional max pooling. +// If not specified, defaults to false +func FractionalMaxPoolOverlapping(value bool) FractionalMaxPoolAttr { + return func(m optionalAttr) { + m["overlapping"] = value + } +} + +// FractionalMaxPoolDeterministic sets the optional deterministic attribute to value. +// +// value: When set to True, a fixed pooling region will be used when +// iterating over a FractionalMaxPool node in the computation graph. Mainly used +// in unit test to make FractionalMaxPool deterministic. +// If not specified, defaults to false +func FractionalMaxPoolDeterministic(value bool) FractionalMaxPoolAttr { + return func(m optionalAttr) { + m["deterministic"] = value + } +} + +// FractionalMaxPoolSeed sets the optional seed attribute to value. +// +// value: If either seed or seed2 are set to be non-zero, the random number +// generator is seeded by the given seed. Otherwise, it is seeded by a +// random seed. +// If not specified, defaults to 0 +func FractionalMaxPoolSeed(value int64) FractionalMaxPoolAttr { + return func(m optionalAttr) { + m["seed"] = value + } +} + +// FractionalMaxPoolSeed2 sets the optional seed2 attribute to value. +// +// value: An second seed to avoid seed collision. +// If not specified, defaults to 0 +func FractionalMaxPoolSeed2(value int64) FractionalMaxPoolAttr { + return func(m optionalAttr) { + m["seed2"] = value + } +} + +// Performs fractional max pooling on the input. +// +// Fractional max pooling is slightly different than regular max pooling. In +// regular max pooling, you downsize an input set by taking the maximum value of +// smaller N x N subsections of the set (often 2x2), and try to reduce the set by +// a factor of N, where N is an integer. Fractional max pooling, as you might +// expect from the word "fractional", means that the overall reduction ratio N +// does not have to be an integer. +// +// The sizes of the pooling regions are generated randomly but are fairly uniform. +// For example, let's look at the height dimension, and the constraints on the +// list of rows that will be pool boundaries. +// +// First we define the following: +// +// 1. input_row_length : the number of rows from the input set +// 2. output_row_length : which will be smaller than the input +// 3. alpha = input_row_length / output_row_length : our reduction ratio +// 4. K = floor(alpha) +// 5. row_pooling_sequence : this is the result list of pool boundary rows +// +// Then, row_pooling_sequence should satisfy: +// +// 1. a[0] = 0 : the first value of the sequence is 0 +// 2. a[end] = input_row_length : the last value of the sequence is the size +// 3. K <= (a[i+1] - a[i]) <= K+1 : all intervals are K or K+1 size +// 4. length(row_pooling_sequence) = output_row_length+1 +// +// For more details on fractional max pooling, see this paper: +// [Benjamin Graham, Fractional Max-Pooling](http://arxiv.org/abs/1412.6071) +// +// Arguments: +// +// value: 4-D with shape `[batch, height, width, channels]`. +// pooling_ratio: Pooling ratio for each dimension of `value`, currently only +// +// supports row and col dimension and should be >= 1.0. For example, a valid +// pooling ratio looks like [1.0, 1.44, 1.73, 1.0]. The first and last elements +// must be 1.0 because we don't allow pooling on batch and channels +// dimensions. 1.44 and 1.73 are pooling ratio on height and width dimensions +// respectively. +// +// Returns: +// +// output: output tensor after fractional max pooling. +// row_pooling_sequence: row pooling sequence, needed to calculate gradient. +// col_pooling_sequence: column pooling sequence, needed to calculate gradient. +func FractionalMaxPool(scope *Scope, value tf.Output, pooling_ratio []float32, optional ...FractionalMaxPoolAttr) (output tf.Output, row_pooling_sequence tf.Output, col_pooling_sequence tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"pooling_ratio": pooling_ratio} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "FractionalMaxPool", + Input: []tf.Input{ + value, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// OptimizeDatasetAttr is an optional argument to OptimizeDataset. +type OptimizeDatasetAttr func(optionalAttr) + +// OptimizeDatasetOptimizationConfigs sets the optional optimization_configs attribute to value. +// If not specified, defaults to <> +func OptimizeDatasetOptimizationConfigs(value []string) OptimizeDatasetAttr { + return func(m optionalAttr) { + m["optimization_configs"] = value + } +} + +// Creates a dataset by applying optimizations to `input_dataset`. +// +// Creates a dataset by applying optimizations to `input_dataset`. +// +// Arguments: +// +// input_dataset: A variant tensor representing the input dataset. +// optimizations: A `tf.string` vector `tf.Tensor` identifying optimizations to use. +func OptimizeDataset(scope *Scope, input_dataset tf.Output, optimizations tf.Output, output_types []tf.DataType, output_shapes []tf.Shape, optional ...OptimizeDatasetAttr) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "OptimizeDataset", + Input: []tf.Input{ + input_dataset, optimizations, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns the index of a data point that should be added to the seed set. +// +// Entries in distances are assumed to be squared distances of candidate points to +// the already sampled centers in the seed set. The op constructs one Markov chain +// of the k-MC^2 algorithm and returns the index of one candidate point to be added +// as an additional cluster center. +// +// Arguments: +// +// distances: Vector with squared distances to the closest previously sampled cluster center +// +// for each candidate point. +// +// seed: Scalar. Seed for initializing the random number generator. +// +// Returns Scalar with the index of the sampled point. +func KMC2ChainInitialization(scope *Scope, distances tf.Output, seed tf.Output) (index tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "KMC2ChainInitialization", + Input: []tf.Input{ + distances, seed, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// PackAttr is an optional argument to Pack. +type PackAttr func(optionalAttr) + +// PackAxis sets the optional axis attribute to value. +// +// value: Dimension along which to pack. Negative values wrap around, so the +// valid range is `[-(R+1), R+1)`. +// If not specified, defaults to 0 +func PackAxis(value int64) PackAttr { + return func(m optionalAttr) { + m["axis"] = value + } +} + +// Packs a list of `N` rank-`R` tensors into one rank-`(R+1)` tensor. +// +// Packs the `N` tensors in `values` into a tensor with rank one higher than each +// tensor in `values`, by packing them along the `axis` dimension. +// Given a list of tensors of shape `(A, B, C)`; +// +// if `axis == 0` then the `output` tensor will have the shape `(N, A, B, C)`. +// if `axis == 1` then the `output` tensor will have the shape `(A, N, B, C)`. +// Etc. +// +// For example: +// +// ``` +// # 'x' is [1, 4] +// # 'y' is [2, 5] +// # 'z' is [3, 6] +// pack([x, y, z]) => [[1, 4], [2, 5], [3, 6]] # Pack along first dim. +// pack([x, y, z], axis=1) => [[1, 2, 3], [4, 5, 6]] +// ``` +// +// This is the opposite of `unpack`. +// +// Arguments: +// +// values: Must be of same shape and type. +// +// Returns The packed tensor. +func Pack(scope *Scope, values []tf.Output, optional ...PackAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "Pack", + Input: []tf.Input{ + tf.OutputList(values), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Creates a dataset that uses a custom thread pool to compute `input_dataset`. +// +// Arguments: +// +// thread_pool: A resource produced by the ThreadPoolHandle op. +func ThreadPoolDataset(scope *Scope, input_dataset tf.Output, thread_pool tf.Output, output_types []tf.DataType, output_shapes []tf.Shape) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + opspec := tf.OpSpec{ + Type: "ThreadPoolDataset", + Input: []tf.Input{ + input_dataset, thread_pool, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Creates a dataset that executes a SQL query and emits rows of the result set. +// +// Arguments: +// +// driver_name: The database type. Currently, the only supported type is 'sqlite'. +// data_source_name: A connection string to connect to the database. +// query: A SQL query to execute. +func SqlDataset(scope *Scope, driver_name tf.Output, data_source_name tf.Output, query tf.Output, output_types []tf.DataType, output_shapes []tf.Shape) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + opspec := tf.OpSpec{ + Type: "SqlDataset", + Input: []tf.Input{ + driver_name, data_source_name, query, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// ResizeBilinearAttr is an optional argument to ResizeBilinear. +type ResizeBilinearAttr func(optionalAttr) + +// ResizeBilinearAlignCorners sets the optional align_corners attribute to value. +// +// value: If true, the centers of the 4 corner pixels of the input and output tensors are +// aligned, preserving the values at the corner pixels. Defaults to false. +// If not specified, defaults to false +func ResizeBilinearAlignCorners(value bool) ResizeBilinearAttr { + return func(m optionalAttr) { + m["align_corners"] = value + } +} + +// ResizeBilinearHalfPixelCenters sets the optional half_pixel_centers attribute to value. +// If not specified, defaults to false +func ResizeBilinearHalfPixelCenters(value bool) ResizeBilinearAttr { + return func(m optionalAttr) { + m["half_pixel_centers"] = value + } +} + +// Resize `images` to `size` using bilinear interpolation. +// +// Input images can be of different types but output images are always float. +// +// Arguments: +// +// images: 4-D with shape `[batch, height, width, channels]`. +// size: = A 1-D int32 Tensor of 2 elements: `new_height, new_width`. The +// +// new size for the images. +// +// Returns 4-D with shape +// `[batch, new_height, new_width, channels]`. +func ResizeBilinear(scope *Scope, images tf.Output, size tf.Output, optional ...ResizeBilinearAttr) (resized_images tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ResizeBilinear", + Input: []tf.Input{ + images, size, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// DecodeAndCropJpegAttr is an optional argument to DecodeAndCropJpeg. +type DecodeAndCropJpegAttr func(optionalAttr) + +// DecodeAndCropJpegChannels sets the optional channels attribute to value. +// +// value: Number of color channels for the decoded image. +// If not specified, defaults to 0 +func DecodeAndCropJpegChannels(value int64) DecodeAndCropJpegAttr { + return func(m optionalAttr) { + m["channels"] = value + } +} + +// DecodeAndCropJpegRatio sets the optional ratio attribute to value. +// +// value: Downscaling ratio. +// If not specified, defaults to 1 +func DecodeAndCropJpegRatio(value int64) DecodeAndCropJpegAttr { + return func(m optionalAttr) { + m["ratio"] = value + } +} + +// DecodeAndCropJpegFancyUpscaling sets the optional fancy_upscaling attribute to value. +// +// value: If true use a slower but nicer upscaling of the +// chroma planes (yuv420/422 only). +// If not specified, defaults to true +func DecodeAndCropJpegFancyUpscaling(value bool) DecodeAndCropJpegAttr { + return func(m optionalAttr) { + m["fancy_upscaling"] = value + } +} + +// DecodeAndCropJpegTryRecoverTruncated sets the optional try_recover_truncated attribute to value. +// +// value: If true try to recover an image from truncated input. +// If not specified, defaults to false +func DecodeAndCropJpegTryRecoverTruncated(value bool) DecodeAndCropJpegAttr { + return func(m optionalAttr) { + m["try_recover_truncated"] = value + } +} + +// DecodeAndCropJpegAcceptableFraction sets the optional acceptable_fraction attribute to value. +// +// value: The minimum required fraction of lines before a truncated +// input is accepted. +// If not specified, defaults to 1 +func DecodeAndCropJpegAcceptableFraction(value float32) DecodeAndCropJpegAttr { + return func(m optionalAttr) { + m["acceptable_fraction"] = value + } +} + +// DecodeAndCropJpegDctMethod sets the optional dct_method attribute to value. +// +// value: string specifying a hint about the algorithm used for +// decompression. Defaults to "" which maps to a system-specific +// default. Currently valid values are ["INTEGER_FAST", +// "INTEGER_ACCURATE"]. The hint may be ignored (e.g., the internal +// jpeg library changes to a version that does not have that specific +// option.) +// If not specified, defaults to "" +func DecodeAndCropJpegDctMethod(value string) DecodeAndCropJpegAttr { + return func(m optionalAttr) { + m["dct_method"] = value + } +} + +// Decode and Crop a JPEG-encoded image to a uint8 tensor. +// +// The attr `channels` indicates the desired number of color channels for the +// decoded image. +// +// Accepted values are: +// +// * 0: Use the number of channels in the JPEG-encoded image. +// * 1: output a grayscale image. +// * 3: output an RGB image. +// +// If needed, the JPEG-encoded image is transformed to match the requested number +// of color channels. +// +// The attr `ratio` allows downscaling the image by an integer factor during +// decoding. Allowed values are: 1, 2, 4, and 8. This is much faster than +// downscaling the image later. +// +// It is equivalent to a combination of decode and crop, but much faster by only +// decoding partial jpeg image. +// +// Arguments: +// +// contents: 0-D. The JPEG-encoded image. +// crop_window: 1-D. The crop window: [crop_y, crop_x, crop_height, crop_width]. +// +// Returns 3-D with shape `[height, width, channels]`.. +func DecodeAndCropJpeg(scope *Scope, contents tf.Output, crop_window tf.Output, optional ...DecodeAndCropJpegAttr) (image tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "DecodeAndCropJpeg", + Input: []tf.Input{ + contents, crop_window, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// StatelessRandomNormalV2Attr is an optional argument to StatelessRandomNormalV2. +type StatelessRandomNormalV2Attr func(optionalAttr) + +// StatelessRandomNormalV2Dtype sets the optional dtype attribute to value. +// +// value: The type of the output. +// If not specified, defaults to DT_FLOAT +func StatelessRandomNormalV2Dtype(value tf.DataType) StatelessRandomNormalV2Attr { + return func(m optionalAttr) { + m["dtype"] = value + } +} + +// Outputs deterministic pseudorandom values from a normal distribution. +// +// The generated values will have mean 0 and standard deviation 1. +// +// The outputs are a deterministic function of `shape`, `key`, `counter` and `alg`. +// +// Arguments: +// +// shape: The shape of the output tensor. +// key: Key for the counter-based RNG algorithm (shape uint64[1]). +// counter: Initial counter for the counter-based RNG algorithm (shape uint64[2] or uint64[1] depending on the algorithm). If a larger vector is given, only the needed portion on the left (i.e. [:N]) will be used. +// alg: The RNG algorithm (shape int32[]). +// +// Returns Random values with specified shape. +func StatelessRandomNormalV2(scope *Scope, shape tf.Output, key tf.Output, counter tf.Output, alg tf.Output, optional ...StatelessRandomNormalV2Attr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "StatelessRandomNormalV2", + Input: []tf.Input{ + shape, key, counter, alg, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// QuantizeAndDequantizeV4Attr is an optional argument to QuantizeAndDequantizeV4. +type QuantizeAndDequantizeV4Attr func(optionalAttr) + +// QuantizeAndDequantizeV4SignedInput sets the optional signed_input attribute to value. +// If not specified, defaults to true +func QuantizeAndDequantizeV4SignedInput(value bool) QuantizeAndDequantizeV4Attr { + return func(m optionalAttr) { + m["signed_input"] = value + } +} + +// QuantizeAndDequantizeV4NumBits sets the optional num_bits attribute to value. +// If not specified, defaults to 8 +func QuantizeAndDequantizeV4NumBits(value int64) QuantizeAndDequantizeV4Attr { + return func(m optionalAttr) { + m["num_bits"] = value + } +} + +// QuantizeAndDequantizeV4RangeGiven sets the optional range_given attribute to value. +// If not specified, defaults to false +func QuantizeAndDequantizeV4RangeGiven(value bool) QuantizeAndDequantizeV4Attr { + return func(m optionalAttr) { + m["range_given"] = value + } +} + +// QuantizeAndDequantizeV4RoundMode sets the optional round_mode attribute to value. +// If not specified, defaults to "HALF_TO_EVEN" +func QuantizeAndDequantizeV4RoundMode(value string) QuantizeAndDequantizeV4Attr { + return func(m optionalAttr) { + m["round_mode"] = value + } +} + +// QuantizeAndDequantizeV4NarrowRange sets the optional narrow_range attribute to value. +// If not specified, defaults to false +func QuantizeAndDequantizeV4NarrowRange(value bool) QuantizeAndDequantizeV4Attr { + return func(m optionalAttr) { + m["narrow_range"] = value + } +} + +// QuantizeAndDequantizeV4Axis sets the optional axis attribute to value. +// If not specified, defaults to -1 +func QuantizeAndDequantizeV4Axis(value int64) QuantizeAndDequantizeV4Attr { + return func(m optionalAttr) { + m["axis"] = value + } +} + +// Returns the gradient of `QuantizeAndDequantizeV4`. +// +// This is almost identical to QuantizeAndDequantizeV2, except that it returns a +// gradient of 1 for inputs that are within the quantization range, or 0 otherwise. +func QuantizeAndDequantizeV4(scope *Scope, input tf.Output, input_min tf.Output, input_max tf.Output, optional ...QuantizeAndDequantizeV4Attr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "QuantizeAndDequantizeV4", + Input: []tf.Input{ + input, input_min, input_max, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Reorders a SparseTensor into the canonical, row-major ordering. +// +// Note that by convention, all sparse ops preserve the canonical ordering along +// increasing dimension number. The only time ordering can be violated is during +// manual manipulation of the indices and values vectors to add entries. +// +// Reordering does not affect the shape of the SparseTensor. +// +// If the tensor has rank `R` and `N` non-empty values, `input_indices` has +// shape `[N, R]`, input_values has length `N`, and input_shape has length `R`. +// +// Arguments: +// +// input_indices: 2-D. `N x R` matrix with the indices of non-empty values in a +// +// SparseTensor, possibly not in canonical ordering. +// +// input_values: 1-D. `N` non-empty values corresponding to `input_indices`. +// input_shape: 1-D. Shape of the input SparseTensor. +// +// Returns: +// +// output_indices: 2-D. `N x R` matrix with the same indices as input_indices, but +// +// in canonical row-major ordering. +// +// output_values: 1-D. `N` non-empty values corresponding to `output_indices`. +func SparseReorder(scope *Scope, input_indices tf.Output, input_values tf.Output, input_shape tf.Output) (output_indices tf.Output, output_values tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "SparseReorder", + Input: []tf.Input{ + input_indices, input_values, input_shape, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// Creates a dataset containing elements of first component of `input_dataset` having true in the last component. +func FilterByLastComponentDataset(scope *Scope, input_dataset tf.Output, output_types []tf.DataType, output_shapes []tf.Shape) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + opspec := tf.OpSpec{ + Type: "FilterByLastComponentDataset", + Input: []tf.Input{ + input_dataset, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Table initializer that takes two tensors for keys and values respectively. +// +// Arguments: +// +// table_handle: Handle to a table which will be initialized. +// keys: Keys of type Tkey. +// values: Values of type Tval. +// +// Returns the created operation. +func InitializeTableV2(scope *Scope, table_handle tf.Output, keys tf.Output, values tf.Output) (o *tf.Operation) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "InitializeTableV2", + Input: []tf.Input{ + table_handle, keys, values, + }, + } + return scope.AddOperation(opspec) +} + +// Returns element-wise smallest integer not less than x. +func Ceil(scope *Scope, x tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Ceil", + Input: []tf.Input{ + x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Returns x / y element-wise for integer types. +// +// Truncation designates that negative numbers will round fractional quantities +// toward zero. I.e. -7 / 5 = -1. This matches C semantics but it is different +// than Python semantics. See `FloorDiv` for a division function that matches +// Python Semantics. +// +// *NOTE*: `TruncateDiv` supports broadcasting. More about broadcasting +// [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) +func TruncateDiv(scope *Scope, x tf.Output, y tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "TruncateDiv", + Input: []tf.Input{ + x, y, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Transforms a vector of tf.Example protos (as strings) into typed tensors. +// +// Arguments: +// +// serialized: A scalar or vector containing binary serialized Example protos. +// names: A tensor containing the names of the serialized protos. +// +// Corresponds 1:1 with the `serialized` tensor. +// May contain, for example, table key (descriptive) names for the +// corresponding serialized protos. These are purely useful for debugging +// purposes, and the presence of values here has no effect on the output. +// May also be an empty vector if no names are available. +// If non-empty, this tensor must have the same shape as "serialized". +// +// sparse_keys: Vector of strings. +// +// The keys expected in the Examples' features associated with sparse values. +// +// dense_keys: Vector of strings. +// +// The keys expected in the Examples' features associated with dense values. +// +// ragged_keys: Vector of strings. +// +// The keys expected in the Examples' features associated with ragged values. +// +// dense_defaults: A list of Tensors (some may be empty). Corresponds 1:1 with `dense_keys`. +// +// dense_defaults[j] provides default values +// when the example's feature_map lacks dense_key[j]. If an empty Tensor is +// provided for dense_defaults[j], then the Feature dense_keys[j] is required. +// The input type is inferred from dense_defaults[j], even when it's empty. +// If dense_defaults[j] is not empty, and dense_shapes[j] is fully defined, +// then the shape of dense_defaults[j] must match that of dense_shapes[j]. +// If dense_shapes[j] has an undefined major dimension (variable strides dense +// feature), dense_defaults[j] must contain a single element: +// the padding element. +// +// num_sparse: The number of sparse keys. +// sparse_types: A list of `num_sparse` types; the data types of data in each Feature +// +// given in sparse_keys. +// Currently the ParseExample supports DT_FLOAT (FloatList), +// DT_INT64 (Int64List), and DT_STRING (BytesList). +// +// ragged_value_types: A list of `num_ragged` types; the data types of data in each Feature +// +// given in ragged_keys (where `num_ragged = sparse_keys.size()`). +// Currently the ParseExample supports DT_FLOAT (FloatList), +// DT_INT64 (Int64List), and DT_STRING (BytesList). +// +// ragged_split_types: A list of `num_ragged` types; the data types of row_splits in each Feature +// +// given in ragged_keys (where `num_ragged = sparse_keys.size()`). +// May be DT_INT32 or DT_INT64. +// +// dense_shapes: A list of `num_dense` shapes; the shapes of data in each Feature +// +// given in dense_keys (where `num_dense = dense_keys.size()`). +// The number of elements in the Feature corresponding to dense_key[j] +// must always equal dense_shapes[j].NumEntries(). +// If dense_shapes[j] == (D0, D1, ..., DN) then the shape of output +// Tensor dense_values[j] will be (|serialized|, D0, D1, ..., DN): +// The dense outputs are just the inputs row-stacked by batch. +// This works for dense_shapes[j] = (-1, D1, ..., DN). In this case +// the shape of the output Tensor dense_values[j] will be +// (|serialized|, M, D1, .., DN), where M is the maximum number of blocks +// of elements of length D1 * .... * DN, across all minibatch entries +// in the input. Any minibatch entry with less than M blocks of elements of +// length D1 * ... * DN will be padded with the corresponding default_value +// scalar element along the second dimension. +func ParseExampleV2(scope *Scope, serialized tf.Output, names tf.Output, sparse_keys tf.Output, dense_keys tf.Output, ragged_keys tf.Output, dense_defaults []tf.Output, num_sparse int64, sparse_types []tf.DataType, ragged_value_types []tf.DataType, ragged_split_types []tf.DataType, dense_shapes []tf.Shape) (sparse_indices []tf.Output, sparse_values []tf.Output, sparse_shapes []tf.Output, dense_values []tf.Output, ragged_values []tf.Output, ragged_row_splits []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"num_sparse": num_sparse, "sparse_types": sparse_types, "ragged_value_types": ragged_value_types, "ragged_split_types": ragged_split_types, "dense_shapes": dense_shapes} + opspec := tf.OpSpec{ + Type: "ParseExampleV2", + Input: []tf.Input{ + serialized, names, sparse_keys, dense_keys, ragged_keys, tf.OutputList(dense_defaults), + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if sparse_indices, idx, err = makeOutputList(op, idx, "sparse_indices"); err != nil { + scope.UpdateErr("ParseExampleV2", err) + return + } + if sparse_values, idx, err = makeOutputList(op, idx, "sparse_values"); err != nil { + scope.UpdateErr("ParseExampleV2", err) + return + } + if sparse_shapes, idx, err = makeOutputList(op, idx, "sparse_shapes"); err != nil { + scope.UpdateErr("ParseExampleV2", err) + return + } + if dense_values, idx, err = makeOutputList(op, idx, "dense_values"); err != nil { + scope.UpdateErr("ParseExampleV2", err) + return + } + if ragged_values, idx, err = makeOutputList(op, idx, "ragged_values"); err != nil { + scope.UpdateErr("ParseExampleV2", err) + return + } + if ragged_row_splits, idx, err = makeOutputList(op, idx, "ragged_row_splits"); err != nil { + scope.UpdateErr("ParseExampleV2", err) + return + } + return sparse_indices, sparse_values, sparse_shapes, dense_values, ragged_values, ragged_row_splits +} + +// Forwards the value of an available tensor from `inputs` to `output`. +// +// `Merge` waits for at least one of the tensors in `inputs` to become available. +// It is usually combined with `Switch` to implement branching. +// +// `Merge` forwards the first tensor to become available to `output`, and sets +// `value_index` to its index in `inputs`. +// +// Arguments: +// +// inputs: The input tensors, exactly one of which will become available. +// +// Returns: +// +// output: Will be set to the available input tensor. +// value_index: The index of the chosen input tensor in `inputs`. +func Merge(scope *Scope, inputs []tf.Output) (output tf.Output, value_index tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Merge", + Input: []tf.Input{ + tf.OutputList(inputs), + }, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1) +} + +// Computes the GRU cell back-propagation for 1 time step. +// +// Args +// +// x: Input to the GRU cell. +// h_prev: State input from the previous GRU cell. +// w_ru: Weight matrix for the reset and update gate. +// w_c: Weight matrix for the cell connection gate. +// b_ru: Bias vector for the reset and update gate. +// b_c: Bias vector for the cell connection gate. +// r: Output of the reset gate. +// u: Output of the update gate. +// c: Output of the cell connection gate. +// d_h: Gradients of the h_new wrt to objective function. +// +// Returns +// +// d_x: Gradients of the x wrt to objective function. +// d_h_prev: Gradients of the h wrt to objective function. +// d_c_bar Gradients of the c_bar wrt to objective function. +// d_r_bar_u_bar Gradients of the r_bar & u_bar wrt to objective function. +// +// This kernel op implements the following mathematical equations: +// +// Note on notation of the variables: +// +// Concatenation of a and b is represented by a_b +// Element-wise dot product of a and b is represented by ab +// Element-wise dot product is represented by \circ +// Matrix multiplication is represented by * +// +// Additional notes for clarity: +// +// `w_ru` can be segmented into 4 different matrices. +// ``` +// w_ru = [w_r_x w_u_x +// +// w_r_h_prev w_u_h_prev] +// +// ``` +// Similarly, `w_c` can be segmented into 2 different matrices. +// ``` +// w_c = [w_c_x w_c_h_prevr] +// ``` +// Same goes for biases. +// ``` +// b_ru = [b_ru_x b_ru_h] +// b_c = [b_c_x b_c_h] +// ``` +// Another note on notation: +// ``` +// d_x = d_x_component_1 + d_x_component_2 +// +// where d_x_component_1 = d_r_bar * w_r_x^T + d_u_bar * w_r_x^T +// and d_x_component_2 = d_c_bar * w_c_x^T +// +// d_h_prev = d_h_prev_component_1 + d_h_prevr \circ r + d_h \circ u +// where d_h_prev_componenet_1 = d_r_bar * w_r_h_prev^T + d_u_bar * w_r_h_prev^T +// ``` +// +// Mathematics behind the Gradients below: +// ``` +// d_c_bar = d_h \circ (1-u) \circ (1-c \circ c) +// d_u_bar = d_h \circ (h-c) \circ u \circ (1-u) +// +// d_r_bar_u_bar = [d_r_bar d_u_bar] +// +// [d_x_component_1 d_h_prev_component_1] = d_r_bar_u_bar * w_ru^T +// +// [d_x_component_2 d_h_prevr] = d_c_bar * w_c^T +// +// d_x = d_x_component_1 + d_x_component_2 +// +// d_h_prev = d_h_prev_component_1 + d_h_prevr \circ r + u +// ``` +// Below calculation is performed in the python wrapper for the Gradients +// (not in the gradient kernel.) +// ``` +// d_w_ru = x_h_prevr^T * d_c_bar +// +// d_w_c = x_h_prev^T * d_r_bar_u_bar +// +// d_b_ru = sum of d_r_bar_u_bar along axis = 0 +// +// d_b_c = sum of d_c_bar along axis = 0 +// ``` +func GRUBlockCellGrad(scope *Scope, x tf.Output, h_prev tf.Output, w_ru tf.Output, w_c tf.Output, b_ru tf.Output, b_c tf.Output, r tf.Output, u tf.Output, c tf.Output, d_h tf.Output) (d_x tf.Output, d_h_prev tf.Output, d_c_bar tf.Output, d_r_bar_u_bar tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "GRUBlockCellGrad", + Input: []tf.Input{ + x, h_prev, w_ru, w_c, b_ru, b_c, r, u, c, d_h, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2), op.Output(3) +} + +// UniqueWithCountsV2Attr is an optional argument to UniqueWithCountsV2. +type UniqueWithCountsV2Attr func(optionalAttr) + +// UniqueWithCountsV2OutIdx sets the optional out_idx attribute to value. +// If not specified, defaults to DT_INT32 +func UniqueWithCountsV2OutIdx(value tf.DataType) UniqueWithCountsV2Attr { + return func(m optionalAttr) { + m["out_idx"] = value + } +} + +// Finds unique elements along an axis of a tensor. +// +// This operation either returns a tensor `y` containing unique elements +// along the `axis` of a tensor. The returned unique elements is sorted +// in the same order as they occur along `axis` in `x`. +// This operation also returns a tensor `idx` and a tensor `count` +// that are the same size as the number of the elements in `x` along the +// `axis` dimension. The `idx` contains the index in the unique output `y` +// and the `count` contains the count in the unique output `y`. +// In other words, for an `1-D` tensor `x` with `axis = None: +// +// `y[idx[i]] = x[i] for i in [0, 1,...,rank(x) - 1]` +// +// For example: +// +// ``` +// # tensor 'x' is [1, 1, 2, 4, 4, 4, 7, 8, 8] +// y, idx, count = unique_with_counts(x) +// y ==> [1, 2, 4, 7, 8] +// idx ==> [0, 0, 1, 2, 2, 2, 3, 4, 4] +// count ==> [2, 1, 3, 1, 2] +// ``` +// +// For an `2-D` tensor `x` with `axis = 0`: +// +// ``` +// # tensor 'x' is [[1, 0, 0], +// # [1, 0, 0], +// # [2, 0, 0]] +// y, idx, count = unique_with_counts(x, axis=0) +// y ==> [[1, 0, 0], +// +// [2, 0, 0]] +// +// idx ==> [0, 0, 1] +// count ==> [2, 1] +// ``` +// +// For an `2-D` tensor `x` with `axis = 1`: +// +// ``` +// # tensor 'x' is [[1, 0, 0], +// # [1, 0, 0], +// # [2, 0, 0]] +// y, idx, count = unique_with_counts(x, axis=1) +// y ==> [[1, 0], +// +// [1, 0], +// [2, 0]] +// +// idx ==> [0, 1, 1] +// count ==> [1, 2] +// ``` +// +// Arguments: +// +// x: A `Tensor`. +// axis: A `Tensor` of type `int32` (default: None). The axis of the Tensor to +// +// find the unique elements. +// +// Returns: +// +// y: A `Tensor`. Unique elements along the `axis` of `Tensor` x. +// idx: A 1-D Tensor. Has the same type as x that contains the index of each +// +// value of x in the output y. +// +// count: A 1-D Tensor. The count of each value of x in the output y. +func UniqueWithCountsV2(scope *Scope, x tf.Output, axis tf.Output, optional ...UniqueWithCountsV2Attr) (y tf.Output, idx tf.Output, count tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "UniqueWithCountsV2", + Input: []tf.Input{ + x, axis, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0), op.Output(1), op.Output(2) +} + +// XlaShardingAttr is an optional argument to XlaSharding. +type XlaShardingAttr func(optionalAttr) + +// XlaShardingSharding sets the optional sharding attribute to value. +// If not specified, defaults to "" +func XlaShardingSharding(value string) XlaShardingAttr { + return func(m optionalAttr) { + m["sharding"] = value + } +} + +// XlaShardingUnspecifiedDims sets the optional unspecified_dims attribute to value. +// If not specified, defaults to <> +func XlaShardingUnspecifiedDims(value []int64) XlaShardingAttr { + return func(m optionalAttr) { + m["unspecified_dims"] = value + } +} + +// An op which shards the input based on the given sharding attribute. It can +// +// selectively annotate a subset of tensor dimensions by skipping unspecified_dims, +// and the sharding annotation should be replicated in those dims. +func XlaSharding(scope *Scope, input tf.Output, optional ...XlaShardingAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "XlaSharding", + Input: []tf.Input{ + input, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// MultiDeviceIteratorFromStringHandleAttr is an optional argument to MultiDeviceIteratorFromStringHandle. +type MultiDeviceIteratorFromStringHandleAttr func(optionalAttr) + +// MultiDeviceIteratorFromStringHandleOutputTypes sets the optional output_types attribute to value. +// +// value: The type list for the return values. +// If not specified, defaults to <> +// +// REQUIRES: len(value) >= 0 +func MultiDeviceIteratorFromStringHandleOutputTypes(value []tf.DataType) MultiDeviceIteratorFromStringHandleAttr { + return func(m optionalAttr) { + m["output_types"] = value + } +} + +// MultiDeviceIteratorFromStringHandleOutputShapes sets the optional output_shapes attribute to value. +// +// value: The list of shapes being produced. +// If not specified, defaults to <> +// +// REQUIRES: len(value) >= 0 +func MultiDeviceIteratorFromStringHandleOutputShapes(value []tf.Shape) MultiDeviceIteratorFromStringHandleAttr { + return func(m optionalAttr) { + m["output_shapes"] = value + } +} + +// Generates a MultiDeviceIterator resource from its provided string handle. +// +// Arguments: +// +// string_handle: String representing the resource. +// +// Returns A MultiDeviceIterator resource. +func MultiDeviceIteratorFromStringHandle(scope *Scope, string_handle tf.Output, optional ...MultiDeviceIteratorFromStringHandleAttr) (multi_device_iterator tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "MultiDeviceIteratorFromStringHandle", + Input: []tf.Input{ + string_handle, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Elementwise computes the bitwise XOR of `x` and `y`. +// +// The result will have those bits set, that are different in `x` and `y`. The +// computation is performed on the underlying representations of `x` and `y`. +// +// For example: +// +// ```python +// import tensorflow as tf +// from tensorflow.python.ops import bitwise_ops +// dtype_list = [tf.int8, tf.int16, tf.int32, tf.int64, +// +// tf.uint8, tf.uint16, tf.uint32, tf.uint64] +// +// for dtype in dtype_list: +// +// lhs = tf.constant([0, 5, 3, 14], dtype=dtype) +// rhs = tf.constant([5, 0, 7, 11], dtype=dtype) +// exp = tf.constant([5, 5, 4, 5], dtype=tf.float32) +// +// res = bitwise_ops.bitwise_xor(lhs, rhs) +// tf.assert_equal(tf.cast(res, tf.float32), exp) # TRUE +// +// ``` +func BitwiseXor(scope *Scope, x tf.Output, y tf.Output) (z tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "BitwiseXor", + Input: []tf.Input{ + x, y, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Calculate product with tridiagonal matrix. +// +// Calculates product of two matrices, where left matrix is a tridiagonal matrix. +// +// Arguments: +// +// superdiag: Tensor of shape `[..., 1, M]`, representing superdiagonals of +// +// tri-diagonal matrices to the left of multiplication. Last element is ignored. +// +// maindiag: Tensor of shape `[..., 1, M]`, representing main diagonals of tri-diagonal +// +// matrices to the left of multiplication. +// +// subdiag: Tensor of shape `[..., 1, M]`, representing subdiagonals of tri-diagonal +// +// matrices to the left of multiplication. First element is ignored. +// +// rhs: Tensor of shape `[..., M, N]`, representing MxN matrices to the right of +// +// multiplication. +// +// Returns Tensor of shape `[..., M, N]` containing the product. +func TridiagonalMatMul(scope *Scope, superdiag tf.Output, maindiag tf.Output, subdiag tf.Output, rhs tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "TridiagonalMatMul", + Input: []tf.Input{ + superdiag, maindiag, subdiag, rhs, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Looks up keys in a table, outputs the corresponding values. +// +// The tensor `keys` must of the same type as the keys of the table. +// The output `values` is of the type of the table values. +// +// The scalar `default_value` is the value output for keys not present in the +// table. It must also be of the same type as the table values. +// +// Arguments: +// +// table_handle: Handle to the table. +// keys: Any shape. Keys to look up. +// +// Returns Same shape as `keys`. Values found in the table, or `default_values` +// for missing keys. +func LookupTableFindV2(scope *Scope, table_handle tf.Output, keys tf.Output, default_value tf.Output) (values tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "LookupTableFindV2", + Input: []tf.Input{ + table_handle, keys, default_value, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// MutableDenseHashTableV2Attr is an optional argument to MutableDenseHashTableV2. +type MutableDenseHashTableV2Attr func(optionalAttr) + +// MutableDenseHashTableV2Container sets the optional container attribute to value. +// +// value: If non-empty, this table is placed in the given container. +// Otherwise, a default container is used. +// If not specified, defaults to "" +func MutableDenseHashTableV2Container(value string) MutableDenseHashTableV2Attr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// MutableDenseHashTableV2SharedName sets the optional shared_name attribute to value. +// +// value: If non-empty, this table is shared under the given name across +// multiple sessions. +// If not specified, defaults to "" +func MutableDenseHashTableV2SharedName(value string) MutableDenseHashTableV2Attr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// MutableDenseHashTableV2UseNodeNameSharing sets the optional use_node_name_sharing attribute to value. +// If not specified, defaults to false +func MutableDenseHashTableV2UseNodeNameSharing(value bool) MutableDenseHashTableV2Attr { + return func(m optionalAttr) { + m["use_node_name_sharing"] = value + } +} + +// MutableDenseHashTableV2ValueShape sets the optional value_shape attribute to value. +// +// value: The shape of each value. +// If not specified, defaults to <> +func MutableDenseHashTableV2ValueShape(value tf.Shape) MutableDenseHashTableV2Attr { + return func(m optionalAttr) { + m["value_shape"] = value + } +} + +// MutableDenseHashTableV2InitialNumBuckets sets the optional initial_num_buckets attribute to value. +// +// value: The initial number of hash table buckets. Must be a power +// to 2. +// If not specified, defaults to 131072 +func MutableDenseHashTableV2InitialNumBuckets(value int64) MutableDenseHashTableV2Attr { + return func(m optionalAttr) { + m["initial_num_buckets"] = value + } +} + +// MutableDenseHashTableV2MaxLoadFactor sets the optional max_load_factor attribute to value. +// +// value: The maximum ratio between number of entries and number of +// buckets before growing the table. Must be between 0 and 1. +// If not specified, defaults to 0.8 +func MutableDenseHashTableV2MaxLoadFactor(value float32) MutableDenseHashTableV2Attr { + return func(m optionalAttr) { + m["max_load_factor"] = value + } +} + +// Creates an empty hash table that uses tensors as the backing store. +// +// It uses "open addressing" with quadratic reprobing to resolve +// collisions. +// +// This op creates a mutable hash table, specifying the type of its keys and +// values. Each value must be a scalar. Data can be inserted into the table using +// the insert operations. It does not support the initialization operation. +// +// Arguments: +// +// empty_key: The key used to represent empty key buckets internally. Must not +// +// be used in insert or lookup operations. +// +// value_dtype: Type of the table values. +// +// Returns Handle to a table. +func MutableDenseHashTableV2(scope *Scope, empty_key tf.Output, deleted_key tf.Output, value_dtype tf.DataType, optional ...MutableDenseHashTableV2Attr) (table_handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"value_dtype": value_dtype} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "MutableDenseHashTableV2", + Input: []tf.Input{ + empty_key, deleted_key, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// StatelessRandomUniformFullIntAttr is an optional argument to StatelessRandomUniformFullInt. +type StatelessRandomUniformFullIntAttr func(optionalAttr) + +// StatelessRandomUniformFullIntDtype sets the optional dtype attribute to value. +// +// value: The type of the output. +// If not specified, defaults to DT_UINT64 +func StatelessRandomUniformFullIntDtype(value tf.DataType) StatelessRandomUniformFullIntAttr { + return func(m optionalAttr) { + m["dtype"] = value + } +} + +// Outputs deterministic pseudorandom random integers from a uniform distribution. +// +// The generated values are uniform integers covering the whole range of `dtype`. +// +// The outputs are a deterministic function of `shape` and `seed`. +// +// Arguments: +// +// shape: The shape of the output tensor. +// seed: 2 seeds (shape [2]). +// +// Returns Random values with specified shape. +func StatelessRandomUniformFullInt(scope *Scope, shape tf.Output, seed tf.Output, optional ...StatelessRandomUniformFullIntAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "StatelessRandomUniformFullInt", + Input: []tf.Input{ + shape, seed, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// FractionalMaxPoolGradAttr is an optional argument to FractionalMaxPoolGrad. +type FractionalMaxPoolGradAttr func(optionalAttr) + +// FractionalMaxPoolGradOverlapping sets the optional overlapping attribute to value. +// +// value: When set to True, it means when pooling, the values at the boundary +// of adjacent pooling cells are used by both cells. For example: +// +// `index 0 1 2 3 4` +// +// `value 20 5 16 3 7` +// +// If the pooling sequence is [0, 2, 4], then 16, at index 2 will be used twice. +// The result would be [20, 16] for fractional max pooling. +// If not specified, defaults to false +func FractionalMaxPoolGradOverlapping(value bool) FractionalMaxPoolGradAttr { + return func(m optionalAttr) { + m["overlapping"] = value + } +} + +// Computes gradient of the FractionalMaxPool function. +// +// Arguments: +// +// orig_input: Original input for `fractional_max_pool` +// orig_output: Original output for `fractional_max_pool` +// out_backprop: 4-D with shape `[batch, height, width, channels]`. Gradients +// +// w.r.t. the output of `fractional_max_pool`. +// +// row_pooling_sequence: row pooling sequence, form pooling region with +// +// col_pooling_sequence. +// +// col_pooling_sequence: column pooling sequence, form pooling region with +// +// row_pooling sequence. +// +// Returns 4-D. Gradients w.r.t. the input of `fractional_max_pool`. +func FractionalMaxPoolGrad(scope *Scope, orig_input tf.Output, orig_output tf.Output, out_backprop tf.Output, row_pooling_sequence tf.Output, col_pooling_sequence tf.Output, optional ...FractionalMaxPoolGradAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "FractionalMaxPoolGrad", + Input: []tf.Input{ + orig_input, orig_output, out_backprop, row_pooling_sequence, col_pooling_sequence, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// SparseSegmentSumWithNumSegmentsAttr is an optional argument to SparseSegmentSumWithNumSegments. +type SparseSegmentSumWithNumSegmentsAttr func(optionalAttr) + +// SparseSegmentSumWithNumSegmentsSparseGradient sets the optional sparse_gradient attribute to value. +// If not specified, defaults to false +func SparseSegmentSumWithNumSegmentsSparseGradient(value bool) SparseSegmentSumWithNumSegmentsAttr { + return func(m optionalAttr) { + m["sparse_gradient"] = value + } +} + +// Computes the sum along sparse segments of a tensor. +// +// Like `SparseSegmentSum`, but allows missing ids in `segment_ids`. If an id is +// missing, the `output` tensor at that position will be zeroed. +// +// Read +// [the section on segmentation](https://tensorflow.org/api_docs/python/tf/sparse#Segmentation) +// for an explanation of segments. +// +// For example: +// +// ```python +// c = tf.constant([[1,2,3,4], [-1,-2,-3,-4], [5,6,7,8]]) +// +// tf.sparse_segment_sum_with_num_segments( +// +// c, tf.constant([0, 1]), tf.constant([0, 0]), num_segments=3) +// +// # => [[0 0 0 0] +// # [0 0 0 0] +// # [0 0 0 0]] +// +// tf.sparse_segment_sum_with_num_segments(c, +// +// tf.constant([0, 1]), +// tf.constant([0, 2], +// num_segments=4)) +// +// # => [[ 1 2 3 4] +// # [ 0 0 0 0] +// # [-1 -2 -3 -4] +// # [ 0 0 0 0]] +// ``` +// +// Arguments: +// +// indices: A 1-D tensor. Has same rank as `segment_ids`. +// segment_ids: A 1-D tensor. Values should be sorted and can be repeated. +// num_segments: Should equal the number of distinct segment IDs. +// +// Returns Has same shape as data, except for dimension 0 which +// has size `num_segments`. +func SparseSegmentSumWithNumSegments(scope *Scope, data tf.Output, indices tf.Output, segment_ids tf.Output, num_segments tf.Output, optional ...SparseSegmentSumWithNumSegmentsAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "SparseSegmentSumWithNumSegments", + Input: []tf.Input{ + data, indices, segment_ids, num_segments, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes sine of x element-wise. +// +// Given an input tensor, this function computes sine of every +// element in the tensor. Input range is `(-inf, inf)` and +// output range is `[-1,1]`. +// +// ```python +// x = tf.constant([-float("inf"), -9, -0.5, 1, 1.2, 200, 10, float("inf")]) +// tf.math.sin(x) ==> [nan -0.4121185 -0.47942555 0.84147096 0.9320391 -0.87329733 -0.54402107 nan] +// ``` +func Sin(scope *Scope, x tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Sin", + Input: []tf.Input{ + x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes natural logarithm of (1 + x) element-wise. +// +// I.e., \\(y = \log_e (1 + x)\\). +// +// Example: +// +// ```python +// x = tf.constant([0, 0.5, 1, 5]) +// tf.math.log1p(x) ==> [0., 0.4054651, 0.6931472, 1.7917595] +// ``` +func Log1p(scope *Scope, x tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Log1p", + Input: []tf.Input{ + x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// OrderedMapPeekAttr is an optional argument to OrderedMapPeek. +type OrderedMapPeekAttr func(optionalAttr) + +// OrderedMapPeekCapacity sets the optional capacity attribute to value. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func OrderedMapPeekCapacity(value int64) OrderedMapPeekAttr { + return func(m optionalAttr) { + m["capacity"] = value + } +} + +// OrderedMapPeekMemoryLimit sets the optional memory_limit attribute to value. +// If not specified, defaults to 0 +// +// REQUIRES: value >= 0 +func OrderedMapPeekMemoryLimit(value int64) OrderedMapPeekAttr { + return func(m optionalAttr) { + m["memory_limit"] = value + } +} + +// OrderedMapPeekContainer sets the optional container attribute to value. +// If not specified, defaults to "" +func OrderedMapPeekContainer(value string) OrderedMapPeekAttr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// OrderedMapPeekSharedName sets the optional shared_name attribute to value. +// If not specified, defaults to "" +func OrderedMapPeekSharedName(value string) OrderedMapPeekAttr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// Op peeks at the values at the specified key. If the +// +// underlying container does not contain this key +// this op will block until it does. This Op is optimized for +// performance. +func OrderedMapPeek(scope *Scope, key tf.Output, indices tf.Output, dtypes []tf.DataType, optional ...OrderedMapPeekAttr) (values []tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"dtypes": dtypes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "OrderedMapPeek", + Input: []tf.Input{ + key, indices, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + if scope.Err() != nil { + return + } + var idx int + var err error + if values, idx, err = makeOutputList(op, idx, "values"); err != nil { + scope.UpdateErr("OrderedMapPeek", err) + return + } + return values +} + +// ResizeAreaAttr is an optional argument to ResizeArea. +type ResizeAreaAttr func(optionalAttr) + +// ResizeAreaAlignCorners sets the optional align_corners attribute to value. +// +// value: If true, the centers of the 4 corner pixels of the input and output tensors are +// aligned, preserving the values at the corner pixels. Defaults to false. +// If not specified, defaults to false +func ResizeAreaAlignCorners(value bool) ResizeAreaAttr { + return func(m optionalAttr) { + m["align_corners"] = value + } +} + +// Resize `images` to `size` using area interpolation. +// +// Input images can be of different types but output images are always float. +// +// The range of pixel values for the output image might be slightly different +// from the range for the input image because of limited numerical precision. +// To guarantee an output range, for example `[0.0, 1.0]`, apply +// `tf.clip_by_value` to the output. +// +// Each output pixel is computed by first transforming the pixel's footprint into +// the input tensor and then averaging the pixels that intersect the footprint. An +// input pixel's contribution to the average is weighted by the fraction of its +// area that intersects the footprint. This is the same as OpenCV's INTER_AREA. +// +// Arguments: +// +// images: 4-D with shape `[batch, height, width, channels]`. +// size: = A 1-D int32 Tensor of 2 elements: `new_height, new_width`. The +// +// new size for the images. +// +// Returns 4-D with shape +// `[batch, new_height, new_width, channels]`. +func ResizeArea(scope *Scope, images tf.Output, size tf.Output, optional ...ResizeAreaAttr) (resized_images tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "ResizeArea", + Input: []tf.Input{ + images, size, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// SparseMatMulAttr is an optional argument to SparseMatMul. +type SparseMatMulAttr func(optionalAttr) + +// SparseMatMulTransposeA sets the optional transpose_a attribute to value. +// If not specified, defaults to false +func SparseMatMulTransposeA(value bool) SparseMatMulAttr { + return func(m optionalAttr) { + m["transpose_a"] = value + } +} + +// SparseMatMulTransposeB sets the optional transpose_b attribute to value. +// If not specified, defaults to false +func SparseMatMulTransposeB(value bool) SparseMatMulAttr { + return func(m optionalAttr) { + m["transpose_b"] = value + } +} + +// SparseMatMulAIsSparse sets the optional a_is_sparse attribute to value. +// If not specified, defaults to false +func SparseMatMulAIsSparse(value bool) SparseMatMulAttr { + return func(m optionalAttr) { + m["a_is_sparse"] = value + } +} + +// SparseMatMulBIsSparse sets the optional b_is_sparse attribute to value. +// If not specified, defaults to false +func SparseMatMulBIsSparse(value bool) SparseMatMulAttr { + return func(m optionalAttr) { + m["b_is_sparse"] = value + } +} + +// Multiply matrix "a" by matrix "b". +// +// The inputs must be two-dimensional matrices and the inner dimension of "a" must +// match the outer dimension of "b". Both "a" and "b" must be `Tensor`s not +// `SparseTensor`s. This op is optimized for the case where at least one of "a" or +// "b" is sparse, in the sense that they have a large proportion of zero values. +// The breakeven for using this versus a dense matrix multiply on one platform was +// 30% zero values in the sparse matrix. +// +// The gradient computation of this operation will only take advantage of sparsity +// in the input gradient when that gradient comes from a Relu. +func SparseMatMul(scope *Scope, a tf.Output, b tf.Output, optional ...SparseMatMulAttr) (product tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "SparseMatMul", + Input: []tf.Input{ + a, b, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Records the latency of producing `input_dataset` elements in a StatsAggregator. +func ExperimentalLatencyStatsDataset(scope *Scope, input_dataset tf.Output, tag tf.Output, output_types []tf.DataType, output_shapes []tf.Shape) (handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"output_types": output_types, "output_shapes": output_shapes} + opspec := tf.OpSpec{ + Type: "ExperimentalLatencyStatsDataset", + Input: []tf.Input{ + input_dataset, tag, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// SparseSegmentMeanWithNumSegmentsAttr is an optional argument to SparseSegmentMeanWithNumSegments. +type SparseSegmentMeanWithNumSegmentsAttr func(optionalAttr) + +// SparseSegmentMeanWithNumSegmentsSparseGradient sets the optional sparse_gradient attribute to value. +// If not specified, defaults to false +func SparseSegmentMeanWithNumSegmentsSparseGradient(value bool) SparseSegmentMeanWithNumSegmentsAttr { + return func(m optionalAttr) { + m["sparse_gradient"] = value + } +} + +// Computes the mean along sparse segments of a tensor. +// +// Like `SparseSegmentMean`, but allows missing ids in `segment_ids`. If an id is +// missing, the `output` tensor at that position will be zeroed. +// +// Read +// [the section on segmentation](https://tensorflow.org/api_docs/python/tf/math#Segmentation) +// for an explanation of segments. +// +// Arguments: +// +// indices: A 1-D tensor. Has same rank as `segment_ids`. +// segment_ids: A 1-D tensor. Values should be sorted and can be repeated. +// num_segments: Should equal the number of distinct segment IDs. +// +// Returns Has same shape as data, except for dimension 0 which has size +// `num_segments`. +func SparseSegmentMeanWithNumSegments(scope *Scope, data tf.Output, indices tf.Output, segment_ids tf.Output, num_segments tf.Output, optional ...SparseSegmentMeanWithNumSegmentsAttr) (output tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "SparseSegmentMeanWithNumSegments", + Input: []tf.Input{ + data, indices, segment_ids, num_segments, + }, + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Stops gradient computation. +// +// When executed in a graph, this op outputs its input tensor as-is. +// +// When building ops to compute gradients, this op prevents the contribution of +// its inputs to be taken into account. Normally, the gradient generator adds ops +// to a graph to compute the derivatives of a specified 'loss' by recursively +// finding out inputs that contributed to its computation. If you insert this op +// in the graph it inputs are masked from the gradient generator. They are not +// taken into account for computing gradients. +// +// This is useful any time you want to compute a value with TensorFlow but need +// to pretend that the value was a constant. Some examples include: +// +// - The *EM* algorithm where the *M-step* should not involve backpropagation +// through the output of the *E-step*. +// - Contrastive divergence training of Boltzmann machines where, when +// differentiating the energy function, the training must not backpropagate +// through the graph that generated the samples from the model. +// - Adversarial training, where no backprop should happen through the adversarial +// example generation process. +func StopGradient(scope *Scope, input tf.Output) (output tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "StopGradient", + Input: []tf.Input{ + input, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// Computes reciprocal of square root of x element-wise. +// +// I.e., \\(y = 1 / \sqrt{x}\\). +func Rsqrt(scope *Scope, x tf.Output) (y tf.Output) { + if scope.Err() != nil { + return + } + opspec := tf.OpSpec{ + Type: "Rsqrt", + Input: []tf.Input{ + x, + }, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} + +// FixedLengthRecordReaderV2Attr is an optional argument to FixedLengthRecordReaderV2. +type FixedLengthRecordReaderV2Attr func(optionalAttr) + +// FixedLengthRecordReaderV2HeaderBytes sets the optional header_bytes attribute to value. +// +// value: Number of bytes in the header, defaults to 0. +// If not specified, defaults to 0 +func FixedLengthRecordReaderV2HeaderBytes(value int64) FixedLengthRecordReaderV2Attr { + return func(m optionalAttr) { + m["header_bytes"] = value + } +} + +// FixedLengthRecordReaderV2FooterBytes sets the optional footer_bytes attribute to value. +// +// value: Number of bytes in the footer, defaults to 0. +// If not specified, defaults to 0 +func FixedLengthRecordReaderV2FooterBytes(value int64) FixedLengthRecordReaderV2Attr { + return func(m optionalAttr) { + m["footer_bytes"] = value + } +} + +// FixedLengthRecordReaderV2HopBytes sets the optional hop_bytes attribute to value. +// +// value: Number of bytes to hop before each read. Default of 0 means using +// record_bytes. +// If not specified, defaults to 0 +func FixedLengthRecordReaderV2HopBytes(value int64) FixedLengthRecordReaderV2Attr { + return func(m optionalAttr) { + m["hop_bytes"] = value + } +} + +// FixedLengthRecordReaderV2Container sets the optional container attribute to value. +// +// value: If non-empty, this reader is placed in the given container. +// Otherwise, a default container is used. +// If not specified, defaults to "" +func FixedLengthRecordReaderV2Container(value string) FixedLengthRecordReaderV2Attr { + return func(m optionalAttr) { + m["container"] = value + } +} + +// FixedLengthRecordReaderV2SharedName sets the optional shared_name attribute to value. +// +// value: If non-empty, this reader is named in the given bucket +// with this shared_name. Otherwise, the node name is used instead. +// If not specified, defaults to "" +func FixedLengthRecordReaderV2SharedName(value string) FixedLengthRecordReaderV2Attr { + return func(m optionalAttr) { + m["shared_name"] = value + } +} + +// FixedLengthRecordReaderV2Encoding sets the optional encoding attribute to value. +// +// value: The type of encoding for the file. Currently ZLIB and GZIP +// are supported. Defaults to none. +// If not specified, defaults to "" +func FixedLengthRecordReaderV2Encoding(value string) FixedLengthRecordReaderV2Attr { + return func(m optionalAttr) { + m["encoding"] = value + } +} + +// A Reader that outputs fixed-length records from a file. +// +// Arguments: +// +// record_bytes: Number of bytes in the record. +// +// Returns The handle to reference the Reader. +func FixedLengthRecordReaderV2(scope *Scope, record_bytes int64, optional ...FixedLengthRecordReaderV2Attr) (reader_handle tf.Output) { + if scope.Err() != nil { + return + } + attrs := map[string]interface{}{"record_bytes": record_bytes} + for _, a := range optional { + a(attrs) + } + opspec := tf.OpSpec{ + Type: "FixedLengthRecordReaderV2", + + Attrs: attrs, + } + op := scope.AddOperation(opspec) + return op.Output(0) +} diff --git a/third_party/go-tensorflow/tensorflow/go/operation.go b/third_party/go-tensorflow/tensorflow/go/operation.go new file mode 100644 index 0000000..d6a37e0 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/operation.go @@ -0,0 +1,216 @@ +/* +Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package tensorflow + +// #include +// #include "tensorflow/c/c_api.h" +import "C" + +import "unsafe" + +// Operation that has been added to the graph. +type Operation struct { + c *C.TF_Operation + // A reference to the Graph to prevent it from + // being GCed while the Operation is still alive. + g *Graph +} + +// Name returns the name of the operation. +func (op *Operation) Name() string { + return C.GoString(C.TF_OperationName(op.c)) +} + +// Type returns the name of the operator used by this operation. +func (op *Operation) Type() string { + return C.GoString(C.TF_OperationOpType(op.c)) +} + +// NumOutputs returns the number of outputs of op. +func (op *Operation) NumOutputs() int { + return int(C.TF_OperationNumOutputs(op.c)) +} + +// Device returns a specification of the device on which this operation +// will be executed, or the empty string if there is no such specification. +func (op *Operation) Device() string { + return C.GoString(C.TF_OperationDevice(op.c)) +} + +// OutputListSize returns the size of the list of Outputs that is produced by a +// named output of op. +// +// An Operation has multiple named outputs, each of which produces either +// a single tensor or a list of tensors. This method returns the size of +// the list of tensors for a specific output of the operation, identified +// by its name. +func (op *Operation) OutputListSize(output string) (int, error) { + cname := C.CString(output) + defer C.free(unsafe.Pointer(cname)) + status := newStatus() + n := C.TF_OperationOutputListLength(op.c, cname, status.c) + return int(n), status.Err() +} + +// Output returns the i-th output of op. +func (op *Operation) Output(i int) Output { + return Output{op, i} +} + +// NumInputs returns the number of inputs of op. +func (op *Operation) NumInputs() int { + return int(C.TF_OperationNumInputs(op.c)) +} + +// Output represents one of the outputs of an operation in the graph. Has a +// DataType (and eventually a Shape). May be passed as an input argument to a +// function for adding operations to a graph, or to a Session's Run() method to +// fetch that output as a tensor. +type Output struct { + // Op is the Operation that produces this Output. + Op *Operation + + // Index specifies the index of the output within the Operation. + Index int +} + +// DataType returns the type of elements in the tensor produced by p. +func (p Output) DataType() DataType { + return DataType(C.TF_OperationOutputType(p.c())) +} + +// Shape returns the (possibly incomplete) shape of the tensor produced p. +func (p Output) Shape() Shape { + status := newStatus() + port := p.c() + ndims := C.TF_GraphGetTensorNumDims(p.Op.g.c, port, status.c) + if err := status.Err(); err != nil { + // This should not be possible since an error only occurs if + // the operation does not belong to the graph. It should not + // be possible to construct such an Operation object. + return Shape{} + } + if ndims < 0 { + return Shape{} + } + if ndims == 0 { + return ScalarShape() + } + dims := make([]C.int64_t, ndims) + C.TF_GraphGetTensorShape(p.Op.g.c, port, &dims[0], ndims, status.c) + if err := status.Err(); err != nil { + // Same as above, should not be possible. + return Shape{} + } + ret := Shape{dims: make([]int64, ndims)} + for i := 0; i < int(ndims); i++ { + ret.dims[i] = int64(dims[i]) + } + return ret +} + +func (p Output) c() C.TF_Output { + if p.Op == nil { + // Attempt to provide a more useful panic message than "nil + // pointer dereference". + panic("nil-Operation. If the Output was created with a Scope object, see Scope.Err() for details.") + } + return C.TF_Output{oper: p.Op.c, index: C.int(p.Index)} +} + +func (p Output) canBeAnInput() {} + +// Consumers returns the inputs that consume this output. +func (p Output) Consumers() []Consumer { + max := int(C.TF_OperationOutputNumConsumers(p.c())) + if max == 0 { + return nil + } + inputs := make([]C.TF_Input, max) + n := C.TF_OperationOutputConsumers(p.c(), (*C.TF_Input)(unsafe.Pointer(&inputs[0])), C.int(max)) + inputs = inputs[:int(n)] + + var consumers []Consumer + for _, consumer := range inputs { + consumers = append(consumers, Consumer{ + Index: int(consumer.index), + Op: &Operation{ + c: consumer.oper, + g: p.Op.g, + }, + }) + } + + return consumers +} + +// Consumer identifies a specific input of an operation that consumes the output +// of another operation. +type Consumer struct { + // Op is the Operation that is consuming the output of another operation. + Op *Operation + + // Index is the index of the input within Op that the output of another + // operation is connected to. + Index int +} + +func (p Consumer) c() C.TF_Input { + if p.Op == nil { + // Attempt to provide a more useful panic message than "nil + // pointer dereference". + panic("nil-Operation. Consumer objects should only be created by a call to Output.Consumers") + } + return C.TF_Input{oper: p.Op.c, index: C.int(p.Index)} +} + +// DataType returns the type of the input. +func (p Consumer) DataType() DataType { + return DataType(C.TF_OperationInputType(p.c())) +} + +// Producer returns the Output that is connected to this Consumer. +func (p Consumer) Producer() Output { + output := C.TF_OperationInput(p.c()) + return Output{ + Op: &Operation{ + c: output.oper, + g: p.Op.g, + }, + Index: int(output.index), + } +} + +// Input is the interface for specifying inputs to an operation being added to +// a Graph. +// +// Operations can have multiple inputs, each of which could be either a tensor +// produced by another operation (an Output object), or a list of tensors +// produced by other operations (an OutputList). Thus, this interface is +// implemented by both Output and OutputList. +// +// See OpSpec.Input for more information. +type Input interface { + // Unexported to preclude implementations outside this package. + canBeAnInput() +} + +// OutputList represents a list of Outputs that can be provided as input to +// another operation. +type OutputList []Output + +func (l OutputList) canBeAnInput() {} diff --git a/third_party/go-tensorflow/tensorflow/go/operation_test.go b/third_party/go-tensorflow/tensorflow/go/operation_test.go new file mode 100644 index 0000000..4af9e33 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/operation_test.go @@ -0,0 +1,269 @@ +/* +Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package tensorflow + +import ( + "fmt" + "runtime" + "runtime/debug" + "testing" +) + +// createGraphAndOp creates an Operation but loses the reference to the Graph. +func createGraphAndOp() (*Operation, error) { + t, err := NewTensor(int64(1)) + if err != nil { + return nil, err + } + g := NewGraph() + output, err := Placeholder(g, "my_placeholder", t.DataType()) + if err != nil { + return nil, err + } + return output.Op, nil +} + +func TestOperationLifetime(t *testing.T) { + // Ensure that the Graph is not garbage collected while the program + // still has access to the Operation. + op, err := createGraphAndOp() + if err != nil { + t.Fatal(err) + } + forceGC() + if got, want := op.Name(), "my_placeholder"; got != want { + t.Errorf("Got '%s', want '%s'", got, want) + } + if got, want := op.Type(), "Placeholder"; got != want { + t.Errorf("Got '%s', want '%s'", got, want) + } +} + +func TestOperationOutputListSize(t *testing.T) { + graph := NewGraph() + c1, err := Const(graph, "c1", int64(1)) + if err != nil { + t.Fatal(err) + } + c2, err := Const(graph, "c2", [][]int64{{1, 2}, {3, 4}}) + if err != nil { + t.Fatal(err) + } + // The ShapeN op takes a list of tensors as input and a list as output. + op, err := graph.AddOperation(OpSpec{ + Type: "ShapeN", + Input: []Input{OutputList{c1, c2}}, + }) + if err != nil { + t.Fatal(err) + } + n, err := op.OutputListSize("output") + if err != nil { + t.Fatal(err) + } + if got, want := n, 2; got != want { + t.Errorf("Got %d, want %d", got, want) + } + if got, want := op.NumOutputs(), 2; got != want { + t.Errorf("Got %d, want %d", got, want) + } +} + +func TestOperationShapeAttribute(t *testing.T) { + g := NewGraph() + _, err := g.AddOperation(OpSpec{ + Type: "Placeholder", + Attrs: map[string]interface{}{ + "dtype": Float, + "shape": MakeShape(-1, 3), + }, + }) + if err != nil { + t.Fatal(err) + } + // If and when the API to get attributes is added, check that here. +} + +func TestOutputDataTypeAndShape(t *testing.T) { + graph := NewGraph() + testdata := []struct { + Value interface{} + Shape []int64 + dtype DataType + }{ + { // Scalar + int64(0), + []int64{}, + Int64, + }, + { // Vector + []int32{1, 2, 3}, + []int64{3}, + Int32, + }, + { // Matrix + [][]float64{ + {1, 2, 3}, + {4, 5, 6}, + }, + []int64{2, 3}, + Double, + }, + { // Matrix of Uint64 + [][]uint64{ + {1, 2, 3}, + {4, 5, 6}, + }, + []int64{2, 3}, + Uint64, + }, + } + for idx, test := range testdata { + t.Run(fmt.Sprintf("#%d Value %T", idx, test.Value), func(t *testing.T) { + c, err := Const(graph, fmt.Sprintf("const%d", idx), test.Value) + if err != nil { + t.Fatal(err) + } + if got, want := c.DataType(), test.dtype; got != want { + t.Errorf("Got DataType %v, want %v", got, want) + } + shape := c.Shape() + if got, want := shape.NumDimensions(), len(test.Shape); got != want { + t.Fatalf("Got a shape with %d dimensions, want %d", got, want) + } + for i := 0; i < len(test.Shape); i++ { + if got, want := shape.Size(i), test.Shape[i]; got != want { + t.Errorf("Got %d, want %d for dimension #%d/%d", got, want, i, len(test.Shape)) + } + } + }) + } + // Unknown number of dimensions + dummyTensor, err := NewTensor(float64(0)) + if err != nil { + t.Fatal(err) + } + placeholder, err := Placeholder(graph, "placeholder", dummyTensor.DataType()) + if err != nil { + t.Fatal(err) + } + if shape := placeholder.Shape(); shape.NumDimensions() != -1 { + t.Errorf("Got shape %v, wanted an unknown number of dimensions", shape) + } +} + +func TestOperationInputs(t *testing.T) { + g := NewGraph() + x, err := Placeholder(g, "x", Float) + if err != nil { + t.Fatal(err) + } + y, err := Placeholder(g, "y", Float) + if err != nil { + t.Fatal(err) + } + add, err := Add(g, "add", x, y) + if err != nil { + t.Fatal(err) + } + addOp := add.Op + + if out := addOp.NumInputs(); out != 2 { + t.Fatalf("Got %d inputs, wanted 2", out) + } +} + +func TestOperationConsumers(t *testing.T) { + g := NewGraph() + x, err := Placeholder(g, "x", Float) + if err != nil { + t.Fatal(err) + } + a, err := Neg(g, "a", x) + if err != nil { + t.Fatal(err) + } + b, err := Neg(g, "b", x) + if err != nil { + t.Fatal(err) + } + + consumers := []*Operation{a.Op, b.Op} + + xConsumers := x.Consumers() + if out := len(xConsumers); out != 2 { + t.Fatalf("Got %d consumers, wanted 2", out) + } + + for i, consumer := range xConsumers { + got := consumer.Op.Name() + want := consumers[i].Name() + if got != want { + t.Fatalf("%d. Got op name %q, wanted %q", i, got, want) + } + + got = consumer.Producer().Op.Name() + want = x.Op.Name() + if got != want { + t.Fatalf("%d. Got op name %q, wanted %q", i, got, want) + } + } + + if len(b.Consumers()) != 0 { + t.Fatalf("expected %+v to have no consumers", b) + } +} + +func TestOperationDevice(t *testing.T) { + graph := NewGraph() + v, err := NewTensor(float32(1.0)) + if err != nil { + t.Fatal(err) + } + op, err := graph.AddOperation(OpSpec{ + Type: "Const", + Name: "Const", + Attrs: map[string]interface{}{ + "dtype": v.DataType(), + "value": v, + }, + Device: "/device:GPU:0", + }) + if err != nil { + t.Fatal(err) + } + if got, want := op.Device(), "/device:GPU:0"; got != want { + t.Errorf("Got %q, want %q", got, want) + } +} + +func forceGC() { + var mem runtime.MemStats + runtime.ReadMemStats(&mem) + // It was empirically observed that without this extra allocation + // TestOperationLifetime would fail only 50% of the time if + // Operation did not hold on to a reference to Graph. With this + // additional allocation, and with the bug where Operation does + // not hold onto a Graph, the test failed 90+% of the time. + // + // The author is aware that this technique is potentially fragile + // and fishy. Suggestions for alternatives are welcome. + bytesTillGC := mem.NextGC - mem.HeapAlloc + 1 + _ = make([]byte, bytesTillGC) + runtime.GC() + debug.FreeOSMemory() +} diff --git a/third_party/go-tensorflow/tensorflow/go/saved_model.go b/third_party/go-tensorflow/tensorflow/go/saved_model.go new file mode 100644 index 0000000..64ae82e --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/saved_model.go @@ -0,0 +1,100 @@ +/* +Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package tensorflow + +import ( + "fmt" + "runtime" + "unsafe" + + "github.com/golang/protobuf/proto" + corepb "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto" +) + +// #include +// #include "tensorflow/c/c_api.h" +import "C" + +// SavedModel represents the contents of loaded SavedModel. +// TODO(jhseu): Add and document metagraphdef when we pregenerate protobufs. +type SavedModel struct { + Session *Session + Graph *Graph + Signatures map[string]Signature +} + +// LoadSavedModel creates a new SavedModel from a model previously +// exported to a directory on disk. +// +// Exported models contain a set of graphs and, optionally, variable values. +// Tags in the model identify a single graph. LoadSavedModel initializes a +// session with the identified graph and with variables initialized to from the +// checkpoints on disk. +// +// The tensorflow package currently does not have the ability to export a model +// to a directory from Go. This function thus currently targets loading models +// exported in other languages, such as using tf.saved_model.builder in Python. +// See: +// https://www.tensorflow.org/code/tensorflow/python/saved_model/ +func LoadSavedModel(exportDir string, tags []string, options *SessionOptions) (*SavedModel, error) { + status := newStatus() + cOpt, doneOpt, err := options.c() + defer doneOpt() + if err != nil { + return nil, err + } + cExportDir := C.CString(exportDir) + if len(tags) == 0 { + return nil, fmt.Errorf("empty tags are not allowed") + } + cTags := make([]*C.char, len(tags)) + for i := range tags { + cTags[i] = C.CString(tags[i]) + } + graph := NewGraph() + metaGraphDefBuf := C.TF_NewBuffer() + defer C.TF_DeleteBuffer(metaGraphDefBuf) + // TODO(jhseu): Add support for run_options and meta_graph_def. + cSess := C.TF_LoadSessionFromSavedModel(cOpt, nil, cExportDir, (**C.char)(unsafe.Pointer(&cTags[0])), C.int(len(cTags)), graph.c, metaGraphDefBuf, status.c) + for i := range cTags { + C.free(unsafe.Pointer(cTags[i])) + } + C.free(unsafe.Pointer(cExportDir)) + + metaGraphDefBytes := C.GoBytes(metaGraphDefBuf.data, C.int(metaGraphDefBuf.length)) + metaGraphDef := new(corepb.MetaGraphDef) + if err := proto.Unmarshal(metaGraphDefBytes, metaGraphDef); err != nil { + return nil, err + } + + signatures := generateSignatures(metaGraphDef.GetSignatureDef()) + + if err := status.Err(); err != nil { + return nil, err + } + s := &Session{c: cSess} + runtime.SetFinalizer(s, func(s *Session) { s.Close() }) + return &SavedModel{Session: s, Graph: graph, Signatures: signatures}, nil +} + +func generateSignatures(pb map[string]*corepb.SignatureDef) map[string]Signature { + signatures := make(map[string]Signature) + for name, signature := range pb { + signatures[name] = signatureDefFromProto(signature) + } + return signatures +} diff --git a/third_party/go-tensorflow/tensorflow/go/saved_model_test.go b/third_party/go-tensorflow/tensorflow/go/saved_model_test.go new file mode 100644 index 0000000..24811d6 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/saved_model_test.go @@ -0,0 +1,41 @@ +/* +Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package tensorflow + +import "testing" + +func TestSavedModel(t *testing.T) { + tags := []string{"serve"} + bundle, err := LoadSavedModel("../cc/saved_model/testdata/half_plus_two/00000123", tags, nil) + if err != nil { + t.Fatalf("LoadSavedModel(): %v", err) + } + if op := bundle.Graph.Operation("y"); op == nil { + t.Fatalf("\"y\" not found in graph") + } + t.Logf("SavedModel: %+v", bundle) + // TODO(jhseu): half_plus_two has a tf.Example proto dependency to run. Add a + // more thorough test when the generated protobufs are available. +} + +func TestSavedModelWithEmptyTags(t *testing.T) { + tags := []string{} + _, err := LoadSavedModel("../cc/saved_model/testdata/half_plus_two/00000123", tags, nil) + if err == nil { + t.Fatalf("LoadSavedModel() should return an error if tags are empty") + } +} diff --git a/third_party/go-tensorflow/tensorflow/go/session.go b/third_party/go-tensorflow/tensorflow/go/session.go new file mode 100644 index 0000000..309dc21 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/session.go @@ -0,0 +1,449 @@ +/* +Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package tensorflow + +// #include +// #include "tensorflow/c/c_api.h" +import "C" + +import ( + "errors" + "fmt" + "runtime" + "sort" + "sync" + "unsafe" +) + +// Session drives a TensorFlow graph computation. +// +// When a Session is created with a given target, a new Session object is bound +// to the universe of resources specified by that target. Those resources are +// available to this session to perform computation described in the GraphDef. +// After creating the session with a graph, the caller uses the Run() API to +// perform the computation and potentially fetch outputs as Tensors. +// A Session allows concurrent calls to Run(). +type Session struct { + c *C.TF_Session + + // For ensuring that: + // - Close() blocks on all Run() calls to complete. + // - Close() can be called multiple times. + wg sync.WaitGroup + mu sync.Mutex +} + +// NewSession creates a new execution session with the associated graph. +// options may be nil to use the default options. +func NewSession(graph *Graph, options *SessionOptions) (*Session, error) { + status := newStatus() + cOpt, doneOpt, err := options.c() + defer doneOpt() + if err != nil { + return nil, err + } + cSess := C.TF_NewSession(graph.c, cOpt, status.c) + if err := status.Err(); err != nil { + return nil, err + } + + s := &Session{c: cSess} + runtime.SetFinalizer(s, func(s *Session) { s.Close() }) + return s, nil +} + +// Device structure contains information about a device associated with a session, as returned by ListDevices() +type Device struct { + Name, Type string + MemoryLimitBytes int64 +} + +// String describes d and implements fmt.Stringer. +func (d Device) String() string { + memStr := "no memory limit" + if d.MemoryLimitBytes >= 0 { + memStr = fmt.Sprintf("memory limit %d bytes", d.MemoryLimitBytes) + } + return fmt.Sprintf("(Device: name \"%s\", type %s, %s)", d.Name, d.Type, memStr) +} + +func deviceSliceFromDeviceList(list *C.TF_DeviceList) ([]Device, error) { + var devices []Device + status := newStatus() + + for i := 0; i < int(C.TF_DeviceListCount(list)); i++ { + name := C.TF_DeviceListName(list, C.int(i), status.c) + if err := status.Err(); err != nil { + return nil, fmt.Errorf("DeviceListName(index=%d) failed: %v", i, err) + } + + deviceType := C.TF_DeviceListType(list, C.int(i), status.c) + if err := status.Err(); err != nil { + return nil, fmt.Errorf("DeviceListType(index=%d) failed: %v", i, err) + } + + memoryLimitBytes := C.TF_DeviceListMemoryBytes(list, C.int(i), status.c) + if err := status.Err(); err != nil { + return nil, fmt.Errorf("DeviceListMemoryBytes(index=%d) failed: %v", i, err) + } + + device := Device{ + Name: C.GoString(name), + Type: C.GoString(deviceType), + MemoryLimitBytes: int64(memoryLimitBytes), + } + + devices = append(devices, device) + } + + return devices, nil +} + +// ListDevices returns the list of devices associated with a Session. +func (s *Session) ListDevices() ([]Device, error) { + status := newStatus() + devicesList := C.TF_SessionListDevices(s.c, status.c) + if err := status.Err(); err != nil { + return nil, fmt.Errorf("SessionListDevices() failed: %v", err) + } + defer C.TF_DeleteDeviceList(devicesList) + return deviceSliceFromDeviceList(devicesList) +} + +// Run the graph with the associated session starting with the supplied feeds +// to compute the value of the requested fetches. Runs, but does not return +// Tensors for operations specified in targets. +// +// On success, returns the fetched Tensors in the same order as supplied in +// the fetches argument. If fetches is set to nil, the returned Tensor fetches +// is empty. +func (s *Session) Run(feeds map[Output]*Tensor, fetches []Output, targets []*Operation) ([]*Tensor, error) { + s.mu.Lock() + if s.c == nil { + s.mu.Unlock() + return nil, errors.New("session is closed") + } + s.wg.Add(1) + s.mu.Unlock() + defer s.wg.Done() + + c := newCRunArgs(feeds, fetches, targets) + status := newStatus() + C.TF_SessionRun(s.c, nil, + ptrOutput(c.feeds), ptrTensor(c.feedTensors), C.int(len(feeds)), + ptrOutput(c.fetches), ptrTensor(c.fetchTensors), C.int(len(fetches)), + ptrOperation(c.targets), C.int(len(targets)), + nil, status.c) + + // Make sure GC won't harvest input tensors until SessionRun() is finished + runtime.KeepAlive(feeds) + + if err := status.Err(); err != nil { + return nil, err + } + return c.toGo(), nil +} + +// PartialRun enables incremental evaluation of graphs. +// +// PartialRun allows the caller to pause the evaluation of a graph, run +// arbitrary code that depends on the intermediate computation of the graph, +// and then resume graph execution. The results of the arbitrary code can be +// fed into the graph when resuming execution. In contrast, Session.Run +// executes the graph to compute the requested fetches using the provided feeds +// and discards all intermediate state (e.g., value of intermediate tensors) +// when it returns. +// +// For example, consider a graph for unsupervised training of a neural network +// model. PartialRun can be used to pause execution after the forward pass of +// the network, let the caller actuate the output (e.g., play a game, actuate a +// robot etc.), determine the error/loss and then feed this calculated loss +// when resuming the backward pass of the graph. +type PartialRun struct { + session *Session + handle *C.char +} + +// Run resumes execution of the graph to compute the requested fetches and +// targets with the provided feeds. +func (pr *PartialRun) Run(feeds map[Output]*Tensor, fetches []Output, targets []*Operation) ([]*Tensor, error) { + var ( + c = newCRunArgs(feeds, fetches, targets) + status = newStatus() + s = pr.session + ) + s.mu.Lock() + if s.c == nil { + s.mu.Unlock() + return nil, errors.New("session is closed") + } + s.wg.Add(1) + s.mu.Unlock() + defer s.wg.Done() + + C.TF_SessionPRun(s.c, pr.handle, + ptrOutput(c.feeds), ptrTensor(c.feedTensors), C.int(len(feeds)), + ptrOutput(c.fetches), ptrTensor(c.fetchTensors), C.int(len(fetches)), + ptrOperation(c.targets), C.int(len(targets)), + status.c) + if err := status.Err(); err != nil { + return nil, err + } + return c.toGo(), nil +} + +// NewPartialRun sets up the graph for incremental evaluation. +// +// All values of feeds, fetches and targets that may be provided to Run calls +// on the returned PartialRun need to be provided to NewPartialRun. +// +// See documentation for the PartialRun type. +func (s *Session) NewPartialRun(feeds, fetches []Output, targets []*Operation) (*PartialRun, error) { + var ( + cfeeds = make([]C.TF_Output, len(feeds)) + cfetches = make([]C.TF_Output, len(fetches)) + ctargets = make([]*C.TF_Operation, len(targets)) + + pcfeeds *C.TF_Output + pcfetches *C.TF_Output + pctargets **C.TF_Operation + + status = newStatus() + ) + if len(feeds) > 0 { + pcfeeds = &cfeeds[0] + for i, o := range feeds { + cfeeds[i] = o.c() + } + } + if len(fetches) > 0 { + pcfetches = &cfetches[0] + for i, o := range fetches { + cfetches[i] = o.c() + } + } + if len(targets) > 0 { + pctargets = &ctargets[0] + for i, o := range targets { + ctargets[i] = o.c + } + } + + s.mu.Lock() + if s.c == nil { + s.mu.Unlock() + return nil, errors.New("session is closed") + } + s.wg.Add(1) + s.mu.Unlock() + defer s.wg.Done() + + pr := &PartialRun{session: s} + C.TF_SessionPRunSetup(s.c, + pcfeeds, C.int(len(feeds)), + pcfetches, C.int(len(fetches)), + pctargets, C.int(len(targets)), + &pr.handle, status.c) + if err := status.Err(); err != nil { + return nil, err + } + runtime.SetFinalizer(pr, func(pr *PartialRun) { + C.TF_DeletePRunHandle(pr.handle) + }) + return pr, nil +} + +// Close a session. This contacts any other processes associated with this +// session, if applicable. Blocks until all previous calls to Run have returned. +func (s *Session) Close() error { + s.mu.Lock() + defer s.mu.Unlock() + s.wg.Wait() + if s.c == nil { + return nil + } + status := newStatus() + C.TF_CloseSession(s.c, status.c) + if err := status.Err(); err != nil { + return err + } + C.TF_DeleteSession(s.c, status.c) + s.c = nil + return status.Err() +} + +// SessionOptions contains configuration information for a session. +type SessionOptions struct { + // Target indicates the TensorFlow runtime to connect to. + // + // If 'target' is empty or unspecified, the local TensorFlow runtime + // implementation will be used. Otherwise, the TensorFlow engine + // defined by 'target' will be used to perform all computations. + // + // "target" can be either a single entry or a comma separated list + // of entries. Each entry is a resolvable address of one of the + // following formats: + // local + // ip:port + // host:port + // ... other system-specific formats to identify tasks and jobs ... + // + // NOTE: at the moment 'local' maps to an in-process service-based + // runtime. + // + // Upon creation, a single session affines itself to one of the + // remote processes, with possible load balancing choices when the + // "target" resolves to a list of possible processes. + // + // If the session disconnects from the remote process during its + // lifetime, session calls may fail immediately. + Target string + + // Config is a binary-serialized representation of the + // tensorflow.ConfigProto protocol message + // (https://www.tensorflow.org/code/tensorflow/core/protobuf/config.proto). + Config []byte +} + +// c converts the SessionOptions to the C API's TF_SessionOptions. Callers must +// deallocate by calling the returned done() closure. +func (o *SessionOptions) c() (ret *C.TF_SessionOptions, done func(), err error) { + opt := C.TF_NewSessionOptions() + if o == nil { + return opt, func() { C.TF_DeleteSessionOptions(opt) }, nil + } + t := C.CString(o.Target) + C.TF_SetTarget(opt, t) + C.free(unsafe.Pointer(t)) + + var cConfig unsafe.Pointer + if sz := len(o.Config); sz > 0 { + status := newStatus() + // Copying into C-memory is the simplest thing to do in terms + // of memory safety and cgo rules ("C code may not keep a copy + // of a Go pointer after the call returns" from + // https://golang.org/cmd/cgo/#hdr-Passing_pointers). + cConfig = C.CBytes(o.Config) + C.TF_SetConfig(opt, cConfig, C.size_t(sz), status.c) + if err := status.Err(); err != nil { + C.TF_DeleteSessionOptions(opt) + return nil, func() {}, fmt.Errorf("invalid SessionOptions.Config: %v", err) + } + } + return opt, func() { + C.TF_DeleteSessionOptions(opt) + C.free(cConfig) + }, nil +} + +// cRunArgs translates the arguments to Session.Run and PartialRun.Run into +// values suitable for C library calls. +type cRunArgs struct { + feeds []C.TF_Output + feedTensors []*C.TF_Tensor + fetches []C.TF_Output + fetchTensors []*C.TF_Tensor + targets []*C.TF_Operation +} + +type feedsort struct { + feeds []C.TF_Output + feedTensors []*C.TF_Tensor +} + +func (f *feedsort) Less(i, j int) bool { + // Ideally we would sort on the output names. But that's not easy for us to + // do efficiently as loads of Go name strings would be created from the C + // strings and destroyed. But we can sort on the addresses of the operation + // names. This won't sort alphabetically, but for a given set of feeds it + // should give consistent results from one run to the next. + ni := uintptr(unsafe.Pointer(C.TF_OperationName(f.feeds[i].oper))) + nj := uintptr(unsafe.Pointer(C.TF_OperationName(f.feeds[j].oper))) + if ni == nj { + // if the names are the same the index may differ + return f.feeds[i].index < f.feeds[j].index + } + return ni < nj +} + +func (f *feedsort) Swap(i, j int) { + f.feeds[i], f.feeds[j] = f.feeds[j], f.feeds[i] + f.feedTensors[i], f.feedTensors[j] = f.feedTensors[j], f.feedTensors[i] +} + +func (f *feedsort) Len() int { + return len(f.feeds) +} + +func newCRunArgs(feeds map[Output]*Tensor, fetches []Output, targets []*Operation) *cRunArgs { + c := &cRunArgs{ + fetches: make([]C.TF_Output, len(fetches)), + fetchTensors: make([]*C.TF_Tensor, len(fetches)), + targets: make([]*C.TF_Operation, len(targets)), + } + // Go map iteration order is random. So our list of input names will be + // random for each Run. This interacts badly with the TF core code which + // builds a executor cache key from these names in the order we provide + // them. We'll eventually enumerate every possible order and store it in the + // executor cache. With n inputs that's n! entries. That gets very big very + // quickly. + for o, t := range feeds { + c.feeds = append(c.feeds, o.c()) + c.feedTensors = append(c.feedTensors, t.c) + } + if len(c.feeds) > 1 { + fs := feedsort{feeds: c.feeds, feedTensors: c.feedTensors} + sort.Sort(&fs) + } + + for i, o := range fetches { + c.fetches[i] = o.c() + } + for i, t := range targets { + c.targets[i] = t.c + } + return c +} + +func (c *cRunArgs) toGo() []*Tensor { + ret := make([]*Tensor, len(c.fetchTensors)) + for i, ct := range c.fetchTensors { + ret[i] = newTensorFromC(ct) + } + return ret +} + +func ptrOutput(l []C.TF_Output) *C.TF_Output { + if len(l) == 0 { + return nil + } + return &l[0] +} + +func ptrTensor(l []*C.TF_Tensor) **C.TF_Tensor { + if len(l) == 0 { + return nil + } + return &l[0] +} + +func ptrOperation(l []*C.TF_Operation) **C.TF_Operation { + if len(l) == 0 { + return nil + } + return &l[0] +} diff --git a/third_party/go-tensorflow/tensorflow/go/session_test.go b/third_party/go-tensorflow/tensorflow/go/session_test.go new file mode 100644 index 0000000..f5479aa --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/session_test.go @@ -0,0 +1,433 @@ +/* +Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package tensorflow + +import ( + "fmt" + "reflect" + "testing" +) + +func createTestGraph(t *testing.T, dt DataType) (*Graph, Output, Output) { + g := NewGraph() + inp, err := Placeholder(g, "p1", dt) + if err != nil { + t.Fatalf("Placeholder() for %v: %v", dt, err) + } + out, err := Neg(g, "neg1", inp) + if err != nil { + t.Fatalf("Neg() for %v: %v", dt, err) + } + return g, inp, out +} + +func TestSessionRunNeg(t *testing.T) { + var tests = []struct { + input interface{} + expected interface{} + }{ + {int64(1), int64(-1)}, + {[]float64{-1, -2, 3}, []float64{1, 2, -3}}, + {[][]float32{{1, -2}, {-3, 4}}, [][]float32{{-1, 2}, {3, -4}}}, + } + + for _, test := range tests { + t.Run(fmt.Sprint(test.input), func(t *testing.T) { + t1, err := NewTensor(test.input) + if err != nil { + t.Fatal(err) + } + graph, inp, out := createTestGraph(t, t1.DataType()) + s, err := NewSession(graph, &SessionOptions{}) + if err != nil { + t.Fatal(err) + } + output, err := s.Run(map[Output]*Tensor{inp: t1}, []Output{out}, []*Operation{out.Op}) + if err != nil { + t.Fatal(err) + } + if len(output) != 1 { + t.Fatalf("got %d outputs, want 1", len(output)) + } + val := output[0].Value() + if !reflect.DeepEqual(test.expected, val) { + t.Errorf("got %v, want %v", val, test.expected) + } + if err := s.Close(); err != nil { + t.Error(err) + } + }) + } +} + +func TestMultipleInput(t *testing.T) { + // The inputs to the graph get sorted. This test checks that process works + // OK and that we still get the right output. + graph := NewGraph() + + inputs := make([]Output, 20) + layer2 := make([]Output, len(inputs)) + for i := range inputs { + in, err := Placeholder(graph, fmt.Sprintf("input%d", i), Int64) + if err != nil { + t.Fatal(err) + } + inputs[i] = in + + factor, err := Const(graph, fmt.Sprintf("factor%d", i), int64(i+1)) + if err != nil { + t.Fatal(err) + } + l2, err := graph.AddOperation(OpSpec{ + Type: "Mul", + Name: fmt.Sprintf("Mul%d", i), + Input: []Input{ + in, + factor, + }, + }) + if err != nil { + t.Fatal(err) + } + layer2[i] = l2.Output(0) + } + + fetch, err := graph.AddOperation(OpSpec{ + Type: "AddN", + Input: []Input{ + OutputList(layer2), + }, + }) + if err != nil { + t.Fatal(err) + } + + session, err := NewSession(graph, nil) + if err != nil { + t.Fatal(err) + } + defer func() { + if err := session.Close(); err != nil { + t.Fatal(err) + } + }() + + feeds := make(map[Output]*Tensor, len(inputs)) + for i, in := range inputs { + tensor, err := NewTensor(int64(i + 1)) + if err != nil { + t.Fatal(err) + } + feeds[in] = tensor + } + + output, err := session.Run( + feeds, + []Output{ + fetch.Output(0), + }, + nil, + ) + if err != nil { + t.Fatal(err) + } + + var exp int64 + for i := range inputs { + exp += int64((i + 1) * (i + 1)) + } + if v := output[0].Value().(int64); v != exp { + t.Fatalf("expected %d got %d", exp, v) + } +} + +func TestInputOrderStable(t *testing.T) { + graph := NewGraph() + + inputs := make([]Output, 20) + for i := range inputs { + in, err := Placeholder(graph, fmt.Sprintf("input%d", i), Int64) + if err != nil { + t.Fatal(err) + } + in.Index = i + inputs[i] = in + } + + makeArgs := func() *cRunArgs { + feeds := make(map[Output]*Tensor, len(inputs)) + for i, in := range inputs { + tensor, err := NewTensor(int64(i + 1)) + if err != nil { + t.Fatal(err) + } + feeds[in] = tensor + } + + return newCRunArgs(feeds, nil, nil) + } + args1 := makeArgs() + args2 := makeArgs() + + if !reflect.DeepEqual(args1.feeds, args2.feeds) { + t.Fatalf("order is not stable") + } +} + +func TestSessionRunConcat(t *testing.T) { + // Runs the Concat operation on two matrices: m1 and m2, along the + // first dimension (dim1). + // This tests the use of both Output and OutputList as inputs to the + // Concat operation. + var ( + g = NewGraph() + dim1, _ = Const(g, "dim1", int32(1)) + m1, _ = Const(g, "m1", [][]int64{ + {1, 2, 3}, + {4, 5, 6}, + }) + m2, _ = Const(g, "m2", [][]int64{ + {7, 8, 9}, + {10, 11, 12}, + }) + want = [][]int64{ + {1, 2, 3, 7, 8, 9}, + {4, 5, 6, 10, 11, 12}, + } + ) + concat, err := g.AddOperation(OpSpec{ + Type: "Concat", + Input: []Input{ + dim1, + OutputList{m1, m2}, + }, + }) + if err != nil { + t.Fatal(err) + } + s, err := NewSession(g, &SessionOptions{}) + if err != nil { + t.Fatal(err) + } + output, err := s.Run(nil, []Output{concat.Output(0)}, nil) + if err != nil { + t.Fatal(err) + } + if len(output) != 1 { + t.Fatal(len(output)) + } + if got := output[0].Value(); !reflect.DeepEqual(got, want) { + t.Fatalf("Got %v, want %v", got, want) + } +} + +func TestSessionWithStringTensors(t *testing.T) { + // Construct the graph: + // AsString(StringToHashBucketFast("PleaseHashMe")) Will be much + // prettier if using the ops package, but in this package graphs are + // constructed from first principles. + var ( + g = NewGraph() + feed, _ = Const(g, "input", "PleaseHashMe") + hash, _ = g.AddOperation(OpSpec{ + Type: "StringToHashBucketFast", + Input: []Input{feed}, + Attrs: map[string]interface{}{ + "num_buckets": int64(1 << 32), + }, + }) + str, _ = g.AddOperation(OpSpec{ + Type: "AsString", + Input: []Input{hash.Output(0)}, + }) + ) + s, err := NewSession(g, nil) + if err != nil { + t.Fatal(err) + } + output, err := s.Run(nil, []Output{str.Output(0)}, nil) + if err != nil { + t.Fatal(err) + } + if len(output) != 1 { + t.Fatal(len(output)) + } + got, ok := output[0].Value().(string) + if !ok { + t.Fatalf("Got %T, wanted string", output[0].Value()) + } + if want := "1027741475"; got != want { + t.Fatalf("Got %q, want %q", got, want) + } +} + +func TestConcurrency(t *testing.T) { + tensor, err := NewTensor(int64(1)) + if err != nil { + t.Fatalf("NewTensor(): %v", err) + } + + graph, inp, out := createTestGraph(t, tensor.DataType()) + s, err := NewSession(graph, &SessionOptions{}) + if err != nil { + t.Fatalf("NewSession(): %v", err) + } + for i := 0; i < 100; i++ { + // Session may close before Run() starts, so we don't check the error. + go s.Run(map[Output]*Tensor{inp: tensor}, []Output{out}, []*Operation{out.Op}) + } + if err = s.Close(); err != nil { + t.Errorf("Close() 1: %v", err) + } + if err = s.Close(); err != nil { + t.Errorf("Close() 2: %v", err) + } +} + +func ExamplePartialRun() { + var ( + // Create a graph: a + 2 + 3 + b. + // + // Skipping error handling for brevity of this example. + // The 'op' package can be used to make graph construction code + // with error handling more succinct. + g = NewGraph() + a, _ = Placeholder(g, "a", Int32) + b, _ = Placeholder(g, "b", Int32) + two, _ = Const(g, "Two", int32(2)) + three, _ = Const(g, "Three", int32(3)) + + plus2, _ = Add(g, "plus2", a, two) // a + 2 + plus3, _ = Add(g, "plus3", plus2, three) // (a + 2) + 3 + plusB, _ = Add(g, "plusB", plus3, b) // ((a + 2) + 3) + b + + ) + sess, err := NewSession(g, nil) + if err != nil { + panic(err) + } + defer sess.Close() + + // All the feeds, fetches and targets for subsequent PartialRun.Run + // calls must be provided at setup. + pr, err := sess.NewPartialRun( + []Output{a, b}, + []Output{plus2, plusB}, + []*Operation{plus3.Op}, + ) + if err != nil { + panic(err) + } + + // Feed 'a=1', fetch 'plus2', and compute (but do not fetch) 'plus3'. + // Imagine this to be the forward pass of unsupervised neural network + // training of a robot. + val, _ := NewTensor(int32(1)) + fetches, err := pr.Run( + map[Output]*Tensor{a: val}, + []Output{plus2}, + nil) + if err != nil { + panic(err) + } + v1 := fetches[0].Value().(int32) + + // Now, feed 'b=4', fetch 'plusB=a+2+3+b' + // Imagine this to be the result of actuating the robot to determine + // the error produced by the current state of the neural network. + val, _ = NewTensor(int32(4)) + fetches, err = pr.Run( + map[Output]*Tensor{b: val}, + []Output{plusB}, + nil) + if err != nil { + panic(err) + } + v2 := fetches[0].Value().(int32) + + fmt.Println(v1, v2) + // Output: 3 10 +} + +func TestSessionConfig(t *testing.T) { + // Exercise SessionOptions. + // Arguably, a better API would be for SessionOptions.Config to be the + // type generated by the protocol buffer compiler. But for now, the + // tensorflow package continues to be independent of protocol buffers + // and this test exercises the option since the implementation has a + // nuanced conversion to C types. + // + // Till then, the []byte form of Config here was generated using a toy + // tensorflow Python program: + /* + import tensorflow + c = tensorflow.ConfigProto() + c.intra_op_parallelism_threads = 1 + print c.SerializeToString() + */ + graph := NewGraph() + c, err := Const(graph, "Const", int32(14)) + if err != nil { + t.Fatal(err) + } + opts := SessionOptions{Config: []byte("(\x01")} + s, err := NewSession(graph, &opts) + if err != nil { + t.Fatal(err) + } + output, err := s.Run(nil, []Output{c}, nil) + if err != nil { + t.Fatal(err) + } + if output[0].Value().(int32) != 14 { + t.Fatalf("Got %v, want -1", output[0].Value()) + } +} + +func TestListDevices(t *testing.T) { + s, err := NewSession(NewGraph(), nil) + if err != nil { + t.Fatalf("NewSession(): %v", err) + } + + devices, err := s.ListDevices() + if err != nil { + t.Fatalf("ListDevices(): %v", err) + } + + if len(devices) == 0 { + t.Fatalf("no devices detected") + } +} + +func TestDeviceString(t *testing.T) { + d := Device{Name: "foo", Type: "bar", MemoryLimitBytes: 12345} + got := d.String() + want := "(Device: name \"foo\", type bar, memory limit 12345 bytes)" + if got != want { + t.Errorf("Got \"%s\", want \"%s\"", got, want) + } +} + +func TestDeviceStringNoMemoryLimit(t *testing.T) { + d := Device{Name: "foo", Type: "bar", MemoryLimitBytes: -1} + got := d.String() + want := "(Device: name \"foo\", type bar, no memory limit)" + if got != want { + t.Errorf("Got \"%s\", want \"%s\"", got, want) + } +} diff --git a/third_party/go-tensorflow/tensorflow/go/shape.go b/third_party/go-tensorflow/tensorflow/go/shape.go new file mode 100644 index 0000000..8d000cb --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/shape.go @@ -0,0 +1,104 @@ +/* +Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package tensorflow + +import ( + "fmt" + "strings" +) + +// Shape represents the (possibly partially known) shape of a tensor that will +// be produced by an operation. +// +// The zero-value of a Shape represents a shape with an unknown number of +// dimensions. +type Shape struct { + dims []int64 +} + +// ScalarShape returns a Shape representing a scalar. +func ScalarShape() Shape { + return Shape{dims: make([]int64, 0)} +} + +// MakeShape returns a Shape with the provided size of each dimension. +// +// A value of -1 implies that the size of the corresponding dimension is not +// known. +func MakeShape(shape ...int64) Shape { + cpy := make([]int64, len(shape)) + copy(cpy, shape) + return Shape{dims: cpy} +} + +// NumDimensions returns the number of dimensions represented by s, or -1 if +// unknown. +func (s Shape) NumDimensions() int { + if s.dims == nil { + return -1 + } + return len(s.dims) +} + +// Size returns the size of the dim-th dimension of the shape, or -1 if it +// is unknown. +// +// REQUIRES: 0 <= dim < s.NumDimensions() +func (s Shape) Size(dim int) int64 { + if dim < 0 || dim >= s.NumDimensions() { + return -1 + } + return s.dims[dim] +} + +// IsFullySpecified returns true iff the size of all the dimensions of s are +// known. +func (s Shape) IsFullySpecified() bool { + if s.dims == nil { + return false + } + for _, size := range s.dims { + if size <= 1 { + return false + } + } + return true +} + +// ToSlice returns the (possibly partially known) shape represented by s as a +// slice, or an error if the number of dimensions is not known. +func (s Shape) ToSlice() ([]int64, error) { + if s.dims == nil { + return nil, fmt.Errorf("cannot create a slice for a Shape with an unknown number of dimensions") + } + cpy := make([]int64, len(s.dims)) + copy(cpy, s.dims) + return cpy, nil +} + +func (s Shape) String() string { + if s.dims == nil { + return "?" + } + ret := fmt.Sprint(s.dims) + for _, size := range s.dims { + if size < 0 { + ret = strings.Replace(ret, fmt.Sprint(size), "?", 1) + } + } + return strings.Replace(ret, " ", ", ", -1) +} diff --git a/third_party/go-tensorflow/tensorflow/go/shape_test.go b/third_party/go-tensorflow/tensorflow/go/shape_test.go new file mode 100644 index 0000000..94ffd27 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/shape_test.go @@ -0,0 +1,85 @@ +/* +Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package tensorflow + +import ( + "fmt" + "reflect" + "testing" +) + +func TestShape(t *testing.T) { + tests := []struct { + shape Shape + slice []int64 + full bool + str string + }{ + { + shape: ScalarShape(), + slice: make([]int64, 0), + full: true, + str: "[]", + }, + { + shape: MakeShape(-1, 2, -1, 4), + slice: []int64{-1, 2, -1, 4}, + full: false, + str: "[?, 2, ?, 4]", + }, + { + shape: MakeShape(2, 3), + slice: []int64{2, 3}, + full: true, + str: "[2, 3]", + }, + } + for _, test := range tests { + t.Run(fmt.Sprintf("%#v", test.shape), func(t *testing.T) { + if got, want := test.shape.NumDimensions(), len(test.slice); got != want { + t.Errorf("Got %v, want %v", got, want) + } + if gotSlice, err := test.shape.ToSlice(); err != nil || !reflect.DeepEqual(gotSlice, test.slice) { + t.Errorf("Got (%#v, %v), want (%#v, nil)", gotSlice, err, test.slice) + } + if got, want := test.shape.IsFullySpecified(), test.full; got != want { + t.Errorf("Got %v, want %v", got, want) + } + if got, want := test.shape.String(), test.str; got != want { + t.Errorf("Got %v, want %v", got, want) + } + }) + } + +} + +func TestZeroShape(t *testing.T) { + var s Shape + if s.NumDimensions() != -1 { + t.Error(s.NumDimensions()) + } + if _, err := s.ToSlice(); err == nil { + t.Error("ToSlice() on a Shape of unknown number of dimensions should fail") + } + if s.IsFullySpecified() { + t.Error("Shape of unknown number of dimensions should not be fully specified") + } + if got, want := s.String(), "?"; got != want { + t.Errorf("Got %q, want %q", got, want) + } + +} diff --git a/third_party/go-tensorflow/tensorflow/go/signature.go b/third_party/go-tensorflow/tensorflow/go/signature.go new file mode 100644 index 0000000..c2db0c7 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/signature.go @@ -0,0 +1,119 @@ +/* +Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package tensorflow + +import corepb "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto" + +// #include "tensorflow/c/c_api.h" +import "C" + +// A Signature defines the signature of a computation supported by a TensorFlow +// graph. +// +// For example, a model with two loss computations, sharing a single input, +// might have the following signature_def map. +// +// Note that across the two Signatures "loss_A" and "loss_B", the input key, +// output key, and method_name are identical, and will be used by system(s) that +// implement or rely upon this particular loss method. The output tensor names +// differ, demonstrating how different outputs can exist for the same method. +// +// signature_def { +// key: "loss_A" +// value { +// inputs { +// key: "input" +// value { +// name: "input:0" +// dtype: DT_STRING +// tensor_shape: ... +// } +// } +// outputs { +// key: "loss_output" +// value { +// name: "loss_output_A:0" +// dtype: DT_FLOAT +// tensor_shape: ... +// } +// } +// } +// ... +// method_name: "some/package/compute_loss" +// } +// signature_def { +// key: "loss_B" +// value { +// inputs { +// key: "input" +// value { +// name: "input:0" +// dtype: DT_STRING +// tensor_shape: ... +// } +// } +// outputs { +// key: "loss_output" +// value { +// name: "loss_output_B:0" +// dtype: DT_FLOAT +// tensor_shape: ... +// } +// } +// } +// ... +// method_name: "some/package/compute_loss" +// } +type Signature struct { + Inputs, Outputs map[string]TensorInfo + MethodName string +} + +// A TensorInfo contains the information about a Tensor necessary for feeding or retrieval. +type TensorInfo struct { + Name string + DType DataType + Shape Shape +} + +func signatureDefFromProto(pb *corepb.SignatureDef) Signature { + inputs := make(map[string]TensorInfo) + for name, input := range pb.GetInputs() { + inputs[name] = tensorInfoFromProto(input) + } + outputs := make(map[string]TensorInfo) + for name, output := range pb.GetOutputs() { + outputs[name] = tensorInfoFromProto(output) + } + return Signature{ + Inputs: inputs, + Outputs: outputs, + MethodName: pb.GetMethodName(), + } +} + +func tensorInfoFromProto(pb *corepb.TensorInfo) TensorInfo { + var dims []int64 + for _, d := range pb.GetTensorShape().GetDim() { + dims = append(dims, d.GetSize()) + } + return TensorInfo{ + Name: pb.GetName(), + DType: DataType(C.TF_DataType(pb.GetDtype())), + Shape: MakeShape(dims...), + } +} diff --git a/third_party/go-tensorflow/tensorflow/go/signature_test.go b/third_party/go-tensorflow/tensorflow/go/signature_test.go new file mode 100644 index 0000000..f9fa842 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/signature_test.go @@ -0,0 +1,207 @@ +/* +Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package tensorflow + +import ( + "fmt" + "testing" + + tspb "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_shape_go_proto" + typb "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/types_go_proto" + corepb "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto" +) + +func TestSignatureFromProto(t *testing.T) { + got := signatureDefFromProto(&corepb.SignatureDef{ + Inputs: map[string]*corepb.TensorInfo{ + "input_1": &corepb.TensorInfo{ + Encoding: &corepb.TensorInfo_Name{ + Name: "tensor_1", + }, + Dtype: typb.DataType_DT_INT8, + TensorShape: &tspb.TensorShapeProto{ + Dim: []*tspb.TensorShapeProto_Dim{ + {Size: 1}, + {Size: 2}, + {Size: 3}, + }, + }, + }, + "input_2": &corepb.TensorInfo{ + Encoding: &corepb.TensorInfo_Name{ + Name: "tensor_2", + }, + Dtype: typb.DataType_DT_FLOAT, + TensorShape: &tspb.TensorShapeProto{ + Dim: []*tspb.TensorShapeProto_Dim{ + {Size: 4}, + {Size: 5}, + {Size: 6}, + }, + }, + }, + }, + Outputs: map[string]*corepb.TensorInfo{ + "output_1": &corepb.TensorInfo{ + Encoding: &corepb.TensorInfo_Name{ + Name: "tensor_3", + }, + Dtype: typb.DataType_DT_STRING, + TensorShape: &tspb.TensorShapeProto{ + Dim: []*tspb.TensorShapeProto_Dim{ + {Size: 1}, + {Size: 2}, + {Size: 3}, + }, + }, + }, + "output_2": &corepb.TensorInfo{ + Encoding: &corepb.TensorInfo_Name{ + Name: "tensor_4", + }, + Dtype: typb.DataType_DT_BOOL, + TensorShape: &tspb.TensorShapeProto{ + Dim: []*tspb.TensorShapeProto_Dim{ + {Size: 4}, + {Size: 5}, + {Size: 6}, + }, + }, + }, + }, + MethodName: "method", + }) + + want := Signature{ + Inputs: map[string]TensorInfo{ + "input_1": TensorInfo{ + Name: "tensor_1", + DType: Int8, + Shape: MakeShape(1, 2, 3), + }, + "input_2": TensorInfo{ + Name: "tensor_2", + DType: Float, + Shape: MakeShape(4, 5, 6), + }, + }, + Outputs: map[string]TensorInfo{ + "output_1": TensorInfo{ + Name: "tensor_3", + DType: String, + Shape: MakeShape(1, 2, 3), + }, + "output_2": TensorInfo{ + Name: "tensor_4", + DType: Bool, + Shape: MakeShape(4, 5, 6), + }, + }, + MethodName: "method", + } + + for k, input := range want.Inputs { + diff, err := diffTensorInfos(got.Inputs[k], input) + if err != nil { + t.Fatalf("Signature.Inputs[%s]: unable to diff TensorInfos: %v", k, err) + } + if diff != "" { + t.Errorf("Signature.Inputs[%s] diff:\n%s", k, diff) + } + } + + for k, output := range want.Outputs { + diff, err := diffTensorInfos(got.Outputs[k], output) + if err != nil { + t.Fatalf("Signature.Outputs[%s]: unable to diff TensorInfos: %v", k, err) + } + if diff != "" { + t.Errorf("Signature.Outputs[%s] diff:\n%s", k, diff) + } + } + + if got.MethodName != want.MethodName { + t.Errorf("Signature.MethodName: got %q, want %q", got.MethodName, want.MethodName) + } +} + +func TestTensorInfoFromProto(t *testing.T) { + got := tensorInfoFromProto(&corepb.TensorInfo{ + Encoding: &corepb.TensorInfo_Name{ + Name: "tensor", + }, + Dtype: typb.DataType_DT_INT8, + TensorShape: &tspb.TensorShapeProto{ + Dim: []*tspb.TensorShapeProto_Dim{ + {Size: 1}, + {Size: 2}, + {Size: 3}, + }, + }, + }) + want := TensorInfo{ + Name: "tensor", + DType: Int8, + Shape: MakeShape(1, 2, 3), + } + + diff, err := diffTensorInfos(got, want) + if err != nil { + t.Fatalf("Unable to diff TensorInfos: %v", err) + } + if diff != "" { + t.Errorf("tensorInfoFromProto produced a diff (got -> want): %s", diff) + } +} + +func diffTensorInfos(a, b TensorInfo) (string, error) { + diff := "" + if a.Name != b.Name { + diff += fmt.Sprintf("Name: %q -> %q\n", a.Name, b.Name) + } + if a.DType != b.DType { + diff += fmt.Sprintf("DType: %v -> %v\n", a.DType, b.DType) + } + + aShape, err := a.Shape.ToSlice() + if err != nil { + return "", err + } + bShape, err := b.Shape.ToSlice() + if err != nil { + return "", err + } + shapeLen := len(aShape) + if len(bShape) > shapeLen { + shapeLen = len(bShape) + } + for i := 0; i < shapeLen; i++ { + if i >= len(aShape) { + diff += fmt.Sprintf("+Shape[%d]: %d\n", i, bShape[i]) + continue + } + if i >= len(bShape) { + diff += fmt.Sprintf("-Shape[%d]: %d\n", i, aShape[i]) + continue + } + if aShape[i] != bShape[i] { + diff += fmt.Sprintf("Shape[%d]: %d -> %d\n", i, aShape[i], bShape[i]) + } + } + + return diff, nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/status.go b/third_party/go-tensorflow/tensorflow/go/status.go new file mode 100644 index 0000000..b4df836 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/status.go @@ -0,0 +1,67 @@ +/* +Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package tensorflow + +// #include "tensorflow/c/c_api.h" +import "C" + +import "runtime" + +type code C.TF_Code + +// status holds error information returned by TensorFlow. We convert all +// TF statuses to Go errors. +type status struct { + c *C.TF_Status +} + +func newStatus() *status { + s := &status{C.TF_NewStatus()} + runtime.SetFinalizer(s, (*status).finalizer) + return s +} + +func (s *status) finalizer() { + C.TF_DeleteStatus(s.c) +} + +func (s *status) Code() code { + return code(C.TF_GetCode(s.c)) +} + +func (s *status) String() string { + return C.GoString(C.TF_Message(s.c)) +} + +// Err converts the status to a Go error and returns nil if the status is OK. +func (s *status) Err() error { + if s == nil || s.Code() == C.TF_OK { + return nil + } + return (*statusError)(s) +} + +// statusError is distinct from status because it fulfills the error interface. +// status itself may have a TF_OK code and is not always considered an error. +// +// TODO(jhseu): Make public, rename to Error, and provide a way for users to +// check status codes. +type statusError status + +func (s *statusError) Error() string { + return (*status)(s).String() +} diff --git a/third_party/go-tensorflow/tensorflow/go/stream_executor/dnn.pb.go b/third_party/go-tensorflow/tensorflow/go/stream_executor/dnn.pb.go new file mode 100644 index 0000000..57465ff --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/stream_executor/dnn.pb.go @@ -0,0 +1,820 @@ +// LINT: LEGACY_NAMES + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/stream_executor/dnn.proto + +package stream_executor + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Specifies the data type used by an operation. +type DataType int32 + +const ( + DataType_kFloat DataType = 0 + DataType_kDouble DataType = 1 + DataType_kHalf DataType = 2 + DataType_kInt8 DataType = 3 + DataType_kInt32 DataType = 4 + DataType_kComplexFloat DataType = 5 + DataType_kComplexDouble DataType = 6 +) + +// Enum value maps for DataType. +var ( + DataType_name = map[int32]string{ + 0: "kFloat", + 1: "kDouble", + 2: "kHalf", + 3: "kInt8", + 4: "kInt32", + 5: "kComplexFloat", + 6: "kComplexDouble", + } + DataType_value = map[string]int32{ + "kFloat": 0, + "kDouble": 1, + "kHalf": 2, + "kInt8": 3, + "kInt32": 4, + "kComplexFloat": 5, + "kComplexDouble": 6, + } +) + +func (x DataType) Enum() *DataType { + p := new(DataType) + *p = x + return p +} + +func (x DataType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (DataType) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_stream_executor_dnn_proto_enumTypes[0].Descriptor() +} + +func (DataType) Type() protoreflect.EnumType { + return &file_tensorflow_stream_executor_dnn_proto_enumTypes[0] +} + +func (x DataType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use DataType.Descriptor instead. +func (DataType) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_stream_executor_dnn_proto_rawDescGZIP(), []int{0} +} + +// Describes how a convolution input or output layer's data is formatted. +type DataLayout int32 + +const ( + // Naming convention: + // Y <-> row or height + // X <-> column or width + // Batch <-> batch, or N + // Depth <-> feature, or channel + // TODO(timshen): turn them into cuDNN names, e.g. kNCHW. + DataLayout_kYXDepthBatch DataLayout = 0 + DataLayout_kYXBatchDepth DataLayout = 1 + DataLayout_kBatchYXDepth DataLayout = 2 // cuDNN's NHWC layout + DataLayout_kBatchDepthYX DataLayout = 3 // cuDNN's NCHW layout + DataLayout_kBatchDepthYX4 DataLayout = 4 // cuDNN's NCHW_VECT_C layout +) + +// Enum value maps for DataLayout. +var ( + DataLayout_name = map[int32]string{ + 0: "kYXDepthBatch", + 1: "kYXBatchDepth", + 2: "kBatchYXDepth", + 3: "kBatchDepthYX", + 4: "kBatchDepthYX4", + } + DataLayout_value = map[string]int32{ + "kYXDepthBatch": 0, + "kYXBatchDepth": 1, + "kBatchYXDepth": 2, + "kBatchDepthYX": 3, + "kBatchDepthYX4": 4, + } +) + +func (x DataLayout) Enum() *DataLayout { + p := new(DataLayout) + *p = x + return p +} + +func (x DataLayout) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (DataLayout) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_stream_executor_dnn_proto_enumTypes[1].Descriptor() +} + +func (DataLayout) Type() protoreflect.EnumType { + return &file_tensorflow_stream_executor_dnn_proto_enumTypes[1] +} + +func (x DataLayout) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use DataLayout.Descriptor instead. +func (DataLayout) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_stream_executor_dnn_proto_rawDescGZIP(), []int{1} +} + +// Describes how a convolution filter is laid out in the memory. +type FilterLayout int32 + +const ( + // Naming convention: + // Y <-> row or height + // X <-> column or width + // Output <-> output feature, or N + // Input <-> input feature, or N + // TODO(timshen): turn them into cuDNN names, e.g. kNCHW. + FilterLayout_kOutputInputYX FilterLayout = 0 // cuDNN's NCHW layout + FilterLayout_kOutputYXInput FilterLayout = 1 // cuDNN's NHWC layout + FilterLayout_kOutputInputYX4 FilterLayout = 2 // cuDNN's NCHW_VECT_C layout + FilterLayout_kInputYXOutput FilterLayout = 3 + FilterLayout_kYXInputOutput FilterLayout = 4 +) + +// Enum value maps for FilterLayout. +var ( + FilterLayout_name = map[int32]string{ + 0: "kOutputInputYX", + 1: "kOutputYXInput", + 2: "kOutputInputYX4", + 3: "kInputYXOutput", + 4: "kYXInputOutput", + } + FilterLayout_value = map[string]int32{ + "kOutputInputYX": 0, + "kOutputYXInput": 1, + "kOutputInputYX4": 2, + "kInputYXOutput": 3, + "kYXInputOutput": 4, + } +) + +func (x FilterLayout) Enum() *FilterLayout { + p := new(FilterLayout) + *p = x + return p +} + +func (x FilterLayout) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (FilterLayout) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_stream_executor_dnn_proto_enumTypes[2].Descriptor() +} + +func (FilterLayout) Type() protoreflect.EnumType { + return &file_tensorflow_stream_executor_dnn_proto_enumTypes[2] +} + +func (x FilterLayout) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use FilterLayout.Descriptor instead. +func (FilterLayout) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_stream_executor_dnn_proto_rawDescGZIP(), []int{2} +} + +// Describes a kind of non-linearity (threshold-like mathematical function). +type ActivationMode int32 + +const ( + ActivationMode_kNone ActivationMode = 0 + ActivationMode_kSigmoid ActivationMode = 1 + // Rectified linear activation: f(x) = x < 0 ? 0 : x + ActivationMode_kRelu ActivationMode = 2 + // Rectified linear activation; where upper maximum is 6.0. + ActivationMode_kRelu6 ActivationMode = 3 + // Rectified linear activation; where upper maximum specified by + // BatchDescriptor::value_max(). + ActivationMode_kReluX ActivationMode = 4 + ActivationMode_kTanh ActivationMode = 5 + // Like ReluX; but passes all values in the range [-X,X]. + ActivationMode_kBandPass ActivationMode = 6 +) + +// Enum value maps for ActivationMode. +var ( + ActivationMode_name = map[int32]string{ + 0: "kNone", + 1: "kSigmoid", + 2: "kRelu", + 3: "kRelu6", + 4: "kReluX", + 5: "kTanh", + 6: "kBandPass", + } + ActivationMode_value = map[string]int32{ + "kNone": 0, + "kSigmoid": 1, + "kRelu": 2, + "kRelu6": 3, + "kReluX": 4, + "kTanh": 5, + "kBandPass": 6, + } +) + +func (x ActivationMode) Enum() *ActivationMode { + p := new(ActivationMode) + *p = x + return p +} + +func (x ActivationMode) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ActivationMode) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_stream_executor_dnn_proto_enumTypes[3].Descriptor() +} + +func (ActivationMode) Type() protoreflect.EnumType { + return &file_tensorflow_stream_executor_dnn_proto_enumTypes[3] +} + +func (x ActivationMode) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ActivationMode.Descriptor instead. +func (ActivationMode) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_stream_executor_dnn_proto_rawDescGZIP(), []int{3} +} + +// Describe the math definition for the conv op. The popular behavior is +// actually called cross-correlation in math, despite the operation is often +// referred as convolution. See cuDNN cudnnConvolutionMode_t. +type ConvolutionMode int32 + +const ( + ConvolutionMode_CROSS_CORRELATION ConvolutionMode = 0 + ConvolutionMode_CONVOLUTION ConvolutionMode = 1 +) + +// Enum value maps for ConvolutionMode. +var ( + ConvolutionMode_name = map[int32]string{ + 0: "CROSS_CORRELATION", + 1: "CONVOLUTION", + } + ConvolutionMode_value = map[string]int32{ + "CROSS_CORRELATION": 0, + "CONVOLUTION": 1, + } +) + +func (x ConvolutionMode) Enum() *ConvolutionMode { + p := new(ConvolutionMode) + *p = x + return p +} + +func (x ConvolutionMode) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ConvolutionMode) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_stream_executor_dnn_proto_enumTypes[4].Descriptor() +} + +func (ConvolutionMode) Type() protoreflect.EnumType { + return &file_tensorflow_stream_executor_dnn_proto_enumTypes[4] +} + +func (x ConvolutionMode) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ConvolutionMode.Descriptor instead. +func (ConvolutionMode) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_stream_executor_dnn_proto_rawDescGZIP(), []int{4} +} + +type ConvolutionKind int32 + +const ( + ConvolutionKind_INVALID ConvolutionKind = 0 + ConvolutionKind_FORWARD ConvolutionKind = 1 + ConvolutionKind_BACKWARD_FILTER ConvolutionKind = 2 + ConvolutionKind_BACKWARD_DATA ConvolutionKind = 3 + ConvolutionKind_FORWARD_BIAS_ACTIVATION ConvolutionKind = 4 +) + +// Enum value maps for ConvolutionKind. +var ( + ConvolutionKind_name = map[int32]string{ + 0: "INVALID", + 1: "FORWARD", + 2: "BACKWARD_FILTER", + 3: "BACKWARD_DATA", + 4: "FORWARD_BIAS_ACTIVATION", + } + ConvolutionKind_value = map[string]int32{ + "INVALID": 0, + "FORWARD": 1, + "BACKWARD_FILTER": 2, + "BACKWARD_DATA": 3, + "FORWARD_BIAS_ACTIVATION": 4, + } +) + +func (x ConvolutionKind) Enum() *ConvolutionKind { + p := new(ConvolutionKind) + *p = x + return p +} + +func (x ConvolutionKind) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ConvolutionKind) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_stream_executor_dnn_proto_enumTypes[5].Descriptor() +} + +func (ConvolutionKind) Type() protoreflect.EnumType { + return &file_tensorflow_stream_executor_dnn_proto_enumTypes[5] +} + +func (x ConvolutionKind) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ConvolutionKind.Descriptor instead. +func (ConvolutionKind) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_stream_executor_dnn_proto_rawDescGZIP(), []int{5} +} + +type AlgorithmProto_MathType int32 + +const ( + AlgorithmProto_DEFAULT_MATH AlgorithmProto_MathType = 0 + // The GPU may operate 4x4 matrix FMA. + // See cuDNN's documentation for CUDNN_TENSOR_OP_MATH. + AlgorithmProto_TENSOR_OP_MATH AlgorithmProto_MathType = 1 +) + +// Enum value maps for AlgorithmProto_MathType. +var ( + AlgorithmProto_MathType_name = map[int32]string{ + 0: "DEFAULT_MATH", + 1: "TENSOR_OP_MATH", + } + AlgorithmProto_MathType_value = map[string]int32{ + "DEFAULT_MATH": 0, + "TENSOR_OP_MATH": 1, + } +) + +func (x AlgorithmProto_MathType) Enum() *AlgorithmProto_MathType { + p := new(AlgorithmProto_MathType) + *p = x + return p +} + +func (x AlgorithmProto_MathType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (AlgorithmProto_MathType) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_stream_executor_dnn_proto_enumTypes[6].Descriptor() +} + +func (AlgorithmProto_MathType) Type() protoreflect.EnumType { + return &file_tensorflow_stream_executor_dnn_proto_enumTypes[6] +} + +func (x AlgorithmProto_MathType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use AlgorithmProto_MathType.Descriptor instead. +func (AlgorithmProto_MathType) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_stream_executor_dnn_proto_rawDescGZIP(), []int{1, 0} +} + +// Generic tensor representation. +type TensorDescriptorProto struct { + state protoimpl.MessageState `protogen:"open.v1"` + Dimensions []int64 `protobuf:"varint,1,rep,packed,name=dimensions,proto3" json:"dimensions,omitempty"` + DataType DataType `protobuf:"varint,2,opt,name=data_type,json=dataType,proto3,enum=stream_executor.dnn.DataType" json:"data_type,omitempty"` + // Types that are valid to be assigned to LayoutOneof: + // + // *TensorDescriptorProto_DataLayout + // *TensorDescriptorProto_FilterLayout + LayoutOneof isTensorDescriptorProto_LayoutOneof `protobuf_oneof:"layout_oneof"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TensorDescriptorProto) Reset() { + *x = TensorDescriptorProto{} + mi := &file_tensorflow_stream_executor_dnn_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TensorDescriptorProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TensorDescriptorProto) ProtoMessage() {} + +func (x *TensorDescriptorProto) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_stream_executor_dnn_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TensorDescriptorProto.ProtoReflect.Descriptor instead. +func (*TensorDescriptorProto) Descriptor() ([]byte, []int) { + return file_tensorflow_stream_executor_dnn_proto_rawDescGZIP(), []int{0} +} + +func (x *TensorDescriptorProto) GetDimensions() []int64 { + if x != nil { + return x.Dimensions + } + return nil +} + +func (x *TensorDescriptorProto) GetDataType() DataType { + if x != nil { + return x.DataType + } + return DataType_kFloat +} + +func (x *TensorDescriptorProto) GetLayoutOneof() isTensorDescriptorProto_LayoutOneof { + if x != nil { + return x.LayoutOneof + } + return nil +} + +func (x *TensorDescriptorProto) GetDataLayout() DataLayout { + if x != nil { + if x, ok := x.LayoutOneof.(*TensorDescriptorProto_DataLayout); ok { + return x.DataLayout + } + } + return DataLayout_kYXDepthBatch +} + +func (x *TensorDescriptorProto) GetFilterLayout() FilterLayout { + if x != nil { + if x, ok := x.LayoutOneof.(*TensorDescriptorProto_FilterLayout); ok { + return x.FilterLayout + } + } + return FilterLayout_kOutputInputYX +} + +type isTensorDescriptorProto_LayoutOneof interface { + isTensorDescriptorProto_LayoutOneof() +} + +type TensorDescriptorProto_DataLayout struct { + DataLayout DataLayout `protobuf:"varint,3,opt,name=data_layout,json=dataLayout,proto3,enum=stream_executor.dnn.DataLayout,oneof"` +} + +type TensorDescriptorProto_FilterLayout struct { + FilterLayout FilterLayout `protobuf:"varint,4,opt,name=filter_layout,json=filterLayout,proto3,enum=stream_executor.dnn.FilterLayout,oneof"` +} + +func (*TensorDescriptorProto_DataLayout) isTensorDescriptorProto_LayoutOneof() {} + +func (*TensorDescriptorProto_FilterLayout) isTensorDescriptorProto_LayoutOneof() {} + +// Generic algorithm representation. +type AlgorithmProto struct { + state protoimpl.MessageState `protogen:"open.v1"` + AlgoId int64 `protobuf:"varint,1,opt,name=algo_id,json=algoId,proto3" json:"algo_id,omitempty"` + MathType AlgorithmProto_MathType `protobuf:"varint,2,opt,name=math_type,json=mathType,proto3,enum=stream_executor.dnn.AlgorithmProto_MathType" json:"math_type,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AlgorithmProto) Reset() { + *x = AlgorithmProto{} + mi := &file_tensorflow_stream_executor_dnn_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AlgorithmProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AlgorithmProto) ProtoMessage() {} + +func (x *AlgorithmProto) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_stream_executor_dnn_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AlgorithmProto.ProtoReflect.Descriptor instead. +func (*AlgorithmProto) Descriptor() ([]byte, []int) { + return file_tensorflow_stream_executor_dnn_proto_rawDescGZIP(), []int{1} +} + +func (x *AlgorithmProto) GetAlgoId() int64 { + if x != nil { + return x.AlgoId + } + return 0 +} + +func (x *AlgorithmProto) GetMathType() AlgorithmProto_MathType { + if x != nil { + return x.MathType + } + return AlgorithmProto_DEFAULT_MATH +} + +// Convolution-specific parameters. +type ConvolutionDescriptorProto struct { + state protoimpl.MessageState `protogen:"open.v1"` + Paddings []int64 `protobuf:"varint,1,rep,packed,name=paddings,proto3" json:"paddings,omitempty"` + Strides []int64 `protobuf:"varint,2,rep,packed,name=strides,proto3" json:"strides,omitempty"` + Dilations []int64 `protobuf:"varint,3,rep,packed,name=dilations,proto3" json:"dilations,omitempty"` + // The "accumulator" type. For example, use F32 as an accumulator for F16 + // convolutions. + // See cuDNN's cudnnConvolutionMode_t. + ComputeMode DataType `protobuf:"varint,4,opt,name=compute_mode,json=computeMode,proto3,enum=stream_executor.dnn.DataType" json:"compute_mode,omitempty"` + // See cuDNN's group count. + GroupCount int32 `protobuf:"varint,5,opt,name=group_count,json=groupCount,proto3" json:"group_count,omitempty"` + ConvolutionMode ConvolutionMode `protobuf:"varint,6,opt,name=convolution_mode,json=convolutionMode,proto3,enum=stream_executor.dnn.ConvolutionMode" json:"convolution_mode,omitempty"` + // Tensorflow node name, same as in NodeDef, for debugging purposes. + Name string `protobuf:"bytes,7,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ConvolutionDescriptorProto) Reset() { + *x = ConvolutionDescriptorProto{} + mi := &file_tensorflow_stream_executor_dnn_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ConvolutionDescriptorProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConvolutionDescriptorProto) ProtoMessage() {} + +func (x *ConvolutionDescriptorProto) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_stream_executor_dnn_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConvolutionDescriptorProto.ProtoReflect.Descriptor instead. +func (*ConvolutionDescriptorProto) Descriptor() ([]byte, []int) { + return file_tensorflow_stream_executor_dnn_proto_rawDescGZIP(), []int{2} +} + +func (x *ConvolutionDescriptorProto) GetPaddings() []int64 { + if x != nil { + return x.Paddings + } + return nil +} + +func (x *ConvolutionDescriptorProto) GetStrides() []int64 { + if x != nil { + return x.Strides + } + return nil +} + +func (x *ConvolutionDescriptorProto) GetDilations() []int64 { + if x != nil { + return x.Dilations + } + return nil +} + +func (x *ConvolutionDescriptorProto) GetComputeMode() DataType { + if x != nil { + return x.ComputeMode + } + return DataType_kFloat +} + +func (x *ConvolutionDescriptorProto) GetGroupCount() int32 { + if x != nil { + return x.GroupCount + } + return 0 +} + +func (x *ConvolutionDescriptorProto) GetConvolutionMode() ConvolutionMode { + if x != nil { + return x.ConvolutionMode + } + return ConvolutionMode_CROSS_CORRELATION +} + +func (x *ConvolutionDescriptorProto) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +var File_tensorflow_stream_executor_dnn_proto protoreflect.FileDescriptor + +const file_tensorflow_stream_executor_dnn_proto_rawDesc = "" + + "\n" + + "$tensorflow/stream_executor/dnn.proto\x12\x13stream_executor.dnn\"\x91\x02\n" + + "\x15TensorDescriptorProto\x12\x1e\n" + + "\n" + + "dimensions\x18\x01 \x03(\x03R\n" + + "dimensions\x12:\n" + + "\tdata_type\x18\x02 \x01(\x0e2\x1d.stream_executor.dnn.DataTypeR\bdataType\x12B\n" + + "\vdata_layout\x18\x03 \x01(\x0e2\x1f.stream_executor.dnn.DataLayoutH\x00R\n" + + "dataLayout\x12H\n" + + "\rfilter_layout\x18\x04 \x01(\x0e2!.stream_executor.dnn.FilterLayoutH\x00R\ffilterLayoutB\x0e\n" + + "\flayout_oneof\"\xa6\x01\n" + + "\x0eAlgorithmProto\x12\x17\n" + + "\aalgo_id\x18\x01 \x01(\x03R\x06algoId\x12I\n" + + "\tmath_type\x18\x02 \x01(\x0e2,.stream_executor.dnn.AlgorithmProto.MathTypeR\bmathType\"0\n" + + "\bMathType\x12\x10\n" + + "\fDEFAULT_MATH\x10\x00\x12\x12\n" + + "\x0eTENSOR_OP_MATH\x10\x01\"\xb8\x02\n" + + "\x1aConvolutionDescriptorProto\x12\x1a\n" + + "\bpaddings\x18\x01 \x03(\x03R\bpaddings\x12\x18\n" + + "\astrides\x18\x02 \x03(\x03R\astrides\x12\x1c\n" + + "\tdilations\x18\x03 \x03(\x03R\tdilations\x12@\n" + + "\fcompute_mode\x18\x04 \x01(\x0e2\x1d.stream_executor.dnn.DataTypeR\vcomputeMode\x12\x1f\n" + + "\vgroup_count\x18\x05 \x01(\x05R\n" + + "groupCount\x12O\n" + + "\x10convolution_mode\x18\x06 \x01(\x0e2$.stream_executor.dnn.ConvolutionModeR\x0fconvolutionMode\x12\x12\n" + + "\x04name\x18\a \x01(\tR\x04name*l\n" + + "\bDataType\x12\n" + + "\n" + + "\x06kFloat\x10\x00\x12\v\n" + + "\akDouble\x10\x01\x12\t\n" + + "\x05kHalf\x10\x02\x12\t\n" + + "\x05kInt8\x10\x03\x12\n" + + "\n" + + "\x06kInt32\x10\x04\x12\x11\n" + + "\rkComplexFloat\x10\x05\x12\x12\n" + + "\x0ekComplexDouble\x10\x06*l\n" + + "\n" + + "DataLayout\x12\x11\n" + + "\rkYXDepthBatch\x10\x00\x12\x11\n" + + "\rkYXBatchDepth\x10\x01\x12\x11\n" + + "\rkBatchYXDepth\x10\x02\x12\x11\n" + + "\rkBatchDepthYX\x10\x03\x12\x12\n" + + "\x0ekBatchDepthYX4\x10\x04*s\n" + + "\fFilterLayout\x12\x12\n" + + "\x0ekOutputInputYX\x10\x00\x12\x12\n" + + "\x0ekOutputYXInput\x10\x01\x12\x13\n" + + "\x0fkOutputInputYX4\x10\x02\x12\x12\n" + + "\x0ekInputYXOutput\x10\x03\x12\x12\n" + + "\x0ekYXInputOutput\x10\x04*f\n" + + "\x0eActivationMode\x12\t\n" + + "\x05kNone\x10\x00\x12\f\n" + + "\bkSigmoid\x10\x01\x12\t\n" + + "\x05kRelu\x10\x02\x12\n" + + "\n" + + "\x06kRelu6\x10\x03\x12\n" + + "\n" + + "\x06kReluX\x10\x04\x12\t\n" + + "\x05kTanh\x10\x05\x12\r\n" + + "\tkBandPass\x10\x06*9\n" + + "\x0fConvolutionMode\x12\x15\n" + + "\x11CROSS_CORRELATION\x10\x00\x12\x0f\n" + + "\vCONVOLUTION\x10\x01*p\n" + + "\x0fConvolutionKind\x12\v\n" + + "\aINVALID\x10\x00\x12\v\n" + + "\aFORWARD\x10\x01\x12\x13\n" + + "\x0fBACKWARD_FILTER\x10\x02\x12\x11\n" + + "\rBACKWARD_DATA\x10\x03\x12\x1b\n" + + "\x17FORWARD_BIAS_ACTIVATION\x10\x04B@Z>github.com/tensorflow/tensorflow/tensorflow/go/stream_executorb\x06proto3" + +var ( + file_tensorflow_stream_executor_dnn_proto_rawDescOnce sync.Once + file_tensorflow_stream_executor_dnn_proto_rawDescData []byte +) + +func file_tensorflow_stream_executor_dnn_proto_rawDescGZIP() []byte { + file_tensorflow_stream_executor_dnn_proto_rawDescOnce.Do(func() { + file_tensorflow_stream_executor_dnn_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_stream_executor_dnn_proto_rawDesc), len(file_tensorflow_stream_executor_dnn_proto_rawDesc))) + }) + return file_tensorflow_stream_executor_dnn_proto_rawDescData +} + +var file_tensorflow_stream_executor_dnn_proto_enumTypes = make([]protoimpl.EnumInfo, 7) +var file_tensorflow_stream_executor_dnn_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_tensorflow_stream_executor_dnn_proto_goTypes = []any{ + (DataType)(0), // 0: stream_executor.dnn.DataType + (DataLayout)(0), // 1: stream_executor.dnn.DataLayout + (FilterLayout)(0), // 2: stream_executor.dnn.FilterLayout + (ActivationMode)(0), // 3: stream_executor.dnn.ActivationMode + (ConvolutionMode)(0), // 4: stream_executor.dnn.ConvolutionMode + (ConvolutionKind)(0), // 5: stream_executor.dnn.ConvolutionKind + (AlgorithmProto_MathType)(0), // 6: stream_executor.dnn.AlgorithmProto.MathType + (*TensorDescriptorProto)(nil), // 7: stream_executor.dnn.TensorDescriptorProto + (*AlgorithmProto)(nil), // 8: stream_executor.dnn.AlgorithmProto + (*ConvolutionDescriptorProto)(nil), // 9: stream_executor.dnn.ConvolutionDescriptorProto +} +var file_tensorflow_stream_executor_dnn_proto_depIdxs = []int32{ + 0, // 0: stream_executor.dnn.TensorDescriptorProto.data_type:type_name -> stream_executor.dnn.DataType + 1, // 1: stream_executor.dnn.TensorDescriptorProto.data_layout:type_name -> stream_executor.dnn.DataLayout + 2, // 2: stream_executor.dnn.TensorDescriptorProto.filter_layout:type_name -> stream_executor.dnn.FilterLayout + 6, // 3: stream_executor.dnn.AlgorithmProto.math_type:type_name -> stream_executor.dnn.AlgorithmProto.MathType + 0, // 4: stream_executor.dnn.ConvolutionDescriptorProto.compute_mode:type_name -> stream_executor.dnn.DataType + 4, // 5: stream_executor.dnn.ConvolutionDescriptorProto.convolution_mode:type_name -> stream_executor.dnn.ConvolutionMode + 6, // [6:6] is the sub-list for method output_type + 6, // [6:6] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_tensorflow_stream_executor_dnn_proto_init() } +func file_tensorflow_stream_executor_dnn_proto_init() { + if File_tensorflow_stream_executor_dnn_proto != nil { + return + } + file_tensorflow_stream_executor_dnn_proto_msgTypes[0].OneofWrappers = []any{ + (*TensorDescriptorProto_DataLayout)(nil), + (*TensorDescriptorProto_FilterLayout)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_stream_executor_dnn_proto_rawDesc), len(file_tensorflow_stream_executor_dnn_proto_rawDesc)), + NumEnums: 7, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_stream_executor_dnn_proto_goTypes, + DependencyIndexes: file_tensorflow_stream_executor_dnn_proto_depIdxs, + EnumInfos: file_tensorflow_stream_executor_dnn_proto_enumTypes, + MessageInfos: file_tensorflow_stream_executor_dnn_proto_msgTypes, + }.Build() + File_tensorflow_stream_executor_dnn_proto = out.File + file_tensorflow_stream_executor_dnn_proto_goTypes = nil + file_tensorflow_stream_executor_dnn_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/tensor.go b/third_party/go-tensorflow/tensorflow/go/tensor.go new file mode 100644 index 0000000..d9036ce --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/tensor.go @@ -0,0 +1,541 @@ +/* +Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package tensorflow + +/* +#include +#include +#include "tensorflow/c/c_api.h" + +void toNewTString(_GoString_ gstr, TF_TString *tstr) { + TF_TString_Init(tstr); + TF_TString_Copy(tstr, _GoStringPtr(gstr), _GoStringLen(gstr)); +} +*/ +import "C" + +import ( + "bytes" + "fmt" + "io" + "math/bits" + "reflect" + "runtime" + "unsafe" +) + +// DataType holds the type for a scalar value. E.g., one slot in a tensor. +type DataType C.TF_DataType + +// Types of scalar values in the TensorFlow type system. +const ( + Float DataType = C.TF_FLOAT + Double DataType = C.TF_DOUBLE + Int32 DataType = C.TF_INT32 + Uint32 DataType = C.TF_UINT32 + Uint8 DataType = C.TF_UINT8 + Int16 DataType = C.TF_INT16 + Int8 DataType = C.TF_INT8 + String DataType = C.TF_STRING + Complex64 DataType = C.TF_COMPLEX64 + Complex DataType = C.TF_COMPLEX + Int64 DataType = C.TF_INT64 + Uint64 DataType = C.TF_UINT64 + Bool DataType = C.TF_BOOL + Qint8 DataType = C.TF_QINT8 + Quint8 DataType = C.TF_QUINT8 + Qint32 DataType = C.TF_QINT32 + Bfloat16 DataType = C.TF_BFLOAT16 + Qint16 DataType = C.TF_QINT16 + Quint16 DataType = C.TF_QUINT16 + Uint16 DataType = C.TF_UINT16 + Complex128 DataType = C.TF_COMPLEX128 + Half DataType = C.TF_HALF +) + +// Tensor holds a multi-dimensional array of elements of a single data type. +type Tensor struct { + c *C.TF_Tensor + shape []int64 +} + +// NewTensor converts from a Go value to a Tensor. Valid values are scalars, +// slices, and arrays. Every element of a slice must have the same length so +// that the resulting Tensor has a valid shape. +func NewTensor(value interface{}) (*Tensor, error) { + val := reflect.ValueOf(value) + shape, dataType, err := shapeAndDataTypeOf(val) + if err != nil { + return nil, err + } + nflattened := numElements(shape) + nbytes := TypeOf(dataType, nil).Size() * uintptr(nflattened) + if dataType == String { + nbytes = uintptr(nflattened) * C.sizeof_TF_TString + } + var shapePtr *C.int64_t + if len(shape) > 0 { + shapePtr = (*C.int64_t)(unsafe.Pointer(&shape[0])) + } + t := &Tensor{ + c: C.TF_AllocateTensor(C.TF_DataType(dataType), shapePtr, C.int(len(shape)), C.size_t(nbytes)), + shape: shape, + } + runtime.SetFinalizer(t, (*Tensor).finalize) + raw := tensorData(t.c) + buf := bytes.NewBuffer(raw[:0:len(raw)]) + + if isAllArray(val.Type()) { + // We have arrays all the way down, or just primitive types. We can + // just copy the memory in as it is all contiguous. + if err := copyPtr(buf, unpackEFace(value).data, int(val.Type().Size())); err != nil { + return nil, err + } + } else { + // When there are slices involved the memory for each leaf slice may + // not be contiguous with the others or in the order we might + // expect, so we need to work our way down to each slice of + // primitives and copy them individually + if err := encodeTensorWithSlices(buf, val, shape); err != nil { + return nil, err + } + } + + if uintptr(buf.Len()) != nbytes { + return nil, bug("NewTensor incorrectly calculated the size of a tensor with type %v and shape %v as %v bytes instead of %v", dataType, shape, nbytes, buf.Len()) + } + return t, nil +} + +// isAllArray returns true if type is a primitive type or an array of primitive +// types or an array of ... etc.. When this is true the data we want is +// contiguous in RAM. +func isAllArray(typ reflect.Type) bool { + switch typ.Kind() { + case reflect.String: + return false + case reflect.Slice: + return false + case reflect.Array: + return isAllArray(typ.Elem()) + default: + // We know the type is slices/arrays of slices/arrays of primitive types. + return true + } +} + +// eface defines what an interface type actually is: a pointer to type +// information about the encapsulated type and a pointer to the encapsulated +// value. +type eface struct { + rtype unsafe.Pointer + data unsafe.Pointer +} + +// unpackEFace gives us an effient way to get us a pointer to the value carried +// in an interface. If you wrap a pointer type in an interface then the pointer +// is directly stored in the interface struct. If you wrap a value type in an +// interface then the compiler copies the value into a newly allocated piece of +// memory and stores a pointer to that memory in the interface. So we're +// guaranteed to get a pointer. Go reflection doesn't expose the pointer to +// value types straightforwardly as it doesn't want you to think you have a +// reference to the original value. But we just want a pointer to make it +// efficient to read the value, so cheating like this should be safe and +// reasonable. +func unpackEFace(obj interface{}) *eface { + return (*eface)(unsafe.Pointer(&obj)) +} + +// ReadTensor constructs a Tensor with the provided type and shape from the +// serialized tensor contents in r. +// +// See also WriteContentsTo. +func ReadTensor(dataType DataType, shape []int64, r io.Reader) (*Tensor, error) { + if err := isTensorSerializable(dataType); err != nil { + return nil, err + } + nbytes := TypeOf(dataType, nil).Size() * uintptr(numElements(shape)) + var shapePtr *C.int64_t + if len(shape) > 0 { + shapePtr = (*C.int64_t)(unsafe.Pointer(&shape[0])) + } + t := &Tensor{ + c: C.TF_AllocateTensor(C.TF_DataType(dataType), shapePtr, C.int(len(shape)), C.size_t(nbytes)), + shape: shape, + } + runtime.SetFinalizer(t, (*Tensor).finalize) + raw := tensorData(t.c) + if _, err := io.ReadFull(r, raw); err != nil { + return nil, err + } + return t, nil +} + +// newTensorFromC takes ownership of c and returns the owning Tensor. +func newTensorFromC(c *C.TF_Tensor) *Tensor { + var shape []int64 + if ndims := int(C.TF_NumDims(c)); ndims > 0 { + shape = make([]int64, ndims) + } + for i := range shape { + shape[i] = int64(C.TF_Dim(c, C.int(i))) + } + t := &Tensor{c: c, shape: shape} + runtime.SetFinalizer(t, (*Tensor).finalize) + return t +} + +func (t *Tensor) finalize() { C.TF_DeleteTensor(t.c) } + +// DataType returns the scalar datatype of the Tensor. +func (t *Tensor) DataType() DataType { return DataType(C.TF_TensorType(t.c)) } + +// Shape returns the shape of the Tensor. +func (t *Tensor) Shape() []int64 { return t.shape } + +// Reshape updates tensor's shape in place if this is possible or returns an error otherwise. +func (t *Tensor) Reshape(new_shape []int64) error { + old_shape_size := numElements(t.shape) + new_shape_size := numElements(new_shape) + + if old_shape_size != new_shape_size { + return fmt.Errorf("unable to convert shape %v (num_elements: %d) into shape %v (num_elements: %d)", t.shape, old_shape_size, new_shape, new_shape_size) + } + + if len(new_shape) == 0 { + return nil + } + + var shapePtr *C.int64_t + shapePtr = (*C.int64_t)(unsafe.Pointer(&new_shape[0])) + + status := newStatus() + C.TF_TensorBitcastFrom(t.c, C.TF_TensorType(t.c), t.c, shapePtr, C.int(len(new_shape)), status.c) + + return status.Err() +} + +// Value converts the Tensor to a Go value. For now, not all Tensor types are +// supported, and this function may panic if it encounters an unsupported +// DataType. +// +// The type of the output depends on the Tensor type and dimensions. +// For example: +// Tensor(int64, 0): int64 +// Tensor(float64, 3): [][][]float64 +func (t *Tensor) Value() interface{} { + raw := tensorData(t.c) + shape := t.Shape() + dt := t.DataType() + return decodeTensor(raw, shape, dt).Interface() +} + +func decodeTensor(raw []byte, shape []int64, dt DataType) reflect.Value { + // Create a 1-dimensional slice of the base large enough for the data and + // copy the data in. + n := int(numElements(shape)) + + var ( + slice reflect.Value + typ reflect.Type + ) + if dt == String { + strs, err := decodeOneDimString(raw, n) + if err != nil { + panic(bug("unable to decode string with shape %v: %v", shape, err)) + } + slice = reflect.ValueOf(strs) + typ = slice.Type() + } else { + typ = typeForDataType(dt) + l := n * int(typ.Size()) + typ = reflect.SliceOf(typ) + slice = reflect.MakeSlice(typ, n, n) + baseBytes := *(*[]byte)(unsafe.Pointer(&sliceHeader{ + Data: unsafe.Pointer(slice.Pointer()), + Len: l, + Cap: l, + })) + copy(baseBytes, raw) + } + + // Now we have the data in place in the base slice we can add the + // dimensions. We want to walk backwards through the shape. If the shape is + // length 1 or 0 then we're already done. + if len(shape) == 0 { + return slice.Index(0) + } + if len(shape) == 1 { + return slice + } + // We have a special case if the tensor has no data. Our backing slice is + // empty, but we still want to create slices following the shape. In this + // case only the final part of the shape will be 0 and we want to recalculate + // n at this point ignoring that 0. + // For example if our shape is 3 * 2 * 0 then n will be zero, but we still + // want 6 zero length slices to group as follows. + // {{} {}} {{} {}} {{} {}} + if n == 0 { + n = int(numElements(shape[:len(shape)-1])) + } + for i := len(shape) - 2; i >= 0; i-- { + underlyingSize := typ.Elem().Size() + typ = reflect.SliceOf(typ) + subsliceLen := int(shape[i+1]) + if subsliceLen != 0 { + n = n / subsliceLen + } + // Just using reflection it is difficult to avoid unnecessary + // allocations while setting up the sub-slices as the Slice function on + // a slice Value allocates. So we end up doing pointer arithmetic! + // Pointer() on a slice gives us access to the data backing the slice. + // We insert slice headers directly into this data. + data := unsafe.Pointer(slice.Pointer()) + nextSlice := reflect.MakeSlice(typ, n, n) + + for j := 0; j < n; j++ { + // This is equivalent to nSlice[j] = slice[j*subsliceLen: (j+1)*subsliceLen] + setSliceInSlice(nextSlice, j, sliceHeader{ + Data: unsafe.Pointer(uintptr(data) + (uintptr(j*subsliceLen) * underlyingSize)), + Len: subsliceLen, + Cap: subsliceLen, + }) + } + + slice = nextSlice + } + return slice +} + +// setSliceInSlice sets slice[index] = content. +func setSliceInSlice(slice reflect.Value, index int, content sliceHeader) { + const sliceSize = unsafe.Sizeof(sliceHeader{}) + // We must cast slice.Pointer to uninptr & back again to avoid GC issues. + // See https://github.com/google/go-cmp/issues/167#issuecomment-546093202 + *(*sliceHeader)(unsafe.Pointer(uintptr(unsafe.Pointer(slice.Pointer())) + (uintptr(index) * sliceSize))) = content +} + +// decodeOneDimString decodes a string tensor into a one-dimensional []string. +func decodeOneDimString(raw []byte, nStrings int) ([]string, error) { + strs := make([]string, nStrings) + tstrs := (*(*[]C.TF_TString)(unsafe.Pointer(&raw)))[:nStrings] + + for i, tstr := range tstrs { + dst := C.TF_TString_GetDataPointer(&tstr) + dstLen := C.TF_TString_GetSize(&tstr) + + strs[i] = C.GoStringN(dst, C.int(dstLen)) + } + + return strs, nil +} + +// WriteContentsTo writes the serialized contents of t to w. +// +// Returns the number of bytes written. See ReadTensor for +// reconstructing a Tensor from the serialized form. +// +// WARNING: WriteContentsTo is not comprehensive and will fail +// if t.DataType() is non-numeric (e.g., String). See +// https://github.com/tensorflow/tensorflow/issues/6003. +func (t *Tensor) WriteContentsTo(w io.Writer) (int64, error) { + if err := isTensorSerializable(t.DataType()); err != nil { + return 0, err + } + return io.Copy(w, bytes.NewReader(tensorData(t.c))) +} + +func tensorData(c *C.TF_Tensor) []byte { + // See: https://github.com/golang/go/wiki/cgo#turning-c-arrays-into-go-slices + cbytes := C.TF_TensorData(c) + if cbytes == nil { + return nil + } + length := int(C.TF_TensorByteSize(c)) + var slice []byte + if unsafe.Sizeof(unsafe.Pointer(nil)) == 8 { + slice = (*[1<<50 - 1]byte)(unsafe.Pointer(cbytes))[:length:length] + } else { + slice = (*[1 << 30]byte)(unsafe.Pointer(cbytes))[:length:length] + } + return slice +} + +var types = []struct { + typ reflect.Type + dataType C.TF_DataType +}{ + {reflect.TypeOf(float32(0)), C.TF_FLOAT}, + {reflect.TypeOf(float64(0)), C.TF_DOUBLE}, + {reflect.TypeOf(int32(0)), C.TF_INT32}, + {reflect.TypeOf(uint32(0)), C.TF_UINT32}, + {reflect.TypeOf(uint8(0)), C.TF_UINT8}, + {reflect.TypeOf(int16(0)), C.TF_INT16}, + {reflect.TypeOf(int8(0)), C.TF_INT8}, + {reflect.TypeOf(""), C.TF_STRING}, + {reflect.TypeOf(complex(float32(0), float32(0))), C.TF_COMPLEX64}, + {reflect.TypeOf(int64(0)), C.TF_INT64}, + {reflect.TypeOf(uint64(0)), C.TF_UINT64}, + {reflect.TypeOf(false), C.TF_BOOL}, + {reflect.TypeOf(uint16(0)), C.TF_UINT16}, + {reflect.TypeOf(complex(float64(0), float64(0))), C.TF_COMPLEX128}, + // TODO(apassos): support DT_RESOURCE representation in go. + // TODO(keveman): support DT_VARIANT representation in go. +} + +// shapeAndDataTypeOf returns the data type and shape of the Tensor +// corresponding to a Go type. +func shapeAndDataTypeOf(val reflect.Value) (shape []int64, dt DataType, err error) { + typ := val.Type() + for typ.Kind() == reflect.Array || typ.Kind() == reflect.Slice { + shape = append(shape, int64(val.Len())) + if val.Len() > 0 { + // In order to check tensor structure properly in general case we need to iterate over all slices of the tensor to check sizes match + // Since we already going to iterate over all elements in encodeTensor() let's + // 1) do the actual check in encodeTensor() to save some cpu cycles here + // 2) assume the shape is represented by lengths of elements with zero index in each dimension + val = val.Index(0) + } + typ = typ.Elem() + } + for _, t := range types { + if typ.Kind() == t.typ.Kind() { + return shape, DataType(t.dataType), nil + } + } + return shape, dt, fmt.Errorf("unsupported type %v", typ) +} + +func typeForDataType(dt DataType) reflect.Type { + for _, t := range types { + if dt == DataType(t.dataType) { + return t.typ + } + } + panic(bug("DataType %v is not supported (see https://www.tensorflow.org/code/tensorflow/core/framework/types.proto)", dt)) +} + +// TypeOf converts from a DataType and Shape to the equivalent Go type. +func TypeOf(dt DataType, shape []int64) reflect.Type { + ret := typeForDataType(dt) + for range shape { + ret = reflect.SliceOf(ret) + } + return ret +} + +func numElements(shape []int64) int64 { + n := int64(1) + for _, d := range shape { + n *= d + } + return n +} + +// sizeVarUint determines how many bytes it would take to encode the int v as +// an unsigned varint +func sizeVarUint(v uint64) int { + if v < 0x80 { + return 1 + } + bits := bits.Len64(v) + return (bits + 6) / 7 +} + +// encodeTensorWithSlices writes v to the specified buffer using the format specified in +// c_api.h. Use stringEncoder for String tensors. +func encodeTensorWithSlices(w *bytes.Buffer, v reflect.Value, shape []int64) error { + // If current dimension is a slice, verify that it has the expected size + // Go's type system makes that guarantee for arrays. + if v.Kind() == reflect.Slice { + expected := int(shape[0]) + if v.Len() != expected { + return fmt.Errorf("mismatched slice lengths: %d and %d", v.Len(), expected) + } + } else if v.Kind() == reflect.String { + s := v.Interface().(string) + var tstr C.TF_TString + C.toNewTString(s, &tstr) + ptr := unsafe.Pointer(&tstr) + return copyPtr(w, ptr, C.sizeof_TF_TString) + } else if v.Kind() != reflect.Array { + return fmt.Errorf("unsupported type %v", v.Type()) + } + + // Once we have just a single dimension we can just copy the data + if len(shape) == 1 && v.Len() > 0 && v.Index(0).Kind() != reflect.String { + elt := v.Index(0) + if !elt.CanAddr() { + panic("cannot take address") + } + ptr := unsafe.Pointer(elt.Addr().Pointer()) + return copyPtr(w, ptr, v.Len()*int(elt.Type().Size())) + } + + subShape := shape[1:] + for i := 0; i < v.Len(); i++ { + err := encodeTensorWithSlices(w, v.Index(i), subShape) + if err != nil { + return err + } + } + + return nil +} + +// It isn't safe to use reflect.SliceHeader as it uses a uintptr for Data and +// this is not inspected by the garbage collector +type sliceHeader struct { + Data unsafe.Pointer + Len int + Cap int +} + +// copyPtr copies the backing data for a slice or array directly into w. Note +// we don't need to worry about byte ordering because we want the natural byte +// order for the machine we're running on. +func copyPtr(w *bytes.Buffer, ptr unsafe.Pointer, l int) error { + // Convert our slice header into a []byte so we can call w.Write + b := *(*[]byte)(unsafe.Pointer(&sliceHeader{ + Data: ptr, + Len: l, + Cap: l, + })) + _, err := w.Write(b) + return err +} + +func bug(format string, args ...interface{}) error { + return fmt.Errorf("BUG: Please report at https://github.com/tensorflow/tensorflow/issues with the note: Go TensorFlow %v: %v", Version(), fmt.Sprintf(format, args...)) +} + +func isTensorSerializable(dataType DataType) error { + // For numeric types, the serialized Tensor matches the in-memory + // representation. See the implementation of Tensor::AsProtoContent in + // https://www.tensorflow.org/code/tensorflow/core/framework/tensor.cc + // + // The more appropriate way to be in sync with Tensor::AsProtoContent + // would be to have the TensorFlow C library export functions for + // serialization and deserialization of Tensors. Till then capitalize + // on knowledge of the implementation for numeric types. + switch dataType { + case Float, Double, Int32, Uint8, Int16, Int8, Complex, Int64, Bool, Quint8, Qint32, Bfloat16, Qint16, Quint16, Uint16, Complex128, Half: + return nil + default: + return fmt.Errorf("serialization of tensors with the DataType %d is not yet supported, see https://github.com/tensorflow/tensorflow/issues/6003", dataType) + } +} diff --git a/third_party/go-tensorflow/tensorflow/go/tensor_handle.go b/third_party/go-tensorflow/tensorflow/go/tensor_handle.go new file mode 100644 index 0000000..09192ec --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/tensor_handle.go @@ -0,0 +1,170 @@ +/* +Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package tensorflow + +// #include +// #include "tensorflow/c/c_api.h" +// #include "tensorflow/c/eager/c_api.h" +import "C" +import ( + "runtime" + "unsafe" +) + +// TensorHandle is a handle to a tensor on a device. +// +// A Tensor referenced by a TensorHandle may be on any device, whereas a Tensor +// always resides in the host CPU's memory. +// +// A Tensor referenced by a TensorHandle may not have been computed yet. For +// example, a TensorHandle might reference the output of an operation that has +// not finished executing. Because of this, various methods, such as Shape() may +// block until the tensor has been instantiated. +// +// This allows multiple operations to be performed on tensors on a device +// (e.g. a GPU) without sending these values back to the host CPU in between +// every operation. +type TensorHandle struct { + c *C.TFE_TensorHandle +} + +// NewTensorHandle creates a new tensor handle from a tensor. +func NewTensorHandle(t *Tensor) (*TensorHandle, error) { + status := newStatus() + cHandle := C.TFE_NewTensorHandle(t.c, status.c) + if err := status.Err(); err != nil { + return nil, err + } + + th := &TensorHandle{c: cHandle} + runtime.SetFinalizer(th, (*TensorHandle).finalizer) + return th, nil +} + +func (th *TensorHandle) finalizer() { + C.TFE_DeleteTensorHandle(th.c) +} + +// newTensorHandleFromC takes ownership of c and returns the owning TensorHandle. +func newTensorHandleFromC(c *C.TFE_TensorHandle) *TensorHandle { + th := &TensorHandle{c: c} + runtime.SetFinalizer(th, (*TensorHandle).finalizer) + return th +} + +// DataType returns the TensorHandle's datatype. +func (th *TensorHandle) DataType() DataType { + return DataType(C.TFE_TensorHandleDataType(th.c)) +} + +// Shape returns the shape of the Tensor referenced by th. +func (th *TensorHandle) Shape() ([]int64, error) { + n, err := th.numDims() + if err != nil { + return nil, err + } + r := make([]int64, n) + for i := 0; i < n; i++ { + if r[i], err = th.dim(i); err != nil { + return nil, err + } + } + return r, nil +} + +// numDims returns the number of dimensions of the TensorHandle. It blocks +// until the operation that produces the handle has completed. +func (th *TensorHandle) numDims() (int, error) { + status := newStatus() + n := int(C.TFE_TensorHandleNumDims(th.c, status.c)) + return n, status.Err() +} + +// dim returns the size of the index'th dimension of the TensorHandle. It +// blocks until the operation that produces the handle has completed. +func (th *TensorHandle) dim(index int) (int64, error) { + status := newStatus() + n := int64(C.TFE_TensorHandleDim(th.c, C.int(index), status.c)) + if err := status.Err(); err != nil { + return 0, err + } + return n, nil +} + +// DeviceName returns the name of the device of the operation that produced the +// TensorHandle. If the handle was produced by a copy, it returns the +// destination device of the copy. Note that returned device name is not always +// the device holding the tensor handle's memory. If you want the latter, use +// BackingDeviceName. This function will block till the operation that produces +// th has completed. +func (th *TensorHandle) DeviceName() (string, error) { + status := newStatus() + name := C.TFE_TensorHandleDeviceName(th.c, status.c) + if err := status.Err(); err != nil { + return "", err + } + return C.GoString(name), nil +} + +// BackingDeviceName returns the name of the device in whose memory the tensor +// handle resides. This function will block till the operation that produces +// `h` has completed. +// +// WARNING: The implementation currently returns the same as DeviceName(). +// After TensoFlow 1.13's C library is released, this implementation will +// be updated to return what the documentation says! +func (th *TensorHandle) BackingDeviceName() (string, error) { + // TODO(ashankar): Restore after TensorFlow 1.13 is released. + // See https://github.com/tensorflow/tensorflow/issues/23257#issuecomment-433751410 + return th.DeviceName() + /* + status := newStatus() + name := C.TFE_TensorHandleBackingDeviceName(th.c, status.c) + if err := status.Err(); err != nil { + return "", err + } + return C.GoString(name), nil + */ +} + +// ToTensor returns the Tensor referenced by th. It may block if this tensor is +// not yet computed. +func (th *TensorHandle) ToTensor() (*Tensor, error) { + status := newStatus() + cTensor := C.TFE_TensorHandleResolve(th.c, status.c) + if err := status.Err(); err != nil { + return nil, err + } + return newTensorFromC(cTensor), nil +} + +// CopyToDevice creates a new TensorHandle with the same contents as this +// TensorHandle but placed in the memory of the device 'deviceName'. If source +// and destination are the same device, then this creates a new handle that +// shares the underlying buffer. Otherwise, it currently requires at least one +// of the source or destination devices to be CPU (i.e., for the source or +// destination tensor to be placed in host memory). +func (th *TensorHandle) CopyToDevice(c *Context, deviceName string) (*TensorHandle, error) { + status := newStatus() + n := C.CString(deviceName) + newTh := C.TFE_TensorHandleCopyToDevice(th.c, c.c, n, status.c) + C.free(unsafe.Pointer(n)) + if err := status.Err(); err != nil { + return nil, err + } + return newTensorHandleFromC(newTh), nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/tensor_handle_test.go b/third_party/go-tensorflow/tensorflow/go/tensor_handle_test.go new file mode 100644 index 0000000..15dea64 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/tensor_handle_test.go @@ -0,0 +1,127 @@ +/* +Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package tensorflow + +import ( + "reflect" + "strings" + "testing" +) + +func TestNewTensorHandle(t *testing.T) { + vals := [][]float32{{1.0, 2.0}, {3.0, 4.0}} + tensor, err := NewTensor(vals) + if err != nil { + t.Fatal(err) + } + if _, err = NewTensorHandle(tensor); err != nil { + t.Fatal(err) + } +} + +func TestTensorHandleDataType(t *testing.T) { + vals := [][]float32{{1.0, 2.0}, {3.0, 4.0}} + tensor, err := NewTensor(vals) + if err != nil { + t.Fatal(err) + } + th, err := NewTensorHandle(tensor) + if err != nil { + t.Fatal(err) + } + + if got, want := th.DataType(), Float; got != want { + t.Errorf("Got %v, want %v", got, want) + } +} + +func TestTensorHandleShape(t *testing.T) { + vals := [][]float32{{1.0, 2.0, 3.0}, {4.0, 5.0, 6.0}} + tensor, err := NewTensor(vals) + if err != nil { + t.Fatal(err) + } + th, err := NewTensorHandle(tensor) + if err != nil { + t.Fatal(err) + } + + got, err := th.Shape() + if err != nil { + t.Fatal(err) + } + if want := []int64{2, 3}; !reflect.DeepEqual(got, want) { + t.Errorf("Got %#v, want %#v", got, want) + } +} + +func TestTensorHandleDeviceName(t *testing.T) { + vals := [][]float32{{1.0, 2.0}, {3.0, 4.0}} + tensor, err := NewTensor(vals) + if err != nil { + t.Fatal(err) + } + th, err := NewTensorHandle(tensor) + if err != nil { + t.Fatal(err) + } + + d, err := th.DeviceName() + if err != nil { + t.Fatal(err) + } + if !strings.Contains(d, "CPU") { + t.Errorf("DeviceName() did not return a CPU device; got: %s", d) + } +} + +func TestTensorHandleBackingDeviceName(t *testing.T) { + vals := [][]float32{{1.0, 2.0}, {3.0, 4.0}} + tensor, err := NewTensor(vals) + if err != nil { + t.Fatal(err) + } + th, err := NewTensorHandle(tensor) + if err != nil { + t.Fatal(err) + } + + d, err := th.BackingDeviceName() + if err != nil { + t.Fatal(err) + } + if !strings.Contains(d, "CPU") { + t.Errorf("BackingDeviceName() did not return a CPU device; got: %s", d) + } +} + +func TestTensorHandleToTensor(t *testing.T) { + initialVals := [][]float32{{1.0, 2.0}, {3.0, 4.0}} + initialTensor, err := NewTensor(initialVals) + if err != nil { + t.Fatal(err) + } + th, err := NewTensorHandle(initialTensor) + if err != nil { + t.Fatal(err) + } + + tensor, err := th.ToTensor() + if v := tensor.Value().([][]float32); !reflect.DeepEqual(v, initialVals) { + t.Errorf("Got %#v, want %#v", v, initialVals) + } +} diff --git a/third_party/go-tensorflow/tensorflow/go/tensor_test.go b/third_party/go-tensorflow/tensorflow/go/tensor_test.go new file mode 100644 index 0000000..ebfbdec --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/tensor_test.go @@ -0,0 +1,352 @@ +/* +Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package tensorflow + +import ( + "bytes" + "fmt" + "io" + "reflect" + "testing" +) + +func TestNewTensor(t *testing.T) { + var tests = []struct { + shape []int64 + value interface{} + }{ + {nil, bool(true)}, + {nil, int8(5)}, + {nil, int16(5)}, + {nil, int32(5)}, + {nil, int64(5)}, + {nil, uint8(5)}, + {nil, uint16(5)}, + {nil, uint32(5)}, + {nil, uint64(5)}, + {nil, float32(5)}, + {nil, float64(5)}, + {nil, complex(float32(5), float32(6))}, + {nil, complex(float64(5), float64(6))}, + {nil, "a string"}, + {[]int64{1}, []uint32{1}}, + {[]int64{1}, []uint64{1}}, + {[]int64{2}, []bool{true, false}}, + {[]int64{1}, []float64{1}}, + {[]int64{1}, [1]float64{1}}, + {[]int64{1, 1}, [1][1]float64{{1}}}, + {[]int64{1, 1, 1}, [1][1][]float64{{{1}}}}, + {[]int64{1, 1, 2}, [1][][2]float64{{{1, 2}}}}, + {[]int64{1, 1, 1, 1}, [1][][1][]float64{{{{1}}}}}, + {[]int64{2}, []string{"string", "slice"}}, + {[]int64{2}, [2]string{"string", "array"}}, + {[]int64{3, 2}, [][]float64{{1, 2}, {3, 4}, {5, 6}}}, + {[]int64{2, 3}, [2][3]float64{{1, 2, 3}, {3, 4, 6}}}, + {[]int64{4, 3, 2}, [][][]float64{ + {{1, 2}, {3, 4}, {5, 6}}, + {{7, 8}, {9, 10}, {11, 12}}, + {{0, -1}, {-2, -3}, {-4, -5}}, + {{-6, -7}, {-8, -9}, {-10, -11}}, + }}, + {[]int64{2, 0}, [][]int64{{}, {}}}, + {[]int64{2, 2}, [][]string{{"row0col0", "row0,col1"}, {"row1col0", "row1,col1"}}}, + {[]int64{2, 3}, [2][3]string{ + {"row0col0", "row0,col1", "row0,col2"}, + {"row1col0", "row1,col1", "row1,col2"}, + }}, + } + + var errorTests = []interface{}{ + struct{ a int }{5}, + new(int32), + new([]int32), + // native ints not supported + int(5), + []int{5}, + // Mismatched dimensions + [][]float32{{1, 2, 3}, {4}}, + // Mismatched dimensions. Should return "mismatched slice lengths" error instead of "BUG" + [][][]float32{{{1, 2}, {3, 4}}, {{1}, {3}}}, + // Mismatched dimensions. Should return error instead of valid tensor + [][][]float32{{{1, 2}, {3, 4}}, {{1}, {3}}, {{1, 2, 3}, {2, 3, 4}}}, + // Mismatched dimensions for strings + [][]string{{"abc"}, {"abcd", "abcd"}}, + } + + for _, test := range tests { + tensor, err := NewTensor(test.value) + if err != nil { + t.Errorf("NewTensor(%v): %v", test.value, err) + continue + } + if !reflect.DeepEqual(test.shape, tensor.Shape()) { + t.Errorf("Tensor.Shape(): got %v, want %v", tensor.Shape(), test.shape) + } + + // Test that encode and decode gives the same value. We skip arrays because + // they're returned as slices. + if reflect.TypeOf(test.value).Kind() != reflect.Array { + got := tensor.Value() + if !reflect.DeepEqual(test.value, got) { + t.Errorf("encode/decode: got %v, want %v", got, test.value) + } + } + } + + for _, test := range errorTests { + tensor, err := NewTensor(test) + if err == nil { + t.Errorf("NewTensor(%v): %v", test, err) + } + if tensor != nil { + t.Errorf("NewTensor(%v) = %v, want nil", test, tensor) + } + } +} + +func TestTensorSerialization(t *testing.T) { + var tests = []interface{}{ + bool(true), + int8(5), + int16(5), + int32(5), + int64(5), + uint8(5), + uint16(5), + float32(5), + float64(5), + complex(float32(5), float32(6)), + complex(float64(5), float64(6)), + []float64{1}, + [][]float32{{1, 2}, {3, 4}, {5, 6}}, + [][][]int8{ + {{1, 2}, {3, 4}, {5, 6}}, + {{7, 8}, {9, 10}, {11, 12}}, + {{0, -1}, {-2, -3}, {-4, -5}}, + {{-6, -7}, {-8, -9}, {-10, -11}}, + }, + []bool{true, false, true}, + } + for _, v := range tests { + t1, err := NewTensor(v) + if err != nil { + t.Errorf("(%v): %v", v, err) + continue + } + buf := new(bytes.Buffer) + n, err := t1.WriteContentsTo(buf) + if err != nil { + t.Errorf("(%v): %v", v, err) + continue + } + if n != int64(buf.Len()) { + t.Errorf("(%v): WriteContentsTo said it wrote %v bytes, but wrote %v", v, n, buf.Len()) + } + t2, err := ReadTensor(t1.DataType(), t1.Shape(), buf) + if err != nil { + t.Errorf("(%v): %v", v, err) + continue + } + if buf.Len() != 0 { + t.Errorf("(%v): %v bytes written by WriteContentsTo not read by ReadTensor", v, buf.Len()) + } + if got, want := t2.DataType(), t1.DataType(); got != want { + t.Errorf("(%v): Got %v, want %v", v, got, want) + } + if got, want := t2.Shape(), t1.Shape(); !reflect.DeepEqual(got, want) { + t.Errorf("(%v): Got %v, want %v", v, got, want) + } + if got, want := t2.Value(), v; !reflect.DeepEqual(got, want) { + t.Errorf("(%v): Got %v, want %v", v, got, want) + } + } +} + +func TestReadTensorDoesNotReadBeyondContent(t *testing.T) { + t1, _ := NewTensor(int8(7)) + t2, _ := NewTensor(float32(2.718)) + buf := new(bytes.Buffer) + if _, err := t1.WriteContentsTo(buf); err != nil { + t.Fatal(err) + } + if _, err := t2.WriteContentsTo(buf); err != nil { + t.Fatal(err) + } + + t3, err := ReadTensor(t1.DataType(), t1.Shape(), buf) + if err != nil { + t.Fatal(err) + } + t4, err := ReadTensor(t2.DataType(), t2.Shape(), buf) + if err != nil { + t.Fatal(err) + } + + if v, ok := t3.Value().(int8); !ok || v != 7 { + t.Errorf("Got (%v (%T), %v), want (7 (int8), true)", v, v, ok) + } + if v, ok := t4.Value().(float32); !ok || v != 2.718 { + t.Errorf("Got (%v (%T), %v), want (2.718 (float32), true)", v, v, ok) + } +} + +func TestTensorSerializationErrors(t *testing.T) { + // String tensors cannot be serialized + t1, err := NewTensor("abcd") + if err != nil { + t.Fatal(err) + } + buf := new(bytes.Buffer) + if n, err := t1.WriteContentsTo(buf); n != 0 || err == nil || buf.Len() != 0 { + t.Errorf("Got (%v, %v, %v) want (0, , 0)", n, err, buf.Len()) + } + // Should fail to read a truncated value. + if t1, err = NewTensor(int8(8)); err != nil { + t.Fatal(err) + } + n, err := t1.WriteContentsTo(buf) + if err != nil { + t.Fatal(err) + } + r := bytes.NewReader(buf.Bytes()[:n-1]) + if _, err = ReadTensor(t1.DataType(), t1.Shape(), r); err == nil { + t.Error("ReadTensor should have failed if the tensor content was truncated") + } +} + +func TestReadTensorReadAll(t *testing.T) { + // Get the bytes of a tensor. + a := []float32{1.1, 1.2, 1.3} + ats, err := NewTensor(a) + if err != nil { + t.Fatal(err) + } + abuf := new(bytes.Buffer) + if _, err := ats.WriteContentsTo(abuf); err != nil { + t.Fatal(err) + } + + // Get the bytes of another tensor. + b := []float32{1.1, 1.2, 1.3} + bts, err := NewTensor(b) + if err != nil { + t.Fatal(err) + } + bbuf := new(bytes.Buffer) + if _, err := bts.WriteContentsTo(bbuf); err != nil { + t.Fatal(err) + } + + // Check that ReadTensor reads all bytes of both tensors, when the situation + // requires one than reads. + abbuf := io.MultiReader(abuf, bbuf) + abts, err := ReadTensor(Float, []int64{2, 3}, abbuf) + if err != nil { + t.Fatal(err) + } + abtsf32 := abts.Value().([][]float32) + expected := [][]float32{a, b} + + if len(abtsf32) != 2 { + t.Fatalf("first dimension %d is not 2", len(abtsf32)) + } + for i := 0; i < 2; i++ { + if len(abtsf32[i]) != 3 { + t.Fatalf("second dimension %d is not 3", len(abtsf32[i])) + } + for j := 0; j < 3; j++ { + if abtsf32[i][j] != expected[i][j] { + t.Errorf("value at %d %d not equal %f %f", i, j, abtsf32[i][j], expected[i][j]) + } + } + } +} + +func benchmarkNewTensor(b *testing.B, v interface{}) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + if t, err := NewTensor(v); err != nil || t == nil { + b.Fatalf("(%v, %v)", t, err) + } + } +} + +func benchmarkValueTensor(b *testing.B, v interface{}) { + t, err := NewTensor(v) + if err != nil { + b.Fatalf("(%v, %v)", t, err) + } + b.ReportAllocs() + b.ResetTimer() + + for i := 0; i < b.N; i++ { + _ = t.Value() + } +} + +func BenchmarkTensor(b *testing.B) { + // Some sample sizes from the Inception image labeling model. + // Where input tensors correspond to a 224x224 RGB image + // flattened into a vector. + var vector [224 * 224 * 3]int32 + var arrays [100][100][100]int32 + + l3 := make([][][]float32, 100) + l2 := make([][]float32, 100*100) + l1 := make([]float32, 100*100*100) + for i := range l2 { + l2[i] = l1[i*100 : (i+1)*100] + } + for i := range l3 { + l3[i] = l2[i*100 : (i+1)*100] + } + + s1 := make([]string, 100*100*100) + s2 := make([][]string, 100*100) + s3 := make([][][]string, 100) + for i := range s1 { + s1[i] = "cheesit" + } + for i := range s2 { + s2[i] = s1[i*100 : (i+1)*100] + } + for i := range s3 { + s3[i] = s2[i*100 : (i+1)*100] + } + + tests := []interface{}{ + vector, + arrays, + l1, + l2, + l3, + s1, + s2, + s3, + } + b.Run("New", func(b *testing.B) { + for _, test := range tests { + b.Run(fmt.Sprintf("%T", test), func(b *testing.B) { benchmarkNewTensor(b, test) }) + } + }) + b.Run("Value", func(b *testing.B) { + for _, test := range tests { + b.Run(fmt.Sprintf("%T", test), func(b *testing.B) { benchmarkValueTensor(b, test) }) + } + }) + +} diff --git a/third_party/go-tensorflow/tensorflow/go/test.sh b/third_party/go-tensorflow/tensorflow/go/test.sh new file mode 100755 index 0000000..3ea8a05 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/test.sh @@ -0,0 +1,76 @@ +#!/usr/bin/env bash +# Copyright 2017 The TensorFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================== + +# TensorFlow uses 'bazel' for builds and tests. +# The TensorFlow Go API aims to be usable with the 'go' tool +# (using 'go get' etc.) and thus without bazel. +# +# This script acts as a brige between bazel and go so that: +# bazel test :test +# succeeds iff +# go test github.com/tensorflow/tensorflow/tensorflow/go +# succeeds. + +set -ex + +# Find the 'go' tool +if [[ ! -x "go" && -z $(which go) ]] +then + if [[ -x "/usr/local/go/bin/go" ]] + then + export PATH="${PATH}:/usr/local/go/bin" + else + echo "Could not find the 'go' tool in PATH or /usr/local/go" + exit 1 + fi +fi + +# Setup a GOPATH that includes just the TensorFlow Go API. +export GOPATH="${TEST_TMPDIR}/go" +export GOCACHE="${TEST_TMPDIR}/cache" +mkdir -p "${GOPATH}/src/github.com/tensorflow" +ln -s -f "${PWD}" "${GOPATH}/src/github.com/tensorflow/tensorflow" + +# Ensure that the TensorFlow C library is accessible to the +# linker at build and run time. +export LIBRARY_PATH="${PWD}/tensorflow" +OS=$(uname -s) +if [[ "${OS}" = "Linux" ]] +then + if [[ -z "${LD_LIBRARY_PATH}" ]] + then + export LD_LIBRARY_PATH="${PWD}/tensorflow" + else + export LD_LIBRARY_PATH="${PWD}/tensorflow:${LD_LIBRARY_PATH}" + fi +elif [[ "${OS}" = "Darwin" ]] +then + if [[ -z "${DYLD_LIBRARY_PATH}" ]] + then + export DYLD_LIBRARY_PATH="${PWD}/tensorflow" + else + export DYLD_LIBRARY_PATH="${PWD}/tensorflow:${DYLD_LIBRARY_PATH}" + fi +else + echo "Only support Linux/Darwin, System $OS is not supported" + exit 1 +fi + +# Document the Go version and run tests +echo "Go version: $(go version)" +go test \ + github.com/tensorflow/tensorflow/tensorflow/go \ + github.com/tensorflow/tensorflow/tensorflow/go/op diff --git a/third_party/go-tensorflow/tensorflow/go/util_test.go b/third_party/go-tensorflow/tensorflow/go/util_test.go new file mode 100644 index 0000000..2bec954 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/util_test.go @@ -0,0 +1,65 @@ +/* +Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package tensorflow + +func Placeholder(g *Graph, name string, dt DataType) (Output, error) { + op, err := g.AddOperation(OpSpec{ + Type: "Placeholder", + Name: name, + Attrs: map[string]interface{}{ + "dtype": dt, + }, + }) + return op.Output(0), err +} + +func Const(g *Graph, name string, value interface{}) (Output, error) { + t, ok := value.(*Tensor) + if !ok { + var err error + if t, err = NewTensor(value); err != nil { + return Output{}, err + } + } + op, err := g.AddOperation(OpSpec{ + Type: "Const", + Name: name, + Attrs: map[string]interface{}{ + "dtype": t.DataType(), + "value": t, + }, + }) + return op.Output(0), err +} + +func Neg(g *Graph, name string, port Output) (Output, error) { + op, err := g.AddOperation(OpSpec{ + Type: "Neg", + Name: name, + Input: []Input{port}, + }) + return op.Output(0), err +} + +func Add(g *Graph, name string, x, y Output) (Output, error) { + op, err := g.AddOperation(OpSpec{ + Type: "Add", + Name: name, + Input: []Input{x, y}, + }) + return op.Output(0), err +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/allocation_description_go_proto/allocation_description.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/allocation_description_go_proto/allocation_description.pb.go new file mode 100644 index 0000000..2cadcf8 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/allocation_description_go_proto/allocation_description.pb.go @@ -0,0 +1,175 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/allocation_description.proto + +package allocation_description_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type AllocationDescription struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Total number of bytes requested + RequestedBytes int64 `protobuf:"varint,1,opt,name=requested_bytes,json=requestedBytes,proto3" json:"requested_bytes,omitempty"` + // Total number of bytes allocated if known + AllocatedBytes int64 `protobuf:"varint,2,opt,name=allocated_bytes,json=allocatedBytes,proto3" json:"allocated_bytes,omitempty"` + // Name of the allocator used + AllocatorName string `protobuf:"bytes,3,opt,name=allocator_name,json=allocatorName,proto3" json:"allocator_name,omitempty"` + // Identifier of the allocated buffer if known + AllocationId int64 `protobuf:"varint,4,opt,name=allocation_id,json=allocationId,proto3" json:"allocation_id,omitempty"` + // Set if this tensor only has one remaining reference + HasSingleReference bool `protobuf:"varint,5,opt,name=has_single_reference,json=hasSingleReference,proto3" json:"has_single_reference,omitempty"` + // Address of the allocation. + Ptr uint64 `protobuf:"varint,6,opt,name=ptr,proto3" json:"ptr,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AllocationDescription) Reset() { + *x = AllocationDescription{} + mi := &file_tensorflow_core_framework_allocation_description_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AllocationDescription) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AllocationDescription) ProtoMessage() {} + +func (x *AllocationDescription) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_allocation_description_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AllocationDescription.ProtoReflect.Descriptor instead. +func (*AllocationDescription) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_allocation_description_proto_rawDescGZIP(), []int{0} +} + +func (x *AllocationDescription) GetRequestedBytes() int64 { + if x != nil { + return x.RequestedBytes + } + return 0 +} + +func (x *AllocationDescription) GetAllocatedBytes() int64 { + if x != nil { + return x.AllocatedBytes + } + return 0 +} + +func (x *AllocationDescription) GetAllocatorName() string { + if x != nil { + return x.AllocatorName + } + return "" +} + +func (x *AllocationDescription) GetAllocationId() int64 { + if x != nil { + return x.AllocationId + } + return 0 +} + +func (x *AllocationDescription) GetHasSingleReference() bool { + if x != nil { + return x.HasSingleReference + } + return false +} + +func (x *AllocationDescription) GetPtr() uint64 { + if x != nil { + return x.Ptr + } + return 0 +} + +var File_tensorflow_core_framework_allocation_description_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_allocation_description_proto_rawDesc = "" + + "\n" + + "6tensorflow/core/framework/allocation_description.proto\x12\n" + + "tensorflow\"\xf9\x01\n" + + "\x15AllocationDescription\x12'\n" + + "\x0frequested_bytes\x18\x01 \x01(\x03R\x0erequestedBytes\x12'\n" + + "\x0fallocated_bytes\x18\x02 \x01(\x03R\x0eallocatedBytes\x12%\n" + + "\x0eallocator_name\x18\x03 \x01(\tR\rallocatorName\x12#\n" + + "\rallocation_id\x18\x04 \x01(\x03R\fallocationId\x120\n" + + "\x14has_single_reference\x18\x05 \x01(\bR\x12hasSingleReference\x12\x10\n" + + "\x03ptr\x18\x06 \x01(\x04R\x03ptrB\x9b\x01\n" + + "\x18org.tensorflow.frameworkB\x1bAllocationDescriptionProtosP\x01Z]github.com/tensorflow/tensorflow/tensorflow/go/core/framework/allocation_description_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_allocation_description_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_allocation_description_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_allocation_description_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_allocation_description_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_allocation_description_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_allocation_description_proto_rawDesc), len(file_tensorflow_core_framework_allocation_description_proto_rawDesc))) + }) + return file_tensorflow_core_framework_allocation_description_proto_rawDescData +} + +var file_tensorflow_core_framework_allocation_description_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_tensorflow_core_framework_allocation_description_proto_goTypes = []any{ + (*AllocationDescription)(nil), // 0: tensorflow.AllocationDescription +} +var file_tensorflow_core_framework_allocation_description_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_allocation_description_proto_init() } +func file_tensorflow_core_framework_allocation_description_proto_init() { + if File_tensorflow_core_framework_allocation_description_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_allocation_description_proto_rawDesc), len(file_tensorflow_core_framework_allocation_description_proto_rawDesc)), + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_allocation_description_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_allocation_description_proto_depIdxs, + MessageInfos: file_tensorflow_core_framework_allocation_description_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_allocation_description_proto = out.File + file_tensorflow_core_framework_allocation_description_proto_goTypes = nil + file_tensorflow_core_framework_allocation_description_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/api_def_go_proto/api_def.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/api_def_go_proto/api_def.pb.go new file mode 100644 index 0000000..f6a05b9 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/api_def_go_proto/api_def.pb.go @@ -0,0 +1,630 @@ +// Defines the text format for including per-op API definition and +// overrides for client language op code generators. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/api_def.proto + +package api_def_go_proto + +import ( + attr_value_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/attr_value_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type ApiDef_Visibility int32 + +const ( + // Normally this is "VISIBLE" unless you are inheriting a + // different value from another ApiDef. + ApiDef_DEFAULT_VISIBILITY ApiDef_Visibility = 0 + // Publicly visible in the API. + ApiDef_VISIBLE ApiDef_Visibility = 1 + // Do not include this op in the generated API. If visibility is + // set to 'SKIP', other fields are ignored for this op. + ApiDef_SKIP ApiDef_Visibility = 2 + // Hide this op by putting it into an internal namespace (or whatever + // is appropriate in the target language). + ApiDef_HIDDEN ApiDef_Visibility = 3 +) + +// Enum value maps for ApiDef_Visibility. +var ( + ApiDef_Visibility_name = map[int32]string{ + 0: "DEFAULT_VISIBILITY", + 1: "VISIBLE", + 2: "SKIP", + 3: "HIDDEN", + } + ApiDef_Visibility_value = map[string]int32{ + "DEFAULT_VISIBILITY": 0, + "VISIBLE": 1, + "SKIP": 2, + "HIDDEN": 3, + } +) + +func (x ApiDef_Visibility) Enum() *ApiDef_Visibility { + p := new(ApiDef_Visibility) + *p = x + return p +} + +func (x ApiDef_Visibility) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ApiDef_Visibility) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_framework_api_def_proto_enumTypes[0].Descriptor() +} + +func (ApiDef_Visibility) Type() protoreflect.EnumType { + return &file_tensorflow_core_framework_api_def_proto_enumTypes[0] +} + +func (x ApiDef_Visibility) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ApiDef_Visibility.Descriptor instead. +func (ApiDef_Visibility) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_framework_api_def_proto_rawDescGZIP(), []int{0, 0} +} + +// Used to specify and override the default API & behavior in the +// generated code for client languages, from what you would get from +// the OpDef alone. There will be a set of ApiDefs that are common +// to all client languages, and another set per client language. +// The per-client-language ApiDefs will inherit values from the +// 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 +// graphs. Overrides go in an "api_def.pbtxt" file with a text-format +// ApiDefs message. +// +// WARNING: Be *very* careful changing the API for any existing op -- +// you can change the semantics of existing code. These changes may +// need to wait until a major release of TensorFlow to avoid breaking +// our compatibility promises. +type ApiDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Name of the op (in the OpDef) to specify the API for. + GraphOpName string `protobuf:"bytes,1,opt,name=graph_op_name,json=graphOpName,proto3" json:"graph_op_name,omitempty"` + // If this op is deprecated, set deprecation message to the message + // that should be logged when this op is used. + // The message should indicate alternative op to use, if any. + DeprecationMessage string `protobuf:"bytes,12,opt,name=deprecation_message,json=deprecationMessage,proto3" json:"deprecation_message,omitempty"` + // Major version when the op will be deleted. For e.g. set this + // value to 2 if op API should be removed in TensorFlow 2.0 and + // deprecated in versions before that. + DeprecationVersion int32 `protobuf:"varint,13,opt,name=deprecation_version,json=deprecationVersion,proto3" json:"deprecation_version,omitempty"` + Visibility ApiDef_Visibility `protobuf:"varint,2,opt,name=visibility,proto3,enum=tensorflow.ApiDef_Visibility" json:"visibility,omitempty"` + Endpoint []*ApiDef_Endpoint `protobuf:"bytes,3,rep,name=endpoint,proto3" json:"endpoint,omitempty"` + InArg []*ApiDef_Arg `protobuf:"bytes,4,rep,name=in_arg,json=inArg,proto3" json:"in_arg,omitempty"` + OutArg []*ApiDef_Arg `protobuf:"bytes,5,rep,name=out_arg,json=outArg,proto3" json:"out_arg,omitempty"` + // List of original in_arg names to specify new argument order. + // Length of arg_order should be either empty to keep current order + // or match size of in_arg. + ArgOrder []string `protobuf:"bytes,11,rep,name=arg_order,json=argOrder,proto3" json:"arg_order,omitempty"` + Attr []*ApiDef_Attr `protobuf:"bytes,6,rep,name=attr,proto3" json:"attr,omitempty"` + // One-line human-readable description of what the Op does. + Summary string `protobuf:"bytes,7,opt,name=summary,proto3" json:"summary,omitempty"` + // Additional, longer human-readable description of what the Op does. + Description string `protobuf:"bytes,8,opt,name=description,proto3" json:"description,omitempty"` + // Modify an existing/inherited description by adding text to the beginning + // or end. + DescriptionPrefix string `protobuf:"bytes,9,opt,name=description_prefix,json=descriptionPrefix,proto3" json:"description_prefix,omitempty"` + DescriptionSuffix string `protobuf:"bytes,10,opt,name=description_suffix,json=descriptionSuffix,proto3" json:"description_suffix,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ApiDef) Reset() { + *x = ApiDef{} + mi := &file_tensorflow_core_framework_api_def_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ApiDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ApiDef) ProtoMessage() {} + +func (x *ApiDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_api_def_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ApiDef.ProtoReflect.Descriptor instead. +func (*ApiDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_api_def_proto_rawDescGZIP(), []int{0} +} + +func (x *ApiDef) GetGraphOpName() string { + if x != nil { + return x.GraphOpName + } + return "" +} + +func (x *ApiDef) GetDeprecationMessage() string { + if x != nil { + return x.DeprecationMessage + } + return "" +} + +func (x *ApiDef) GetDeprecationVersion() int32 { + if x != nil { + return x.DeprecationVersion + } + return 0 +} + +func (x *ApiDef) GetVisibility() ApiDef_Visibility { + if x != nil { + return x.Visibility + } + return ApiDef_DEFAULT_VISIBILITY +} + +func (x *ApiDef) GetEndpoint() []*ApiDef_Endpoint { + if x != nil { + return x.Endpoint + } + return nil +} + +func (x *ApiDef) GetInArg() []*ApiDef_Arg { + if x != nil { + return x.InArg + } + return nil +} + +func (x *ApiDef) GetOutArg() []*ApiDef_Arg { + if x != nil { + return x.OutArg + } + return nil +} + +func (x *ApiDef) GetArgOrder() []string { + if x != nil { + return x.ArgOrder + } + return nil +} + +func (x *ApiDef) GetAttr() []*ApiDef_Attr { + if x != nil { + return x.Attr + } + return nil +} + +func (x *ApiDef) GetSummary() string { + if x != nil { + return x.Summary + } + return "" +} + +func (x *ApiDef) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *ApiDef) GetDescriptionPrefix() string { + if x != nil { + return x.DescriptionPrefix + } + return "" +} + +func (x *ApiDef) GetDescriptionSuffix() string { + if x != nil { + return x.DescriptionSuffix + } + return "" +} + +type ApiDefs struct { + state protoimpl.MessageState `protogen:"open.v1"` + Op []*ApiDef `protobuf:"bytes,1,rep,name=op,proto3" json:"op,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ApiDefs) Reset() { + *x = ApiDefs{} + mi := &file_tensorflow_core_framework_api_def_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ApiDefs) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ApiDefs) ProtoMessage() {} + +func (x *ApiDefs) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_api_def_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ApiDefs.ProtoReflect.Descriptor instead. +func (*ApiDefs) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_api_def_proto_rawDescGZIP(), []int{1} +} + +func (x *ApiDefs) GetOp() []*ApiDef { + if x != nil { + return x.Op + } + return nil +} + +// If you specify any endpoint, this will replace all of the +// inherited endpoints. The first endpoint should be the +// "canonical" endpoint, and should not be deprecated (unless all +// endpoints are deprecated). +type ApiDef_Endpoint struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Name should be either like "CamelCaseName" or + // "Package.CamelCaseName". Client-language-specific ApiDefs may + // use a snake_case convention instead of CamelCase. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Set if this endpoint is deprecated. If set to true, a message suggesting + // to use a non-deprecated endpoint instead will be printed. If all + // endpoints are deprecated, set deprecation_message in ApiDef instead. + Deprecated bool `protobuf:"varint,3,opt,name=deprecated,proto3" json:"deprecated,omitempty"` + // Major version when an endpoint will be deleted. For e.g. set this + // value to 2 if endpoint should be removed in TensorFlow 2.0 and + // deprecated in versions before that. + DeprecationVersion int32 `protobuf:"varint,4,opt,name=deprecation_version,json=deprecationVersion,proto3" json:"deprecation_version,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ApiDef_Endpoint) Reset() { + *x = ApiDef_Endpoint{} + mi := &file_tensorflow_core_framework_api_def_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ApiDef_Endpoint) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ApiDef_Endpoint) ProtoMessage() {} + +func (x *ApiDef_Endpoint) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_api_def_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ApiDef_Endpoint.ProtoReflect.Descriptor instead. +func (*ApiDef_Endpoint) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_api_def_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *ApiDef_Endpoint) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ApiDef_Endpoint) GetDeprecated() bool { + if x != nil { + return x.Deprecated + } + return false +} + +func (x *ApiDef_Endpoint) GetDeprecationVersion() int32 { + if x != nil { + return x.DeprecationVersion + } + return 0 +} + +type ApiDef_Arg struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Change the name used to access this arg in the API from what + // is used in the GraphDef. Note that these names in `backticks` + // will also be replaced in the summary & description fields. + RenameTo string `protobuf:"bytes,2,opt,name=rename_to,json=renameTo,proto3" json:"rename_to,omitempty"` + // Note: this will replace any inherited arg doc. There is no + // current way of modifying arg descriptions (other than replacing + // them entirely) as can be done with op descriptions. + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ApiDef_Arg) Reset() { + *x = ApiDef_Arg{} + mi := &file_tensorflow_core_framework_api_def_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ApiDef_Arg) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ApiDef_Arg) ProtoMessage() {} + +func (x *ApiDef_Arg) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_api_def_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ApiDef_Arg.ProtoReflect.Descriptor instead. +func (*ApiDef_Arg) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_api_def_proto_rawDescGZIP(), []int{0, 1} +} + +func (x *ApiDef_Arg) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ApiDef_Arg) GetRenameTo() string { + if x != nil { + return x.RenameTo + } + return "" +} + +func (x *ApiDef_Arg) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +// Description of the graph-construction-time configuration of this +// Op. That is to say, this describes the attr fields that will +// be specified in the NodeDef. +type ApiDef_Attr struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Change the name used to access this attr in the API from what + // is used in the GraphDef. Note that these names in `backticks` + // will also be replaced in the summary & description fields. + RenameTo string `protobuf:"bytes,2,opt,name=rename_to,json=renameTo,proto3" json:"rename_to,omitempty"` + // Specify a new default value to use for this attr. This default + // will be used when creating new graphs, as opposed to the + // default in the OpDef, which will be used when interpreting old + // GraphDefs. + DefaultValue *attr_value_go_proto.AttrValue `protobuf:"bytes,3,opt,name=default_value,json=defaultValue,proto3" json:"default_value,omitempty"` + // Note: this will replace any inherited attr doc, there is no current + // way of modifying attr descriptions as can be done with op descriptions. + Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ApiDef_Attr) Reset() { + *x = ApiDef_Attr{} + mi := &file_tensorflow_core_framework_api_def_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ApiDef_Attr) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ApiDef_Attr) ProtoMessage() {} + +func (x *ApiDef_Attr) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_api_def_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ApiDef_Attr.ProtoReflect.Descriptor instead. +func (*ApiDef_Attr) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_api_def_proto_rawDescGZIP(), []int{0, 2} +} + +func (x *ApiDef_Attr) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ApiDef_Attr) GetRenameTo() string { + if x != nil { + return x.RenameTo + } + return "" +} + +func (x *ApiDef_Attr) GetDefaultValue() *attr_value_go_proto.AttrValue { + if x != nil { + return x.DefaultValue + } + return nil +} + +func (x *ApiDef_Attr) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +var File_tensorflow_core_framework_api_def_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_api_def_proto_rawDesc = "" + + "\n" + + "'tensorflow/core/framework/api_def.proto\x12\n" + + "tensorflow\x1a*tensorflow/core/framework/attr_value.proto\"\xf6\a\n" + + "\x06ApiDef\x12\"\n" + + "\rgraph_op_name\x18\x01 \x01(\tR\vgraphOpName\x12/\n" + + "\x13deprecation_message\x18\f \x01(\tR\x12deprecationMessage\x12/\n" + + "\x13deprecation_version\x18\r \x01(\x05R\x12deprecationVersion\x12=\n" + + "\n" + + "visibility\x18\x02 \x01(\x0e2\x1d.tensorflow.ApiDef.VisibilityR\n" + + "visibility\x127\n" + + "\bendpoint\x18\x03 \x03(\v2\x1b.tensorflow.ApiDef.EndpointR\bendpoint\x12-\n" + + "\x06in_arg\x18\x04 \x03(\v2\x16.tensorflow.ApiDef.ArgR\x05inArg\x12/\n" + + "\aout_arg\x18\x05 \x03(\v2\x16.tensorflow.ApiDef.ArgR\x06outArg\x12\x1b\n" + + "\targ_order\x18\v \x03(\tR\bargOrder\x12+\n" + + "\x04attr\x18\x06 \x03(\v2\x17.tensorflow.ApiDef.AttrR\x04attr\x12\x18\n" + + "\asummary\x18\a \x01(\tR\asummary\x12 \n" + + "\vdescription\x18\b \x01(\tR\vdescription\x12-\n" + + "\x12description_prefix\x18\t \x01(\tR\x11descriptionPrefix\x12-\n" + + "\x12description_suffix\x18\n" + + " \x01(\tR\x11descriptionSuffix\x1ao\n" + + "\bEndpoint\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x1e\n" + + "\n" + + "deprecated\x18\x03 \x01(\bR\n" + + "deprecated\x12/\n" + + "\x13deprecation_version\x18\x04 \x01(\x05R\x12deprecationVersion\x1aX\n" + + "\x03Arg\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x1b\n" + + "\trename_to\x18\x02 \x01(\tR\brenameTo\x12 \n" + + "\vdescription\x18\x03 \x01(\tR\vdescription\x1a\x95\x01\n" + + "\x04Attr\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x1b\n" + + "\trename_to\x18\x02 \x01(\tR\brenameTo\x12:\n" + + "\rdefault_value\x18\x03 \x01(\v2\x15.tensorflow.AttrValueR\fdefaultValue\x12 \n" + + "\vdescription\x18\x04 \x01(\tR\vdescription\"G\n" + + "\n" + + "Visibility\x12\x16\n" + + "\x12DEFAULT_VISIBILITY\x10\x00\x12\v\n" + + "\aVISIBLE\x10\x01\x12\b\n" + + "\x04SKIP\x10\x02\x12\n" + + "\n" + + "\x06HIDDEN\x10\x03\"-\n" + + "\aApiDefs\x12\"\n" + + "\x02op\x18\x01 \x03(\v2\x12.tensorflow.ApiDefR\x02opB}\n" + + "\x18org.tensorflow.frameworkB\fApiDefProtosP\x01ZNgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/api_def_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_api_def_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_api_def_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_api_def_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_api_def_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_api_def_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_api_def_proto_rawDesc), len(file_tensorflow_core_framework_api_def_proto_rawDesc))) + }) + return file_tensorflow_core_framework_api_def_proto_rawDescData +} + +var file_tensorflow_core_framework_api_def_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_tensorflow_core_framework_api_def_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_tensorflow_core_framework_api_def_proto_goTypes = []any{ + (ApiDef_Visibility)(0), // 0: tensorflow.ApiDef.Visibility + (*ApiDef)(nil), // 1: tensorflow.ApiDef + (*ApiDefs)(nil), // 2: tensorflow.ApiDefs + (*ApiDef_Endpoint)(nil), // 3: tensorflow.ApiDef.Endpoint + (*ApiDef_Arg)(nil), // 4: tensorflow.ApiDef.Arg + (*ApiDef_Attr)(nil), // 5: tensorflow.ApiDef.Attr + (*attr_value_go_proto.AttrValue)(nil), // 6: tensorflow.AttrValue +} +var file_tensorflow_core_framework_api_def_proto_depIdxs = []int32{ + 0, // 0: tensorflow.ApiDef.visibility:type_name -> tensorflow.ApiDef.Visibility + 3, // 1: tensorflow.ApiDef.endpoint:type_name -> tensorflow.ApiDef.Endpoint + 4, // 2: tensorflow.ApiDef.in_arg:type_name -> tensorflow.ApiDef.Arg + 4, // 3: tensorflow.ApiDef.out_arg:type_name -> tensorflow.ApiDef.Arg + 5, // 4: tensorflow.ApiDef.attr:type_name -> tensorflow.ApiDef.Attr + 1, // 5: tensorflow.ApiDefs.op:type_name -> tensorflow.ApiDef + 6, // 6: tensorflow.ApiDef.Attr.default_value:type_name -> tensorflow.AttrValue + 7, // [7:7] is the sub-list for method output_type + 7, // [7:7] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_api_def_proto_init() } +func file_tensorflow_core_framework_api_def_proto_init() { + if File_tensorflow_core_framework_api_def_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_api_def_proto_rawDesc), len(file_tensorflow_core_framework_api_def_proto_rawDesc)), + NumEnums: 1, + NumMessages: 5, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_api_def_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_api_def_proto_depIdxs, + EnumInfos: file_tensorflow_core_framework_api_def_proto_enumTypes, + MessageInfos: file_tensorflow_core_framework_api_def_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_api_def_proto = out.File + file_tensorflow_core_framework_api_def_proto_goTypes = nil + file_tensorflow_core_framework_api_def_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/attr_value_go_proto/attr_value.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/attr_value_go_proto/attr_value.pb.go new file mode 100644 index 0000000..6aab6e3 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/attr_value_go_proto/attr_value.pb.go @@ -0,0 +1,517 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/attr_value.proto + +package attr_value_go_proto + +import ( + tensor_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_go_proto" + tensor_shape_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_shape_go_proto" + types_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/types_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Protocol buffer representing the value for an attr used to configure an Op. +// Comment indicates the corresponding attr type. Only the field matching the +// attr type may be filled. +type AttrValue struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Value: + // + // *AttrValue_S + // *AttrValue_I + // *AttrValue_F + // *AttrValue_B + // *AttrValue_Type + // *AttrValue_Shape + // *AttrValue_Tensor + // *AttrValue_List + // *AttrValue_Func + // *AttrValue_Placeholder + Value isAttrValue_Value `protobuf_oneof:"value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AttrValue) Reset() { + *x = AttrValue{} + mi := &file_tensorflow_core_framework_attr_value_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AttrValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AttrValue) ProtoMessage() {} + +func (x *AttrValue) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_attr_value_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AttrValue.ProtoReflect.Descriptor instead. +func (*AttrValue) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_attr_value_proto_rawDescGZIP(), []int{0} +} + +func (x *AttrValue) GetValue() isAttrValue_Value { + if x != nil { + return x.Value + } + return nil +} + +func (x *AttrValue) GetS() []byte { + if x != nil { + if x, ok := x.Value.(*AttrValue_S); ok { + return x.S + } + } + return nil +} + +func (x *AttrValue) GetI() int64 { + if x != nil { + if x, ok := x.Value.(*AttrValue_I); ok { + return x.I + } + } + return 0 +} + +func (x *AttrValue) GetF() float32 { + if x != nil { + if x, ok := x.Value.(*AttrValue_F); ok { + return x.F + } + } + return 0 +} + +func (x *AttrValue) GetB() bool { + if x != nil { + if x, ok := x.Value.(*AttrValue_B); ok { + return x.B + } + } + return false +} + +func (x *AttrValue) GetType() types_go_proto.DataType { + if x != nil { + if x, ok := x.Value.(*AttrValue_Type); ok { + return x.Type + } + } + return types_go_proto.DataType(0) +} + +func (x *AttrValue) GetShape() *tensor_shape_go_proto.TensorShapeProto { + if x != nil { + if x, ok := x.Value.(*AttrValue_Shape); ok { + return x.Shape + } + } + return nil +} + +func (x *AttrValue) GetTensor() *tensor_go_proto.TensorProto { + if x != nil { + if x, ok := x.Value.(*AttrValue_Tensor); ok { + return x.Tensor + } + } + return nil +} + +func (x *AttrValue) GetList() *AttrValue_ListValue { + if x != nil { + if x, ok := x.Value.(*AttrValue_List); ok { + return x.List + } + } + return nil +} + +func (x *AttrValue) GetFunc() *NameAttrList { + if x != nil { + if x, ok := x.Value.(*AttrValue_Func); ok { + return x.Func + } + } + return nil +} + +func (x *AttrValue) GetPlaceholder() string { + if x != nil { + if x, ok := x.Value.(*AttrValue_Placeholder); ok { + return x.Placeholder + } + } + return "" +} + +type isAttrValue_Value interface { + isAttrValue_Value() +} + +type AttrValue_S struct { + S []byte `protobuf:"bytes,2,opt,name=s,proto3,oneof"` // "string" +} + +type AttrValue_I struct { + I int64 `protobuf:"varint,3,opt,name=i,proto3,oneof"` // "int" +} + +type AttrValue_F struct { + F float32 `protobuf:"fixed32,4,opt,name=f,proto3,oneof"` // "float" +} + +type AttrValue_B struct { + B bool `protobuf:"varint,5,opt,name=b,proto3,oneof"` // "bool" +} + +type AttrValue_Type struct { + Type types_go_proto.DataType `protobuf:"varint,6,opt,name=type,proto3,enum=tensorflow.DataType,oneof"` // "type" +} + +type AttrValue_Shape struct { + Shape *tensor_shape_go_proto.TensorShapeProto `protobuf:"bytes,7,opt,name=shape,proto3,oneof"` // "shape" +} + +type AttrValue_Tensor struct { + Tensor *tensor_go_proto.TensorProto `protobuf:"bytes,8,opt,name=tensor,proto3,oneof"` // "tensor" +} + +type AttrValue_List struct { + List *AttrValue_ListValue `protobuf:"bytes,1,opt,name=list,proto3,oneof"` // any "list(...)" +} + +type AttrValue_Func struct { + // "func" represents a function. func.name is a function's name or + // a primitive op's name. func.attr.first is the name of an attr + // defined for that function. func.attr.second is the value for + // that attr in the instantiation. + Func *NameAttrList `protobuf:"bytes,10,opt,name=func,proto3,oneof"` +} + +type AttrValue_Placeholder struct { + // This is a placeholder only used in nodes defined inside a + // function. It indicates the attr value will be supplied when + // the function is instantiated. For example, let us suppose a + // node "N" in function "FN". "N" has an attr "A" with value + // placeholder = "foo". When FN is instantiated with attr "foo" + // set to "bar", the instantiated node N's attr A will have been + // given the value "bar". + Placeholder string `protobuf:"bytes,9,opt,name=placeholder,proto3,oneof"` +} + +func (*AttrValue_S) isAttrValue_Value() {} + +func (*AttrValue_I) isAttrValue_Value() {} + +func (*AttrValue_F) isAttrValue_Value() {} + +func (*AttrValue_B) isAttrValue_Value() {} + +func (*AttrValue_Type) isAttrValue_Value() {} + +func (*AttrValue_Shape) isAttrValue_Value() {} + +func (*AttrValue_Tensor) isAttrValue_Value() {} + +func (*AttrValue_List) isAttrValue_Value() {} + +func (*AttrValue_Func) isAttrValue_Value() {} + +func (*AttrValue_Placeholder) isAttrValue_Value() {} + +// A list of attr names and their values. The whole list is attached +// with a string name. E.g., MatMul[T=float]. +type NameAttrList struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Attr map[string]*AttrValue `protobuf:"bytes,2,rep,name=attr,proto3" json:"attr,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NameAttrList) Reset() { + *x = NameAttrList{} + mi := &file_tensorflow_core_framework_attr_value_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NameAttrList) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NameAttrList) ProtoMessage() {} + +func (x *NameAttrList) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_attr_value_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NameAttrList.ProtoReflect.Descriptor instead. +func (*NameAttrList) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_attr_value_proto_rawDescGZIP(), []int{1} +} + +func (x *NameAttrList) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *NameAttrList) GetAttr() map[string]*AttrValue { + if x != nil { + return x.Attr + } + return nil +} + +// LINT.IfChange +type AttrValue_ListValue struct { + state protoimpl.MessageState `protogen:"open.v1"` + S [][]byte `protobuf:"bytes,2,rep,name=s,proto3" json:"s,omitempty"` // "list(string)" + I []int64 `protobuf:"varint,3,rep,packed,name=i,proto3" json:"i,omitempty"` // "list(int)" + F []float32 `protobuf:"fixed32,4,rep,packed,name=f,proto3" json:"f,omitempty"` // "list(float)" + B []bool `protobuf:"varint,5,rep,packed,name=b,proto3" json:"b,omitempty"` // "list(bool)" + Type []types_go_proto.DataType `protobuf:"varint,6,rep,packed,name=type,proto3,enum=tensorflow.DataType" json:"type,omitempty"` // "list(type)" + Shape []*tensor_shape_go_proto.TensorShapeProto `protobuf:"bytes,7,rep,name=shape,proto3" json:"shape,omitempty"` // "list(shape)" + Tensor []*tensor_go_proto.TensorProto `protobuf:"bytes,8,rep,name=tensor,proto3" json:"tensor,omitempty"` // "list(tensor)" + Func []*NameAttrList `protobuf:"bytes,9,rep,name=func,proto3" json:"func,omitempty"` // "list(attr)" + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AttrValue_ListValue) Reset() { + *x = AttrValue_ListValue{} + mi := &file_tensorflow_core_framework_attr_value_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AttrValue_ListValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AttrValue_ListValue) ProtoMessage() {} + +func (x *AttrValue_ListValue) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_attr_value_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AttrValue_ListValue.ProtoReflect.Descriptor instead. +func (*AttrValue_ListValue) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_attr_value_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *AttrValue_ListValue) GetS() [][]byte { + if x != nil { + return x.S + } + return nil +} + +func (x *AttrValue_ListValue) GetI() []int64 { + if x != nil { + return x.I + } + return nil +} + +func (x *AttrValue_ListValue) GetF() []float32 { + if x != nil { + return x.F + } + return nil +} + +func (x *AttrValue_ListValue) GetB() []bool { + if x != nil { + return x.B + } + return nil +} + +func (x *AttrValue_ListValue) GetType() []types_go_proto.DataType { + if x != nil { + return x.Type + } + return nil +} + +func (x *AttrValue_ListValue) GetShape() []*tensor_shape_go_proto.TensorShapeProto { + if x != nil { + return x.Shape + } + return nil +} + +func (x *AttrValue_ListValue) GetTensor() []*tensor_go_proto.TensorProto { + if x != nil { + return x.Tensor + } + return nil +} + +func (x *AttrValue_ListValue) GetFunc() []*NameAttrList { + if x != nil { + return x.Func + } + return nil +} + +var File_tensorflow_core_framework_attr_value_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_attr_value_proto_rawDesc = "" + + "\n" + + "*tensorflow/core/framework/attr_value.proto\x12\n" + + "tensorflow\x1a&tensorflow/core/framework/tensor.proto\x1a,tensorflow/core/framework/tensor_shape.proto\x1a%tensorflow/core/framework/types.proto\"\x87\x05\n" + + "\tAttrValue\x12\x0e\n" + + "\x01s\x18\x02 \x01(\fH\x00R\x01s\x12\x0e\n" + + "\x01i\x18\x03 \x01(\x03H\x00R\x01i\x12\x0e\n" + + "\x01f\x18\x04 \x01(\x02H\x00R\x01f\x12\x0e\n" + + "\x01b\x18\x05 \x01(\bH\x00R\x01b\x12*\n" + + "\x04type\x18\x06 \x01(\x0e2\x14.tensorflow.DataTypeH\x00R\x04type\x124\n" + + "\x05shape\x18\a \x01(\v2\x1c.tensorflow.TensorShapeProtoH\x00R\x05shape\x121\n" + + "\x06tensor\x18\b \x01(\v2\x17.tensorflow.TensorProtoH\x00R\x06tensor\x125\n" + + "\x04list\x18\x01 \x01(\v2\x1f.tensorflow.AttrValue.ListValueH\x00R\x04list\x12.\n" + + "\x04func\x18\n" + + " \x01(\v2\x18.tensorflow.NameAttrListH\x00R\x04func\x12\"\n" + + "\vplaceholder\x18\t \x01(\tH\x00R\vplaceholder\x1a\x90\x02\n" + + "\tListValue\x12\f\n" + + "\x01s\x18\x02 \x03(\fR\x01s\x12\x10\n" + + "\x01i\x18\x03 \x03(\x03B\x02\x10\x01R\x01i\x12\x10\n" + + "\x01f\x18\x04 \x03(\x02B\x02\x10\x01R\x01f\x12\x10\n" + + "\x01b\x18\x05 \x03(\bB\x02\x10\x01R\x01b\x12,\n" + + "\x04type\x18\x06 \x03(\x0e2\x14.tensorflow.DataTypeB\x02\x10\x01R\x04type\x122\n" + + "\x05shape\x18\a \x03(\v2\x1c.tensorflow.TensorShapeProtoR\x05shape\x12/\n" + + "\x06tensor\x18\b \x03(\v2\x17.tensorflow.TensorProtoR\x06tensor\x12,\n" + + "\x04func\x18\t \x03(\v2\x18.tensorflow.NameAttrListR\x04funcB\a\n" + + "\x05value\"\xaa\x01\n" + + "\fNameAttrList\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x126\n" + + "\x04attr\x18\x02 \x03(\v2\".tensorflow.NameAttrList.AttrEntryR\x04attr\x1aN\n" + + "\tAttrEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12+\n" + + "\x05value\x18\x02 \x01(\v2\x15.tensorflow.AttrValueR\x05value:\x028\x01B\x83\x01\n" + + "\x18org.tensorflow.frameworkB\x0fAttrValueProtosP\x01ZQgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/attr_value_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_attr_value_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_attr_value_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_attr_value_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_attr_value_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_attr_value_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_attr_value_proto_rawDesc), len(file_tensorflow_core_framework_attr_value_proto_rawDesc))) + }) + return file_tensorflow_core_framework_attr_value_proto_rawDescData +} + +var file_tensorflow_core_framework_attr_value_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_tensorflow_core_framework_attr_value_proto_goTypes = []any{ + (*AttrValue)(nil), // 0: tensorflow.AttrValue + (*NameAttrList)(nil), // 1: tensorflow.NameAttrList + (*AttrValue_ListValue)(nil), // 2: tensorflow.AttrValue.ListValue + nil, // 3: tensorflow.NameAttrList.AttrEntry + (types_go_proto.DataType)(0), // 4: tensorflow.DataType + (*tensor_shape_go_proto.TensorShapeProto)(nil), // 5: tensorflow.TensorShapeProto + (*tensor_go_proto.TensorProto)(nil), // 6: tensorflow.TensorProto +} +var file_tensorflow_core_framework_attr_value_proto_depIdxs = []int32{ + 4, // 0: tensorflow.AttrValue.type:type_name -> tensorflow.DataType + 5, // 1: tensorflow.AttrValue.shape:type_name -> tensorflow.TensorShapeProto + 6, // 2: tensorflow.AttrValue.tensor:type_name -> tensorflow.TensorProto + 2, // 3: tensorflow.AttrValue.list:type_name -> tensorflow.AttrValue.ListValue + 1, // 4: tensorflow.AttrValue.func:type_name -> tensorflow.NameAttrList + 3, // 5: tensorflow.NameAttrList.attr:type_name -> tensorflow.NameAttrList.AttrEntry + 4, // 6: tensorflow.AttrValue.ListValue.type:type_name -> tensorflow.DataType + 5, // 7: tensorflow.AttrValue.ListValue.shape:type_name -> tensorflow.TensorShapeProto + 6, // 8: tensorflow.AttrValue.ListValue.tensor:type_name -> tensorflow.TensorProto + 1, // 9: tensorflow.AttrValue.ListValue.func:type_name -> tensorflow.NameAttrList + 0, // 10: tensorflow.NameAttrList.AttrEntry.value:type_name -> tensorflow.AttrValue + 11, // [11:11] is the sub-list for method output_type + 11, // [11:11] is the sub-list for method input_type + 11, // [11:11] is the sub-list for extension type_name + 11, // [11:11] is the sub-list for extension extendee + 0, // [0:11] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_attr_value_proto_init() } +func file_tensorflow_core_framework_attr_value_proto_init() { + if File_tensorflow_core_framework_attr_value_proto != nil { + return + } + file_tensorflow_core_framework_attr_value_proto_msgTypes[0].OneofWrappers = []any{ + (*AttrValue_S)(nil), + (*AttrValue_I)(nil), + (*AttrValue_F)(nil), + (*AttrValue_B)(nil), + (*AttrValue_Type)(nil), + (*AttrValue_Shape)(nil), + (*AttrValue_Tensor)(nil), + (*AttrValue_List)(nil), + (*AttrValue_Func)(nil), + (*AttrValue_Placeholder)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_attr_value_proto_rawDesc), len(file_tensorflow_core_framework_attr_value_proto_rawDesc)), + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_attr_value_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_attr_value_proto_depIdxs, + MessageInfos: file_tensorflow_core_framework_attr_value_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_attr_value_proto = out.File + file_tensorflow_core_framework_attr_value_proto_goTypes = nil + file_tensorflow_core_framework_attr_value_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/cost_graph_go_proto/cost_graph.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/cost_graph_go_proto/cost_graph.pb.go new file mode 100644 index 0000000..6c633a7 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/cost_graph_go_proto/cost_graph.pb.go @@ -0,0 +1,549 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/cost_graph.proto + +package cost_graph_go_proto + +import ( + tensor_shape_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_shape_go_proto" + types_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/types_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type CostGraphDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + Node []*CostGraphDef_Node `protobuf:"bytes,1,rep,name=node,proto3" json:"node,omitempty"` + Cost []*CostGraphDef_AggregatedCost `protobuf:"bytes,2,rep,name=cost,proto3" json:"cost,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CostGraphDef) Reset() { + *x = CostGraphDef{} + mi := &file_tensorflow_core_framework_cost_graph_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CostGraphDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CostGraphDef) ProtoMessage() {} + +func (x *CostGraphDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_cost_graph_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CostGraphDef.ProtoReflect.Descriptor instead. +func (*CostGraphDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_cost_graph_proto_rawDescGZIP(), []int{0} +} + +func (x *CostGraphDef) GetNode() []*CostGraphDef_Node { + if x != nil { + return x.Node + } + return nil +} + +func (x *CostGraphDef) GetCost() []*CostGraphDef_AggregatedCost { + if x != nil { + return x.Cost + } + return nil +} + +type CostGraphDef_Node struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The name of the node. Names are globally unique. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // The device of the node. Can be empty if the node is mapped to the + // default partition or partitioning hasn't been run yet. + Device string `protobuf:"bytes,2,opt,name=device,proto3" json:"device,omitempty"` + // The id of the node. Node ids are only unique inside a partition. + Id int32 `protobuf:"varint,3,opt,name=id,proto3" json:"id,omitempty"` + InputInfo []*CostGraphDef_Node_InputInfo `protobuf:"bytes,4,rep,name=input_info,json=inputInfo,proto3" json:"input_info,omitempty"` + OutputInfo []*CostGraphDef_Node_OutputInfo `protobuf:"bytes,5,rep,name=output_info,json=outputInfo,proto3" json:"output_info,omitempty"` + // Temporary memory used by this node. + TemporaryMemorySize int64 `protobuf:"varint,6,opt,name=temporary_memory_size,json=temporaryMemorySize,proto3" json:"temporary_memory_size,omitempty"` + // Persistent memory used by this node. + PersistentMemorySize int64 `protobuf:"varint,12,opt,name=persistent_memory_size,json=persistentMemorySize,proto3" json:"persistent_memory_size,omitempty"` + // Deprecated: Marked as deprecated in tensorflow/core/framework/cost_graph.proto. + HostTempMemorySize int64 `protobuf:"varint,10,opt,name=host_temp_memory_size,json=hostTempMemorySize,proto3" json:"host_temp_memory_size,omitempty"` + // Deprecated: Marked as deprecated in tensorflow/core/framework/cost_graph.proto. + DeviceTempMemorySize int64 `protobuf:"varint,11,opt,name=device_temp_memory_size,json=deviceTempMemorySize,proto3" json:"device_temp_memory_size,omitempty"` + // Deprecated: Marked as deprecated in tensorflow/core/framework/cost_graph.proto. + DevicePersistentMemorySize int64 `protobuf:"varint,16,opt,name=device_persistent_memory_size,json=devicePersistentMemorySize,proto3" json:"device_persistent_memory_size,omitempty"` + // Estimate of the computational cost of this node, in microseconds. + ComputeCost int64 `protobuf:"varint,9,opt,name=compute_cost,json=computeCost,proto3" json:"compute_cost,omitempty"` + // Analytical estimate of the computational cost of this node, in + // microseconds. + ComputeTime int64 `protobuf:"varint,14,opt,name=compute_time,json=computeTime,proto3" json:"compute_time,omitempty"` + // Analytical estimate of the memory access cost of this node, in + // microseconds. + MemoryTime int64 `protobuf:"varint,15,opt,name=memory_time,json=memoryTime,proto3" json:"memory_time,omitempty"` + // If true, the output is permanent: it can't be discarded, because this + // node is part of the "final output". Nodes may depend on final nodes. + IsFinal bool `protobuf:"varint,7,opt,name=is_final,json=isFinal,proto3" json:"is_final,omitempty"` + // Ids of the control inputs for this node. + ControlInput []int32 `protobuf:"varint,8,rep,packed,name=control_input,json=controlInput,proto3" json:"control_input,omitempty"` + // Are the costs inaccurate? + Inaccurate bool `protobuf:"varint,17,opt,name=inaccurate,proto3" json:"inaccurate,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CostGraphDef_Node) Reset() { + *x = CostGraphDef_Node{} + mi := &file_tensorflow_core_framework_cost_graph_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CostGraphDef_Node) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CostGraphDef_Node) ProtoMessage() {} + +func (x *CostGraphDef_Node) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_cost_graph_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CostGraphDef_Node.ProtoReflect.Descriptor instead. +func (*CostGraphDef_Node) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_cost_graph_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *CostGraphDef_Node) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CostGraphDef_Node) GetDevice() string { + if x != nil { + return x.Device + } + return "" +} + +func (x *CostGraphDef_Node) GetId() int32 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *CostGraphDef_Node) GetInputInfo() []*CostGraphDef_Node_InputInfo { + if x != nil { + return x.InputInfo + } + return nil +} + +func (x *CostGraphDef_Node) GetOutputInfo() []*CostGraphDef_Node_OutputInfo { + if x != nil { + return x.OutputInfo + } + return nil +} + +func (x *CostGraphDef_Node) GetTemporaryMemorySize() int64 { + if x != nil { + return x.TemporaryMemorySize + } + return 0 +} + +func (x *CostGraphDef_Node) GetPersistentMemorySize() int64 { + if x != nil { + return x.PersistentMemorySize + } + return 0 +} + +// Deprecated: Marked as deprecated in tensorflow/core/framework/cost_graph.proto. +func (x *CostGraphDef_Node) GetHostTempMemorySize() int64 { + if x != nil { + return x.HostTempMemorySize + } + return 0 +} + +// Deprecated: Marked as deprecated in tensorflow/core/framework/cost_graph.proto. +func (x *CostGraphDef_Node) GetDeviceTempMemorySize() int64 { + if x != nil { + return x.DeviceTempMemorySize + } + return 0 +} + +// Deprecated: Marked as deprecated in tensorflow/core/framework/cost_graph.proto. +func (x *CostGraphDef_Node) GetDevicePersistentMemorySize() int64 { + if x != nil { + return x.DevicePersistentMemorySize + } + return 0 +} + +func (x *CostGraphDef_Node) GetComputeCost() int64 { + if x != nil { + return x.ComputeCost + } + return 0 +} + +func (x *CostGraphDef_Node) GetComputeTime() int64 { + if x != nil { + return x.ComputeTime + } + return 0 +} + +func (x *CostGraphDef_Node) GetMemoryTime() int64 { + if x != nil { + return x.MemoryTime + } + return 0 +} + +func (x *CostGraphDef_Node) GetIsFinal() bool { + if x != nil { + return x.IsFinal + } + return false +} + +func (x *CostGraphDef_Node) GetControlInput() []int32 { + if x != nil { + return x.ControlInput + } + return nil +} + +func (x *CostGraphDef_Node) GetInaccurate() bool { + if x != nil { + return x.Inaccurate + } + return false +} + +// Total cost of this graph, typically used for balancing decisions. +type CostGraphDef_AggregatedCost struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Aggregated cost value. + Cost float32 `protobuf:"fixed32,1,opt,name=cost,proto3" json:"cost,omitempty"` + // Aggregated cost dimension (e.g. 'memory', 'compute', 'network'). + Dimension string `protobuf:"bytes,2,opt,name=dimension,proto3" json:"dimension,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CostGraphDef_AggregatedCost) Reset() { + *x = CostGraphDef_AggregatedCost{} + mi := &file_tensorflow_core_framework_cost_graph_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CostGraphDef_AggregatedCost) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CostGraphDef_AggregatedCost) ProtoMessage() {} + +func (x *CostGraphDef_AggregatedCost) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_cost_graph_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CostGraphDef_AggregatedCost.ProtoReflect.Descriptor instead. +func (*CostGraphDef_AggregatedCost) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_cost_graph_proto_rawDescGZIP(), []int{0, 1} +} + +func (x *CostGraphDef_AggregatedCost) GetCost() float32 { + if x != nil { + return x.Cost + } + return 0 +} + +func (x *CostGraphDef_AggregatedCost) GetDimension() string { + if x != nil { + return x.Dimension + } + return "" +} + +// 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. +type CostGraphDef_Node_InputInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + PrecedingNode int32 `protobuf:"varint,1,opt,name=preceding_node,json=precedingNode,proto3" json:"preceding_node,omitempty"` + PrecedingPort int32 `protobuf:"varint,2,opt,name=preceding_port,json=precedingPort,proto3" json:"preceding_port,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CostGraphDef_Node_InputInfo) Reset() { + *x = CostGraphDef_Node_InputInfo{} + mi := &file_tensorflow_core_framework_cost_graph_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CostGraphDef_Node_InputInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CostGraphDef_Node_InputInfo) ProtoMessage() {} + +func (x *CostGraphDef_Node_InputInfo) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_cost_graph_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CostGraphDef_Node_InputInfo.ProtoReflect.Descriptor instead. +func (*CostGraphDef_Node_InputInfo) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_cost_graph_proto_rawDescGZIP(), []int{0, 0, 0} +} + +func (x *CostGraphDef_Node_InputInfo) GetPrecedingNode() int32 { + if x != nil { + return x.PrecedingNode + } + return 0 +} + +func (x *CostGraphDef_Node_InputInfo) GetPrecedingPort() int32 { + if x != nil { + return x.PrecedingPort + } + return 0 +} + +// Outputs of this node. +type CostGraphDef_Node_OutputInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + Size int64 `protobuf:"varint,1,opt,name=size,proto3" json:"size,omitempty"` + // If >= 0, the output is an alias of an input. Note that an alias input + // may itself be an alias. The algorithm will therefore need to follow + // those pointers. + AliasInputPort int64 `protobuf:"varint,2,opt,name=alias_input_port,json=aliasInputPort,proto3" json:"alias_input_port,omitempty"` + Shape *tensor_shape_go_proto.TensorShapeProto `protobuf:"bytes,3,opt,name=shape,proto3" json:"shape,omitempty"` + Dtype types_go_proto.DataType `protobuf:"varint,4,opt,name=dtype,proto3,enum=tensorflow.DataType" json:"dtype,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CostGraphDef_Node_OutputInfo) Reset() { + *x = CostGraphDef_Node_OutputInfo{} + mi := &file_tensorflow_core_framework_cost_graph_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CostGraphDef_Node_OutputInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CostGraphDef_Node_OutputInfo) ProtoMessage() {} + +func (x *CostGraphDef_Node_OutputInfo) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_cost_graph_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CostGraphDef_Node_OutputInfo.ProtoReflect.Descriptor instead. +func (*CostGraphDef_Node_OutputInfo) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_cost_graph_proto_rawDescGZIP(), []int{0, 0, 1} +} + +func (x *CostGraphDef_Node_OutputInfo) GetSize() int64 { + if x != nil { + return x.Size + } + return 0 +} + +func (x *CostGraphDef_Node_OutputInfo) GetAliasInputPort() int64 { + if x != nil { + return x.AliasInputPort + } + return 0 +} + +func (x *CostGraphDef_Node_OutputInfo) GetShape() *tensor_shape_go_proto.TensorShapeProto { + if x != nil { + return x.Shape + } + return nil +} + +func (x *CostGraphDef_Node_OutputInfo) GetDtype() types_go_proto.DataType { + if x != nil { + return x.Dtype + } + return types_go_proto.DataType(0) +} + +var File_tensorflow_core_framework_cost_graph_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_cost_graph_proto_rawDesc = "" + + "\n" + + "*tensorflow/core/framework/cost_graph.proto\x12\n" + + "tensorflow\x1a,tensorflow/core/framework/tensor_shape.proto\x1a%tensorflow/core/framework/types.proto\"\x8c\t\n" + + "\fCostGraphDef\x121\n" + + "\x04node\x18\x01 \x03(\v2\x1d.tensorflow.CostGraphDef.NodeR\x04node\x12;\n" + + "\x04cost\x18\x02 \x03(\v2'.tensorflow.CostGraphDef.AggregatedCostR\x04cost\x1a\xc7\a\n" + + "\x04Node\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x16\n" + + "\x06device\x18\x02 \x01(\tR\x06device\x12\x0e\n" + + "\x02id\x18\x03 \x01(\x05R\x02id\x12F\n" + + "\n" + + "input_info\x18\x04 \x03(\v2'.tensorflow.CostGraphDef.Node.InputInfoR\tinputInfo\x12I\n" + + "\voutput_info\x18\x05 \x03(\v2(.tensorflow.CostGraphDef.Node.OutputInfoR\n" + + "outputInfo\x122\n" + + "\x15temporary_memory_size\x18\x06 \x01(\x03R\x13temporaryMemorySize\x124\n" + + "\x16persistent_memory_size\x18\f \x01(\x03R\x14persistentMemorySize\x125\n" + + "\x15host_temp_memory_size\x18\n" + + " \x01(\x03B\x02\x18\x01R\x12hostTempMemorySize\x129\n" + + "\x17device_temp_memory_size\x18\v \x01(\x03B\x02\x18\x01R\x14deviceTempMemorySize\x12E\n" + + "\x1ddevice_persistent_memory_size\x18\x10 \x01(\x03B\x02\x18\x01R\x1adevicePersistentMemorySize\x12!\n" + + "\fcompute_cost\x18\t \x01(\x03R\vcomputeCost\x12!\n" + + "\fcompute_time\x18\x0e \x01(\x03R\vcomputeTime\x12\x1f\n" + + "\vmemory_time\x18\x0f \x01(\x03R\n" + + "memoryTime\x12\x19\n" + + "\bis_final\x18\a \x01(\bR\aisFinal\x12#\n" + + "\rcontrol_input\x18\b \x03(\x05R\fcontrolInput\x12\x1e\n" + + "\n" + + "inaccurate\x18\x11 \x01(\bR\n" + + "inaccurate\x1aY\n" + + "\tInputInfo\x12%\n" + + "\x0epreceding_node\x18\x01 \x01(\x05R\rprecedingNode\x12%\n" + + "\x0epreceding_port\x18\x02 \x01(\x05R\rprecedingPort\x1a\xaa\x01\n" + + "\n" + + "OutputInfo\x12\x12\n" + + "\x04size\x18\x01 \x01(\x03R\x04size\x12(\n" + + "\x10alias_input_port\x18\x02 \x01(\x03R\x0ealiasInputPort\x122\n" + + "\x05shape\x18\x03 \x01(\v2\x1c.tensorflow.TensorShapeProtoR\x05shape\x12*\n" + + "\x05dtype\x18\x04 \x01(\x0e2\x14.tensorflow.DataTypeR\x05dtype\x1aB\n" + + "\x0eAggregatedCost\x12\x12\n" + + "\x04cost\x18\x01 \x01(\x02R\x04cost\x12\x1c\n" + + "\tdimension\x18\x02 \x01(\tR\tdimensionB\x83\x01\n" + + "\x18org.tensorflow.frameworkB\x0fCostGraphProtosP\x01ZQgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/cost_graph_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_cost_graph_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_cost_graph_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_cost_graph_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_cost_graph_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_cost_graph_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_cost_graph_proto_rawDesc), len(file_tensorflow_core_framework_cost_graph_proto_rawDesc))) + }) + return file_tensorflow_core_framework_cost_graph_proto_rawDescData +} + +var file_tensorflow_core_framework_cost_graph_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_tensorflow_core_framework_cost_graph_proto_goTypes = []any{ + (*CostGraphDef)(nil), // 0: tensorflow.CostGraphDef + (*CostGraphDef_Node)(nil), // 1: tensorflow.CostGraphDef.Node + (*CostGraphDef_AggregatedCost)(nil), // 2: tensorflow.CostGraphDef.AggregatedCost + (*CostGraphDef_Node_InputInfo)(nil), // 3: tensorflow.CostGraphDef.Node.InputInfo + (*CostGraphDef_Node_OutputInfo)(nil), // 4: tensorflow.CostGraphDef.Node.OutputInfo + (*tensor_shape_go_proto.TensorShapeProto)(nil), // 5: tensorflow.TensorShapeProto + (types_go_proto.DataType)(0), // 6: tensorflow.DataType +} +var file_tensorflow_core_framework_cost_graph_proto_depIdxs = []int32{ + 1, // 0: tensorflow.CostGraphDef.node:type_name -> tensorflow.CostGraphDef.Node + 2, // 1: tensorflow.CostGraphDef.cost:type_name -> tensorflow.CostGraphDef.AggregatedCost + 3, // 2: tensorflow.CostGraphDef.Node.input_info:type_name -> tensorflow.CostGraphDef.Node.InputInfo + 4, // 3: tensorflow.CostGraphDef.Node.output_info:type_name -> tensorflow.CostGraphDef.Node.OutputInfo + 5, // 4: tensorflow.CostGraphDef.Node.OutputInfo.shape:type_name -> tensorflow.TensorShapeProto + 6, // 5: tensorflow.CostGraphDef.Node.OutputInfo.dtype:type_name -> tensorflow.DataType + 6, // [6:6] is the sub-list for method output_type + 6, // [6:6] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_cost_graph_proto_init() } +func file_tensorflow_core_framework_cost_graph_proto_init() { + if File_tensorflow_core_framework_cost_graph_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_cost_graph_proto_rawDesc), len(file_tensorflow_core_framework_cost_graph_proto_rawDesc)), + NumEnums: 0, + NumMessages: 5, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_cost_graph_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_cost_graph_proto_depIdxs, + MessageInfos: file_tensorflow_core_framework_cost_graph_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_cost_graph_proto = out.File + file_tensorflow_core_framework_cost_graph_proto_goTypes = nil + file_tensorflow_core_framework_cost_graph_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/device_attributes_go_proto/device_attributes.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/device_attributes_go_proto/device_attributes.pb.go new file mode 100644 index 0000000..6af80d8 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/device_attributes_go_proto/device_attributes.pb.go @@ -0,0 +1,363 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/device_attributes.proto + +package device_attributes_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type InterconnectLink struct { + state protoimpl.MessageState `protogen:"open.v1"` + DeviceId int32 `protobuf:"varint,1,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"` + Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` + Strength int32 `protobuf:"varint,3,opt,name=strength,proto3" json:"strength,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *InterconnectLink) Reset() { + *x = InterconnectLink{} + mi := &file_tensorflow_core_framework_device_attributes_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *InterconnectLink) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InterconnectLink) ProtoMessage() {} + +func (x *InterconnectLink) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_device_attributes_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InterconnectLink.ProtoReflect.Descriptor instead. +func (*InterconnectLink) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_device_attributes_proto_rawDescGZIP(), []int{0} +} + +func (x *InterconnectLink) GetDeviceId() int32 { + if x != nil { + return x.DeviceId + } + return 0 +} + +func (x *InterconnectLink) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *InterconnectLink) GetStrength() int32 { + if x != nil { + return x.Strength + } + return 0 +} + +type LocalLinks struct { + state protoimpl.MessageState `protogen:"open.v1"` + Link []*InterconnectLink `protobuf:"bytes,1,rep,name=link,proto3" json:"link,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LocalLinks) Reset() { + *x = LocalLinks{} + mi := &file_tensorflow_core_framework_device_attributes_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LocalLinks) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LocalLinks) ProtoMessage() {} + +func (x *LocalLinks) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_device_attributes_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LocalLinks.ProtoReflect.Descriptor instead. +func (*LocalLinks) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_device_attributes_proto_rawDescGZIP(), []int{1} +} + +func (x *LocalLinks) GetLink() []*InterconnectLink { + if x != nil { + return x.Link + } + return nil +} + +type DeviceLocality struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Optional bus locality of device. Default value of 0 means + // no specific locality. Specific localities are indexed from 1. + BusId int32 `protobuf:"varint,1,opt,name=bus_id,json=busId,proto3" json:"bus_id,omitempty"` + // Optional NUMA locality of device. + NumaNode int32 `protobuf:"varint,2,opt,name=numa_node,json=numaNode,proto3" json:"numa_node,omitempty"` + // Optional local interconnect links to other devices. + Links *LocalLinks `protobuf:"bytes,3,opt,name=links,proto3" json:"links,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeviceLocality) Reset() { + *x = DeviceLocality{} + mi := &file_tensorflow_core_framework_device_attributes_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeviceLocality) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeviceLocality) ProtoMessage() {} + +func (x *DeviceLocality) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_device_attributes_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeviceLocality.ProtoReflect.Descriptor instead. +func (*DeviceLocality) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_device_attributes_proto_rawDescGZIP(), []int{2} +} + +func (x *DeviceLocality) GetBusId() int32 { + if x != nil { + return x.BusId + } + return 0 +} + +func (x *DeviceLocality) GetNumaNode() int32 { + if x != nil { + return x.NumaNode + } + return 0 +} + +func (x *DeviceLocality) GetLinks() *LocalLinks { + if x != nil { + return x.Links + } + return nil +} + +type DeviceAttributes struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Fully specified name of the device within a cluster. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // String representation of device_type. + DeviceType string `protobuf:"bytes,2,opt,name=device_type,json=deviceType,proto3" json:"device_type,omitempty"` + // Memory capacity of device in bytes. + MemoryLimit int64 `protobuf:"varint,4,opt,name=memory_limit,json=memoryLimit,proto3" json:"memory_limit,omitempty"` + // Platform-specific data about device that may be useful + // for supporting efficient data transfers. + Locality *DeviceLocality `protobuf:"bytes,5,opt,name=locality,proto3" json:"locality,omitempty"` + // A device is assigned a global unique number each time it is + // initialized. "incarnation" should never be 0. + Incarnation uint64 `protobuf:"fixed64,6,opt,name=incarnation,proto3" json:"incarnation,omitempty"` + // String representation of the physical device that this device maps to. + PhysicalDeviceDesc string `protobuf:"bytes,7,opt,name=physical_device_desc,json=physicalDeviceDesc,proto3" json:"physical_device_desc,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeviceAttributes) Reset() { + *x = DeviceAttributes{} + mi := &file_tensorflow_core_framework_device_attributes_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeviceAttributes) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeviceAttributes) ProtoMessage() {} + +func (x *DeviceAttributes) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_device_attributes_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeviceAttributes.ProtoReflect.Descriptor instead. +func (*DeviceAttributes) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_device_attributes_proto_rawDescGZIP(), []int{3} +} + +func (x *DeviceAttributes) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *DeviceAttributes) GetDeviceType() string { + if x != nil { + return x.DeviceType + } + return "" +} + +func (x *DeviceAttributes) GetMemoryLimit() int64 { + if x != nil { + return x.MemoryLimit + } + return 0 +} + +func (x *DeviceAttributes) GetLocality() *DeviceLocality { + if x != nil { + return x.Locality + } + return nil +} + +func (x *DeviceAttributes) GetIncarnation() uint64 { + if x != nil { + return x.Incarnation + } + return 0 +} + +func (x *DeviceAttributes) GetPhysicalDeviceDesc() string { + if x != nil { + return x.PhysicalDeviceDesc + } + return "" +} + +var File_tensorflow_core_framework_device_attributes_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_device_attributes_proto_rawDesc = "" + + "\n" + + "1tensorflow/core/framework/device_attributes.proto\x12\n" + + "tensorflow\"_\n" + + "\x10InterconnectLink\x12\x1b\n" + + "\tdevice_id\x18\x01 \x01(\x05R\bdeviceId\x12\x12\n" + + "\x04type\x18\x02 \x01(\tR\x04type\x12\x1a\n" + + "\bstrength\x18\x03 \x01(\x05R\bstrength\">\n" + + "\n" + + "LocalLinks\x120\n" + + "\x04link\x18\x01 \x03(\v2\x1c.tensorflow.InterconnectLinkR\x04link\"r\n" + + "\x0eDeviceLocality\x12\x15\n" + + "\x06bus_id\x18\x01 \x01(\x05R\x05busId\x12\x1b\n" + + "\tnuma_node\x18\x02 \x01(\x05R\bnumaNode\x12,\n" + + "\x05links\x18\x03 \x01(\v2\x16.tensorflow.LocalLinksR\x05links\"\xf6\x01\n" + + "\x10DeviceAttributes\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x1f\n" + + "\vdevice_type\x18\x02 \x01(\tR\n" + + "deviceType\x12!\n" + + "\fmemory_limit\x18\x04 \x01(\x03R\vmemoryLimit\x126\n" + + "\blocality\x18\x05 \x01(\v2\x1a.tensorflow.DeviceLocalityR\blocality\x12 \n" + + "\vincarnation\x18\x06 \x01(\x06R\vincarnation\x120\n" + + "\x14physical_device_desc\x18\a \x01(\tR\x12physicalDeviceDescB\x91\x01\n" + + "\x18org.tensorflow.frameworkB\x16DeviceAttributesProtosP\x01ZXgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/device_attributes_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_device_attributes_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_device_attributes_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_device_attributes_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_device_attributes_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_device_attributes_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_device_attributes_proto_rawDesc), len(file_tensorflow_core_framework_device_attributes_proto_rawDesc))) + }) + return file_tensorflow_core_framework_device_attributes_proto_rawDescData +} + +var file_tensorflow_core_framework_device_attributes_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_tensorflow_core_framework_device_attributes_proto_goTypes = []any{ + (*InterconnectLink)(nil), // 0: tensorflow.InterconnectLink + (*LocalLinks)(nil), // 1: tensorflow.LocalLinks + (*DeviceLocality)(nil), // 2: tensorflow.DeviceLocality + (*DeviceAttributes)(nil), // 3: tensorflow.DeviceAttributes +} +var file_tensorflow_core_framework_device_attributes_proto_depIdxs = []int32{ + 0, // 0: tensorflow.LocalLinks.link:type_name -> tensorflow.InterconnectLink + 1, // 1: tensorflow.DeviceLocality.links:type_name -> tensorflow.LocalLinks + 2, // 2: tensorflow.DeviceAttributes.locality:type_name -> tensorflow.DeviceLocality + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_device_attributes_proto_init() } +func file_tensorflow_core_framework_device_attributes_proto_init() { + if File_tensorflow_core_framework_device_attributes_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_device_attributes_proto_rawDesc), len(file_tensorflow_core_framework_device_attributes_proto_rawDesc)), + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_device_attributes_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_device_attributes_proto_depIdxs, + MessageInfos: file_tensorflow_core_framework_device_attributes_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_device_attributes_proto = out.File + file_tensorflow_core_framework_device_attributes_proto_goTypes = nil + file_tensorflow_core_framework_device_attributes_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/function_go_proto/function.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/function_go_proto/function.pb.go new file mode 100644 index 0000000..84cc8ce --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/function_go_proto/function.pb.go @@ -0,0 +1,431 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/function.proto + +package function_go_proto + +import ( + attr_value_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/attr_value_go_proto" + node_def_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/node_def_go_proto" + op_def_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/op_def_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// A library is a set of named functions. +type FunctionDefLibrary struct { + state protoimpl.MessageState `protogen:"open.v1"` + Function []*FunctionDef `protobuf:"bytes,1,rep,name=function,proto3" json:"function,omitempty"` + Gradient []*GradientDef `protobuf:"bytes,2,rep,name=gradient,proto3" json:"gradient,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *FunctionDefLibrary) Reset() { + *x = FunctionDefLibrary{} + mi := &file_tensorflow_core_framework_function_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *FunctionDefLibrary) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FunctionDefLibrary) ProtoMessage() {} + +func (x *FunctionDefLibrary) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_function_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FunctionDefLibrary.ProtoReflect.Descriptor instead. +func (*FunctionDefLibrary) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_function_proto_rawDescGZIP(), []int{0} +} + +func (x *FunctionDefLibrary) GetFunction() []*FunctionDef { + if x != nil { + return x.Function + } + return nil +} + +func (x *FunctionDefLibrary) GetGradient() []*GradientDef { + if x != nil { + return x.Gradient + } + return nil +} + +// A function can be instantiated when the runtime can bind every attr +// with a value. When a GraphDef has a call to a function, it must +// have binding for every attr defined in the signature. +// +// TODO(zhifengc): +// - device spec, etc. +type FunctionDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The definition of the function's name, arguments, return values, + // attrs etc. + Signature *op_def_go_proto.OpDef `protobuf:"bytes,1,opt,name=signature,proto3" json:"signature,omitempty"` + // Attributes specific to this function definition. + Attr map[string]*attr_value_go_proto.AttrValue `protobuf:"bytes,5,rep,name=attr,proto3" json:"attr,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + ArgAttr map[uint32]*FunctionDef_ArgAttrs `protobuf:"bytes,7,rep,name=arg_attr,json=argAttr,proto3" json:"arg_attr,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // Unique IDs for each resource argument, used to track aliasing resources. If + // Argument A and Argument B alias each other, then + // resource_arg_unique_ids[A.index] == resource_arg_unique_ids[B.index]. + // + // If this field is empty, none of the arguments could alias; otherwise, every + // resource argument should have an entry in this field. + // + // When instantiated, the unique IDs will be attached to the _Arg nodes' + // "_resource_arg_unique_id" attribute. + ResourceArgUniqueId map[uint32]uint32 `protobuf:"bytes,8,rep,name=resource_arg_unique_id,json=resourceArgUniqueId,proto3" json:"resource_arg_unique_id,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"` + // By convention, "op" in node_def is resolved by consulting with a + // user-defined library first. If not resolved, "func" is assumed to + // be a builtin op. + NodeDef []*node_def_go_proto.NodeDef `protobuf:"bytes,3,rep,name=node_def,json=nodeDef,proto3" json:"node_def,omitempty"` + // A mapping from the output arg names from `signature` to the + // outputs from `node_def` that should be returned by the function. + Ret map[string]string `protobuf:"bytes,4,rep,name=ret,proto3" json:"ret,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // A mapping from control output names from `signature` to node names in + // `node_def` which should be control outputs of this function. + ControlRet map[string]string `protobuf:"bytes,6,rep,name=control_ret,json=controlRet,proto3" json:"control_ret,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *FunctionDef) Reset() { + *x = FunctionDef{} + mi := &file_tensorflow_core_framework_function_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *FunctionDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FunctionDef) ProtoMessage() {} + +func (x *FunctionDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_function_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FunctionDef.ProtoReflect.Descriptor instead. +func (*FunctionDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_function_proto_rawDescGZIP(), []int{1} +} + +func (x *FunctionDef) GetSignature() *op_def_go_proto.OpDef { + if x != nil { + return x.Signature + } + return nil +} + +func (x *FunctionDef) GetAttr() map[string]*attr_value_go_proto.AttrValue { + if x != nil { + return x.Attr + } + return nil +} + +func (x *FunctionDef) GetArgAttr() map[uint32]*FunctionDef_ArgAttrs { + if x != nil { + return x.ArgAttr + } + return nil +} + +func (x *FunctionDef) GetResourceArgUniqueId() map[uint32]uint32 { + if x != nil { + return x.ResourceArgUniqueId + } + return nil +} + +func (x *FunctionDef) GetNodeDef() []*node_def_go_proto.NodeDef { + if x != nil { + return x.NodeDef + } + return nil +} + +func (x *FunctionDef) GetRet() map[string]string { + if x != nil { + return x.Ret + } + return nil +} + +func (x *FunctionDef) GetControlRet() map[string]string { + if x != nil { + return x.ControlRet + } + return nil +} + +// GradientDef defines the gradient function of a function defined in +// a function library. +// +// A gradient function g (specified by gradient_func) for a function f +// (specified by function_name) must follow the following: +// +// The function 'f' must be a numerical function which takes N inputs +// and produces M outputs. Its gradient function 'g', which is a +// function taking N + M inputs and produces N outputs. +// +// I.e. if we have +// +// (y1, y2, ..., y_M) = f(x1, x2, ..., x_N), +// +// then, g is +// +// (dL/dx1, dL/dx2, ..., dL/dx_N) = g(x1, x2, ..., x_N, +// dL/dy1, dL/dy2, ..., dL/dy_M), +// +// where L is a scalar-value function of (x1, x2, ..., xN) (e.g., the +// loss function). dL/dx_i is the partial derivative of L with respect +// to x_i. +type GradientDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + FunctionName string `protobuf:"bytes,1,opt,name=function_name,json=functionName,proto3" json:"function_name,omitempty"` // The function name. + GradientFunc string `protobuf:"bytes,2,opt,name=gradient_func,json=gradientFunc,proto3" json:"gradient_func,omitempty"` // The gradient function's name. + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GradientDef) Reset() { + *x = GradientDef{} + mi := &file_tensorflow_core_framework_function_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GradientDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GradientDef) ProtoMessage() {} + +func (x *GradientDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_function_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GradientDef.ProtoReflect.Descriptor instead. +func (*GradientDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_function_proto_rawDescGZIP(), []int{2} +} + +func (x *GradientDef) GetFunctionName() string { + if x != nil { + return x.FunctionName + } + return "" +} + +func (x *GradientDef) GetGradientFunc() string { + if x != nil { + return x.GradientFunc + } + return "" +} + +// Attributes for function arguments. These attributes are the same set of +// valid attributes as to _Arg nodes. +type FunctionDef_ArgAttrs struct { + state protoimpl.MessageState `protogen:"open.v1"` + Attr map[string]*attr_value_go_proto.AttrValue `protobuf:"bytes,1,rep,name=attr,proto3" json:"attr,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *FunctionDef_ArgAttrs) Reset() { + *x = FunctionDef_ArgAttrs{} + mi := &file_tensorflow_core_framework_function_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *FunctionDef_ArgAttrs) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FunctionDef_ArgAttrs) ProtoMessage() {} + +func (x *FunctionDef_ArgAttrs) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_function_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FunctionDef_ArgAttrs.ProtoReflect.Descriptor instead. +func (*FunctionDef_ArgAttrs) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_function_proto_rawDescGZIP(), []int{1, 1} +} + +func (x *FunctionDef_ArgAttrs) GetAttr() map[string]*attr_value_go_proto.AttrValue { + if x != nil { + return x.Attr + } + return nil +} + +var File_tensorflow_core_framework_function_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_function_proto_rawDesc = "" + + "\n" + + "(tensorflow/core/framework/function.proto\x12\n" + + "tensorflow\x1a*tensorflow/core/framework/attr_value.proto\x1a(tensorflow/core/framework/node_def.proto\x1a&tensorflow/core/framework/op_def.proto\"~\n" + + "\x12FunctionDefLibrary\x123\n" + + "\bfunction\x18\x01 \x03(\v2\x17.tensorflow.FunctionDefR\bfunction\x123\n" + + "\bgradient\x18\x02 \x03(\v2\x17.tensorflow.GradientDefR\bgradient\"\xdb\a\n" + + "\vFunctionDef\x12/\n" + + "\tsignature\x18\x01 \x01(\v2\x11.tensorflow.OpDefR\tsignature\x125\n" + + "\x04attr\x18\x05 \x03(\v2!.tensorflow.FunctionDef.AttrEntryR\x04attr\x12?\n" + + "\barg_attr\x18\a \x03(\v2$.tensorflow.FunctionDef.ArgAttrEntryR\aargAttr\x12e\n" + + "\x16resource_arg_unique_id\x18\b \x03(\v20.tensorflow.FunctionDef.ResourceArgUniqueIdEntryR\x13resourceArgUniqueId\x12.\n" + + "\bnode_def\x18\x03 \x03(\v2\x13.tensorflow.NodeDefR\anodeDef\x122\n" + + "\x03ret\x18\x04 \x03(\v2 .tensorflow.FunctionDef.RetEntryR\x03ret\x12H\n" + + "\vcontrol_ret\x18\x06 \x03(\v2'.tensorflow.FunctionDef.ControlRetEntryR\n" + + "controlRet\x1aN\n" + + "\tAttrEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12+\n" + + "\x05value\x18\x02 \x01(\v2\x15.tensorflow.AttrValueR\x05value:\x028\x01\x1a\x9a\x01\n" + + "\bArgAttrs\x12>\n" + + "\x04attr\x18\x01 \x03(\v2*.tensorflow.FunctionDef.ArgAttrs.AttrEntryR\x04attr\x1aN\n" + + "\tAttrEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12+\n" + + "\x05value\x18\x02 \x01(\v2\x15.tensorflow.AttrValueR\x05value:\x028\x01\x1a\\\n" + + "\fArgAttrEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\rR\x03key\x126\n" + + "\x05value\x18\x02 \x01(\v2 .tensorflow.FunctionDef.ArgAttrsR\x05value:\x028\x01\x1aF\n" + + "\x18ResourceArgUniqueIdEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\rR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\rR\x05value:\x028\x01\x1a6\n" + + "\bRetEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\x1a=\n" + + "\x0fControlRetEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01J\x04\b\x02\x10\x03\"W\n" + + "\vGradientDef\x12#\n" + + "\rfunction_name\x18\x01 \x01(\tR\ffunctionName\x12#\n" + + "\rgradient_func\x18\x02 \x01(\tR\fgradientFuncB\x80\x01\n" + + "\x18org.tensorflow.frameworkB\x0eFunctionProtosP\x01ZOgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/function_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_function_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_function_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_function_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_function_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_function_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_function_proto_rawDesc), len(file_tensorflow_core_framework_function_proto_rawDesc))) + }) + return file_tensorflow_core_framework_function_proto_rawDescData +} + +var file_tensorflow_core_framework_function_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_tensorflow_core_framework_function_proto_goTypes = []any{ + (*FunctionDefLibrary)(nil), // 0: tensorflow.FunctionDefLibrary + (*FunctionDef)(nil), // 1: tensorflow.FunctionDef + (*GradientDef)(nil), // 2: tensorflow.GradientDef + nil, // 3: tensorflow.FunctionDef.AttrEntry + (*FunctionDef_ArgAttrs)(nil), // 4: tensorflow.FunctionDef.ArgAttrs + nil, // 5: tensorflow.FunctionDef.ArgAttrEntry + nil, // 6: tensorflow.FunctionDef.ResourceArgUniqueIdEntry + nil, // 7: tensorflow.FunctionDef.RetEntry + nil, // 8: tensorflow.FunctionDef.ControlRetEntry + nil, // 9: tensorflow.FunctionDef.ArgAttrs.AttrEntry + (*op_def_go_proto.OpDef)(nil), // 10: tensorflow.OpDef + (*node_def_go_proto.NodeDef)(nil), // 11: tensorflow.NodeDef + (*attr_value_go_proto.AttrValue)(nil), // 12: tensorflow.AttrValue +} +var file_tensorflow_core_framework_function_proto_depIdxs = []int32{ + 1, // 0: tensorflow.FunctionDefLibrary.function:type_name -> tensorflow.FunctionDef + 2, // 1: tensorflow.FunctionDefLibrary.gradient:type_name -> tensorflow.GradientDef + 10, // 2: tensorflow.FunctionDef.signature:type_name -> tensorflow.OpDef + 3, // 3: tensorflow.FunctionDef.attr:type_name -> tensorflow.FunctionDef.AttrEntry + 5, // 4: tensorflow.FunctionDef.arg_attr:type_name -> tensorflow.FunctionDef.ArgAttrEntry + 6, // 5: tensorflow.FunctionDef.resource_arg_unique_id:type_name -> tensorflow.FunctionDef.ResourceArgUniqueIdEntry + 11, // 6: tensorflow.FunctionDef.node_def:type_name -> tensorflow.NodeDef + 7, // 7: tensorflow.FunctionDef.ret:type_name -> tensorflow.FunctionDef.RetEntry + 8, // 8: tensorflow.FunctionDef.control_ret:type_name -> tensorflow.FunctionDef.ControlRetEntry + 12, // 9: tensorflow.FunctionDef.AttrEntry.value:type_name -> tensorflow.AttrValue + 9, // 10: tensorflow.FunctionDef.ArgAttrs.attr:type_name -> tensorflow.FunctionDef.ArgAttrs.AttrEntry + 4, // 11: tensorflow.FunctionDef.ArgAttrEntry.value:type_name -> tensorflow.FunctionDef.ArgAttrs + 12, // 12: tensorflow.FunctionDef.ArgAttrs.AttrEntry.value:type_name -> tensorflow.AttrValue + 13, // [13:13] is the sub-list for method output_type + 13, // [13:13] is the sub-list for method input_type + 13, // [13:13] is the sub-list for extension type_name + 13, // [13:13] is the sub-list for extension extendee + 0, // [0:13] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_function_proto_init() } +func file_tensorflow_core_framework_function_proto_init() { + if File_tensorflow_core_framework_function_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_function_proto_rawDesc), len(file_tensorflow_core_framework_function_proto_rawDesc)), + NumEnums: 0, + NumMessages: 10, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_function_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_function_proto_depIdxs, + MessageInfos: file_tensorflow_core_framework_function_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_function_proto = out.File + file_tensorflow_core_framework_function_proto_goTypes = nil + file_tensorflow_core_framework_function_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/graph_go_proto/graph.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/graph_go_proto/graph.pb.go new file mode 100644 index 0000000..25f9aff --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/graph_go_proto/graph.pb.go @@ -0,0 +1,197 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/graph.proto + +package graph_go_proto + +import ( + function_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/function_go_proto" + node_def_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/node_def_go_proto" + versions_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/versions_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Represents the graph of operations +type GraphDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + Node []*node_def_go_proto.NodeDef `protobuf:"bytes,1,rep,name=node,proto3" json:"node,omitempty"` + // Compatibility versions of the graph. See core/public/version.h for version + // history. The GraphDef version is distinct from the TensorFlow version, and + // each release of TensorFlow will support a range of GraphDef versions. + Versions *versions_go_proto.VersionDef `protobuf:"bytes,4,opt,name=versions,proto3" json:"versions,omitempty"` + // Deprecated single version field; use versions above instead. Since all + // GraphDef changes before "versions" was introduced were forward + // compatible, this field is entirely ignored. + // + // Deprecated: Marked as deprecated in tensorflow/core/framework/graph.proto. + Version int32 `protobuf:"varint,3,opt,name=version,proto3" json:"version,omitempty"` + // EXPERIMENTAL. DO NOT USE OR DEPEND ON THIS YET. + // + // "library" provides user-defined functions. + // + // Naming: + // - library.function.name are in a flat namespace. + // NOTE: We may need to change it to be hierarchical to support + // different orgs. E.g., + // { "/google/nn", { ... }}, + // { "/google/vision", { ... }} + // { "/org_foo/module_bar", { ... }} + // map named_lib; + // - If node[i].op is the name of one function in "library", + // node[i] is deemed as a function call. Otherwise, node[i].op + // must be a primitive operation supported by the runtime. + // + // Function call semantics: + // + // - The callee may start execution as soon as some of its inputs + // are ready. The caller may want to use Tuple() mechanism to + // ensure all inputs are ready in the same time. + // + // - The consumer of return values may start executing as soon as + // the return values the consumer depends on are ready. The + // consumer may want to use Tuple() mechanism to ensure the + // consumer does not start until all return values of the callee + // function are ready. + Library *function_go_proto.FunctionDefLibrary `protobuf:"bytes,2,opt,name=library,proto3" json:"library,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GraphDef) Reset() { + *x = GraphDef{} + mi := &file_tensorflow_core_framework_graph_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GraphDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GraphDef) ProtoMessage() {} + +func (x *GraphDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_graph_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GraphDef.ProtoReflect.Descriptor instead. +func (*GraphDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_graph_proto_rawDescGZIP(), []int{0} +} + +func (x *GraphDef) GetNode() []*node_def_go_proto.NodeDef { + if x != nil { + return x.Node + } + return nil +} + +func (x *GraphDef) GetVersions() *versions_go_proto.VersionDef { + if x != nil { + return x.Versions + } + return nil +} + +// Deprecated: Marked as deprecated in tensorflow/core/framework/graph.proto. +func (x *GraphDef) GetVersion() int32 { + if x != nil { + return x.Version + } + return 0 +} + +func (x *GraphDef) GetLibrary() *function_go_proto.FunctionDefLibrary { + if x != nil { + return x.Library + } + return nil +} + +var File_tensorflow_core_framework_graph_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_graph_proto_rawDesc = "" + + "\n" + + "%tensorflow/core/framework/graph.proto\x12\n" + + "tensorflow\x1a(tensorflow/core/framework/function.proto\x1a(tensorflow/core/framework/node_def.proto\x1a(tensorflow/core/framework/versions.proto\"\xbf\x01\n" + + "\bGraphDef\x12'\n" + + "\x04node\x18\x01 \x03(\v2\x13.tensorflow.NodeDefR\x04node\x122\n" + + "\bversions\x18\x04 \x01(\v2\x16.tensorflow.VersionDefR\bversions\x12\x1c\n" + + "\aversion\x18\x03 \x01(\x05B\x02\x18\x01R\aversion\x128\n" + + "\alibrary\x18\x02 \x01(\v2\x1e.tensorflow.FunctionDefLibraryR\alibraryBz\n" + + "\x18org.tensorflow.frameworkB\vGraphProtosP\x01ZLgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/graph_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_graph_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_graph_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_graph_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_graph_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_graph_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_graph_proto_rawDesc), len(file_tensorflow_core_framework_graph_proto_rawDesc))) + }) + return file_tensorflow_core_framework_graph_proto_rawDescData +} + +var file_tensorflow_core_framework_graph_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_tensorflow_core_framework_graph_proto_goTypes = []any{ + (*GraphDef)(nil), // 0: tensorflow.GraphDef + (*node_def_go_proto.NodeDef)(nil), // 1: tensorflow.NodeDef + (*versions_go_proto.VersionDef)(nil), // 2: tensorflow.VersionDef + (*function_go_proto.FunctionDefLibrary)(nil), // 3: tensorflow.FunctionDefLibrary +} +var file_tensorflow_core_framework_graph_proto_depIdxs = []int32{ + 1, // 0: tensorflow.GraphDef.node:type_name -> tensorflow.NodeDef + 2, // 1: tensorflow.GraphDef.versions:type_name -> tensorflow.VersionDef + 3, // 2: tensorflow.GraphDef.library:type_name -> tensorflow.FunctionDefLibrary + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_graph_proto_init() } +func file_tensorflow_core_framework_graph_proto_init() { + if File_tensorflow_core_framework_graph_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_graph_proto_rawDesc), len(file_tensorflow_core_framework_graph_proto_rawDesc)), + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_graph_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_graph_proto_depIdxs, + MessageInfos: file_tensorflow_core_framework_graph_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_graph_proto = out.File + file_tensorflow_core_framework_graph_proto_goTypes = nil + file_tensorflow_core_framework_graph_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/graph_transfer_info_go_proto/graph_transfer_info.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/graph_transfer_info_go_proto/graph_transfer_info.pb.go new file mode 100644 index 0000000..524dace --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/graph_transfer_info_go_proto/graph_transfer_info.pb.go @@ -0,0 +1,734 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/graph_transfer_info.proto + +package graph_transfer_info_go_proto + +import ( + types_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/types_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type GraphTransferInfo_Destination int32 + +const ( + GraphTransferInfo_NOP GraphTransferInfo_Destination = 0 + GraphTransferInfo_HEXAGON GraphTransferInfo_Destination = 1 +) + +// Enum value maps for GraphTransferInfo_Destination. +var ( + GraphTransferInfo_Destination_name = map[int32]string{ + 0: "NOP", + 1: "HEXAGON", + } + GraphTransferInfo_Destination_value = map[string]int32{ + "NOP": 0, + "HEXAGON": 1, + } +) + +func (x GraphTransferInfo_Destination) Enum() *GraphTransferInfo_Destination { + p := new(GraphTransferInfo_Destination) + *p = x + return p +} + +func (x GraphTransferInfo_Destination) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (GraphTransferInfo_Destination) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_framework_graph_transfer_info_proto_enumTypes[0].Descriptor() +} + +func (GraphTransferInfo_Destination) Type() protoreflect.EnumType { + return &file_tensorflow_core_framework_graph_transfer_info_proto_enumTypes[0] +} + +func (x GraphTransferInfo_Destination) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use GraphTransferInfo_Destination.Descriptor instead. +func (GraphTransferInfo_Destination) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_framework_graph_transfer_info_proto_rawDescGZIP(), []int{7, 0} +} + +type GraphTransferNodeInput struct { + state protoimpl.MessageState `protogen:"open.v1"` + NodeId int32 `protobuf:"varint,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` + OutputPort int32 `protobuf:"varint,2,opt,name=output_port,json=outputPort,proto3" json:"output_port,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GraphTransferNodeInput) Reset() { + *x = GraphTransferNodeInput{} + mi := &file_tensorflow_core_framework_graph_transfer_info_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GraphTransferNodeInput) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GraphTransferNodeInput) ProtoMessage() {} + +func (x *GraphTransferNodeInput) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_graph_transfer_info_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GraphTransferNodeInput.ProtoReflect.Descriptor instead. +func (*GraphTransferNodeInput) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_graph_transfer_info_proto_rawDescGZIP(), []int{0} +} + +func (x *GraphTransferNodeInput) GetNodeId() int32 { + if x != nil { + return x.NodeId + } + return 0 +} + +func (x *GraphTransferNodeInput) GetOutputPort() int32 { + if x != nil { + return x.OutputPort + } + return 0 +} + +type GraphTransferNodeInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + NodeId int32 `protobuf:"varint,2,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` + TypeName string `protobuf:"bytes,3,opt,name=type_name,json=typeName,proto3" json:"type_name,omitempty"` + SocOpId int32 `protobuf:"varint,4,opt,name=soc_op_id,json=socOpId,proto3" json:"soc_op_id,omitempty"` + PaddingId int32 `protobuf:"varint,5,opt,name=padding_id,json=paddingId,proto3" json:"padding_id,omitempty"` + InputCount int32 `protobuf:"varint,6,opt,name=input_count,json=inputCount,proto3" json:"input_count,omitempty"` + OutputCount int32 `protobuf:"varint,7,opt,name=output_count,json=outputCount,proto3" json:"output_count,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GraphTransferNodeInfo) Reset() { + *x = GraphTransferNodeInfo{} + mi := &file_tensorflow_core_framework_graph_transfer_info_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GraphTransferNodeInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GraphTransferNodeInfo) ProtoMessage() {} + +func (x *GraphTransferNodeInfo) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_graph_transfer_info_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GraphTransferNodeInfo.ProtoReflect.Descriptor instead. +func (*GraphTransferNodeInfo) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_graph_transfer_info_proto_rawDescGZIP(), []int{1} +} + +func (x *GraphTransferNodeInfo) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *GraphTransferNodeInfo) GetNodeId() int32 { + if x != nil { + return x.NodeId + } + return 0 +} + +func (x *GraphTransferNodeInfo) GetTypeName() string { + if x != nil { + return x.TypeName + } + return "" +} + +func (x *GraphTransferNodeInfo) GetSocOpId() int32 { + if x != nil { + return x.SocOpId + } + return 0 +} + +func (x *GraphTransferNodeInfo) GetPaddingId() int32 { + if x != nil { + return x.PaddingId + } + return 0 +} + +func (x *GraphTransferNodeInfo) GetInputCount() int32 { + if x != nil { + return x.InputCount + } + return 0 +} + +func (x *GraphTransferNodeInfo) GetOutputCount() int32 { + if x != nil { + return x.OutputCount + } + return 0 +} + +type GraphTransferConstNodeInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + NodeId int32 `protobuf:"varint,2,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` + Shape []int64 `protobuf:"varint,3,rep,packed,name=shape,proto3" json:"shape,omitempty"` + Data []byte `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` + Dtype types_go_proto.DataType `protobuf:"varint,5,opt,name=dtype,proto3,enum=tensorflow.DataType" json:"dtype,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GraphTransferConstNodeInfo) Reset() { + *x = GraphTransferConstNodeInfo{} + mi := &file_tensorflow_core_framework_graph_transfer_info_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GraphTransferConstNodeInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GraphTransferConstNodeInfo) ProtoMessage() {} + +func (x *GraphTransferConstNodeInfo) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_graph_transfer_info_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GraphTransferConstNodeInfo.ProtoReflect.Descriptor instead. +func (*GraphTransferConstNodeInfo) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_graph_transfer_info_proto_rawDescGZIP(), []int{2} +} + +func (x *GraphTransferConstNodeInfo) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *GraphTransferConstNodeInfo) GetNodeId() int32 { + if x != nil { + return x.NodeId + } + return 0 +} + +func (x *GraphTransferConstNodeInfo) GetShape() []int64 { + if x != nil { + return x.Shape + } + return nil +} + +func (x *GraphTransferConstNodeInfo) GetData() []byte { + if x != nil { + return x.Data + } + return nil +} + +func (x *GraphTransferConstNodeInfo) GetDtype() types_go_proto.DataType { + if x != nil { + return x.Dtype + } + return types_go_proto.DataType(0) +} + +type GraphTransferNodeInputInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + NodeId int32 `protobuf:"varint,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` + NodeInput []*GraphTransferNodeInput `protobuf:"bytes,2,rep,name=node_input,json=nodeInput,proto3" json:"node_input,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GraphTransferNodeInputInfo) Reset() { + *x = GraphTransferNodeInputInfo{} + mi := &file_tensorflow_core_framework_graph_transfer_info_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GraphTransferNodeInputInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GraphTransferNodeInputInfo) ProtoMessage() {} + +func (x *GraphTransferNodeInputInfo) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_graph_transfer_info_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GraphTransferNodeInputInfo.ProtoReflect.Descriptor instead. +func (*GraphTransferNodeInputInfo) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_graph_transfer_info_proto_rawDescGZIP(), []int{3} +} + +func (x *GraphTransferNodeInputInfo) GetNodeId() int32 { + if x != nil { + return x.NodeId + } + return 0 +} + +func (x *GraphTransferNodeInputInfo) GetNodeInput() []*GraphTransferNodeInput { + if x != nil { + return x.NodeInput + } + return nil +} + +type GraphTransferNodeOutputInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + NodeId int32 `protobuf:"varint,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` + MaxByteSize []int32 `protobuf:"varint,2,rep,packed,name=max_byte_size,json=maxByteSize,proto3" json:"max_byte_size,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GraphTransferNodeOutputInfo) Reset() { + *x = GraphTransferNodeOutputInfo{} + mi := &file_tensorflow_core_framework_graph_transfer_info_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GraphTransferNodeOutputInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GraphTransferNodeOutputInfo) ProtoMessage() {} + +func (x *GraphTransferNodeOutputInfo) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_graph_transfer_info_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GraphTransferNodeOutputInfo.ProtoReflect.Descriptor instead. +func (*GraphTransferNodeOutputInfo) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_graph_transfer_info_proto_rawDescGZIP(), []int{4} +} + +func (x *GraphTransferNodeOutputInfo) GetNodeId() int32 { + if x != nil { + return x.NodeId + } + return 0 +} + +func (x *GraphTransferNodeOutputInfo) GetMaxByteSize() []int32 { + if x != nil { + return x.MaxByteSize + } + return nil +} + +type GraphTransferGraphInputNodeInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Shape []int64 `protobuf:"varint,2,rep,packed,name=shape,proto3" json:"shape,omitempty"` + Dtype types_go_proto.DataType `protobuf:"varint,3,opt,name=dtype,proto3,enum=tensorflow.DataType" json:"dtype,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GraphTransferGraphInputNodeInfo) Reset() { + *x = GraphTransferGraphInputNodeInfo{} + mi := &file_tensorflow_core_framework_graph_transfer_info_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GraphTransferGraphInputNodeInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GraphTransferGraphInputNodeInfo) ProtoMessage() {} + +func (x *GraphTransferGraphInputNodeInfo) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_graph_transfer_info_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GraphTransferGraphInputNodeInfo.ProtoReflect.Descriptor instead. +func (*GraphTransferGraphInputNodeInfo) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_graph_transfer_info_proto_rawDescGZIP(), []int{5} +} + +func (x *GraphTransferGraphInputNodeInfo) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *GraphTransferGraphInputNodeInfo) GetShape() []int64 { + if x != nil { + return x.Shape + } + return nil +} + +func (x *GraphTransferGraphInputNodeInfo) GetDtype() types_go_proto.DataType { + if x != nil { + return x.Dtype + } + return types_go_proto.DataType(0) +} + +type GraphTransferGraphOutputNodeInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Shape []int64 `protobuf:"varint,2,rep,packed,name=shape,proto3" json:"shape,omitempty"` + Dtype types_go_proto.DataType `protobuf:"varint,3,opt,name=dtype,proto3,enum=tensorflow.DataType" json:"dtype,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GraphTransferGraphOutputNodeInfo) Reset() { + *x = GraphTransferGraphOutputNodeInfo{} + mi := &file_tensorflow_core_framework_graph_transfer_info_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GraphTransferGraphOutputNodeInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GraphTransferGraphOutputNodeInfo) ProtoMessage() {} + +func (x *GraphTransferGraphOutputNodeInfo) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_graph_transfer_info_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GraphTransferGraphOutputNodeInfo.ProtoReflect.Descriptor instead. +func (*GraphTransferGraphOutputNodeInfo) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_graph_transfer_info_proto_rawDescGZIP(), []int{6} +} + +func (x *GraphTransferGraphOutputNodeInfo) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *GraphTransferGraphOutputNodeInfo) GetShape() []int64 { + if x != nil { + return x.Shape + } + return nil +} + +func (x *GraphTransferGraphOutputNodeInfo) GetDtype() types_go_proto.DataType { + if x != nil { + return x.Dtype + } + return types_go_proto.DataType(0) +} + +// Protocol buffer representing a handle to a tensorflow resource. Handles are +// not valid across executions, but can be serialized back and forth from within +// a single run. +type GraphTransferInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + NodeInfo []*GraphTransferNodeInfo `protobuf:"bytes,1,rep,name=node_info,json=nodeInfo,proto3" json:"node_info,omitempty"` + ConstNodeInfo []*GraphTransferConstNodeInfo `protobuf:"bytes,2,rep,name=const_node_info,json=constNodeInfo,proto3" json:"const_node_info,omitempty"` + NodeInputInfo []*GraphTransferNodeInputInfo `protobuf:"bytes,3,rep,name=node_input_info,json=nodeInputInfo,proto3" json:"node_input_info,omitempty"` + NodeOutputInfo []*GraphTransferNodeOutputInfo `protobuf:"bytes,4,rep,name=node_output_info,json=nodeOutputInfo,proto3" json:"node_output_info,omitempty"` + // Input Node parameters of transferred graph + GraphInputNodeInfo []*GraphTransferGraphInputNodeInfo `protobuf:"bytes,5,rep,name=graph_input_node_info,json=graphInputNodeInfo,proto3" json:"graph_input_node_info,omitempty"` + GraphOutputNodeInfo []*GraphTransferGraphOutputNodeInfo `protobuf:"bytes,6,rep,name=graph_output_node_info,json=graphOutputNodeInfo,proto3" json:"graph_output_node_info,omitempty"` + // Destination of graph transfer + Destination GraphTransferInfo_Destination `protobuf:"varint,7,opt,name=destination,proto3,enum=tensorflow.GraphTransferInfo_Destination" json:"destination,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GraphTransferInfo) Reset() { + *x = GraphTransferInfo{} + mi := &file_tensorflow_core_framework_graph_transfer_info_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GraphTransferInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GraphTransferInfo) ProtoMessage() {} + +func (x *GraphTransferInfo) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_graph_transfer_info_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GraphTransferInfo.ProtoReflect.Descriptor instead. +func (*GraphTransferInfo) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_graph_transfer_info_proto_rawDescGZIP(), []int{7} +} + +func (x *GraphTransferInfo) GetNodeInfo() []*GraphTransferNodeInfo { + if x != nil { + return x.NodeInfo + } + return nil +} + +func (x *GraphTransferInfo) GetConstNodeInfo() []*GraphTransferConstNodeInfo { + if x != nil { + return x.ConstNodeInfo + } + return nil +} + +func (x *GraphTransferInfo) GetNodeInputInfo() []*GraphTransferNodeInputInfo { + if x != nil { + return x.NodeInputInfo + } + return nil +} + +func (x *GraphTransferInfo) GetNodeOutputInfo() []*GraphTransferNodeOutputInfo { + if x != nil { + return x.NodeOutputInfo + } + return nil +} + +func (x *GraphTransferInfo) GetGraphInputNodeInfo() []*GraphTransferGraphInputNodeInfo { + if x != nil { + return x.GraphInputNodeInfo + } + return nil +} + +func (x *GraphTransferInfo) GetGraphOutputNodeInfo() []*GraphTransferGraphOutputNodeInfo { + if x != nil { + return x.GraphOutputNodeInfo + } + return nil +} + +func (x *GraphTransferInfo) GetDestination() GraphTransferInfo_Destination { + if x != nil { + return x.Destination + } + return GraphTransferInfo_NOP +} + +var File_tensorflow_core_framework_graph_transfer_info_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_graph_transfer_info_proto_rawDesc = "" + + "\n" + + "3tensorflow/core/framework/graph_transfer_info.proto\x12\n" + + "tensorflow\x1a%tensorflow/core/framework/types.proto\"R\n" + + "\x16GraphTransferNodeInput\x12\x17\n" + + "\anode_id\x18\x01 \x01(\x05R\x06nodeId\x12\x1f\n" + + "\voutput_port\x18\x02 \x01(\x05R\n" + + "outputPort\"\xe0\x01\n" + + "\x15GraphTransferNodeInfo\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x17\n" + + "\anode_id\x18\x02 \x01(\x05R\x06nodeId\x12\x1b\n" + + "\ttype_name\x18\x03 \x01(\tR\btypeName\x12\x1a\n" + + "\tsoc_op_id\x18\x04 \x01(\x05R\asocOpId\x12\x1d\n" + + "\n" + + "padding_id\x18\x05 \x01(\x05R\tpaddingId\x12\x1f\n" + + "\vinput_count\x18\x06 \x01(\x05R\n" + + "inputCount\x12!\n" + + "\foutput_count\x18\a \x01(\x05R\voutputCount\"\x9f\x01\n" + + "\x1aGraphTransferConstNodeInfo\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x17\n" + + "\anode_id\x18\x02 \x01(\x05R\x06nodeId\x12\x14\n" + + "\x05shape\x18\x03 \x03(\x03R\x05shape\x12\x12\n" + + "\x04data\x18\x04 \x01(\fR\x04data\x12*\n" + + "\x05dtype\x18\x05 \x01(\x0e2\x14.tensorflow.DataTypeR\x05dtype\"x\n" + + "\x1aGraphTransferNodeInputInfo\x12\x17\n" + + "\anode_id\x18\x01 \x01(\x05R\x06nodeId\x12A\n" + + "\n" + + "node_input\x18\x02 \x03(\v2\".tensorflow.GraphTransferNodeInputR\tnodeInput\"Z\n" + + "\x1bGraphTransferNodeOutputInfo\x12\x17\n" + + "\anode_id\x18\x01 \x01(\x05R\x06nodeId\x12\"\n" + + "\rmax_byte_size\x18\x02 \x03(\x05R\vmaxByteSize\"w\n" + + "\x1fGraphTransferGraphInputNodeInfo\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x14\n" + + "\x05shape\x18\x02 \x03(\x03R\x05shape\x12*\n" + + "\x05dtype\x18\x03 \x01(\x0e2\x14.tensorflow.DataTypeR\x05dtype\"x\n" + + " GraphTransferGraphOutputNodeInfo\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x14\n" + + "\x05shape\x18\x02 \x03(\x03R\x05shape\x12*\n" + + "\x05dtype\x18\x03 \x01(\x0e2\x14.tensorflow.DataTypeR\x05dtype\"\xfb\x04\n" + + "\x11GraphTransferInfo\x12>\n" + + "\tnode_info\x18\x01 \x03(\v2!.tensorflow.GraphTransferNodeInfoR\bnodeInfo\x12N\n" + + "\x0fconst_node_info\x18\x02 \x03(\v2&.tensorflow.GraphTransferConstNodeInfoR\rconstNodeInfo\x12N\n" + + "\x0fnode_input_info\x18\x03 \x03(\v2&.tensorflow.GraphTransferNodeInputInfoR\rnodeInputInfo\x12Q\n" + + "\x10node_output_info\x18\x04 \x03(\v2'.tensorflow.GraphTransferNodeOutputInfoR\x0enodeOutputInfo\x12^\n" + + "\x15graph_input_node_info\x18\x05 \x03(\v2+.tensorflow.GraphTransferGraphInputNodeInfoR\x12graphInputNodeInfo\x12a\n" + + "\x16graph_output_node_info\x18\x06 \x03(\v2,.tensorflow.GraphTransferGraphOutputNodeInfoR\x13graphOutputNodeInfo\x12K\n" + + "\vdestination\x18\a \x01(\x0e2).tensorflow.GraphTransferInfo.DestinationR\vdestination\"#\n" + + "\vDestination\x12\a\n" + + "\x03NOP\x10\x00\x12\v\n" + + "\aHEXAGON\x10\x01B\x93\x01\n" + + "\x18org.tensorflow.frameworkB\x16GraphTransferInfoProtoP\x01ZZgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/graph_transfer_info_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_graph_transfer_info_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_graph_transfer_info_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_graph_transfer_info_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_graph_transfer_info_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_graph_transfer_info_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_graph_transfer_info_proto_rawDesc), len(file_tensorflow_core_framework_graph_transfer_info_proto_rawDesc))) + }) + return file_tensorflow_core_framework_graph_transfer_info_proto_rawDescData +} + +var file_tensorflow_core_framework_graph_transfer_info_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_tensorflow_core_framework_graph_transfer_info_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_tensorflow_core_framework_graph_transfer_info_proto_goTypes = []any{ + (GraphTransferInfo_Destination)(0), // 0: tensorflow.GraphTransferInfo.Destination + (*GraphTransferNodeInput)(nil), // 1: tensorflow.GraphTransferNodeInput + (*GraphTransferNodeInfo)(nil), // 2: tensorflow.GraphTransferNodeInfo + (*GraphTransferConstNodeInfo)(nil), // 3: tensorflow.GraphTransferConstNodeInfo + (*GraphTransferNodeInputInfo)(nil), // 4: tensorflow.GraphTransferNodeInputInfo + (*GraphTransferNodeOutputInfo)(nil), // 5: tensorflow.GraphTransferNodeOutputInfo + (*GraphTransferGraphInputNodeInfo)(nil), // 6: tensorflow.GraphTransferGraphInputNodeInfo + (*GraphTransferGraphOutputNodeInfo)(nil), // 7: tensorflow.GraphTransferGraphOutputNodeInfo + (*GraphTransferInfo)(nil), // 8: tensorflow.GraphTransferInfo + (types_go_proto.DataType)(0), // 9: tensorflow.DataType +} +var file_tensorflow_core_framework_graph_transfer_info_proto_depIdxs = []int32{ + 9, // 0: tensorflow.GraphTransferConstNodeInfo.dtype:type_name -> tensorflow.DataType + 1, // 1: tensorflow.GraphTransferNodeInputInfo.node_input:type_name -> tensorflow.GraphTransferNodeInput + 9, // 2: tensorflow.GraphTransferGraphInputNodeInfo.dtype:type_name -> tensorflow.DataType + 9, // 3: tensorflow.GraphTransferGraphOutputNodeInfo.dtype:type_name -> tensorflow.DataType + 2, // 4: tensorflow.GraphTransferInfo.node_info:type_name -> tensorflow.GraphTransferNodeInfo + 3, // 5: tensorflow.GraphTransferInfo.const_node_info:type_name -> tensorflow.GraphTransferConstNodeInfo + 4, // 6: tensorflow.GraphTransferInfo.node_input_info:type_name -> tensorflow.GraphTransferNodeInputInfo + 5, // 7: tensorflow.GraphTransferInfo.node_output_info:type_name -> tensorflow.GraphTransferNodeOutputInfo + 6, // 8: tensorflow.GraphTransferInfo.graph_input_node_info:type_name -> tensorflow.GraphTransferGraphInputNodeInfo + 7, // 9: tensorflow.GraphTransferInfo.graph_output_node_info:type_name -> tensorflow.GraphTransferGraphOutputNodeInfo + 0, // 10: tensorflow.GraphTransferInfo.destination:type_name -> tensorflow.GraphTransferInfo.Destination + 11, // [11:11] is the sub-list for method output_type + 11, // [11:11] is the sub-list for method input_type + 11, // [11:11] is the sub-list for extension type_name + 11, // [11:11] is the sub-list for extension extendee + 0, // [0:11] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_graph_transfer_info_proto_init() } +func file_tensorflow_core_framework_graph_transfer_info_proto_init() { + if File_tensorflow_core_framework_graph_transfer_info_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_graph_transfer_info_proto_rawDesc), len(file_tensorflow_core_framework_graph_transfer_info_proto_rawDesc)), + NumEnums: 1, + NumMessages: 8, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_graph_transfer_info_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_graph_transfer_info_proto_depIdxs, + EnumInfos: file_tensorflow_core_framework_graph_transfer_info_proto_enumTypes, + MessageInfos: file_tensorflow_core_framework_graph_transfer_info_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_graph_transfer_info_proto = out.File + file_tensorflow_core_framework_graph_transfer_info_proto_goTypes = nil + file_tensorflow_core_framework_graph_transfer_info_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/kernel_def_go_proto/kernel_def.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/kernel_def_go_proto/kernel_def.pb.go new file mode 100644 index 0000000..83811b5 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/kernel_def_go_proto/kernel_def.pb.go @@ -0,0 +1,295 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/kernel_def.proto + +package kernel_def_go_proto + +import ( + attr_value_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/attr_value_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type KernelDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Must match the name of an Op. + Op string `protobuf:"bytes,1,opt,name=op,proto3" json:"op,omitempty"` + // Type of device this kernel runs on. + DeviceType string `protobuf:"bytes,2,opt,name=device_type,json=deviceType,proto3" json:"device_type,omitempty"` + Constraint []*KernelDef_AttrConstraint `protobuf:"bytes,3,rep,name=constraint,proto3" json:"constraint,omitempty"` + // Names of the Op's input_/output_args that reside in host memory + // instead of device memory. + HostMemoryArg []string `protobuf:"bytes,4,rep,name=host_memory_arg,json=hostMemoryArg,proto3" json:"host_memory_arg,omitempty"` + // This allows experimental kernels to be registered for an op that + // won't be used unless the user specifies a "_kernel" attr with + // value matching this. + Label string `protobuf:"bytes,5,opt,name=label,proto3" json:"label,omitempty"` + // Prioritization of kernel amongst different devices. By default we assume + // priority is 0. The higher the priority the better. By default (i.e. if + // this is not set), we prefer GPU kernels over CPU. + Priority int32 `protobuf:"varint,6,opt,name=priority,proto3" json:"priority,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KernelDef) Reset() { + *x = KernelDef{} + mi := &file_tensorflow_core_framework_kernel_def_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KernelDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KernelDef) ProtoMessage() {} + +func (x *KernelDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_kernel_def_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KernelDef.ProtoReflect.Descriptor instead. +func (*KernelDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_kernel_def_proto_rawDescGZIP(), []int{0} +} + +func (x *KernelDef) GetOp() string { + if x != nil { + return x.Op + } + return "" +} + +func (x *KernelDef) GetDeviceType() string { + if x != nil { + return x.DeviceType + } + return "" +} + +func (x *KernelDef) GetConstraint() []*KernelDef_AttrConstraint { + if x != nil { + return x.Constraint + } + return nil +} + +func (x *KernelDef) GetHostMemoryArg() []string { + if x != nil { + return x.HostMemoryArg + } + return nil +} + +func (x *KernelDef) GetLabel() string { + if x != nil { + return x.Label + } + return "" +} + +func (x *KernelDef) GetPriority() int32 { + if x != nil { + return x.Priority + } + return 0 +} + +// A collection of KernelDefs +type KernelList struct { + state protoimpl.MessageState `protogen:"open.v1"` + Kernel []*KernelDef `protobuf:"bytes,1,rep,name=kernel,proto3" json:"kernel,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KernelList) Reset() { + *x = KernelList{} + mi := &file_tensorflow_core_framework_kernel_def_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KernelList) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KernelList) ProtoMessage() {} + +func (x *KernelList) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_kernel_def_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KernelList.ProtoReflect.Descriptor instead. +func (*KernelList) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_kernel_def_proto_rawDescGZIP(), []int{1} +} + +func (x *KernelList) GetKernel() []*KernelDef { + if x != nil { + return x.Kernel + } + return nil +} + +type KernelDef_AttrConstraint struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Name of an attr from the Op. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // A list of values that this kernel supports for this attr. + // Like OpDef.AttrDef.allowed_values, except for kernels instead of Ops. + AllowedValues *attr_value_go_proto.AttrValue `protobuf:"bytes,2,opt,name=allowed_values,json=allowedValues,proto3" json:"allowed_values,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KernelDef_AttrConstraint) Reset() { + *x = KernelDef_AttrConstraint{} + mi := &file_tensorflow_core_framework_kernel_def_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KernelDef_AttrConstraint) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KernelDef_AttrConstraint) ProtoMessage() {} + +func (x *KernelDef_AttrConstraint) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_kernel_def_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KernelDef_AttrConstraint.ProtoReflect.Descriptor instead. +func (*KernelDef_AttrConstraint) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_kernel_def_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *KernelDef_AttrConstraint) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *KernelDef_AttrConstraint) GetAllowedValues() *attr_value_go_proto.AttrValue { + if x != nil { + return x.AllowedValues + } + return nil +} + +var File_tensorflow_core_framework_kernel_def_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_kernel_def_proto_rawDesc = "" + + "\n" + + "*tensorflow/core/framework/kernel_def.proto\x12\n" + + "tensorflow\x1a*tensorflow/core/framework/attr_value.proto\"\xc0\x02\n" + + "\tKernelDef\x12\x0e\n" + + "\x02op\x18\x01 \x01(\tR\x02op\x12\x1f\n" + + "\vdevice_type\x18\x02 \x01(\tR\n" + + "deviceType\x12D\n" + + "\n" + + "constraint\x18\x03 \x03(\v2$.tensorflow.KernelDef.AttrConstraintR\n" + + "constraint\x12&\n" + + "\x0fhost_memory_arg\x18\x04 \x03(\tR\rhostMemoryArg\x12\x14\n" + + "\x05label\x18\x05 \x01(\tR\x05label\x12\x1a\n" + + "\bpriority\x18\x06 \x01(\x05R\bpriority\x1ab\n" + + "\x0eAttrConstraint\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12<\n" + + "\x0eallowed_values\x18\x02 \x01(\v2\x15.tensorflow.AttrValueR\rallowedValues\";\n" + + "\n" + + "KernelList\x12-\n" + + "\x06kernel\x18\x01 \x03(\v2\x15.tensorflow.KernelDefR\x06kernelB\x83\x01\n" + + "\x18org.tensorflow.frameworkB\x0fKernelDefProtosP\x01ZQgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/kernel_def_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_kernel_def_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_kernel_def_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_kernel_def_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_kernel_def_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_kernel_def_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_kernel_def_proto_rawDesc), len(file_tensorflow_core_framework_kernel_def_proto_rawDesc))) + }) + return file_tensorflow_core_framework_kernel_def_proto_rawDescData +} + +var file_tensorflow_core_framework_kernel_def_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_tensorflow_core_framework_kernel_def_proto_goTypes = []any{ + (*KernelDef)(nil), // 0: tensorflow.KernelDef + (*KernelList)(nil), // 1: tensorflow.KernelList + (*KernelDef_AttrConstraint)(nil), // 2: tensorflow.KernelDef.AttrConstraint + (*attr_value_go_proto.AttrValue)(nil), // 3: tensorflow.AttrValue +} +var file_tensorflow_core_framework_kernel_def_proto_depIdxs = []int32{ + 2, // 0: tensorflow.KernelDef.constraint:type_name -> tensorflow.KernelDef.AttrConstraint + 0, // 1: tensorflow.KernelList.kernel:type_name -> tensorflow.KernelDef + 3, // 2: tensorflow.KernelDef.AttrConstraint.allowed_values:type_name -> tensorflow.AttrValue + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_kernel_def_proto_init() } +func file_tensorflow_core_framework_kernel_def_proto_init() { + if File_tensorflow_core_framework_kernel_def_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_kernel_def_proto_rawDesc), len(file_tensorflow_core_framework_kernel_def_proto_rawDesc)), + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_kernel_def_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_kernel_def_proto_depIdxs, + MessageInfos: file_tensorflow_core_framework_kernel_def_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_kernel_def_proto = out.File + file_tensorflow_core_framework_kernel_def_proto_goTypes = nil + file_tensorflow_core_framework_kernel_def_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/log_memory_go_proto/log_memory.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/log_memory_go_proto/log_memory.pb.go new file mode 100644 index 0000000..68edb11 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/log_memory_go_proto/log_memory.pb.go @@ -0,0 +1,537 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/log_memory.proto + +package log_memory_go_proto + +import ( + tensor_description_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_description_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type MemoryLogStep struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Process-unique step id. + StepId int64 `protobuf:"varint,1,opt,name=step_id,json=stepId,proto3" json:"step_id,omitempty"` + // Handle describing the feeds and fetches of the step. + Handle string `protobuf:"bytes,2,opt,name=handle,proto3" json:"handle,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MemoryLogStep) Reset() { + *x = MemoryLogStep{} + mi := &file_tensorflow_core_framework_log_memory_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MemoryLogStep) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MemoryLogStep) ProtoMessage() {} + +func (x *MemoryLogStep) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_log_memory_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MemoryLogStep.ProtoReflect.Descriptor instead. +func (*MemoryLogStep) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_log_memory_proto_rawDescGZIP(), []int{0} +} + +func (x *MemoryLogStep) GetStepId() int64 { + if x != nil { + return x.StepId + } + return 0 +} + +func (x *MemoryLogStep) GetHandle() string { + if x != nil { + return x.Handle + } + return "" +} + +type MemoryLogTensorAllocation struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Process-unique step id. + StepId int64 `protobuf:"varint,1,opt,name=step_id,json=stepId,proto3" json:"step_id,omitempty"` + // Name of the kernel making the allocation as set in GraphDef, + // e.g., "affine2/weights/Assign". + KernelName string `protobuf:"bytes,2,opt,name=kernel_name,json=kernelName,proto3" json:"kernel_name,omitempty"` + // Allocated tensor details. + Tensor *tensor_description_go_proto.TensorDescription `protobuf:"bytes,3,opt,name=tensor,proto3" json:"tensor,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MemoryLogTensorAllocation) Reset() { + *x = MemoryLogTensorAllocation{} + mi := &file_tensorflow_core_framework_log_memory_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MemoryLogTensorAllocation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MemoryLogTensorAllocation) ProtoMessage() {} + +func (x *MemoryLogTensorAllocation) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_log_memory_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MemoryLogTensorAllocation.ProtoReflect.Descriptor instead. +func (*MemoryLogTensorAllocation) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_log_memory_proto_rawDescGZIP(), []int{1} +} + +func (x *MemoryLogTensorAllocation) GetStepId() int64 { + if x != nil { + return x.StepId + } + return 0 +} + +func (x *MemoryLogTensorAllocation) GetKernelName() string { + if x != nil { + return x.KernelName + } + return "" +} + +func (x *MemoryLogTensorAllocation) GetTensor() *tensor_description_go_proto.TensorDescription { + if x != nil { + return x.Tensor + } + return nil +} + +type MemoryLogTensorDeallocation struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Id of the tensor buffer being deallocated, used to match to a + // corresponding allocation. + AllocationId int64 `protobuf:"varint,1,opt,name=allocation_id,json=allocationId,proto3" json:"allocation_id,omitempty"` + // Name of the allocator used. + AllocatorName string `protobuf:"bytes,2,opt,name=allocator_name,json=allocatorName,proto3" json:"allocator_name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MemoryLogTensorDeallocation) Reset() { + *x = MemoryLogTensorDeallocation{} + mi := &file_tensorflow_core_framework_log_memory_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MemoryLogTensorDeallocation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MemoryLogTensorDeallocation) ProtoMessage() {} + +func (x *MemoryLogTensorDeallocation) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_log_memory_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MemoryLogTensorDeallocation.ProtoReflect.Descriptor instead. +func (*MemoryLogTensorDeallocation) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_log_memory_proto_rawDescGZIP(), []int{2} +} + +func (x *MemoryLogTensorDeallocation) GetAllocationId() int64 { + if x != nil { + return x.AllocationId + } + return 0 +} + +func (x *MemoryLogTensorDeallocation) GetAllocatorName() string { + if x != nil { + return x.AllocatorName + } + return "" +} + +type MemoryLogTensorOutput struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Process-unique step id. + StepId int64 `protobuf:"varint,1,opt,name=step_id,json=stepId,proto3" json:"step_id,omitempty"` + // Name of the kernel producing an output as set in GraphDef, e.g., + // "affine2/weights/Assign". + KernelName string `protobuf:"bytes,2,opt,name=kernel_name,json=kernelName,proto3" json:"kernel_name,omitempty"` + // Index of the output being set. + Index int32 `protobuf:"varint,3,opt,name=index,proto3" json:"index,omitempty"` + // Output tensor details. + Tensor *tensor_description_go_proto.TensorDescription `protobuf:"bytes,4,opt,name=tensor,proto3" json:"tensor,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MemoryLogTensorOutput) Reset() { + *x = MemoryLogTensorOutput{} + mi := &file_tensorflow_core_framework_log_memory_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MemoryLogTensorOutput) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MemoryLogTensorOutput) ProtoMessage() {} + +func (x *MemoryLogTensorOutput) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_log_memory_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MemoryLogTensorOutput.ProtoReflect.Descriptor instead. +func (*MemoryLogTensorOutput) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_log_memory_proto_rawDescGZIP(), []int{3} +} + +func (x *MemoryLogTensorOutput) GetStepId() int64 { + if x != nil { + return x.StepId + } + return 0 +} + +func (x *MemoryLogTensorOutput) GetKernelName() string { + if x != nil { + return x.KernelName + } + return "" +} + +func (x *MemoryLogTensorOutput) GetIndex() int32 { + if x != nil { + return x.Index + } + return 0 +} + +func (x *MemoryLogTensorOutput) GetTensor() *tensor_description_go_proto.TensorDescription { + if x != nil { + return x.Tensor + } + return nil +} + +type MemoryLogRawAllocation struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Process-unique step id. + StepId int64 `protobuf:"varint,1,opt,name=step_id,json=stepId,proto3" json:"step_id,omitempty"` + // Name of the operation making the allocation. + Operation string `protobuf:"bytes,2,opt,name=operation,proto3" json:"operation,omitempty"` + // Number of bytes in the allocation. + NumBytes int64 `protobuf:"varint,3,opt,name=num_bytes,json=numBytes,proto3" json:"num_bytes,omitempty"` + // Address of the allocation. + Ptr uint64 `protobuf:"varint,4,opt,name=ptr,proto3" json:"ptr,omitempty"` + // Id of the tensor buffer being allocated, used to match to a + // corresponding deallocation. + AllocationId int64 `protobuf:"varint,5,opt,name=allocation_id,json=allocationId,proto3" json:"allocation_id,omitempty"` + // Name of the allocator used. + AllocatorName string `protobuf:"bytes,6,opt,name=allocator_name,json=allocatorName,proto3" json:"allocator_name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MemoryLogRawAllocation) Reset() { + *x = MemoryLogRawAllocation{} + mi := &file_tensorflow_core_framework_log_memory_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MemoryLogRawAllocation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MemoryLogRawAllocation) ProtoMessage() {} + +func (x *MemoryLogRawAllocation) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_log_memory_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MemoryLogRawAllocation.ProtoReflect.Descriptor instead. +func (*MemoryLogRawAllocation) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_log_memory_proto_rawDescGZIP(), []int{4} +} + +func (x *MemoryLogRawAllocation) GetStepId() int64 { + if x != nil { + return x.StepId + } + return 0 +} + +func (x *MemoryLogRawAllocation) GetOperation() string { + if x != nil { + return x.Operation + } + return "" +} + +func (x *MemoryLogRawAllocation) GetNumBytes() int64 { + if x != nil { + return x.NumBytes + } + return 0 +} + +func (x *MemoryLogRawAllocation) GetPtr() uint64 { + if x != nil { + return x.Ptr + } + return 0 +} + +func (x *MemoryLogRawAllocation) GetAllocationId() int64 { + if x != nil { + return x.AllocationId + } + return 0 +} + +func (x *MemoryLogRawAllocation) GetAllocatorName() string { + if x != nil { + return x.AllocatorName + } + return "" +} + +type MemoryLogRawDeallocation struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Process-unique step id. + StepId int64 `protobuf:"varint,1,opt,name=step_id,json=stepId,proto3" json:"step_id,omitempty"` + // Name of the operation making the deallocation. + Operation string `protobuf:"bytes,2,opt,name=operation,proto3" json:"operation,omitempty"` + // Id of the tensor buffer being deallocated, used to match to a + // corresponding allocation. + AllocationId int64 `protobuf:"varint,3,opt,name=allocation_id,json=allocationId,proto3" json:"allocation_id,omitempty"` + // Name of the allocator used. + AllocatorName string `protobuf:"bytes,4,opt,name=allocator_name,json=allocatorName,proto3" json:"allocator_name,omitempty"` + // True if the deallocation is queued and will be performed later, + // e.g. for GPU lazy freeing of buffers. + Deferred bool `protobuf:"varint,5,opt,name=deferred,proto3" json:"deferred,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MemoryLogRawDeallocation) Reset() { + *x = MemoryLogRawDeallocation{} + mi := &file_tensorflow_core_framework_log_memory_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MemoryLogRawDeallocation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MemoryLogRawDeallocation) ProtoMessage() {} + +func (x *MemoryLogRawDeallocation) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_log_memory_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MemoryLogRawDeallocation.ProtoReflect.Descriptor instead. +func (*MemoryLogRawDeallocation) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_log_memory_proto_rawDescGZIP(), []int{5} +} + +func (x *MemoryLogRawDeallocation) GetStepId() int64 { + if x != nil { + return x.StepId + } + return 0 +} + +func (x *MemoryLogRawDeallocation) GetOperation() string { + if x != nil { + return x.Operation + } + return "" +} + +func (x *MemoryLogRawDeallocation) GetAllocationId() int64 { + if x != nil { + return x.AllocationId + } + return 0 +} + +func (x *MemoryLogRawDeallocation) GetAllocatorName() string { + if x != nil { + return x.AllocatorName + } + return "" +} + +func (x *MemoryLogRawDeallocation) GetDeferred() bool { + if x != nil { + return x.Deferred + } + return false +} + +var File_tensorflow_core_framework_log_memory_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_log_memory_proto_rawDesc = "" + + "\n" + + "*tensorflow/core/framework/log_memory.proto\x12\n" + + "tensorflow\x1a2tensorflow/core/framework/tensor_description.proto\"@\n" + + "\rMemoryLogStep\x12\x17\n" + + "\astep_id\x18\x01 \x01(\x03R\x06stepId\x12\x16\n" + + "\x06handle\x18\x02 \x01(\tR\x06handle\"\x8c\x01\n" + + "\x19MemoryLogTensorAllocation\x12\x17\n" + + "\astep_id\x18\x01 \x01(\x03R\x06stepId\x12\x1f\n" + + "\vkernel_name\x18\x02 \x01(\tR\n" + + "kernelName\x125\n" + + "\x06tensor\x18\x03 \x01(\v2\x1d.tensorflow.TensorDescriptionR\x06tensor\"i\n" + + "\x1bMemoryLogTensorDeallocation\x12#\n" + + "\rallocation_id\x18\x01 \x01(\x03R\fallocationId\x12%\n" + + "\x0eallocator_name\x18\x02 \x01(\tR\rallocatorName\"\x9e\x01\n" + + "\x15MemoryLogTensorOutput\x12\x17\n" + + "\astep_id\x18\x01 \x01(\x03R\x06stepId\x12\x1f\n" + + "\vkernel_name\x18\x02 \x01(\tR\n" + + "kernelName\x12\x14\n" + + "\x05index\x18\x03 \x01(\x05R\x05index\x125\n" + + "\x06tensor\x18\x04 \x01(\v2\x1d.tensorflow.TensorDescriptionR\x06tensor\"\xca\x01\n" + + "\x16MemoryLogRawAllocation\x12\x17\n" + + "\astep_id\x18\x01 \x01(\x03R\x06stepId\x12\x1c\n" + + "\toperation\x18\x02 \x01(\tR\toperation\x12\x1b\n" + + "\tnum_bytes\x18\x03 \x01(\x03R\bnumBytes\x12\x10\n" + + "\x03ptr\x18\x04 \x01(\x04R\x03ptr\x12#\n" + + "\rallocation_id\x18\x05 \x01(\x03R\fallocationId\x12%\n" + + "\x0eallocator_name\x18\x06 \x01(\tR\rallocatorName\"\xb9\x01\n" + + "\x18MemoryLogRawDeallocation\x12\x17\n" + + "\astep_id\x18\x01 \x01(\x03R\x06stepId\x12\x1c\n" + + "\toperation\x18\x02 \x01(\tR\toperation\x12#\n" + + "\rallocation_id\x18\x03 \x01(\x03R\fallocationId\x12%\n" + + "\x0eallocator_name\x18\x04 \x01(\tR\rallocatorName\x12\x1a\n" + + "\bdeferred\x18\x05 \x01(\bR\bdeferredB\x83\x01\n" + + "\x18org.tensorflow.frameworkB\x0fLogMemoryProtosP\x01ZQgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/log_memory_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_log_memory_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_log_memory_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_log_memory_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_log_memory_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_log_memory_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_log_memory_proto_rawDesc), len(file_tensorflow_core_framework_log_memory_proto_rawDesc))) + }) + return file_tensorflow_core_framework_log_memory_proto_rawDescData +} + +var file_tensorflow_core_framework_log_memory_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_tensorflow_core_framework_log_memory_proto_goTypes = []any{ + (*MemoryLogStep)(nil), // 0: tensorflow.MemoryLogStep + (*MemoryLogTensorAllocation)(nil), // 1: tensorflow.MemoryLogTensorAllocation + (*MemoryLogTensorDeallocation)(nil), // 2: tensorflow.MemoryLogTensorDeallocation + (*MemoryLogTensorOutput)(nil), // 3: tensorflow.MemoryLogTensorOutput + (*MemoryLogRawAllocation)(nil), // 4: tensorflow.MemoryLogRawAllocation + (*MemoryLogRawDeallocation)(nil), // 5: tensorflow.MemoryLogRawDeallocation + (*tensor_description_go_proto.TensorDescription)(nil), // 6: tensorflow.TensorDescription +} +var file_tensorflow_core_framework_log_memory_proto_depIdxs = []int32{ + 6, // 0: tensorflow.MemoryLogTensorAllocation.tensor:type_name -> tensorflow.TensorDescription + 6, // 1: tensorflow.MemoryLogTensorOutput.tensor:type_name -> tensorflow.TensorDescription + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_log_memory_proto_init() } +func file_tensorflow_core_framework_log_memory_proto_init() { + if File_tensorflow_core_framework_log_memory_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_log_memory_proto_rawDesc), len(file_tensorflow_core_framework_log_memory_proto_rawDesc)), + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_log_memory_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_log_memory_proto_depIdxs, + MessageInfos: file_tensorflow_core_framework_log_memory_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_log_memory_proto = out.File + file_tensorflow_core_framework_log_memory_proto_goTypes = nil + file_tensorflow_core_framework_log_memory_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/node_def_go_proto/node_def.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/node_def_go_proto/node_def.pb.go new file mode 100644 index 0000000..8e998a7 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/node_def_go_proto/node_def.pb.go @@ -0,0 +1,292 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/node_def.proto + +package node_def_go_proto + +import ( + attr_value_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/attr_value_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type NodeDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The name given to this operator. Used for naming inputs, + // logging, visualization, etc. Unique within a single GraphDef. + // Must match the regexp "[A-Za-z0-9.][A-Za-z0-9_>./]*". + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // The operation name. There may be custom parameters in attrs. + // Op names starting with an underscore are reserved for internal use. + Op string `protobuf:"bytes,2,opt,name=op,proto3" json:"op,omitempty"` + // Each input is "node:src_output" with "node" being a string name and + // "src_output" indicating which output tensor to use from "node". If + // "src_output" is 0 the ":0" suffix can be omitted. Regular inputs + // may optionally be followed by control inputs that have the format + // "^node". + Input []string `protobuf:"bytes,3,rep,name=input,proto3" json:"input,omitempty"` + // A (possibly partial) specification for the device on which this + // node should be placed. + // The expected syntax for this string is as follows: + // + // DEVICE_SPEC ::= PARTIAL_SPEC + // + // PARTIAL_SPEC ::= ("/" CONSTRAINT) * + // CONSTRAINT ::= ("job:" JOB_NAME) + // + // | ("replica:" [1-9][0-9]*) + // | ("task:" [1-9][0-9]*) + // | ("device:" [A-Za-z]* ":" ([1-9][0-9]* | "*") ) + // + // Valid values for this string include: + // * "/job:worker/replica:0/task:1/device:GPU:3" (full specification) + // * "/job:worker/device:GPU:3" (partial specification) + // * "" (no specification) + // + // If the constraints do not resolve to a single device (or if this + // field is empty or not present), the runtime will attempt to + // choose a device automatically. + Device string `protobuf:"bytes,4,opt,name=device,proto3" json:"device,omitempty"` + // Operation-specific graph-construction-time configuration. + // Note that this should include all attrs defined in the + // corresponding OpDef, including those with a value matching + // the default -- this allows the default to change and makes + // NodeDefs easier to interpret on their own. However, if + // an attr with a default is not specified in this list, the + // default will be used. + // The "names" (keys) must match the regexp "[a-z][a-z0-9_]+" (and + // one of the names from the corresponding OpDef's attr field). + // The values must have a type matching the corresponding OpDef + // attr's type field. + // TODO(josh11b): Add some examples here showing best practices. + Attr map[string]*attr_value_go_proto.AttrValue `protobuf:"bytes,5,rep,name=attr,proto3" json:"attr,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // This stores debug information associated with the node. + ExperimentalDebugInfo *NodeDef_ExperimentalDebugInfo `protobuf:"bytes,6,opt,name=experimental_debug_info,json=experimentalDebugInfo,proto3" json:"experimental_debug_info,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NodeDef) Reset() { + *x = NodeDef{} + mi := &file_tensorflow_core_framework_node_def_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NodeDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NodeDef) ProtoMessage() {} + +func (x *NodeDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_node_def_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NodeDef.ProtoReflect.Descriptor instead. +func (*NodeDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_node_def_proto_rawDescGZIP(), []int{0} +} + +func (x *NodeDef) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *NodeDef) GetOp() string { + if x != nil { + return x.Op + } + return "" +} + +func (x *NodeDef) GetInput() []string { + if x != nil { + return x.Input + } + return nil +} + +func (x *NodeDef) GetDevice() string { + if x != nil { + return x.Device + } + return "" +} + +func (x *NodeDef) GetAttr() map[string]*attr_value_go_proto.AttrValue { + if x != nil { + return x.Attr + } + return nil +} + +func (x *NodeDef) GetExperimentalDebugInfo() *NodeDef_ExperimentalDebugInfo { + if x != nil { + return x.ExperimentalDebugInfo + } + return nil +} + +type NodeDef_ExperimentalDebugInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Opaque string inserted into error messages created by the runtime. + // + // This is intended to store the list of names of the nodes from the + // original graph that this node was derived. For example if this node, say + // C, was result of a fusion of 2 nodes A and B, then 'original_node' would + // be {A, B}. This information can be used to map errors originating at the + // current node to some top level source code. + OriginalNodeNames []string `protobuf:"bytes,1,rep,name=original_node_names,json=originalNodeNames,proto3" json:"original_node_names,omitempty"` + // This is intended to store the list of names of the functions from the + // original graph that this node was derived. For example if this node, say + // C, was result of a fusion of node A in function FA and node B in function + // FB, then `original_funcs` would be {FA, FB}. If the node is in the top + // level graph, the `original_func` is empty. This information, with the + // `original_node_names` can be used to map errors originating at the + // current ndoe to some top level source code. + OriginalFuncNames []string `protobuf:"bytes,2,rep,name=original_func_names,json=originalFuncNames,proto3" json:"original_func_names,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NodeDef_ExperimentalDebugInfo) Reset() { + *x = NodeDef_ExperimentalDebugInfo{} + mi := &file_tensorflow_core_framework_node_def_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NodeDef_ExperimentalDebugInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NodeDef_ExperimentalDebugInfo) ProtoMessage() {} + +func (x *NodeDef_ExperimentalDebugInfo) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_node_def_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NodeDef_ExperimentalDebugInfo.ProtoReflect.Descriptor instead. +func (*NodeDef_ExperimentalDebugInfo) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_node_def_proto_rawDescGZIP(), []int{0, 1} +} + +func (x *NodeDef_ExperimentalDebugInfo) GetOriginalNodeNames() []string { + if x != nil { + return x.OriginalNodeNames + } + return nil +} + +func (x *NodeDef_ExperimentalDebugInfo) GetOriginalFuncNames() []string { + if x != nil { + return x.OriginalFuncNames + } + return nil +} + +var File_tensorflow_core_framework_node_def_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_node_def_proto_rawDesc = "" + + "\n" + + "(tensorflow/core/framework/node_def.proto\x12\n" + + "tensorflow\x1a*tensorflow/core/framework/attr_value.proto\"\xba\x03\n" + + "\aNodeDef\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x0e\n" + + "\x02op\x18\x02 \x01(\tR\x02op\x12\x14\n" + + "\x05input\x18\x03 \x03(\tR\x05input\x12\x16\n" + + "\x06device\x18\x04 \x01(\tR\x06device\x121\n" + + "\x04attr\x18\x05 \x03(\v2\x1d.tensorflow.NodeDef.AttrEntryR\x04attr\x12a\n" + + "\x17experimental_debug_info\x18\x06 \x01(\v2).tensorflow.NodeDef.ExperimentalDebugInfoR\x15experimentalDebugInfo\x1aN\n" + + "\tAttrEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12+\n" + + "\x05value\x18\x02 \x01(\v2\x15.tensorflow.AttrValueR\x05value:\x028\x01\x1aw\n" + + "\x15ExperimentalDebugInfo\x12.\n" + + "\x13original_node_names\x18\x01 \x03(\tR\x11originalNodeNames\x12.\n" + + "\x13original_func_names\x18\x02 \x03(\tR\x11originalFuncNamesB{\n" + + "\x18org.tensorflow.frameworkB\tNodeProtoP\x01ZOgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/node_def_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_node_def_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_node_def_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_node_def_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_node_def_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_node_def_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_node_def_proto_rawDesc), len(file_tensorflow_core_framework_node_def_proto_rawDesc))) + }) + return file_tensorflow_core_framework_node_def_proto_rawDescData +} + +var file_tensorflow_core_framework_node_def_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_tensorflow_core_framework_node_def_proto_goTypes = []any{ + (*NodeDef)(nil), // 0: tensorflow.NodeDef + nil, // 1: tensorflow.NodeDef.AttrEntry + (*NodeDef_ExperimentalDebugInfo)(nil), // 2: tensorflow.NodeDef.ExperimentalDebugInfo + (*attr_value_go_proto.AttrValue)(nil), // 3: tensorflow.AttrValue +} +var file_tensorflow_core_framework_node_def_proto_depIdxs = []int32{ + 1, // 0: tensorflow.NodeDef.attr:type_name -> tensorflow.NodeDef.AttrEntry + 2, // 1: tensorflow.NodeDef.experimental_debug_info:type_name -> tensorflow.NodeDef.ExperimentalDebugInfo + 3, // 2: tensorflow.NodeDef.AttrEntry.value:type_name -> tensorflow.AttrValue + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_node_def_proto_init() } +func file_tensorflow_core_framework_node_def_proto_init() { + if File_tensorflow_core_framework_node_def_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_node_def_proto_rawDesc), len(file_tensorflow_core_framework_node_def_proto_rawDesc)), + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_node_def_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_node_def_proto_depIdxs, + MessageInfos: file_tensorflow_core_framework_node_def_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_node_def_proto = out.File + file_tensorflow_core_framework_node_def_proto_goTypes = nil + file_tensorflow_core_framework_node_def_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/op_def_go_proto/op_def.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/op_def_go_proto/op_def.pb.go new file mode 100644 index 0000000..a9451ae --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/op_def_go_proto/op_def.pb.go @@ -0,0 +1,623 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/op_def.proto + +package op_def_go_proto + +import ( + attr_value_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/attr_value_go_proto" + types_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/types_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Defines an operation. A NodeDef in a GraphDef specifies an Op by +// using the "op" field which should match the name of a OpDef. +// LINT.IfChange +type OpDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Op names starting with an underscore are reserved for internal use. + // Names should be CamelCase and match the regexp "[A-Z][a-zA-Z0-9>_]*". + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Description of the input(s). + InputArg []*OpDef_ArgDef `protobuf:"bytes,2,rep,name=input_arg,json=inputArg,proto3" json:"input_arg,omitempty"` + // Description of the output(s). + OutputArg []*OpDef_ArgDef `protobuf:"bytes,3,rep,name=output_arg,json=outputArg,proto3" json:"output_arg,omitempty"` + // Named control outputs for this operation. Useful only for composite + // operations (i.e. functions) which want to name different control outputs. + ControlOutput []string `protobuf:"bytes,20,rep,name=control_output,json=controlOutput,proto3" json:"control_output,omitempty"` + Attr []*OpDef_AttrDef `protobuf:"bytes,4,rep,name=attr,proto3" json:"attr,omitempty"` + // Optional deprecation based on GraphDef versions. + Deprecation *OpDeprecation `protobuf:"bytes,8,opt,name=deprecation,proto3" json:"deprecation,omitempty"` + // One-line human-readable description of what the Op does. + Summary string `protobuf:"bytes,5,opt,name=summary,proto3" json:"summary,omitempty"` + // Additional, longer human-readable description of what the Op does. + Description string `protobuf:"bytes,6,opt,name=description,proto3" json:"description,omitempty"` + // True if the operation is commutative ("op(a,b) == op(b,a)" for all inputs) + IsCommutative bool `protobuf:"varint,18,opt,name=is_commutative,json=isCommutative,proto3" json:"is_commutative,omitempty"` + // If is_aggregate is true, then this operation accepts N >= 2 + // inputs and produces 1 output all of the same type. Should be + // associative and commutative, and produce output with the same + // shape as the input. The optimizer may replace an aggregate op + // taking input from multiple devices with a tree of aggregate ops + // that aggregate locally within each device (and possibly within + // groups of nearby devices) before communicating. + // TODO(josh11b): Implement that optimization. + IsAggregate bool `protobuf:"varint,16,opt,name=is_aggregate,json=isAggregate,proto3" json:"is_aggregate,omitempty"` // for things like add + // Ops are marked as stateful if their behavior depends on some state beyond + // their input tensors (e.g. variable reading op) or if they have + // a side-effect (e.g. printing or asserting ops). Equivalently, stateless ops + // must always produce the same output for the same input and have + // no side-effects. + // + // By default Ops may be moved between devices. Stateful ops should + // either not be moved, or should only be moved if that state can also + // be moved (e.g. via some sort of save / restore). + // Stateful ops are guaranteed to never be optimized away by Common + // Subexpression Elimination (CSE). + IsStateful bool `protobuf:"varint,17,opt,name=is_stateful,json=isStateful,proto3" json:"is_stateful,omitempty"` // for things like variables, queue + // By default, all inputs to an Op must be initialized Tensors. Ops + // that may initialize tensors for the first time should set this + // field to true, to allow the Op to take an uninitialized Tensor as + // input. + AllowsUninitializedInput bool `protobuf:"varint,19,opt,name=allows_uninitialized_input,json=allowsUninitializedInput,proto3" json:"allows_uninitialized_input,omitempty"` // for Assign, etc. + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *OpDef) Reset() { + *x = OpDef{} + mi := &file_tensorflow_core_framework_op_def_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *OpDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OpDef) ProtoMessage() {} + +func (x *OpDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_op_def_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OpDef.ProtoReflect.Descriptor instead. +func (*OpDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_op_def_proto_rawDescGZIP(), []int{0} +} + +func (x *OpDef) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *OpDef) GetInputArg() []*OpDef_ArgDef { + if x != nil { + return x.InputArg + } + return nil +} + +func (x *OpDef) GetOutputArg() []*OpDef_ArgDef { + if x != nil { + return x.OutputArg + } + return nil +} + +func (x *OpDef) GetControlOutput() []string { + if x != nil { + return x.ControlOutput + } + return nil +} + +func (x *OpDef) GetAttr() []*OpDef_AttrDef { + if x != nil { + return x.Attr + } + return nil +} + +func (x *OpDef) GetDeprecation() *OpDeprecation { + if x != nil { + return x.Deprecation + } + return nil +} + +func (x *OpDef) GetSummary() string { + if x != nil { + return x.Summary + } + return "" +} + +func (x *OpDef) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *OpDef) GetIsCommutative() bool { + if x != nil { + return x.IsCommutative + } + return false +} + +func (x *OpDef) GetIsAggregate() bool { + if x != nil { + return x.IsAggregate + } + return false +} + +func (x *OpDef) GetIsStateful() bool { + if x != nil { + return x.IsStateful + } + return false +} + +func (x *OpDef) GetAllowsUninitializedInput() bool { + if x != nil { + return x.AllowsUninitializedInput + } + return false +} + +// Information about version-dependent deprecation of an op +type OpDeprecation struct { + state protoimpl.MessageState `protogen:"open.v1"` + // First GraphDef version at which the op is disallowed. + Version int32 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"` + // Explanation of why it was deprecated and what to use instead. + Explanation string `protobuf:"bytes,2,opt,name=explanation,proto3" json:"explanation,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *OpDeprecation) Reset() { + *x = OpDeprecation{} + mi := &file_tensorflow_core_framework_op_def_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *OpDeprecation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OpDeprecation) ProtoMessage() {} + +func (x *OpDeprecation) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_op_def_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OpDeprecation.ProtoReflect.Descriptor instead. +func (*OpDeprecation) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_op_def_proto_rawDescGZIP(), []int{1} +} + +func (x *OpDeprecation) GetVersion() int32 { + if x != nil { + return x.Version + } + return 0 +} + +func (x *OpDeprecation) GetExplanation() string { + if x != nil { + return x.Explanation + } + return "" +} + +// A collection of OpDefs +type OpList struct { + state protoimpl.MessageState `protogen:"open.v1"` + Op []*OpDef `protobuf:"bytes,1,rep,name=op,proto3" json:"op,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *OpList) Reset() { + *x = OpList{} + mi := &file_tensorflow_core_framework_op_def_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *OpList) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OpList) ProtoMessage() {} + +func (x *OpList) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_op_def_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OpList.ProtoReflect.Descriptor instead. +func (*OpList) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_op_def_proto_rawDescGZIP(), []int{2} +} + +func (x *OpList) GetOp() []*OpDef { + if x != nil { + return x.Op + } + return nil +} + +// For describing inputs and outputs. +type OpDef_ArgDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Name for the input/output. Should match the regexp "[a-z][a-z0-9_]*". + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Human readable description. + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + // Describes the type of one or more tensors that are accepted/produced + // by this input/output arg. The only legal combinations are: + // - For a single tensor: either the "type" field is set or the + // "type_attr" field is set to the name of an attr with type "type". + // - For a sequence of tensors with the same type: the "number_attr" + // field will be set to the name of an attr with type "int", and + // either the "type" or "type_attr" field will be set as for + // single tensors. + // - For a sequence of tensors, the "type_list_attr" field will be set + // to the name of an attr with type "list(type)". + Type types_go_proto.DataType `protobuf:"varint,3,opt,name=type,proto3,enum=tensorflow.DataType" json:"type,omitempty"` + TypeAttr string `protobuf:"bytes,4,opt,name=type_attr,json=typeAttr,proto3" json:"type_attr,omitempty"` // if specified, attr must have type "type" + NumberAttr string `protobuf:"bytes,5,opt,name=number_attr,json=numberAttr,proto3" json:"number_attr,omitempty"` // if specified, attr must have type "int" + // If specified, attr must have type "list(type)", and none of + // type, type_attr, and number_attr may be specified. + TypeListAttr string `protobuf:"bytes,6,opt,name=type_list_attr,json=typeListAttr,proto3" json:"type_list_attr,omitempty"` + // For inputs: if true, the inputs are required to be refs. + // + // By default, inputs can be either refs or non-refs. + // + // For outputs: if true, outputs are refs, otherwise they are not. + IsRef bool `protobuf:"varint,16,opt,name=is_ref,json=isRef,proto3" json:"is_ref,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *OpDef_ArgDef) Reset() { + *x = OpDef_ArgDef{} + mi := &file_tensorflow_core_framework_op_def_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *OpDef_ArgDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OpDef_ArgDef) ProtoMessage() {} + +func (x *OpDef_ArgDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_op_def_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OpDef_ArgDef.ProtoReflect.Descriptor instead. +func (*OpDef_ArgDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_op_def_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *OpDef_ArgDef) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *OpDef_ArgDef) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *OpDef_ArgDef) GetType() types_go_proto.DataType { + if x != nil { + return x.Type + } + return types_go_proto.DataType(0) +} + +func (x *OpDef_ArgDef) GetTypeAttr() string { + if x != nil { + return x.TypeAttr + } + return "" +} + +func (x *OpDef_ArgDef) GetNumberAttr() string { + if x != nil { + return x.NumberAttr + } + return "" +} + +func (x *OpDef_ArgDef) GetTypeListAttr() string { + if x != nil { + return x.TypeListAttr + } + return "" +} + +func (x *OpDef_ArgDef) GetIsRef() bool { + if x != nil { + return x.IsRef + } + return false +} + +// Description of the graph-construction-time configuration of this +// Op. That is to say, this describes the attr fields that will +// be specified in the NodeDef. +type OpDef_AttrDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // A descriptive name for the argument. May be used, e.g. by the + // Python client, as a keyword argument name, and so should match + // the regexp "[a-z][a-z0-9_]+". + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // One of the type names from attr_value.proto ("string", "list(string)", + // "int", etc.). + Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` + // A reasonable default for this attribute if the user does not supply + // a value. If not specified, the user must supply a value. + DefaultValue *attr_value_go_proto.AttrValue `protobuf:"bytes,3,opt,name=default_value,json=defaultValue,proto3" json:"default_value,omitempty"` + // Human-readable description. + Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` + // For type == "int", this is a minimum value. For "list(___)" + // types, this is the minimum length. + HasMinimum bool `protobuf:"varint,5,opt,name=has_minimum,json=hasMinimum,proto3" json:"has_minimum,omitempty"` + Minimum int64 `protobuf:"varint,6,opt,name=minimum,proto3" json:"minimum,omitempty"` + // The set of allowed values. Has type that is the "list" version + // of the "type" field above (uses the "list" field of AttrValue). + // If type == "type" or "list(type)" above, then the "type" field + // of "allowed_values.list" has the set of allowed DataTypes. + // If type == "string" or "list(string)", then the "s" field of + // "allowed_values.list" has the set of allowed strings. + AllowedValues *attr_value_go_proto.AttrValue `protobuf:"bytes,7,opt,name=allowed_values,json=allowedValues,proto3" json:"allowed_values,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *OpDef_AttrDef) Reset() { + *x = OpDef_AttrDef{} + mi := &file_tensorflow_core_framework_op_def_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *OpDef_AttrDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OpDef_AttrDef) ProtoMessage() {} + +func (x *OpDef_AttrDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_op_def_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OpDef_AttrDef.ProtoReflect.Descriptor instead. +func (*OpDef_AttrDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_op_def_proto_rawDescGZIP(), []int{0, 1} +} + +func (x *OpDef_AttrDef) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *OpDef_AttrDef) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *OpDef_AttrDef) GetDefaultValue() *attr_value_go_proto.AttrValue { + if x != nil { + return x.DefaultValue + } + return nil +} + +func (x *OpDef_AttrDef) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *OpDef_AttrDef) GetHasMinimum() bool { + if x != nil { + return x.HasMinimum + } + return false +} + +func (x *OpDef_AttrDef) GetMinimum() int64 { + if x != nil { + return x.Minimum + } + return 0 +} + +func (x *OpDef_AttrDef) GetAllowedValues() *attr_value_go_proto.AttrValue { + if x != nil { + return x.AllowedValues + } + return nil +} + +var File_tensorflow_core_framework_op_def_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_op_def_proto_rawDesc = "" + + "\n" + + "&tensorflow/core/framework/op_def.proto\x12\n" + + "tensorflow\x1a*tensorflow/core/framework/attr_value.proto\x1a%tensorflow/core/framework/types.proto\"\xf4\a\n" + + "\x05OpDef\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x125\n" + + "\tinput_arg\x18\x02 \x03(\v2\x18.tensorflow.OpDef.ArgDefR\binputArg\x127\n" + + "\n" + + "output_arg\x18\x03 \x03(\v2\x18.tensorflow.OpDef.ArgDefR\toutputArg\x12%\n" + + "\x0econtrol_output\x18\x14 \x03(\tR\rcontrolOutput\x12-\n" + + "\x04attr\x18\x04 \x03(\v2\x19.tensorflow.OpDef.AttrDefR\x04attr\x12;\n" + + "\vdeprecation\x18\b \x01(\v2\x19.tensorflow.OpDeprecationR\vdeprecation\x12\x18\n" + + "\asummary\x18\x05 \x01(\tR\asummary\x12 \n" + + "\vdescription\x18\x06 \x01(\tR\vdescription\x12%\n" + + "\x0eis_commutative\x18\x12 \x01(\bR\risCommutative\x12!\n" + + "\fis_aggregate\x18\x10 \x01(\bR\visAggregate\x12\x1f\n" + + "\vis_stateful\x18\x11 \x01(\bR\n" + + "isStateful\x12<\n" + + "\x1aallows_uninitialized_input\x18\x13 \x01(\bR\x18allowsUninitializedInput\x1a\xe3\x01\n" + + "\x06ArgDef\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12 \n" + + "\vdescription\x18\x02 \x01(\tR\vdescription\x12(\n" + + "\x04type\x18\x03 \x01(\x0e2\x14.tensorflow.DataTypeR\x04type\x12\x1b\n" + + "\ttype_attr\x18\x04 \x01(\tR\btypeAttr\x12\x1f\n" + + "\vnumber_attr\x18\x05 \x01(\tR\n" + + "numberAttr\x12$\n" + + "\x0etype_list_attr\x18\x06 \x01(\tR\ftypeListAttr\x12\x15\n" + + "\x06is_ref\x18\x10 \x01(\bR\x05isRef\x1a\x88\x02\n" + + "\aAttrDef\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x12\n" + + "\x04type\x18\x02 \x01(\tR\x04type\x12:\n" + + "\rdefault_value\x18\x03 \x01(\v2\x15.tensorflow.AttrValueR\fdefaultValue\x12 \n" + + "\vdescription\x18\x04 \x01(\tR\vdescription\x12\x1f\n" + + "\vhas_minimum\x18\x05 \x01(\bR\n" + + "hasMinimum\x12\x18\n" + + "\aminimum\x18\x06 \x01(\x03R\aminimum\x12<\n" + + "\x0eallowed_values\x18\a \x01(\v2\x15.tensorflow.AttrValueR\rallowedValues\"K\n" + + "\rOpDeprecation\x12\x18\n" + + "\aversion\x18\x01 \x01(\x05R\aversion\x12 \n" + + "\vexplanation\x18\x02 \x01(\tR\vexplanation\"+\n" + + "\x06OpList\x12!\n" + + "\x02op\x18\x01 \x03(\v2\x11.tensorflow.OpDefR\x02opB{\n" + + "\x18org.tensorflow.frameworkB\vOpDefProtosP\x01ZMgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/op_def_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_op_def_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_op_def_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_op_def_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_op_def_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_op_def_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_op_def_proto_rawDesc), len(file_tensorflow_core_framework_op_def_proto_rawDesc))) + }) + return file_tensorflow_core_framework_op_def_proto_rawDescData +} + +var file_tensorflow_core_framework_op_def_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_tensorflow_core_framework_op_def_proto_goTypes = []any{ + (*OpDef)(nil), // 0: tensorflow.OpDef + (*OpDeprecation)(nil), // 1: tensorflow.OpDeprecation + (*OpList)(nil), // 2: tensorflow.OpList + (*OpDef_ArgDef)(nil), // 3: tensorflow.OpDef.ArgDef + (*OpDef_AttrDef)(nil), // 4: tensorflow.OpDef.AttrDef + (types_go_proto.DataType)(0), // 5: tensorflow.DataType + (*attr_value_go_proto.AttrValue)(nil), // 6: tensorflow.AttrValue +} +var file_tensorflow_core_framework_op_def_proto_depIdxs = []int32{ + 3, // 0: tensorflow.OpDef.input_arg:type_name -> tensorflow.OpDef.ArgDef + 3, // 1: tensorflow.OpDef.output_arg:type_name -> tensorflow.OpDef.ArgDef + 4, // 2: tensorflow.OpDef.attr:type_name -> tensorflow.OpDef.AttrDef + 1, // 3: tensorflow.OpDef.deprecation:type_name -> tensorflow.OpDeprecation + 0, // 4: tensorflow.OpList.op:type_name -> tensorflow.OpDef + 5, // 5: tensorflow.OpDef.ArgDef.type:type_name -> tensorflow.DataType + 6, // 6: tensorflow.OpDef.AttrDef.default_value:type_name -> tensorflow.AttrValue + 6, // 7: tensorflow.OpDef.AttrDef.allowed_values:type_name -> tensorflow.AttrValue + 8, // [8:8] is the sub-list for method output_type + 8, // [8:8] is the sub-list for method input_type + 8, // [8:8] is the sub-list for extension type_name + 8, // [8:8] is the sub-list for extension extendee + 0, // [0:8] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_op_def_proto_init() } +func file_tensorflow_core_framework_op_def_proto_init() { + if File_tensorflow_core_framework_op_def_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_op_def_proto_rawDesc), len(file_tensorflow_core_framework_op_def_proto_rawDesc)), + NumEnums: 0, + NumMessages: 5, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_op_def_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_op_def_proto_depIdxs, + MessageInfos: file_tensorflow_core_framework_op_def_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_op_def_proto = out.File + file_tensorflow_core_framework_op_def_proto_goTypes = nil + file_tensorflow_core_framework_op_def_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/reader_base_go_proto/reader_base.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/reader_base_go_proto/reader_base.pb.go new file mode 100644 index 0000000..bcb9559 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/reader_base_go_proto/reader_base.pb.go @@ -0,0 +1,153 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/reader_base.proto + +package reader_base_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// For serializing and restoring the state of ReaderBase, see +// reader_base.h for details. +type ReaderBaseState struct { + state protoimpl.MessageState `protogen:"open.v1"` + WorkStarted int64 `protobuf:"varint,1,opt,name=work_started,json=workStarted,proto3" json:"work_started,omitempty"` + WorkFinished int64 `protobuf:"varint,2,opt,name=work_finished,json=workFinished,proto3" json:"work_finished,omitempty"` + NumRecordsProduced int64 `protobuf:"varint,3,opt,name=num_records_produced,json=numRecordsProduced,proto3" json:"num_records_produced,omitempty"` + CurrentWork []byte `protobuf:"bytes,4,opt,name=current_work,json=currentWork,proto3" json:"current_work,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ReaderBaseState) Reset() { + *x = ReaderBaseState{} + mi := &file_tensorflow_core_framework_reader_base_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ReaderBaseState) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReaderBaseState) ProtoMessage() {} + +func (x *ReaderBaseState) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_reader_base_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReaderBaseState.ProtoReflect.Descriptor instead. +func (*ReaderBaseState) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_reader_base_proto_rawDescGZIP(), []int{0} +} + +func (x *ReaderBaseState) GetWorkStarted() int64 { + if x != nil { + return x.WorkStarted + } + return 0 +} + +func (x *ReaderBaseState) GetWorkFinished() int64 { + if x != nil { + return x.WorkFinished + } + return 0 +} + +func (x *ReaderBaseState) GetNumRecordsProduced() int64 { + if x != nil { + return x.NumRecordsProduced + } + return 0 +} + +func (x *ReaderBaseState) GetCurrentWork() []byte { + if x != nil { + return x.CurrentWork + } + return nil +} + +var File_tensorflow_core_framework_reader_base_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_reader_base_proto_rawDesc = "" + + "\n" + + "+tensorflow/core/framework/reader_base.proto\x12\n" + + "tensorflow\"\xae\x01\n" + + "\x0fReaderBaseState\x12!\n" + + "\fwork_started\x18\x01 \x01(\x03R\vworkStarted\x12#\n" + + "\rwork_finished\x18\x02 \x01(\x03R\fworkFinished\x120\n" + + "\x14num_records_produced\x18\x03 \x01(\x03R\x12numRecordsProduced\x12!\n" + + "\fcurrent_work\x18\x04 \x01(\fR\vcurrentWorkB\x85\x01\n" + + "\x18org.tensorflow.frameworkB\x10ReaderBaseProtosP\x01ZRgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/reader_base_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_reader_base_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_reader_base_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_reader_base_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_reader_base_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_reader_base_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_reader_base_proto_rawDesc), len(file_tensorflow_core_framework_reader_base_proto_rawDesc))) + }) + return file_tensorflow_core_framework_reader_base_proto_rawDescData +} + +var file_tensorflow_core_framework_reader_base_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_tensorflow_core_framework_reader_base_proto_goTypes = []any{ + (*ReaderBaseState)(nil), // 0: tensorflow.ReaderBaseState +} +var file_tensorflow_core_framework_reader_base_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_reader_base_proto_init() } +func file_tensorflow_core_framework_reader_base_proto_init() { + if File_tensorflow_core_framework_reader_base_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_reader_base_proto_rawDesc), len(file_tensorflow_core_framework_reader_base_proto_rawDesc)), + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_reader_base_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_reader_base_proto_depIdxs, + MessageInfos: file_tensorflow_core_framework_reader_base_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_reader_base_proto = out.File + file_tensorflow_core_framework_reader_base_proto_goTypes = nil + file_tensorflow_core_framework_reader_base_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/remote_fused_graph_execute_info_go_proto/remote_fused_graph_execute_info.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/remote_fused_graph_execute_info_go_proto/remote_fused_graph_execute_info.pb.go new file mode 100644 index 0000000..c1773c8 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/remote_fused_graph_execute_info_go_proto/remote_fused_graph_execute_info.pb.go @@ -0,0 +1,259 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/remote_fused_graph_execute_info.proto + +package remote_fused_graph_execute_info_go_proto + +import ( + graph_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/graph_go_proto" + tensor_shape_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_shape_go_proto" + types_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/types_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Protocol buffer representing a handle to a tensorflow resource. Handles are +// not valid across executions, but can be serialized back and forth from within +// a single run. +type RemoteFusedGraphExecuteInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Definition of remote graph + RemoteGraph *graph_go_proto.GraphDef `protobuf:"bytes,1,opt,name=remote_graph,json=remoteGraph,proto3" json:"remote_graph,omitempty"` + // Remote fused graph input node name + GraphInputNodeName []string `protobuf:"bytes,2,rep,name=graph_input_node_name,json=graphInputNodeName,proto3" json:"graph_input_node_name,omitempty"` + // Remote fused graph output node name + GraphOutputNodeName []string `protobuf:"bytes,3,rep,name=graph_output_node_name,json=graphOutputNodeName,proto3" json:"graph_output_node_name,omitempty"` + // Executor's name + ExecutorName string `protobuf:"bytes,4,opt,name=executor_name,json=executorName,proto3" json:"executor_name,omitempty"` + // Optional: Parameters given to the executor + SerializedExecutorParameters []byte `protobuf:"bytes,5,opt,name=serialized_executor_parameters,json=serializedExecutorParameters,proto3" json:"serialized_executor_parameters,omitempty"` + // Optional: Default graph input tensor shape used to allocate memory + // before executing op + DefaultGraphInputTensorShape []*RemoteFusedGraphExecuteInfo_TensorShapeTypeProto `protobuf:"bytes,6,rep,name=default_graph_input_tensor_shape,json=defaultGraphInputTensorShape,proto3" json:"default_graph_input_tensor_shape,omitempty"` + // Optional: Default graph input tensor shape used to allocate memory + // before executing op + // TODO(satok): Remote output tensor shape once shape information is stored + // in NodeDef + DefaultGraphOutputTensorShape []*RemoteFusedGraphExecuteInfo_TensorShapeTypeProto `protobuf:"bytes,7,rep,name=default_graph_output_tensor_shape,json=defaultGraphOutputTensorShape,proto3" json:"default_graph_output_tensor_shape,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RemoteFusedGraphExecuteInfo) Reset() { + *x = RemoteFusedGraphExecuteInfo{} + mi := &file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RemoteFusedGraphExecuteInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoteFusedGraphExecuteInfo) ProtoMessage() {} + +func (x *RemoteFusedGraphExecuteInfo) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RemoteFusedGraphExecuteInfo.ProtoReflect.Descriptor instead. +func (*RemoteFusedGraphExecuteInfo) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_rawDescGZIP(), []int{0} +} + +func (x *RemoteFusedGraphExecuteInfo) GetRemoteGraph() *graph_go_proto.GraphDef { + if x != nil { + return x.RemoteGraph + } + return nil +} + +func (x *RemoteFusedGraphExecuteInfo) GetGraphInputNodeName() []string { + if x != nil { + return x.GraphInputNodeName + } + return nil +} + +func (x *RemoteFusedGraphExecuteInfo) GetGraphOutputNodeName() []string { + if x != nil { + return x.GraphOutputNodeName + } + return nil +} + +func (x *RemoteFusedGraphExecuteInfo) GetExecutorName() string { + if x != nil { + return x.ExecutorName + } + return "" +} + +func (x *RemoteFusedGraphExecuteInfo) GetSerializedExecutorParameters() []byte { + if x != nil { + return x.SerializedExecutorParameters + } + return nil +} + +func (x *RemoteFusedGraphExecuteInfo) GetDefaultGraphInputTensorShape() []*RemoteFusedGraphExecuteInfo_TensorShapeTypeProto { + if x != nil { + return x.DefaultGraphInputTensorShape + } + return nil +} + +func (x *RemoteFusedGraphExecuteInfo) GetDefaultGraphOutputTensorShape() []*RemoteFusedGraphExecuteInfo_TensorShapeTypeProto { + if x != nil { + return x.DefaultGraphOutputTensorShape + } + return nil +} + +type RemoteFusedGraphExecuteInfo_TensorShapeTypeProto struct { + state protoimpl.MessageState `protogen:"open.v1"` + Dtype types_go_proto.DataType `protobuf:"varint,1,opt,name=dtype,proto3,enum=tensorflow.DataType" json:"dtype,omitempty"` + Shape *tensor_shape_go_proto.TensorShapeProto `protobuf:"bytes,2,opt,name=shape,proto3" json:"shape,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RemoteFusedGraphExecuteInfo_TensorShapeTypeProto) Reset() { + *x = RemoteFusedGraphExecuteInfo_TensorShapeTypeProto{} + mi := &file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RemoteFusedGraphExecuteInfo_TensorShapeTypeProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoteFusedGraphExecuteInfo_TensorShapeTypeProto) ProtoMessage() {} + +func (x *RemoteFusedGraphExecuteInfo_TensorShapeTypeProto) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RemoteFusedGraphExecuteInfo_TensorShapeTypeProto.ProtoReflect.Descriptor instead. +func (*RemoteFusedGraphExecuteInfo_TensorShapeTypeProto) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *RemoteFusedGraphExecuteInfo_TensorShapeTypeProto) GetDtype() types_go_proto.DataType { + if x != nil { + return x.Dtype + } + return types_go_proto.DataType(0) +} + +func (x *RemoteFusedGraphExecuteInfo_TensorShapeTypeProto) GetShape() *tensor_shape_go_proto.TensorShapeProto { + if x != nil { + return x.Shape + } + return nil +} + +var File_tensorflow_core_framework_remote_fused_graph_execute_info_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_rawDesc = "" + + "\n" + + "?tensorflow/core/framework/remote_fused_graph_execute_info.proto\x12\n" + + "tensorflow\x1a%tensorflow/core/framework/graph.proto\x1a,tensorflow/core/framework/tensor_shape.proto\x1a%tensorflow/core/framework/types.proto\"\xb1\x05\n" + + "\x1bRemoteFusedGraphExecuteInfo\x127\n" + + "\fremote_graph\x18\x01 \x01(\v2\x14.tensorflow.GraphDefR\vremoteGraph\x121\n" + + "\x15graph_input_node_name\x18\x02 \x03(\tR\x12graphInputNodeName\x123\n" + + "\x16graph_output_node_name\x18\x03 \x03(\tR\x13graphOutputNodeName\x12#\n" + + "\rexecutor_name\x18\x04 \x01(\tR\fexecutorName\x12D\n" + + "\x1eserialized_executor_parameters\x18\x05 \x01(\fR\x1cserializedExecutorParameters\x12\x84\x01\n" + + " default_graph_input_tensor_shape\x18\x06 \x03(\v2<.tensorflow.RemoteFusedGraphExecuteInfo.TensorShapeTypeProtoR\x1cdefaultGraphInputTensorShape\x12\x86\x01\n" + + "!default_graph_output_tensor_shape\x18\a \x03(\v2<.tensorflow.RemoteFusedGraphExecuteInfo.TensorShapeTypeProtoR\x1ddefaultGraphOutputTensorShape\x1av\n" + + "\x14TensorShapeTypeProto\x12*\n" + + "\x05dtype\x18\x01 \x01(\x0e2\x14.tensorflow.DataTypeR\x05dtype\x122\n" + + "\x05shape\x18\x02 \x01(\v2\x1c.tensorflow.TensorShapeProtoR\x05shapeB\xa9\x01\n" + + "\x18org.tensorflow.frameworkB RemoteFusedGraphExecuteInfoProtoP\x01Zfgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/remote_fused_graph_execute_info_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_rawDesc), len(file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_rawDesc))) + }) + return file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_rawDescData +} + +var file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_goTypes = []any{ + (*RemoteFusedGraphExecuteInfo)(nil), // 0: tensorflow.RemoteFusedGraphExecuteInfo + (*RemoteFusedGraphExecuteInfo_TensorShapeTypeProto)(nil), // 1: tensorflow.RemoteFusedGraphExecuteInfo.TensorShapeTypeProto + (*graph_go_proto.GraphDef)(nil), // 2: tensorflow.GraphDef + (types_go_proto.DataType)(0), // 3: tensorflow.DataType + (*tensor_shape_go_proto.TensorShapeProto)(nil), // 4: tensorflow.TensorShapeProto +} +var file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_depIdxs = []int32{ + 2, // 0: tensorflow.RemoteFusedGraphExecuteInfo.remote_graph:type_name -> tensorflow.GraphDef + 1, // 1: tensorflow.RemoteFusedGraphExecuteInfo.default_graph_input_tensor_shape:type_name -> tensorflow.RemoteFusedGraphExecuteInfo.TensorShapeTypeProto + 1, // 2: tensorflow.RemoteFusedGraphExecuteInfo.default_graph_output_tensor_shape:type_name -> tensorflow.RemoteFusedGraphExecuteInfo.TensorShapeTypeProto + 3, // 3: tensorflow.RemoteFusedGraphExecuteInfo.TensorShapeTypeProto.dtype:type_name -> tensorflow.DataType + 4, // 4: tensorflow.RemoteFusedGraphExecuteInfo.TensorShapeTypeProto.shape:type_name -> tensorflow.TensorShapeProto + 5, // [5:5] is the sub-list for method output_type + 5, // [5:5] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_init() } +func file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_init() { + if File_tensorflow_core_framework_remote_fused_graph_execute_info_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_rawDesc), len(file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_rawDesc)), + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_depIdxs, + MessageInfos: file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_remote_fused_graph_execute_info_proto = out.File + file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_goTypes = nil + file_tensorflow_core_framework_remote_fused_graph_execute_info_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/resource_handle_go_proto/resource_handle.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/resource_handle_go_proto/resource_handle.pb.go new file mode 100644 index 0000000..13746ba --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/resource_handle_go_proto/resource_handle.pb.go @@ -0,0 +1,244 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/resource_handle.proto + +package resource_handle_go_proto + +import ( + tensor_shape_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_shape_go_proto" + types_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/types_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Protocol buffer representing a handle to a tensorflow resource. Handles are +// not valid across executions, but can be serialized back and forth from within +// a single run. +type ResourceHandleProto struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Unique name for the device containing the resource. + Device string `protobuf:"bytes,1,opt,name=device,proto3" json:"device,omitempty"` + // Container in which this resource is placed. + Container string `protobuf:"bytes,2,opt,name=container,proto3" json:"container,omitempty"` + // Unique name of this resource. + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + // Hash code for the type of the resource. Is only valid in the same device + // and in the same execution. + HashCode uint64 `protobuf:"varint,4,opt,name=hash_code,json=hashCode,proto3" json:"hash_code,omitempty"` + // For debug-only, the name of the type pointed to by this handle, if + // available. + MaybeTypeName string `protobuf:"bytes,5,opt,name=maybe_type_name,json=maybeTypeName,proto3" json:"maybe_type_name,omitempty"` + // Data types and shapes for the underlying resource. + DtypesAndShapes []*ResourceHandleProto_DtypeAndShape `protobuf:"bytes,6,rep,name=dtypes_and_shapes,json=dtypesAndShapes,proto3" json:"dtypes_and_shapes,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ResourceHandleProto) Reset() { + *x = ResourceHandleProto{} + mi := &file_tensorflow_core_framework_resource_handle_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ResourceHandleProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResourceHandleProto) ProtoMessage() {} + +func (x *ResourceHandleProto) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_resource_handle_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ResourceHandleProto.ProtoReflect.Descriptor instead. +func (*ResourceHandleProto) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_resource_handle_proto_rawDescGZIP(), []int{0} +} + +func (x *ResourceHandleProto) GetDevice() string { + if x != nil { + return x.Device + } + return "" +} + +func (x *ResourceHandleProto) GetContainer() string { + if x != nil { + return x.Container + } + return "" +} + +func (x *ResourceHandleProto) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ResourceHandleProto) GetHashCode() uint64 { + if x != nil { + return x.HashCode + } + return 0 +} + +func (x *ResourceHandleProto) GetMaybeTypeName() string { + if x != nil { + return x.MaybeTypeName + } + return "" +} + +func (x *ResourceHandleProto) GetDtypesAndShapes() []*ResourceHandleProto_DtypeAndShape { + if x != nil { + return x.DtypesAndShapes + } + return nil +} + +// Protocol buffer representing a pair of (data type, tensor shape). +type ResourceHandleProto_DtypeAndShape struct { + state protoimpl.MessageState `protogen:"open.v1"` + Dtype types_go_proto.DataType `protobuf:"varint,1,opt,name=dtype,proto3,enum=tensorflow.DataType" json:"dtype,omitempty"` + Shape *tensor_shape_go_proto.TensorShapeProto `protobuf:"bytes,2,opt,name=shape,proto3" json:"shape,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ResourceHandleProto_DtypeAndShape) Reset() { + *x = ResourceHandleProto_DtypeAndShape{} + mi := &file_tensorflow_core_framework_resource_handle_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ResourceHandleProto_DtypeAndShape) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResourceHandleProto_DtypeAndShape) ProtoMessage() {} + +func (x *ResourceHandleProto_DtypeAndShape) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_resource_handle_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ResourceHandleProto_DtypeAndShape.ProtoReflect.Descriptor instead. +func (*ResourceHandleProto_DtypeAndShape) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_resource_handle_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *ResourceHandleProto_DtypeAndShape) GetDtype() types_go_proto.DataType { + if x != nil { + return x.Dtype + } + return types_go_proto.DataType(0) +} + +func (x *ResourceHandleProto_DtypeAndShape) GetShape() *tensor_shape_go_proto.TensorShapeProto { + if x != nil { + return x.Shape + } + return nil +} + +var File_tensorflow_core_framework_resource_handle_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_resource_handle_proto_rawDesc = "" + + "\n" + + "/tensorflow/core/framework/resource_handle.proto\x12\n" + + "tensorflow\x1a,tensorflow/core/framework/tensor_shape.proto\x1a%tensorflow/core/framework/types.proto\"\xf6\x02\n" + + "\x13ResourceHandleProto\x12\x16\n" + + "\x06device\x18\x01 \x01(\tR\x06device\x12\x1c\n" + + "\tcontainer\x18\x02 \x01(\tR\tcontainer\x12\x12\n" + + "\x04name\x18\x03 \x01(\tR\x04name\x12\x1b\n" + + "\thash_code\x18\x04 \x01(\x04R\bhashCode\x12&\n" + + "\x0fmaybe_type_name\x18\x05 \x01(\tR\rmaybeTypeName\x12Y\n" + + "\x11dtypes_and_shapes\x18\x06 \x03(\v2-.tensorflow.ResourceHandleProto.DtypeAndShapeR\x0fdtypesAndShapes\x1ao\n" + + "\rDtypeAndShape\x12*\n" + + "\x05dtype\x18\x01 \x01(\x0e2\x14.tensorflow.DataTypeR\x05dtype\x122\n" + + "\x05shape\x18\x02 \x01(\v2\x1c.tensorflow.TensorShapeProtoR\x05shapeJ\x04\b\a\x10\bB\x87\x01\n" + + "\x18org.tensorflow.frameworkB\x0eResourceHandleP\x01ZVgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/resource_handle_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_resource_handle_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_resource_handle_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_resource_handle_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_resource_handle_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_resource_handle_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_resource_handle_proto_rawDesc), len(file_tensorflow_core_framework_resource_handle_proto_rawDesc))) + }) + return file_tensorflow_core_framework_resource_handle_proto_rawDescData +} + +var file_tensorflow_core_framework_resource_handle_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_tensorflow_core_framework_resource_handle_proto_goTypes = []any{ + (*ResourceHandleProto)(nil), // 0: tensorflow.ResourceHandleProto + (*ResourceHandleProto_DtypeAndShape)(nil), // 1: tensorflow.ResourceHandleProto.DtypeAndShape + (types_go_proto.DataType)(0), // 2: tensorflow.DataType + (*tensor_shape_go_proto.TensorShapeProto)(nil), // 3: tensorflow.TensorShapeProto +} +var file_tensorflow_core_framework_resource_handle_proto_depIdxs = []int32{ + 1, // 0: tensorflow.ResourceHandleProto.dtypes_and_shapes:type_name -> tensorflow.ResourceHandleProto.DtypeAndShape + 2, // 1: tensorflow.ResourceHandleProto.DtypeAndShape.dtype:type_name -> tensorflow.DataType + 3, // 2: tensorflow.ResourceHandleProto.DtypeAndShape.shape:type_name -> tensorflow.TensorShapeProto + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_resource_handle_proto_init() } +func file_tensorflow_core_framework_resource_handle_proto_init() { + if File_tensorflow_core_framework_resource_handle_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_resource_handle_proto_rawDesc), len(file_tensorflow_core_framework_resource_handle_proto_rawDesc)), + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_resource_handle_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_resource_handle_proto_depIdxs, + MessageInfos: file_tensorflow_core_framework_resource_handle_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_resource_handle_proto = out.File + file_tensorflow_core_framework_resource_handle_proto_goTypes = nil + file_tensorflow_core_framework_resource_handle_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/step_stats_go_proto/step_stats.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/step_stats_go_proto/step_stats.pb.go new file mode 100644 index 0000000..aded855 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/step_stats_go_proto/step_stats.pb.go @@ -0,0 +1,722 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/step_stats.proto + +package step_stats_go_proto + +import ( + allocation_description_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/allocation_description_go_proto" + tensor_description_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_description_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// An allocation/de-allocation operation performed by the allocator. +type AllocationRecord struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The timestamp of the operation. + AllocMicros int64 `protobuf:"varint,1,opt,name=alloc_micros,json=allocMicros,proto3" json:"alloc_micros,omitempty"` + // Number of bytes allocated, or de-allocated if negative. + AllocBytes int64 `protobuf:"varint,2,opt,name=alloc_bytes,json=allocBytes,proto3" json:"alloc_bytes,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AllocationRecord) Reset() { + *x = AllocationRecord{} + mi := &file_tensorflow_core_framework_step_stats_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AllocationRecord) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AllocationRecord) ProtoMessage() {} + +func (x *AllocationRecord) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_step_stats_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AllocationRecord.ProtoReflect.Descriptor instead. +func (*AllocationRecord) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_step_stats_proto_rawDescGZIP(), []int{0} +} + +func (x *AllocationRecord) GetAllocMicros() int64 { + if x != nil { + return x.AllocMicros + } + return 0 +} + +func (x *AllocationRecord) GetAllocBytes() int64 { + if x != nil { + return x.AllocBytes + } + return 0 +} + +type AllocatorMemoryUsed struct { + state protoimpl.MessageState `protogen:"open.v1"` + AllocatorName string `protobuf:"bytes,1,opt,name=allocator_name,json=allocatorName,proto3" json:"allocator_name,omitempty"` + // These are per-node allocator memory stats. + TotalBytes int64 `protobuf:"varint,2,opt,name=total_bytes,json=totalBytes,proto3" json:"total_bytes,omitempty"` + PeakBytes int64 `protobuf:"varint,3,opt,name=peak_bytes,json=peakBytes,proto3" json:"peak_bytes,omitempty"` + // The bytes that are not deallocated. + LiveBytes int64 `protobuf:"varint,4,opt,name=live_bytes,json=liveBytes,proto3" json:"live_bytes,omitempty"` + // The allocation and deallocation timeline. + AllocationRecords []*AllocationRecord `protobuf:"bytes,6,rep,name=allocation_records,json=allocationRecords,proto3" json:"allocation_records,omitempty"` + // These are snapshots of the overall allocator memory stats. + // The number of live bytes currently allocated by the allocator. + AllocatorBytesInUse int64 `protobuf:"varint,5,opt,name=allocator_bytes_in_use,json=allocatorBytesInUse,proto3" json:"allocator_bytes_in_use,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AllocatorMemoryUsed) Reset() { + *x = AllocatorMemoryUsed{} + mi := &file_tensorflow_core_framework_step_stats_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AllocatorMemoryUsed) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AllocatorMemoryUsed) ProtoMessage() {} + +func (x *AllocatorMemoryUsed) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_step_stats_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AllocatorMemoryUsed.ProtoReflect.Descriptor instead. +func (*AllocatorMemoryUsed) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_step_stats_proto_rawDescGZIP(), []int{1} +} + +func (x *AllocatorMemoryUsed) GetAllocatorName() string { + if x != nil { + return x.AllocatorName + } + return "" +} + +func (x *AllocatorMemoryUsed) GetTotalBytes() int64 { + if x != nil { + return x.TotalBytes + } + return 0 +} + +func (x *AllocatorMemoryUsed) GetPeakBytes() int64 { + if x != nil { + return x.PeakBytes + } + return 0 +} + +func (x *AllocatorMemoryUsed) GetLiveBytes() int64 { + if x != nil { + return x.LiveBytes + } + return 0 +} + +func (x *AllocatorMemoryUsed) GetAllocationRecords() []*AllocationRecord { + if x != nil { + return x.AllocationRecords + } + return nil +} + +func (x *AllocatorMemoryUsed) GetAllocatorBytesInUse() int64 { + if x != nil { + return x.AllocatorBytesInUse + } + return 0 +} + +// Output sizes recorded for a single execution of a graph node. +type NodeOutput struct { + state protoimpl.MessageState `protogen:"open.v1"` + Slot int32 `protobuf:"varint,1,opt,name=slot,proto3" json:"slot,omitempty"` + TensorDescription *tensor_description_go_proto.TensorDescription `protobuf:"bytes,3,opt,name=tensor_description,json=tensorDescription,proto3" json:"tensor_description,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NodeOutput) Reset() { + *x = NodeOutput{} + mi := &file_tensorflow_core_framework_step_stats_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NodeOutput) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NodeOutput) ProtoMessage() {} + +func (x *NodeOutput) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_step_stats_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NodeOutput.ProtoReflect.Descriptor instead. +func (*NodeOutput) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_step_stats_proto_rawDescGZIP(), []int{2} +} + +func (x *NodeOutput) GetSlot() int32 { + if x != nil { + return x.Slot + } + return 0 +} + +func (x *NodeOutput) GetTensorDescription() *tensor_description_go_proto.TensorDescription { + if x != nil { + return x.TensorDescription + } + return nil +} + +// For memory tracking. +type MemoryStats struct { + state protoimpl.MessageState `protogen:"open.v1"` + TempMemorySize int64 `protobuf:"varint,1,opt,name=temp_memory_size,json=tempMemorySize,proto3" json:"temp_memory_size,omitempty"` + PersistentMemorySize int64 `protobuf:"varint,3,opt,name=persistent_memory_size,json=persistentMemorySize,proto3" json:"persistent_memory_size,omitempty"` + PersistentTensorAllocIds []int64 `protobuf:"varint,5,rep,packed,name=persistent_tensor_alloc_ids,json=persistentTensorAllocIds,proto3" json:"persistent_tensor_alloc_ids,omitempty"` + // Deprecated: Marked as deprecated in tensorflow/core/framework/step_stats.proto. + DeviceTempMemorySize int64 `protobuf:"varint,2,opt,name=device_temp_memory_size,json=deviceTempMemorySize,proto3" json:"device_temp_memory_size,omitempty"` + // Deprecated: Marked as deprecated in tensorflow/core/framework/step_stats.proto. + DevicePersistentMemorySize int64 `protobuf:"varint,4,opt,name=device_persistent_memory_size,json=devicePersistentMemorySize,proto3" json:"device_persistent_memory_size,omitempty"` + // Deprecated: Marked as deprecated in tensorflow/core/framework/step_stats.proto. + DevicePersistentTensorAllocIds []int64 `protobuf:"varint,6,rep,packed,name=device_persistent_tensor_alloc_ids,json=devicePersistentTensorAllocIds,proto3" json:"device_persistent_tensor_alloc_ids,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MemoryStats) Reset() { + *x = MemoryStats{} + mi := &file_tensorflow_core_framework_step_stats_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MemoryStats) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MemoryStats) ProtoMessage() {} + +func (x *MemoryStats) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_step_stats_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MemoryStats.ProtoReflect.Descriptor instead. +func (*MemoryStats) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_step_stats_proto_rawDescGZIP(), []int{3} +} + +func (x *MemoryStats) GetTempMemorySize() int64 { + if x != nil { + return x.TempMemorySize + } + return 0 +} + +func (x *MemoryStats) GetPersistentMemorySize() int64 { + if x != nil { + return x.PersistentMemorySize + } + return 0 +} + +func (x *MemoryStats) GetPersistentTensorAllocIds() []int64 { + if x != nil { + return x.PersistentTensorAllocIds + } + return nil +} + +// Deprecated: Marked as deprecated in tensorflow/core/framework/step_stats.proto. +func (x *MemoryStats) GetDeviceTempMemorySize() int64 { + if x != nil { + return x.DeviceTempMemorySize + } + return 0 +} + +// Deprecated: Marked as deprecated in tensorflow/core/framework/step_stats.proto. +func (x *MemoryStats) GetDevicePersistentMemorySize() int64 { + if x != nil { + return x.DevicePersistentMemorySize + } + return 0 +} + +// Deprecated: Marked as deprecated in tensorflow/core/framework/step_stats.proto. +func (x *MemoryStats) GetDevicePersistentTensorAllocIds() []int64 { + if x != nil { + return x.DevicePersistentTensorAllocIds + } + return nil +} + +// Time/size stats recorded for a single execution of a graph node. +type NodeExecStats struct { + state protoimpl.MessageState `protogen:"open.v1"` + // TODO(tucker): Use some more compact form of node identity than + // the full string name. Either all processes should agree on a + // global id (cost_id?) for each node, or we should use a hash of + // the name. + NodeName string `protobuf:"bytes,1,opt,name=node_name,json=nodeName,proto3" json:"node_name,omitempty"` + AllStartMicros int64 `protobuf:"varint,2,opt,name=all_start_micros,json=allStartMicros,proto3" json:"all_start_micros,omitempty"` + OpStartRelMicros int64 `protobuf:"varint,3,opt,name=op_start_rel_micros,json=opStartRelMicros,proto3" json:"op_start_rel_micros,omitempty"` + OpEndRelMicros int64 `protobuf:"varint,4,opt,name=op_end_rel_micros,json=opEndRelMicros,proto3" json:"op_end_rel_micros,omitempty"` + AllEndRelMicros int64 `protobuf:"varint,5,opt,name=all_end_rel_micros,json=allEndRelMicros,proto3" json:"all_end_rel_micros,omitempty"` + Memory []*AllocatorMemoryUsed `protobuf:"bytes,6,rep,name=memory,proto3" json:"memory,omitempty"` + Output []*NodeOutput `protobuf:"bytes,7,rep,name=output,proto3" json:"output,omitempty"` + TimelineLabel string `protobuf:"bytes,8,opt,name=timeline_label,json=timelineLabel,proto3" json:"timeline_label,omitempty"` + ScheduledMicros int64 `protobuf:"varint,9,opt,name=scheduled_micros,json=scheduledMicros,proto3" json:"scheduled_micros,omitempty"` + ThreadId uint32 `protobuf:"varint,10,opt,name=thread_id,json=threadId,proto3" json:"thread_id,omitempty"` + ReferencedTensor []*allocation_description_go_proto.AllocationDescription `protobuf:"bytes,11,rep,name=referenced_tensor,json=referencedTensor,proto3" json:"referenced_tensor,omitempty"` + MemoryStats *MemoryStats `protobuf:"bytes,12,opt,name=memory_stats,json=memoryStats,proto3" json:"memory_stats,omitempty"` + AllStartNanos int64 `protobuf:"varint,13,opt,name=all_start_nanos,json=allStartNanos,proto3" json:"all_start_nanos,omitempty"` + OpStartRelNanos int64 `protobuf:"varint,14,opt,name=op_start_rel_nanos,json=opStartRelNanos,proto3" json:"op_start_rel_nanos,omitempty"` + OpEndRelNanos int64 `protobuf:"varint,15,opt,name=op_end_rel_nanos,json=opEndRelNanos,proto3" json:"op_end_rel_nanos,omitempty"` + AllEndRelNanos int64 `protobuf:"varint,16,opt,name=all_end_rel_nanos,json=allEndRelNanos,proto3" json:"all_end_rel_nanos,omitempty"` + ScheduledNanos int64 `protobuf:"varint,17,opt,name=scheduled_nanos,json=scheduledNanos,proto3" json:"scheduled_nanos,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NodeExecStats) Reset() { + *x = NodeExecStats{} + mi := &file_tensorflow_core_framework_step_stats_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NodeExecStats) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NodeExecStats) ProtoMessage() {} + +func (x *NodeExecStats) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_step_stats_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NodeExecStats.ProtoReflect.Descriptor instead. +func (*NodeExecStats) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_step_stats_proto_rawDescGZIP(), []int{4} +} + +func (x *NodeExecStats) GetNodeName() string { + if x != nil { + return x.NodeName + } + return "" +} + +func (x *NodeExecStats) GetAllStartMicros() int64 { + if x != nil { + return x.AllStartMicros + } + return 0 +} + +func (x *NodeExecStats) GetOpStartRelMicros() int64 { + if x != nil { + return x.OpStartRelMicros + } + return 0 +} + +func (x *NodeExecStats) GetOpEndRelMicros() int64 { + if x != nil { + return x.OpEndRelMicros + } + return 0 +} + +func (x *NodeExecStats) GetAllEndRelMicros() int64 { + if x != nil { + return x.AllEndRelMicros + } + return 0 +} + +func (x *NodeExecStats) GetMemory() []*AllocatorMemoryUsed { + if x != nil { + return x.Memory + } + return nil +} + +func (x *NodeExecStats) GetOutput() []*NodeOutput { + if x != nil { + return x.Output + } + return nil +} + +func (x *NodeExecStats) GetTimelineLabel() string { + if x != nil { + return x.TimelineLabel + } + return "" +} + +func (x *NodeExecStats) GetScheduledMicros() int64 { + if x != nil { + return x.ScheduledMicros + } + return 0 +} + +func (x *NodeExecStats) GetThreadId() uint32 { + if x != nil { + return x.ThreadId + } + return 0 +} + +func (x *NodeExecStats) GetReferencedTensor() []*allocation_description_go_proto.AllocationDescription { + if x != nil { + return x.ReferencedTensor + } + return nil +} + +func (x *NodeExecStats) GetMemoryStats() *MemoryStats { + if x != nil { + return x.MemoryStats + } + return nil +} + +func (x *NodeExecStats) GetAllStartNanos() int64 { + if x != nil { + return x.AllStartNanos + } + return 0 +} + +func (x *NodeExecStats) GetOpStartRelNanos() int64 { + if x != nil { + return x.OpStartRelNanos + } + return 0 +} + +func (x *NodeExecStats) GetOpEndRelNanos() int64 { + if x != nil { + return x.OpEndRelNanos + } + return 0 +} + +func (x *NodeExecStats) GetAllEndRelNanos() int64 { + if x != nil { + return x.AllEndRelNanos + } + return 0 +} + +func (x *NodeExecStats) GetScheduledNanos() int64 { + if x != nil { + return x.ScheduledNanos + } + return 0 +} + +type DeviceStepStats struct { + state protoimpl.MessageState `protogen:"open.v1"` + Device string `protobuf:"bytes,1,opt,name=device,proto3" json:"device,omitempty"` + NodeStats []*NodeExecStats `protobuf:"bytes,2,rep,name=node_stats,json=nodeStats,proto3" json:"node_stats,omitempty"` + // Its key is thread id. + ThreadNames map[uint32]string `protobuf:"bytes,3,rep,name=thread_names,json=threadNames,proto3" json:"thread_names,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeviceStepStats) Reset() { + *x = DeviceStepStats{} + mi := &file_tensorflow_core_framework_step_stats_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeviceStepStats) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeviceStepStats) ProtoMessage() {} + +func (x *DeviceStepStats) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_step_stats_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeviceStepStats.ProtoReflect.Descriptor instead. +func (*DeviceStepStats) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_step_stats_proto_rawDescGZIP(), []int{5} +} + +func (x *DeviceStepStats) GetDevice() string { + if x != nil { + return x.Device + } + return "" +} + +func (x *DeviceStepStats) GetNodeStats() []*NodeExecStats { + if x != nil { + return x.NodeStats + } + return nil +} + +func (x *DeviceStepStats) GetThreadNames() map[uint32]string { + if x != nil { + return x.ThreadNames + } + return nil +} + +type StepStats struct { + state protoimpl.MessageState `protogen:"open.v1"` + DevStats []*DeviceStepStats `protobuf:"bytes,1,rep,name=dev_stats,json=devStats,proto3" json:"dev_stats,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *StepStats) Reset() { + *x = StepStats{} + mi := &file_tensorflow_core_framework_step_stats_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *StepStats) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StepStats) ProtoMessage() {} + +func (x *StepStats) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_step_stats_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StepStats.ProtoReflect.Descriptor instead. +func (*StepStats) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_step_stats_proto_rawDescGZIP(), []int{6} +} + +func (x *StepStats) GetDevStats() []*DeviceStepStats { + if x != nil { + return x.DevStats + } + return nil +} + +var File_tensorflow_core_framework_step_stats_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_step_stats_proto_rawDesc = "" + + "\n" + + "*tensorflow/core/framework/step_stats.proto\x12\n" + + "tensorflow\x1a6tensorflow/core/framework/allocation_description.proto\x1a2tensorflow/core/framework/tensor_description.proto\"V\n" + + "\x10AllocationRecord\x12!\n" + + "\falloc_micros\x18\x01 \x01(\x03R\vallocMicros\x12\x1f\n" + + "\valloc_bytes\x18\x02 \x01(\x03R\n" + + "allocBytes\"\x9d\x02\n" + + "\x13AllocatorMemoryUsed\x12%\n" + + "\x0eallocator_name\x18\x01 \x01(\tR\rallocatorName\x12\x1f\n" + + "\vtotal_bytes\x18\x02 \x01(\x03R\n" + + "totalBytes\x12\x1d\n" + + "\n" + + "peak_bytes\x18\x03 \x01(\x03R\tpeakBytes\x12\x1d\n" + + "\n" + + "live_bytes\x18\x04 \x01(\x03R\tliveBytes\x12K\n" + + "\x12allocation_records\x18\x06 \x03(\v2\x1c.tensorflow.AllocationRecordR\x11allocationRecords\x123\n" + + "\x16allocator_bytes_in_use\x18\x05 \x01(\x03R\x13allocatorBytesInUse\"n\n" + + "\n" + + "NodeOutput\x12\x12\n" + + "\x04slot\x18\x01 \x01(\x05R\x04slot\x12L\n" + + "\x12tensor_description\x18\x03 \x01(\v2\x1d.tensorflow.TensorDescriptionR\x11tensorDescription\"\xfe\x02\n" + + "\vMemoryStats\x12(\n" + + "\x10temp_memory_size\x18\x01 \x01(\x03R\x0etempMemorySize\x124\n" + + "\x16persistent_memory_size\x18\x03 \x01(\x03R\x14persistentMemorySize\x12=\n" + + "\x1bpersistent_tensor_alloc_ids\x18\x05 \x03(\x03R\x18persistentTensorAllocIds\x129\n" + + "\x17device_temp_memory_size\x18\x02 \x01(\x03B\x02\x18\x01R\x14deviceTempMemorySize\x12E\n" + + "\x1ddevice_persistent_memory_size\x18\x04 \x01(\x03B\x02\x18\x01R\x1adevicePersistentMemorySize\x12N\n" + + "\"device_persistent_tensor_alloc_ids\x18\x06 \x03(\x03B\x02\x18\x01R\x1edevicePersistentTensorAllocIds\"\x93\x06\n" + + "\rNodeExecStats\x12\x1b\n" + + "\tnode_name\x18\x01 \x01(\tR\bnodeName\x12(\n" + + "\x10all_start_micros\x18\x02 \x01(\x03R\x0eallStartMicros\x12-\n" + + "\x13op_start_rel_micros\x18\x03 \x01(\x03R\x10opStartRelMicros\x12)\n" + + "\x11op_end_rel_micros\x18\x04 \x01(\x03R\x0eopEndRelMicros\x12+\n" + + "\x12all_end_rel_micros\x18\x05 \x01(\x03R\x0fallEndRelMicros\x127\n" + + "\x06memory\x18\x06 \x03(\v2\x1f.tensorflow.AllocatorMemoryUsedR\x06memory\x12.\n" + + "\x06output\x18\a \x03(\v2\x16.tensorflow.NodeOutputR\x06output\x12%\n" + + "\x0etimeline_label\x18\b \x01(\tR\rtimelineLabel\x12)\n" + + "\x10scheduled_micros\x18\t \x01(\x03R\x0fscheduledMicros\x12\x1b\n" + + "\tthread_id\x18\n" + + " \x01(\rR\bthreadId\x12N\n" + + "\x11referenced_tensor\x18\v \x03(\v2!.tensorflow.AllocationDescriptionR\x10referencedTensor\x12:\n" + + "\fmemory_stats\x18\f \x01(\v2\x17.tensorflow.MemoryStatsR\vmemoryStats\x12&\n" + + "\x0fall_start_nanos\x18\r \x01(\x03R\rallStartNanos\x12+\n" + + "\x12op_start_rel_nanos\x18\x0e \x01(\x03R\x0fopStartRelNanos\x12'\n" + + "\x10op_end_rel_nanos\x18\x0f \x01(\x03R\ropEndRelNanos\x12)\n" + + "\x11all_end_rel_nanos\x18\x10 \x01(\x03R\x0eallEndRelNanos\x12'\n" + + "\x0fscheduled_nanos\x18\x11 \x01(\x03R\x0escheduledNanos\"\xf4\x01\n" + + "\x0fDeviceStepStats\x12\x16\n" + + "\x06device\x18\x01 \x01(\tR\x06device\x128\n" + + "\n" + + "node_stats\x18\x02 \x03(\v2\x19.tensorflow.NodeExecStatsR\tnodeStats\x12O\n" + + "\fthread_names\x18\x03 \x03(\v2,.tensorflow.DeviceStepStats.ThreadNamesEntryR\vthreadNames\x1a>\n" + + "\x10ThreadNamesEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\rR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"E\n" + + "\tStepStats\x128\n" + + "\tdev_stats\x18\x01 \x03(\v2\x1b.tensorflow.DeviceStepStatsR\bdevStatsB\x83\x01\n" + + "\x18org.tensorflow.frameworkB\x0fStepStatsProtosP\x01ZQgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/step_stats_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_step_stats_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_step_stats_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_step_stats_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_step_stats_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_step_stats_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_step_stats_proto_rawDesc), len(file_tensorflow_core_framework_step_stats_proto_rawDesc))) + }) + return file_tensorflow_core_framework_step_stats_proto_rawDescData +} + +var file_tensorflow_core_framework_step_stats_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_tensorflow_core_framework_step_stats_proto_goTypes = []any{ + (*AllocationRecord)(nil), // 0: tensorflow.AllocationRecord + (*AllocatorMemoryUsed)(nil), // 1: tensorflow.AllocatorMemoryUsed + (*NodeOutput)(nil), // 2: tensorflow.NodeOutput + (*MemoryStats)(nil), // 3: tensorflow.MemoryStats + (*NodeExecStats)(nil), // 4: tensorflow.NodeExecStats + (*DeviceStepStats)(nil), // 5: tensorflow.DeviceStepStats + (*StepStats)(nil), // 6: tensorflow.StepStats + nil, // 7: tensorflow.DeviceStepStats.ThreadNamesEntry + (*tensor_description_go_proto.TensorDescription)(nil), // 8: tensorflow.TensorDescription + (*allocation_description_go_proto.AllocationDescription)(nil), // 9: tensorflow.AllocationDescription +} +var file_tensorflow_core_framework_step_stats_proto_depIdxs = []int32{ + 0, // 0: tensorflow.AllocatorMemoryUsed.allocation_records:type_name -> tensorflow.AllocationRecord + 8, // 1: tensorflow.NodeOutput.tensor_description:type_name -> tensorflow.TensorDescription + 1, // 2: tensorflow.NodeExecStats.memory:type_name -> tensorflow.AllocatorMemoryUsed + 2, // 3: tensorflow.NodeExecStats.output:type_name -> tensorflow.NodeOutput + 9, // 4: tensorflow.NodeExecStats.referenced_tensor:type_name -> tensorflow.AllocationDescription + 3, // 5: tensorflow.NodeExecStats.memory_stats:type_name -> tensorflow.MemoryStats + 4, // 6: tensorflow.DeviceStepStats.node_stats:type_name -> tensorflow.NodeExecStats + 7, // 7: tensorflow.DeviceStepStats.thread_names:type_name -> tensorflow.DeviceStepStats.ThreadNamesEntry + 5, // 8: tensorflow.StepStats.dev_stats:type_name -> tensorflow.DeviceStepStats + 9, // [9:9] is the sub-list for method output_type + 9, // [9:9] is the sub-list for method input_type + 9, // [9:9] is the sub-list for extension type_name + 9, // [9:9] is the sub-list for extension extendee + 0, // [0:9] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_step_stats_proto_init() } +func file_tensorflow_core_framework_step_stats_proto_init() { + if File_tensorflow_core_framework_step_stats_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_step_stats_proto_rawDesc), len(file_tensorflow_core_framework_step_stats_proto_rawDesc)), + NumEnums: 0, + NumMessages: 8, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_step_stats_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_step_stats_proto_depIdxs, + MessageInfos: file_tensorflow_core_framework_step_stats_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_step_stats_proto = out.File + file_tensorflow_core_framework_step_stats_proto_goTypes = nil + file_tensorflow_core_framework_step_stats_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/summary_go_proto/summary.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/summary_go_proto/summary.pb.go new file mode 100644 index 0000000..3619ae0 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/summary_go_proto/summary.pb.go @@ -0,0 +1,895 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/summary.proto + +package summary_go_proto + +import ( + tensor_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type DataClass int32 + +const ( + // Unknown data class, used (implicitly) for legacy data. Will not be + // processed by data ingestion pipelines. + DataClass_DATA_CLASS_UNKNOWN DataClass = 0 + // Scalar time series. Each `Value` for the corresponding tag must have + // `tensor` set to a rank-0 tensor of floating-point dtype, which will be + // converted to float64. + DataClass_DATA_CLASS_SCALAR DataClass = 1 + // Tensor time series. Each `Value` for the corresponding tag must have + // `tensor` set. The tensor value is arbitrary, but should be small to + // accommodate direct storage in database backends: an upper bound of a few + // kilobytes is a reasonable rule of thumb. + DataClass_DATA_CLASS_TENSOR DataClass = 2 + // Blob sequence time series. Each `Value` for the corresponding tag must + // have `tensor` set to a rank-1 tensor of bytestring dtype. + DataClass_DATA_CLASS_BLOB_SEQUENCE DataClass = 3 +) + +// Enum value maps for DataClass. +var ( + DataClass_name = map[int32]string{ + 0: "DATA_CLASS_UNKNOWN", + 1: "DATA_CLASS_SCALAR", + 2: "DATA_CLASS_TENSOR", + 3: "DATA_CLASS_BLOB_SEQUENCE", + } + DataClass_value = map[string]int32{ + "DATA_CLASS_UNKNOWN": 0, + "DATA_CLASS_SCALAR": 1, + "DATA_CLASS_TENSOR": 2, + "DATA_CLASS_BLOB_SEQUENCE": 3, + } +) + +func (x DataClass) Enum() *DataClass { + p := new(DataClass) + *p = x + return p +} + +func (x DataClass) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (DataClass) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_framework_summary_proto_enumTypes[0].Descriptor() +} + +func (DataClass) Type() protoreflect.EnumType { + return &file_tensorflow_core_framework_summary_proto_enumTypes[0] +} + +func (x DataClass) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use DataClass.Descriptor instead. +func (DataClass) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_framework_summary_proto_rawDescGZIP(), []int{0} +} + +// Metadata associated with a series of Summary data +type SummaryDescription struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Hint on how plugins should process the data in this series. + // Supported values include "scalar", "histogram", "image", "audio" + TypeHint string `protobuf:"bytes,1,opt,name=type_hint,json=typeHint,proto3" json:"type_hint,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SummaryDescription) Reset() { + *x = SummaryDescription{} + mi := &file_tensorflow_core_framework_summary_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SummaryDescription) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SummaryDescription) ProtoMessage() {} + +func (x *SummaryDescription) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_summary_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SummaryDescription.ProtoReflect.Descriptor instead. +func (*SummaryDescription) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_summary_proto_rawDescGZIP(), []int{0} +} + +func (x *SummaryDescription) GetTypeHint() string { + if x != nil { + return x.TypeHint + } + return "" +} + +// Serialization format for histogram module in +// core/lib/histogram/histogram.h +type HistogramProto struct { + state protoimpl.MessageState `protogen:"open.v1"` + Min float64 `protobuf:"fixed64,1,opt,name=min,proto3" json:"min,omitempty"` + Max float64 `protobuf:"fixed64,2,opt,name=max,proto3" json:"max,omitempty"` + Num float64 `protobuf:"fixed64,3,opt,name=num,proto3" json:"num,omitempty"` + Sum float64 `protobuf:"fixed64,4,opt,name=sum,proto3" json:"sum,omitempty"` + SumSquares float64 `protobuf:"fixed64,5,opt,name=sum_squares,json=sumSquares,proto3" json:"sum_squares,omitempty"` + // 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) + BucketLimit []float64 `protobuf:"fixed64,6,rep,packed,name=bucket_limit,json=bucketLimit,proto3" json:"bucket_limit,omitempty"` + Bucket []float64 `protobuf:"fixed64,7,rep,packed,name=bucket,proto3" json:"bucket,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HistogramProto) Reset() { + *x = HistogramProto{} + mi := &file_tensorflow_core_framework_summary_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HistogramProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HistogramProto) ProtoMessage() {} + +func (x *HistogramProto) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_summary_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HistogramProto.ProtoReflect.Descriptor instead. +func (*HistogramProto) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_summary_proto_rawDescGZIP(), []int{1} +} + +func (x *HistogramProto) GetMin() float64 { + if x != nil { + return x.Min + } + return 0 +} + +func (x *HistogramProto) GetMax() float64 { + if x != nil { + return x.Max + } + return 0 +} + +func (x *HistogramProto) GetNum() float64 { + if x != nil { + return x.Num + } + return 0 +} + +func (x *HistogramProto) GetSum() float64 { + if x != nil { + return x.Sum + } + return 0 +} + +func (x *HistogramProto) GetSumSquares() float64 { + if x != nil { + return x.SumSquares + } + return 0 +} + +func (x *HistogramProto) GetBucketLimit() []float64 { + if x != nil { + return x.BucketLimit + } + return nil +} + +func (x *HistogramProto) GetBucket() []float64 { + if x != nil { + return x.Bucket + } + return nil +} + +// A SummaryMetadata encapsulates information on which plugins are able to make +// use of a certain summary value. +type SummaryMetadata struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Data that associates a summary with a certain plugin. + PluginData *SummaryMetadata_PluginData `protobuf:"bytes,1,opt,name=plugin_data,json=pluginData,proto3" json:"plugin_data,omitempty"` + // Display name for viewing in TensorBoard. + DisplayName string `protobuf:"bytes,2,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` + // Longform readable description of the summary sequence. Markdown supported. + SummaryDescription string `protobuf:"bytes,3,opt,name=summary_description,json=summaryDescription,proto3" json:"summary_description,omitempty"` + // Class of data stored in this time series. Required for compatibility with + // TensorBoard's generic data facilities (`DataProvider`, et al.). This value + // imposes constraints on the dtype and shape of the corresponding tensor + // values. See `DataClass` docs for details. + DataClass DataClass `protobuf:"varint,4,opt,name=data_class,json=dataClass,proto3,enum=tensorflow.DataClass" json:"data_class,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SummaryMetadata) Reset() { + *x = SummaryMetadata{} + mi := &file_tensorflow_core_framework_summary_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SummaryMetadata) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SummaryMetadata) ProtoMessage() {} + +func (x *SummaryMetadata) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_summary_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SummaryMetadata.ProtoReflect.Descriptor instead. +func (*SummaryMetadata) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_summary_proto_rawDescGZIP(), []int{2} +} + +func (x *SummaryMetadata) GetPluginData() *SummaryMetadata_PluginData { + if x != nil { + return x.PluginData + } + return nil +} + +func (x *SummaryMetadata) GetDisplayName() string { + if x != nil { + return x.DisplayName + } + return "" +} + +func (x *SummaryMetadata) GetSummaryDescription() string { + if x != nil { + return x.SummaryDescription + } + return "" +} + +func (x *SummaryMetadata) GetDataClass() DataClass { + if x != nil { + return x.DataClass + } + return DataClass_DATA_CLASS_UNKNOWN +} + +// A Summary is a set of named values to be displayed by the +// visualizer. +// +// Summaries are produced regularly during training, as controlled by +// the "summary_interval_secs" attribute of the training operation. +// Summaries are also produced at the end of an evaluation. +type Summary struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Set of values for the summary. + Value []*Summary_Value `protobuf:"bytes,1,rep,name=value,proto3" json:"value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Summary) Reset() { + *x = Summary{} + mi := &file_tensorflow_core_framework_summary_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Summary) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Summary) ProtoMessage() {} + +func (x *Summary) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_summary_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Summary.ProtoReflect.Descriptor instead. +func (*Summary) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_summary_proto_rawDescGZIP(), []int{3} +} + +func (x *Summary) GetValue() []*Summary_Value { + if x != nil { + return x.Value + } + return nil +} + +type SummaryMetadata_PluginData struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The name of the plugin this data pertains to. + PluginName string `protobuf:"bytes,1,opt,name=plugin_name,json=pluginName,proto3" json:"plugin_name,omitempty"` + // The content to store for the plugin. The best practice is for this to be + // a binary serialized protocol buffer. + Content []byte `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SummaryMetadata_PluginData) Reset() { + *x = SummaryMetadata_PluginData{} + mi := &file_tensorflow_core_framework_summary_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SummaryMetadata_PluginData) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SummaryMetadata_PluginData) ProtoMessage() {} + +func (x *SummaryMetadata_PluginData) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_summary_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SummaryMetadata_PluginData.ProtoReflect.Descriptor instead. +func (*SummaryMetadata_PluginData) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_summary_proto_rawDescGZIP(), []int{2, 0} +} + +func (x *SummaryMetadata_PluginData) GetPluginName() string { + if x != nil { + return x.PluginName + } + return "" +} + +func (x *SummaryMetadata_PluginData) GetContent() []byte { + if x != nil { + return x.Content + } + return nil +} + +type Summary_Image struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Dimensions of the image. + Height int32 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + Width int32 `protobuf:"varint,2,opt,name=width,proto3" json:"width,omitempty"` + // Valid colorspace values are + // + // 1 - grayscale + // 2 - grayscale + alpha + // 3 - RGB + // 4 - RGBA + // 5 - DIGITAL_YUV + // 6 - BGRA + Colorspace int32 `protobuf:"varint,3,opt,name=colorspace,proto3" json:"colorspace,omitempty"` + // Image data in encoded format. All image formats supported by + // image_codec::CoderUtil can be stored here. + EncodedImageString []byte `protobuf:"bytes,4,opt,name=encoded_image_string,json=encodedImageString,proto3" json:"encoded_image_string,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Summary_Image) Reset() { + *x = Summary_Image{} + mi := &file_tensorflow_core_framework_summary_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Summary_Image) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Summary_Image) ProtoMessage() {} + +func (x *Summary_Image) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_summary_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Summary_Image.ProtoReflect.Descriptor instead. +func (*Summary_Image) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_summary_proto_rawDescGZIP(), []int{3, 0} +} + +func (x *Summary_Image) GetHeight() int32 { + if x != nil { + return x.Height + } + return 0 +} + +func (x *Summary_Image) GetWidth() int32 { + if x != nil { + return x.Width + } + return 0 +} + +func (x *Summary_Image) GetColorspace() int32 { + if x != nil { + return x.Colorspace + } + return 0 +} + +func (x *Summary_Image) GetEncodedImageString() []byte { + if x != nil { + return x.EncodedImageString + } + return nil +} + +type Summary_Audio struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Sample rate of the audio in Hz. + SampleRate float32 `protobuf:"fixed32,1,opt,name=sample_rate,json=sampleRate,proto3" json:"sample_rate,omitempty"` + // Number of channels of audio. + NumChannels int64 `protobuf:"varint,2,opt,name=num_channels,json=numChannels,proto3" json:"num_channels,omitempty"` + // Length of the audio in frames (samples per channel). + LengthFrames int64 `protobuf:"varint,3,opt,name=length_frames,json=lengthFrames,proto3" json:"length_frames,omitempty"` + // Encoded audio data and its associated RFC 2045 content type (e.g. + // "audio/wav"). + EncodedAudioString []byte `protobuf:"bytes,4,opt,name=encoded_audio_string,json=encodedAudioString,proto3" json:"encoded_audio_string,omitempty"` + ContentType string `protobuf:"bytes,5,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Summary_Audio) Reset() { + *x = Summary_Audio{} + mi := &file_tensorflow_core_framework_summary_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Summary_Audio) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Summary_Audio) ProtoMessage() {} + +func (x *Summary_Audio) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_summary_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Summary_Audio.ProtoReflect.Descriptor instead. +func (*Summary_Audio) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_summary_proto_rawDescGZIP(), []int{3, 1} +} + +func (x *Summary_Audio) GetSampleRate() float32 { + if x != nil { + return x.SampleRate + } + return 0 +} + +func (x *Summary_Audio) GetNumChannels() int64 { + if x != nil { + return x.NumChannels + } + return 0 +} + +func (x *Summary_Audio) GetLengthFrames() int64 { + if x != nil { + return x.LengthFrames + } + return 0 +} + +func (x *Summary_Audio) GetEncodedAudioString() []byte { + if x != nil { + return x.EncodedAudioString + } + return nil +} + +func (x *Summary_Audio) GetContentType() string { + if x != nil { + return x.ContentType + } + return "" +} + +type Summary_Value struct { + state protoimpl.MessageState `protogen:"open.v1"` + // This field is deprecated and will not be set. + NodeName string `protobuf:"bytes,7,opt,name=node_name,json=nodeName,proto3" json:"node_name,omitempty"` + // Tag name for the data. Used by TensorBoard plugins to organize data. Tags + // are often organized by scope (which contains slashes to convey + // hierarchy). For example: foo/bar/0 + Tag string `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"` + // Contains metadata on the summary value such as which plugins may use it. + // Take note that many summary values may lack a metadata field. This is + // because the FileWriter only keeps a metadata object on the first summary + // value with a certain tag for each tag. TensorBoard then remembers which + // tags are associated with which plugins. This saves space. + Metadata *SummaryMetadata `protobuf:"bytes,9,opt,name=metadata,proto3" json:"metadata,omitempty"` + // Value associated with the tag. + // + // Types that are valid to be assigned to Value: + // + // *Summary_Value_SimpleValue + // *Summary_Value_ObsoleteOldStyleHistogram + // *Summary_Value_Image + // *Summary_Value_Histo + // *Summary_Value_Audio + // *Summary_Value_Tensor + Value isSummary_Value_Value `protobuf_oneof:"value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Summary_Value) Reset() { + *x = Summary_Value{} + mi := &file_tensorflow_core_framework_summary_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Summary_Value) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Summary_Value) ProtoMessage() {} + +func (x *Summary_Value) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_summary_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Summary_Value.ProtoReflect.Descriptor instead. +func (*Summary_Value) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_summary_proto_rawDescGZIP(), []int{3, 2} +} + +func (x *Summary_Value) GetNodeName() string { + if x != nil { + return x.NodeName + } + return "" +} + +func (x *Summary_Value) GetTag() string { + if x != nil { + return x.Tag + } + return "" +} + +func (x *Summary_Value) GetMetadata() *SummaryMetadata { + if x != nil { + return x.Metadata + } + return nil +} + +func (x *Summary_Value) GetValue() isSummary_Value_Value { + if x != nil { + return x.Value + } + return nil +} + +func (x *Summary_Value) GetSimpleValue() float32 { + if x != nil { + if x, ok := x.Value.(*Summary_Value_SimpleValue); ok { + return x.SimpleValue + } + } + return 0 +} + +func (x *Summary_Value) GetObsoleteOldStyleHistogram() []byte { + if x != nil { + if x, ok := x.Value.(*Summary_Value_ObsoleteOldStyleHistogram); ok { + return x.ObsoleteOldStyleHistogram + } + } + return nil +} + +func (x *Summary_Value) GetImage() *Summary_Image { + if x != nil { + if x, ok := x.Value.(*Summary_Value_Image); ok { + return x.Image + } + } + return nil +} + +func (x *Summary_Value) GetHisto() *HistogramProto { + if x != nil { + if x, ok := x.Value.(*Summary_Value_Histo); ok { + return x.Histo + } + } + return nil +} + +func (x *Summary_Value) GetAudio() *Summary_Audio { + if x != nil { + if x, ok := x.Value.(*Summary_Value_Audio); ok { + return x.Audio + } + } + return nil +} + +func (x *Summary_Value) GetTensor() *tensor_go_proto.TensorProto { + if x != nil { + if x, ok := x.Value.(*Summary_Value_Tensor); ok { + return x.Tensor + } + } + return nil +} + +type isSummary_Value_Value interface { + isSummary_Value_Value() +} + +type Summary_Value_SimpleValue struct { + SimpleValue float32 `protobuf:"fixed32,2,opt,name=simple_value,json=simpleValue,proto3,oneof"` +} + +type Summary_Value_ObsoleteOldStyleHistogram struct { + ObsoleteOldStyleHistogram []byte `protobuf:"bytes,3,opt,name=obsolete_old_style_histogram,json=obsoleteOldStyleHistogram,proto3,oneof"` +} + +type Summary_Value_Image struct { + Image *Summary_Image `protobuf:"bytes,4,opt,name=image,proto3,oneof"` +} + +type Summary_Value_Histo struct { + Histo *HistogramProto `protobuf:"bytes,5,opt,name=histo,proto3,oneof"` +} + +type Summary_Value_Audio struct { + Audio *Summary_Audio `protobuf:"bytes,6,opt,name=audio,proto3,oneof"` +} + +type Summary_Value_Tensor struct { + Tensor *tensor_go_proto.TensorProto `protobuf:"bytes,8,opt,name=tensor,proto3,oneof"` +} + +func (*Summary_Value_SimpleValue) isSummary_Value_Value() {} + +func (*Summary_Value_ObsoleteOldStyleHistogram) isSummary_Value_Value() {} + +func (*Summary_Value_Image) isSummary_Value_Value() {} + +func (*Summary_Value_Histo) isSummary_Value_Value() {} + +func (*Summary_Value_Audio) isSummary_Value_Value() {} + +func (*Summary_Value_Tensor) isSummary_Value_Value() {} + +var File_tensorflow_core_framework_summary_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_summary_proto_rawDesc = "" + + "\n" + + "'tensorflow/core/framework/summary.proto\x12\n" + + "tensorflow\x1a&tensorflow/core/framework/tensor.proto\"1\n" + + "\x12SummaryDescription\x12\x1b\n" + + "\ttype_hint\x18\x01 \x01(\tR\btypeHint\"\xbc\x01\n" + + "\x0eHistogramProto\x12\x10\n" + + "\x03min\x18\x01 \x01(\x01R\x03min\x12\x10\n" + + "\x03max\x18\x02 \x01(\x01R\x03max\x12\x10\n" + + "\x03num\x18\x03 \x01(\x01R\x03num\x12\x10\n" + + "\x03sum\x18\x04 \x01(\x01R\x03sum\x12\x1f\n" + + "\vsum_squares\x18\x05 \x01(\x01R\n" + + "sumSquares\x12%\n" + + "\fbucket_limit\x18\x06 \x03(\x01B\x02\x10\x01R\vbucketLimit\x12\x1a\n" + + "\x06bucket\x18\a \x03(\x01B\x02\x10\x01R\x06bucket\"\xad\x02\n" + + "\x0fSummaryMetadata\x12G\n" + + "\vplugin_data\x18\x01 \x01(\v2&.tensorflow.SummaryMetadata.PluginDataR\n" + + "pluginData\x12!\n" + + "\fdisplay_name\x18\x02 \x01(\tR\vdisplayName\x12/\n" + + "\x13summary_description\x18\x03 \x01(\tR\x12summaryDescription\x124\n" + + "\n" + + "data_class\x18\x04 \x01(\x0e2\x15.tensorflow.DataClassR\tdataClass\x1aG\n" + + "\n" + + "PluginData\x12\x1f\n" + + "\vplugin_name\x18\x01 \x01(\tR\n" + + "pluginName\x12\x18\n" + + "\acontent\x18\x02 \x01(\fR\acontent\"\xbc\x06\n" + + "\aSummary\x12/\n" + + "\x05value\x18\x01 \x03(\v2\x19.tensorflow.Summary.ValueR\x05value\x1a\x87\x01\n" + + "\x05Image\x12\x16\n" + + "\x06height\x18\x01 \x01(\x05R\x06height\x12\x14\n" + + "\x05width\x18\x02 \x01(\x05R\x05width\x12\x1e\n" + + "\n" + + "colorspace\x18\x03 \x01(\x05R\n" + + "colorspace\x120\n" + + "\x14encoded_image_string\x18\x04 \x01(\fR\x12encodedImageString\x1a\xc5\x01\n" + + "\x05Audio\x12\x1f\n" + + "\vsample_rate\x18\x01 \x01(\x02R\n" + + "sampleRate\x12!\n" + + "\fnum_channels\x18\x02 \x01(\x03R\vnumChannels\x12#\n" + + "\rlength_frames\x18\x03 \x01(\x03R\flengthFrames\x120\n" + + "\x14encoded_audio_string\x18\x04 \x01(\fR\x12encodedAudioString\x12!\n" + + "\fcontent_type\x18\x05 \x01(\tR\vcontentType\x1a\xad\x03\n" + + "\x05Value\x12\x1b\n" + + "\tnode_name\x18\a \x01(\tR\bnodeName\x12\x10\n" + + "\x03tag\x18\x01 \x01(\tR\x03tag\x127\n" + + "\bmetadata\x18\t \x01(\v2\x1b.tensorflow.SummaryMetadataR\bmetadata\x12#\n" + + "\fsimple_value\x18\x02 \x01(\x02H\x00R\vsimpleValue\x12A\n" + + "\x1cobsolete_old_style_histogram\x18\x03 \x01(\fH\x00R\x19obsoleteOldStyleHistogram\x121\n" + + "\x05image\x18\x04 \x01(\v2\x19.tensorflow.Summary.ImageH\x00R\x05image\x122\n" + + "\x05histo\x18\x05 \x01(\v2\x1a.tensorflow.HistogramProtoH\x00R\x05histo\x121\n" + + "\x05audio\x18\x06 \x01(\v2\x19.tensorflow.Summary.AudioH\x00R\x05audio\x121\n" + + "\x06tensor\x18\b \x01(\v2\x17.tensorflow.TensorProtoH\x00R\x06tensorB\a\n" + + "\x05value*o\n" + + "\tDataClass\x12\x16\n" + + "\x12DATA_CLASS_UNKNOWN\x10\x00\x12\x15\n" + + "\x11DATA_CLASS_SCALAR\x10\x01\x12\x15\n" + + "\x11DATA_CLASS_TENSOR\x10\x02\x12\x1c\n" + + "\x18DATA_CLASS_BLOB_SEQUENCE\x10\x03B~\n" + + "\x18org.tensorflow.frameworkB\rSummaryProtosP\x01ZNgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/summary_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_summary_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_summary_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_summary_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_summary_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_summary_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_summary_proto_rawDesc), len(file_tensorflow_core_framework_summary_proto_rawDesc))) + }) + return file_tensorflow_core_framework_summary_proto_rawDescData +} + +var file_tensorflow_core_framework_summary_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_tensorflow_core_framework_summary_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_tensorflow_core_framework_summary_proto_goTypes = []any{ + (DataClass)(0), // 0: tensorflow.DataClass + (*SummaryDescription)(nil), // 1: tensorflow.SummaryDescription + (*HistogramProto)(nil), // 2: tensorflow.HistogramProto + (*SummaryMetadata)(nil), // 3: tensorflow.SummaryMetadata + (*Summary)(nil), // 4: tensorflow.Summary + (*SummaryMetadata_PluginData)(nil), // 5: tensorflow.SummaryMetadata.PluginData + (*Summary_Image)(nil), // 6: tensorflow.Summary.Image + (*Summary_Audio)(nil), // 7: tensorflow.Summary.Audio + (*Summary_Value)(nil), // 8: tensorflow.Summary.Value + (*tensor_go_proto.TensorProto)(nil), // 9: tensorflow.TensorProto +} +var file_tensorflow_core_framework_summary_proto_depIdxs = []int32{ + 5, // 0: tensorflow.SummaryMetadata.plugin_data:type_name -> tensorflow.SummaryMetadata.PluginData + 0, // 1: tensorflow.SummaryMetadata.data_class:type_name -> tensorflow.DataClass + 8, // 2: tensorflow.Summary.value:type_name -> tensorflow.Summary.Value + 3, // 3: tensorflow.Summary.Value.metadata:type_name -> tensorflow.SummaryMetadata + 6, // 4: tensorflow.Summary.Value.image:type_name -> tensorflow.Summary.Image + 2, // 5: tensorflow.Summary.Value.histo:type_name -> tensorflow.HistogramProto + 7, // 6: tensorflow.Summary.Value.audio:type_name -> tensorflow.Summary.Audio + 9, // 7: tensorflow.Summary.Value.tensor:type_name -> tensorflow.TensorProto + 8, // [8:8] is the sub-list for method output_type + 8, // [8:8] is the sub-list for method input_type + 8, // [8:8] is the sub-list for extension type_name + 8, // [8:8] is the sub-list for extension extendee + 0, // [0:8] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_summary_proto_init() } +func file_tensorflow_core_framework_summary_proto_init() { + if File_tensorflow_core_framework_summary_proto != nil { + return + } + file_tensorflow_core_framework_summary_proto_msgTypes[7].OneofWrappers = []any{ + (*Summary_Value_SimpleValue)(nil), + (*Summary_Value_ObsoleteOldStyleHistogram)(nil), + (*Summary_Value_Image)(nil), + (*Summary_Value_Histo)(nil), + (*Summary_Value_Audio)(nil), + (*Summary_Value_Tensor)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_summary_proto_rawDesc), len(file_tensorflow_core_framework_summary_proto_rawDesc)), + NumEnums: 1, + NumMessages: 8, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_summary_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_summary_proto_depIdxs, + EnumInfos: file_tensorflow_core_framework_summary_proto_enumTypes, + MessageInfos: file_tensorflow_core_framework_summary_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_summary_proto = out.File + file_tensorflow_core_framework_summary_proto_goTypes = nil + file_tensorflow_core_framework_summary_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_description_go_proto/tensor_description.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_description_go_proto/tensor_description.pb.go new file mode 100644 index 0000000..de32d25 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_description_go_proto/tensor_description.pb.go @@ -0,0 +1,154 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/tensor_description.proto + +package tensor_description_go_proto + +import ( + allocation_description_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/allocation_description_go_proto" + tensor_shape_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_shape_go_proto" + types_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/types_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type TensorDescription struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Data type of tensor elements + Dtype types_go_proto.DataType `protobuf:"varint,1,opt,name=dtype,proto3,enum=tensorflow.DataType" json:"dtype,omitempty"` + // Shape of the tensor. + Shape *tensor_shape_go_proto.TensorShapeProto `protobuf:"bytes,2,opt,name=shape,proto3" json:"shape,omitempty"` + // Information about the size and allocator used for the data + AllocationDescription *allocation_description_go_proto.AllocationDescription `protobuf:"bytes,4,opt,name=allocation_description,json=allocationDescription,proto3" json:"allocation_description,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TensorDescription) Reset() { + *x = TensorDescription{} + mi := &file_tensorflow_core_framework_tensor_description_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TensorDescription) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TensorDescription) ProtoMessage() {} + +func (x *TensorDescription) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_tensor_description_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TensorDescription.ProtoReflect.Descriptor instead. +func (*TensorDescription) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_tensor_description_proto_rawDescGZIP(), []int{0} +} + +func (x *TensorDescription) GetDtype() types_go_proto.DataType { + if x != nil { + return x.Dtype + } + return types_go_proto.DataType(0) +} + +func (x *TensorDescription) GetShape() *tensor_shape_go_proto.TensorShapeProto { + if x != nil { + return x.Shape + } + return nil +} + +func (x *TensorDescription) GetAllocationDescription() *allocation_description_go_proto.AllocationDescription { + if x != nil { + return x.AllocationDescription + } + return nil +} + +var File_tensorflow_core_framework_tensor_description_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_tensor_description_proto_rawDesc = "" + + "\n" + + "2tensorflow/core/framework/tensor_description.proto\x12\n" + + "tensorflow\x1a6tensorflow/core/framework/allocation_description.proto\x1a,tensorflow/core/framework/tensor_shape.proto\x1a%tensorflow/core/framework/types.proto\"\xcd\x01\n" + + "\x11TensorDescription\x12*\n" + + "\x05dtype\x18\x01 \x01(\x0e2\x14.tensorflow.DataTypeR\x05dtype\x122\n" + + "\x05shape\x18\x02 \x01(\v2\x1c.tensorflow.TensorShapeProtoR\x05shape\x12X\n" + + "\x16allocation_description\x18\x04 \x01(\v2!.tensorflow.AllocationDescriptionR\x15allocationDescriptionB\x93\x01\n" + + "\x18org.tensorflow.frameworkB\x17TensorDescriptionProtosP\x01ZYgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_description_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_tensor_description_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_tensor_description_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_tensor_description_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_tensor_description_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_tensor_description_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_tensor_description_proto_rawDesc), len(file_tensorflow_core_framework_tensor_description_proto_rawDesc))) + }) + return file_tensorflow_core_framework_tensor_description_proto_rawDescData +} + +var file_tensorflow_core_framework_tensor_description_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_tensorflow_core_framework_tensor_description_proto_goTypes = []any{ + (*TensorDescription)(nil), // 0: tensorflow.TensorDescription + (types_go_proto.DataType)(0), // 1: tensorflow.DataType + (*tensor_shape_go_proto.TensorShapeProto)(nil), // 2: tensorflow.TensorShapeProto + (*allocation_description_go_proto.AllocationDescription)(nil), // 3: tensorflow.AllocationDescription +} +var file_tensorflow_core_framework_tensor_description_proto_depIdxs = []int32{ + 1, // 0: tensorflow.TensorDescription.dtype:type_name -> tensorflow.DataType + 2, // 1: tensorflow.TensorDescription.shape:type_name -> tensorflow.TensorShapeProto + 3, // 2: tensorflow.TensorDescription.allocation_description:type_name -> tensorflow.AllocationDescription + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_tensor_description_proto_init() } +func file_tensorflow_core_framework_tensor_description_proto_init() { + if File_tensorflow_core_framework_tensor_description_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_tensor_description_proto_rawDesc), len(file_tensorflow_core_framework_tensor_description_proto_rawDesc)), + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_tensor_description_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_tensor_description_proto_depIdxs, + MessageInfos: file_tensorflow_core_framework_tensor_description_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_tensor_description_proto = out.File + file_tensorflow_core_framework_tensor_description_proto_goTypes = nil + file_tensorflow_core_framework_tensor_description_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_go_proto/tensor.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_go_proto/tensor.pb.go new file mode 100644 index 0000000..bcd95ac --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_go_proto/tensor.pb.go @@ -0,0 +1,382 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/tensor.proto + +package tensor_go_proto + +import ( + resource_handle_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/resource_handle_go_proto" + tensor_shape_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_shape_go_proto" + types_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/types_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Protocol buffer representing a tensor. +type TensorProto struct { + state protoimpl.MessageState `protogen:"open.v1"` + Dtype types_go_proto.DataType `protobuf:"varint,1,opt,name=dtype,proto3,enum=tensorflow.DataType" json:"dtype,omitempty"` + // Shape of the tensor. TODO(touts): sort out the 0-rank issues. + TensorShape *tensor_shape_go_proto.TensorShapeProto `protobuf:"bytes,2,opt,name=tensor_shape,json=tensorShape,proto3" json:"tensor_shape,omitempty"` + // Version number. + // + // In version 0, if the "repeated xxx" representations contain only one + // element, that element is repeated to fill the shape. This makes it easy + // to represent a constant Tensor with a single value. + VersionNumber int32 `protobuf:"varint,3,opt,name=version_number,json=versionNumber,proto3" json:"version_number,omitempty"` + // Serialized raw tensor content from either Tensor::AsProtoTensorContent or + // memcpy in tensorflow::grpc::EncodeTensorToByteBuffer. This representation + // can be used for all tensor types. The purpose of this representation is to + // reduce serialization overhead during RPC call by avoiding serialization of + // many repeated small items. + TensorContent []byte `protobuf:"bytes,4,opt,name=tensor_content,json=tensorContent,proto3" json:"tensor_content,omitempty"` + // DT_HALF, DT_BFLOAT16. Note that since protobuf has no int16 type, we'll + // have some pointless zero padding for each value here. + HalfVal []int32 `protobuf:"varint,13,rep,packed,name=half_val,json=halfVal,proto3" json:"half_val,omitempty"` + // DT_FLOAT. + FloatVal []float32 `protobuf:"fixed32,5,rep,packed,name=float_val,json=floatVal,proto3" json:"float_val,omitempty"` + // DT_DOUBLE. + DoubleVal []float64 `protobuf:"fixed64,6,rep,packed,name=double_val,json=doubleVal,proto3" json:"double_val,omitempty"` + // DT_INT32, DT_INT16, DT_INT8, DT_UINT8. + IntVal []int32 `protobuf:"varint,7,rep,packed,name=int_val,json=intVal,proto3" json:"int_val,omitempty"` + // DT_STRING + StringVal [][]byte `protobuf:"bytes,8,rep,name=string_val,json=stringVal,proto3" json:"string_val,omitempty"` + // DT_COMPLEX64. scomplex_val(2*i) and scomplex_val(2*i+1) are real + // and imaginary parts of i-th single precision complex. + ScomplexVal []float32 `protobuf:"fixed32,9,rep,packed,name=scomplex_val,json=scomplexVal,proto3" json:"scomplex_val,omitempty"` + // DT_INT64 + Int64Val []int64 `protobuf:"varint,10,rep,packed,name=int64_val,json=int64Val,proto3" json:"int64_val,omitempty"` + // DT_BOOL + BoolVal []bool `protobuf:"varint,11,rep,packed,name=bool_val,json=boolVal,proto3" json:"bool_val,omitempty"` + // DT_COMPLEX128. dcomplex_val(2*i) and dcomplex_val(2*i+1) are real + // and imaginary parts of i-th double precision complex. + DcomplexVal []float64 `protobuf:"fixed64,12,rep,packed,name=dcomplex_val,json=dcomplexVal,proto3" json:"dcomplex_val,omitempty"` + // DT_RESOURCE + ResourceHandleVal []*resource_handle_go_proto.ResourceHandleProto `protobuf:"bytes,14,rep,name=resource_handle_val,json=resourceHandleVal,proto3" json:"resource_handle_val,omitempty"` + // DT_VARIANT + VariantVal []*VariantTensorDataProto `protobuf:"bytes,15,rep,name=variant_val,json=variantVal,proto3" json:"variant_val,omitempty"` + // DT_UINT32 + Uint32Val []uint32 `protobuf:"varint,16,rep,packed,name=uint32_val,json=uint32Val,proto3" json:"uint32_val,omitempty"` + // DT_UINT64 + Uint64Val []uint64 `protobuf:"varint,17,rep,packed,name=uint64_val,json=uint64Val,proto3" json:"uint64_val,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TensorProto) Reset() { + *x = TensorProto{} + mi := &file_tensorflow_core_framework_tensor_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TensorProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TensorProto) ProtoMessage() {} + +func (x *TensorProto) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_tensor_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TensorProto.ProtoReflect.Descriptor instead. +func (*TensorProto) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_tensor_proto_rawDescGZIP(), []int{0} +} + +func (x *TensorProto) GetDtype() types_go_proto.DataType { + if x != nil { + return x.Dtype + } + return types_go_proto.DataType(0) +} + +func (x *TensorProto) GetTensorShape() *tensor_shape_go_proto.TensorShapeProto { + if x != nil { + return x.TensorShape + } + return nil +} + +func (x *TensorProto) GetVersionNumber() int32 { + if x != nil { + return x.VersionNumber + } + return 0 +} + +func (x *TensorProto) GetTensorContent() []byte { + if x != nil { + return x.TensorContent + } + return nil +} + +func (x *TensorProto) GetHalfVal() []int32 { + if x != nil { + return x.HalfVal + } + return nil +} + +func (x *TensorProto) GetFloatVal() []float32 { + if x != nil { + return x.FloatVal + } + return nil +} + +func (x *TensorProto) GetDoubleVal() []float64 { + if x != nil { + return x.DoubleVal + } + return nil +} + +func (x *TensorProto) GetIntVal() []int32 { + if x != nil { + return x.IntVal + } + return nil +} + +func (x *TensorProto) GetStringVal() [][]byte { + if x != nil { + return x.StringVal + } + return nil +} + +func (x *TensorProto) GetScomplexVal() []float32 { + if x != nil { + return x.ScomplexVal + } + return nil +} + +func (x *TensorProto) GetInt64Val() []int64 { + if x != nil { + return x.Int64Val + } + return nil +} + +func (x *TensorProto) GetBoolVal() []bool { + if x != nil { + return x.BoolVal + } + return nil +} + +func (x *TensorProto) GetDcomplexVal() []float64 { + if x != nil { + return x.DcomplexVal + } + return nil +} + +func (x *TensorProto) GetResourceHandleVal() []*resource_handle_go_proto.ResourceHandleProto { + if x != nil { + return x.ResourceHandleVal + } + return nil +} + +func (x *TensorProto) GetVariantVal() []*VariantTensorDataProto { + if x != nil { + return x.VariantVal + } + return nil +} + +func (x *TensorProto) GetUint32Val() []uint32 { + if x != nil { + return x.Uint32Val + } + return nil +} + +func (x *TensorProto) GetUint64Val() []uint64 { + if x != nil { + return x.Uint64Val + } + return nil +} + +// Protocol buffer representing the serialization format of DT_VARIANT tensors. +type VariantTensorDataProto struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Name of the type of objects being serialized. + TypeName string `protobuf:"bytes,1,opt,name=type_name,json=typeName,proto3" json:"type_name,omitempty"` + // Portions of the object that are not Tensors. + Metadata []byte `protobuf:"bytes,2,opt,name=metadata,proto3" json:"metadata,omitempty"` + // Tensors contained within objects being serialized. + Tensors []*TensorProto `protobuf:"bytes,3,rep,name=tensors,proto3" json:"tensors,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *VariantTensorDataProto) Reset() { + *x = VariantTensorDataProto{} + mi := &file_tensorflow_core_framework_tensor_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *VariantTensorDataProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VariantTensorDataProto) ProtoMessage() {} + +func (x *VariantTensorDataProto) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_tensor_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use VariantTensorDataProto.ProtoReflect.Descriptor instead. +func (*VariantTensorDataProto) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_tensor_proto_rawDescGZIP(), []int{1} +} + +func (x *VariantTensorDataProto) GetTypeName() string { + if x != nil { + return x.TypeName + } + return "" +} + +func (x *VariantTensorDataProto) GetMetadata() []byte { + if x != nil { + return x.Metadata + } + return nil +} + +func (x *VariantTensorDataProto) GetTensors() []*TensorProto { + if x != nil { + return x.Tensors + } + return nil +} + +var File_tensorflow_core_framework_tensor_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_tensor_proto_rawDesc = "" + + "\n" + + "&tensorflow/core/framework/tensor.proto\x12\n" + + "tensorflow\x1a/tensorflow/core/framework/resource_handle.proto\x1a,tensorflow/core/framework/tensor_shape.proto\x1a%tensorflow/core/framework/types.proto\"\xd1\x05\n" + + "\vTensorProto\x12*\n" + + "\x05dtype\x18\x01 \x01(\x0e2\x14.tensorflow.DataTypeR\x05dtype\x12?\n" + + "\ftensor_shape\x18\x02 \x01(\v2\x1c.tensorflow.TensorShapeProtoR\vtensorShape\x12%\n" + + "\x0eversion_number\x18\x03 \x01(\x05R\rversionNumber\x12%\n" + + "\x0etensor_content\x18\x04 \x01(\fR\rtensorContent\x12\x1d\n" + + "\bhalf_val\x18\r \x03(\x05B\x02\x10\x01R\ahalfVal\x12\x1f\n" + + "\tfloat_val\x18\x05 \x03(\x02B\x02\x10\x01R\bfloatVal\x12!\n" + + "\n" + + "double_val\x18\x06 \x03(\x01B\x02\x10\x01R\tdoubleVal\x12\x1b\n" + + "\aint_val\x18\a \x03(\x05B\x02\x10\x01R\x06intVal\x12\x1d\n" + + "\n" + + "string_val\x18\b \x03(\fR\tstringVal\x12%\n" + + "\fscomplex_val\x18\t \x03(\x02B\x02\x10\x01R\vscomplexVal\x12\x1f\n" + + "\tint64_val\x18\n" + + " \x03(\x03B\x02\x10\x01R\bint64Val\x12\x1d\n" + + "\bbool_val\x18\v \x03(\bB\x02\x10\x01R\aboolVal\x12%\n" + + "\fdcomplex_val\x18\f \x03(\x01B\x02\x10\x01R\vdcomplexVal\x12O\n" + + "\x13resource_handle_val\x18\x0e \x03(\v2\x1f.tensorflow.ResourceHandleProtoR\x11resourceHandleVal\x12C\n" + + "\vvariant_val\x18\x0f \x03(\v2\".tensorflow.VariantTensorDataProtoR\n" + + "variantVal\x12!\n" + + "\n" + + "uint32_val\x18\x10 \x03(\rB\x02\x10\x01R\tuint32Val\x12!\n" + + "\n" + + "uint64_val\x18\x11 \x03(\x04B\x02\x10\x01R\tuint64Val\"\x84\x01\n" + + "\x16VariantTensorDataProto\x12\x1b\n" + + "\ttype_name\x18\x01 \x01(\tR\btypeName\x12\x1a\n" + + "\bmetadata\x18\x02 \x01(\fR\bmetadata\x121\n" + + "\atensors\x18\x03 \x03(\v2\x17.tensorflow.TensorProtoR\atensorsB|\n" + + "\x18org.tensorflow.frameworkB\fTensorProtosP\x01ZMgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_tensor_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_tensor_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_tensor_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_tensor_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_tensor_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_tensor_proto_rawDesc), len(file_tensorflow_core_framework_tensor_proto_rawDesc))) + }) + return file_tensorflow_core_framework_tensor_proto_rawDescData +} + +var file_tensorflow_core_framework_tensor_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_tensorflow_core_framework_tensor_proto_goTypes = []any{ + (*TensorProto)(nil), // 0: tensorflow.TensorProto + (*VariantTensorDataProto)(nil), // 1: tensorflow.VariantTensorDataProto + (types_go_proto.DataType)(0), // 2: tensorflow.DataType + (*tensor_shape_go_proto.TensorShapeProto)(nil), // 3: tensorflow.TensorShapeProto + (*resource_handle_go_proto.ResourceHandleProto)(nil), // 4: tensorflow.ResourceHandleProto +} +var file_tensorflow_core_framework_tensor_proto_depIdxs = []int32{ + 2, // 0: tensorflow.TensorProto.dtype:type_name -> tensorflow.DataType + 3, // 1: tensorflow.TensorProto.tensor_shape:type_name -> tensorflow.TensorShapeProto + 4, // 2: tensorflow.TensorProto.resource_handle_val:type_name -> tensorflow.ResourceHandleProto + 1, // 3: tensorflow.TensorProto.variant_val:type_name -> tensorflow.VariantTensorDataProto + 0, // 4: tensorflow.VariantTensorDataProto.tensors:type_name -> tensorflow.TensorProto + 5, // [5:5] is the sub-list for method output_type + 5, // [5:5] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_tensor_proto_init() } +func file_tensorflow_core_framework_tensor_proto_init() { + if File_tensorflow_core_framework_tensor_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_tensor_proto_rawDesc), len(file_tensorflow_core_framework_tensor_proto_rawDesc)), + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_tensor_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_tensor_proto_depIdxs, + MessageInfos: file_tensorflow_core_framework_tensor_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_tensor_proto = out.File + file_tensorflow_core_framework_tensor_proto_goTypes = nil + file_tensorflow_core_framework_tensor_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_shape_go_proto/tensor_shape.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_shape_go_proto/tensor_shape.pb.go new file mode 100644 index 0000000..e0160c2 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_shape_go_proto/tensor_shape.pb.go @@ -0,0 +1,216 @@ +// Protocol buffer representing the shape of tensors. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/tensor_shape.proto + +package tensor_shape_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Dimensions of a tensor. +type TensorShapeProto struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Dimensions of the tensor, such as {"input", 30}, {"output", 40} + // for a 30 x 40 2D tensor. If an entry has size -1, this + // corresponds to a dimension of unknown size. The names are + // optional. + // + // The order of entries in "dim" matters: It indicates the layout of the + // values in the tensor in-memory representation. + // + // The first entry in "dim" is the outermost dimension used to layout the + // values, the last entry is the innermost dimension. This matches the + // in-memory layout of RowMajor Eigen tensors. + // + // If "dim.size()" > 0, "unknown_rank" must be false. + Dim []*TensorShapeProto_Dim `protobuf:"bytes,2,rep,name=dim,proto3" json:"dim,omitempty"` + // If true, the number of dimensions in the shape is unknown. + // + // If true, "dim.size()" must be 0. + UnknownRank bool `protobuf:"varint,3,opt,name=unknown_rank,json=unknownRank,proto3" json:"unknown_rank,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TensorShapeProto) Reset() { + *x = TensorShapeProto{} + mi := &file_tensorflow_core_framework_tensor_shape_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TensorShapeProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TensorShapeProto) ProtoMessage() {} + +func (x *TensorShapeProto) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_tensor_shape_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TensorShapeProto.ProtoReflect.Descriptor instead. +func (*TensorShapeProto) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_tensor_shape_proto_rawDescGZIP(), []int{0} +} + +func (x *TensorShapeProto) GetDim() []*TensorShapeProto_Dim { + if x != nil { + return x.Dim + } + return nil +} + +func (x *TensorShapeProto) GetUnknownRank() bool { + if x != nil { + return x.UnknownRank + } + return false +} + +// One dimension of the tensor. +type TensorShapeProto_Dim struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Size of the tensor in that dimension. + // This value must be >= -1, but values of -1 are reserved for "unknown" + // shapes (values of -1 mean "unknown" dimension). Certain wrappers + // that work with TensorShapeProto may fail at runtime when deserializing + // a TensorShapeProto containing a dim value of -1. + Size int64 `protobuf:"varint,1,opt,name=size,proto3" json:"size,omitempty"` + // Optional name of the tensor dimension. + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TensorShapeProto_Dim) Reset() { + *x = TensorShapeProto_Dim{} + mi := &file_tensorflow_core_framework_tensor_shape_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TensorShapeProto_Dim) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TensorShapeProto_Dim) ProtoMessage() {} + +func (x *TensorShapeProto_Dim) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_tensor_shape_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TensorShapeProto_Dim.ProtoReflect.Descriptor instead. +func (*TensorShapeProto_Dim) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_tensor_shape_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *TensorShapeProto_Dim) GetSize() int64 { + if x != nil { + return x.Size + } + return 0 +} + +func (x *TensorShapeProto_Dim) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +var File_tensorflow_core_framework_tensor_shape_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_tensor_shape_proto_rawDesc = "" + + "\n" + + ",tensorflow/core/framework/tensor_shape.proto\x12\n" + + "tensorflow\"\x98\x01\n" + + "\x10TensorShapeProto\x122\n" + + "\x03dim\x18\x02 \x03(\v2 .tensorflow.TensorShapeProto.DimR\x03dim\x12!\n" + + "\funknown_rank\x18\x03 \x01(\bR\vunknownRank\x1a-\n" + + "\x03Dim\x12\x12\n" + + "\x04size\x18\x01 \x01(\x03R\x04size\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04nameB\x87\x01\n" + + "\x18org.tensorflow.frameworkB\x11TensorShapeProtosP\x01ZSgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_shape_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_tensor_shape_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_tensor_shape_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_tensor_shape_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_tensor_shape_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_tensor_shape_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_tensor_shape_proto_rawDesc), len(file_tensorflow_core_framework_tensor_shape_proto_rawDesc))) + }) + return file_tensorflow_core_framework_tensor_shape_proto_rawDescData +} + +var file_tensorflow_core_framework_tensor_shape_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_tensorflow_core_framework_tensor_shape_proto_goTypes = []any{ + (*TensorShapeProto)(nil), // 0: tensorflow.TensorShapeProto + (*TensorShapeProto_Dim)(nil), // 1: tensorflow.TensorShapeProto.Dim +} +var file_tensorflow_core_framework_tensor_shape_proto_depIdxs = []int32{ + 1, // 0: tensorflow.TensorShapeProto.dim:type_name -> tensorflow.TensorShapeProto.Dim + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_tensor_shape_proto_init() } +func file_tensorflow_core_framework_tensor_shape_proto_init() { + if File_tensorflow_core_framework_tensor_shape_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_tensor_shape_proto_rawDesc), len(file_tensorflow_core_framework_tensor_shape_proto_rawDesc)), + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_tensor_shape_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_tensor_shape_proto_depIdxs, + MessageInfos: file_tensorflow_core_framework_tensor_shape_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_tensor_shape_proto = out.File + file_tensorflow_core_framework_tensor_shape_proto_goTypes = nil + file_tensorflow_core_framework_tensor_shape_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_slice_go_proto/tensor_slice.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_slice_go_proto/tensor_slice.pb.go new file mode 100644 index 0000000..a579c51 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_slice_go_proto/tensor_slice.pb.go @@ -0,0 +1,224 @@ +// Protocol buffer representing slices of a tensor + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/tensor_slice.proto + +package tensor_slice_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Can only be interpreted if you know the corresponding TensorShape. +type TensorSliceProto struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Extent of the slice in all tensor dimensions. + // + // Must have one entry for each of the dimension of the tensor that this + // slice belongs to. The order of sizes is the same as the order of + // dimensions in the TensorShape. + Extent []*TensorSliceProto_Extent `protobuf:"bytes,1,rep,name=extent,proto3" json:"extent,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TensorSliceProto) Reset() { + *x = TensorSliceProto{} + mi := &file_tensorflow_core_framework_tensor_slice_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TensorSliceProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TensorSliceProto) ProtoMessage() {} + +func (x *TensorSliceProto) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_tensor_slice_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TensorSliceProto.ProtoReflect.Descriptor instead. +func (*TensorSliceProto) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_tensor_slice_proto_rawDescGZIP(), []int{0} +} + +func (x *TensorSliceProto) GetExtent() []*TensorSliceProto_Extent { + if x != nil { + return x.Extent + } + return nil +} + +// Extent of the slice in one dimension. +type TensorSliceProto_Extent struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Start index of the slice, starting at 0. + Start int64 `protobuf:"varint,1,opt,name=start,proto3" json:"start,omitempty"` + // Length of the slice: if the length is missing or -1 we will + // interpret this as "everything in this dimension". We use + // "oneof" to preserve information about whether the length is + // present without changing the serialization format from the + // prior proto2 version of this proto. + // + // Types that are valid to be assigned to HasLength: + // + // *TensorSliceProto_Extent_Length + HasLength isTensorSliceProto_Extent_HasLength `protobuf_oneof:"has_length"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TensorSliceProto_Extent) Reset() { + *x = TensorSliceProto_Extent{} + mi := &file_tensorflow_core_framework_tensor_slice_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TensorSliceProto_Extent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TensorSliceProto_Extent) ProtoMessage() {} + +func (x *TensorSliceProto_Extent) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_tensor_slice_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TensorSliceProto_Extent.ProtoReflect.Descriptor instead. +func (*TensorSliceProto_Extent) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_tensor_slice_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *TensorSliceProto_Extent) GetStart() int64 { + if x != nil { + return x.Start + } + return 0 +} + +func (x *TensorSliceProto_Extent) GetHasLength() isTensorSliceProto_Extent_HasLength { + if x != nil { + return x.HasLength + } + return nil +} + +func (x *TensorSliceProto_Extent) GetLength() int64 { + if x != nil { + if x, ok := x.HasLength.(*TensorSliceProto_Extent_Length); ok { + return x.Length + } + } + return 0 +} + +type isTensorSliceProto_Extent_HasLength interface { + isTensorSliceProto_Extent_HasLength() +} + +type TensorSliceProto_Extent_Length struct { + Length int64 `protobuf:"varint,2,opt,name=length,proto3,oneof"` +} + +func (*TensorSliceProto_Extent_Length) isTensorSliceProto_Extent_HasLength() {} + +var File_tensorflow_core_framework_tensor_slice_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_tensor_slice_proto_rawDesc = "" + + "\n" + + ",tensorflow/core/framework/tensor_slice.proto\x12\n" + + "tensorflow\"\x97\x01\n" + + "\x10TensorSliceProto\x12;\n" + + "\x06extent\x18\x01 \x03(\v2#.tensorflow.TensorSliceProto.ExtentR\x06extent\x1aF\n" + + "\x06Extent\x12\x14\n" + + "\x05start\x18\x01 \x01(\x03R\x05start\x12\x18\n" + + "\x06length\x18\x02 \x01(\x03H\x00R\x06lengthB\f\n" + + "\n" + + "has_lengthB\x87\x01\n" + + "\x18org.tensorflow.frameworkB\x11TensorSliceProtosP\x01ZSgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_slice_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_tensor_slice_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_tensor_slice_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_tensor_slice_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_tensor_slice_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_tensor_slice_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_tensor_slice_proto_rawDesc), len(file_tensorflow_core_framework_tensor_slice_proto_rawDesc))) + }) + return file_tensorflow_core_framework_tensor_slice_proto_rawDescData +} + +var file_tensorflow_core_framework_tensor_slice_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_tensorflow_core_framework_tensor_slice_proto_goTypes = []any{ + (*TensorSliceProto)(nil), // 0: tensorflow.TensorSliceProto + (*TensorSliceProto_Extent)(nil), // 1: tensorflow.TensorSliceProto.Extent +} +var file_tensorflow_core_framework_tensor_slice_proto_depIdxs = []int32{ + 1, // 0: tensorflow.TensorSliceProto.extent:type_name -> tensorflow.TensorSliceProto.Extent + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_tensor_slice_proto_init() } +func file_tensorflow_core_framework_tensor_slice_proto_init() { + if File_tensorflow_core_framework_tensor_slice_proto != nil { + return + } + file_tensorflow_core_framework_tensor_slice_proto_msgTypes[1].OneofWrappers = []any{ + (*TensorSliceProto_Extent_Length)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_tensor_slice_proto_rawDesc), len(file_tensorflow_core_framework_tensor_slice_proto_rawDesc)), + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_tensor_slice_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_tensor_slice_proto_depIdxs, + MessageInfos: file_tensorflow_core_framework_tensor_slice_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_tensor_slice_proto = out.File + file_tensorflow_core_framework_tensor_slice_proto_goTypes = nil + file_tensorflow_core_framework_tensor_slice_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/types_go_proto/types.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/types_go_proto/types.pb.go new file mode 100644 index 0000000..cbfd2e6 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/types_go_proto/types.pb.go @@ -0,0 +1,376 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/types.proto + +package types_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// (== suppress_warning documentation-presence ==) +// LINT.IfChange +type DataType int32 + +const ( + // Not a legal value for DataType. Used to indicate a DataType field + // has not been set. + DataType_DT_INVALID DataType = 0 + // Data types that all computation devices are expected to be + // capable to support. + DataType_DT_FLOAT DataType = 1 + DataType_DT_DOUBLE DataType = 2 + DataType_DT_INT32 DataType = 3 + DataType_DT_UINT8 DataType = 4 + DataType_DT_INT16 DataType = 5 + DataType_DT_INT8 DataType = 6 + DataType_DT_STRING DataType = 7 + DataType_DT_COMPLEX64 DataType = 8 // Single-precision complex + DataType_DT_INT64 DataType = 9 + DataType_DT_BOOL DataType = 10 + DataType_DT_QINT8 DataType = 11 // Quantized int8 + DataType_DT_QUINT8 DataType = 12 // Quantized uint8 + DataType_DT_QINT32 DataType = 13 // Quantized int32 + DataType_DT_BFLOAT16 DataType = 14 // Float32 truncated to 16 bits. Only for cast ops. + DataType_DT_QINT16 DataType = 15 // Quantized int16 + DataType_DT_QUINT16 DataType = 16 // Quantized uint16 + DataType_DT_UINT16 DataType = 17 + DataType_DT_COMPLEX128 DataType = 18 // Double-precision complex + DataType_DT_HALF DataType = 19 + DataType_DT_RESOURCE DataType = 20 + DataType_DT_VARIANT DataType = 21 // Arbitrary C++ data types + DataType_DT_UINT32 DataType = 22 + DataType_DT_UINT64 DataType = 23 + // Do not use! These are only for parameters. Every enum above + // should have a corresponding value below (verified by types_test). + DataType_DT_FLOAT_REF DataType = 101 + DataType_DT_DOUBLE_REF DataType = 102 + DataType_DT_INT32_REF DataType = 103 + DataType_DT_UINT8_REF DataType = 104 + DataType_DT_INT16_REF DataType = 105 + DataType_DT_INT8_REF DataType = 106 + DataType_DT_STRING_REF DataType = 107 + DataType_DT_COMPLEX64_REF DataType = 108 + DataType_DT_INT64_REF DataType = 109 + DataType_DT_BOOL_REF DataType = 110 + DataType_DT_QINT8_REF DataType = 111 + DataType_DT_QUINT8_REF DataType = 112 + DataType_DT_QINT32_REF DataType = 113 + DataType_DT_BFLOAT16_REF DataType = 114 + DataType_DT_QINT16_REF DataType = 115 + DataType_DT_QUINT16_REF DataType = 116 + DataType_DT_UINT16_REF DataType = 117 + DataType_DT_COMPLEX128_REF DataType = 118 + DataType_DT_HALF_REF DataType = 119 + DataType_DT_RESOURCE_REF DataType = 120 + DataType_DT_VARIANT_REF DataType = 121 + DataType_DT_UINT32_REF DataType = 122 + DataType_DT_UINT64_REF DataType = 123 +) + +// Enum value maps for DataType. +var ( + DataType_name = map[int32]string{ + 0: "DT_INVALID", + 1: "DT_FLOAT", + 2: "DT_DOUBLE", + 3: "DT_INT32", + 4: "DT_UINT8", + 5: "DT_INT16", + 6: "DT_INT8", + 7: "DT_STRING", + 8: "DT_COMPLEX64", + 9: "DT_INT64", + 10: "DT_BOOL", + 11: "DT_QINT8", + 12: "DT_QUINT8", + 13: "DT_QINT32", + 14: "DT_BFLOAT16", + 15: "DT_QINT16", + 16: "DT_QUINT16", + 17: "DT_UINT16", + 18: "DT_COMPLEX128", + 19: "DT_HALF", + 20: "DT_RESOURCE", + 21: "DT_VARIANT", + 22: "DT_UINT32", + 23: "DT_UINT64", + 101: "DT_FLOAT_REF", + 102: "DT_DOUBLE_REF", + 103: "DT_INT32_REF", + 104: "DT_UINT8_REF", + 105: "DT_INT16_REF", + 106: "DT_INT8_REF", + 107: "DT_STRING_REF", + 108: "DT_COMPLEX64_REF", + 109: "DT_INT64_REF", + 110: "DT_BOOL_REF", + 111: "DT_QINT8_REF", + 112: "DT_QUINT8_REF", + 113: "DT_QINT32_REF", + 114: "DT_BFLOAT16_REF", + 115: "DT_QINT16_REF", + 116: "DT_QUINT16_REF", + 117: "DT_UINT16_REF", + 118: "DT_COMPLEX128_REF", + 119: "DT_HALF_REF", + 120: "DT_RESOURCE_REF", + 121: "DT_VARIANT_REF", + 122: "DT_UINT32_REF", + 123: "DT_UINT64_REF", + } + DataType_value = map[string]int32{ + "DT_INVALID": 0, + "DT_FLOAT": 1, + "DT_DOUBLE": 2, + "DT_INT32": 3, + "DT_UINT8": 4, + "DT_INT16": 5, + "DT_INT8": 6, + "DT_STRING": 7, + "DT_COMPLEX64": 8, + "DT_INT64": 9, + "DT_BOOL": 10, + "DT_QINT8": 11, + "DT_QUINT8": 12, + "DT_QINT32": 13, + "DT_BFLOAT16": 14, + "DT_QINT16": 15, + "DT_QUINT16": 16, + "DT_UINT16": 17, + "DT_COMPLEX128": 18, + "DT_HALF": 19, + "DT_RESOURCE": 20, + "DT_VARIANT": 21, + "DT_UINT32": 22, + "DT_UINT64": 23, + "DT_FLOAT_REF": 101, + "DT_DOUBLE_REF": 102, + "DT_INT32_REF": 103, + "DT_UINT8_REF": 104, + "DT_INT16_REF": 105, + "DT_INT8_REF": 106, + "DT_STRING_REF": 107, + "DT_COMPLEX64_REF": 108, + "DT_INT64_REF": 109, + "DT_BOOL_REF": 110, + "DT_QINT8_REF": 111, + "DT_QUINT8_REF": 112, + "DT_QINT32_REF": 113, + "DT_BFLOAT16_REF": 114, + "DT_QINT16_REF": 115, + "DT_QUINT16_REF": 116, + "DT_UINT16_REF": 117, + "DT_COMPLEX128_REF": 118, + "DT_HALF_REF": 119, + "DT_RESOURCE_REF": 120, + "DT_VARIANT_REF": 121, + "DT_UINT32_REF": 122, + "DT_UINT64_REF": 123, + } +) + +func (x DataType) Enum() *DataType { + p := new(DataType) + *p = x + return p +} + +func (x DataType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (DataType) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_framework_types_proto_enumTypes[0].Descriptor() +} + +func (DataType) Type() protoreflect.EnumType { + return &file_tensorflow_core_framework_types_proto_enumTypes[0] +} + +func (x DataType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use DataType.Descriptor instead. +func (DataType) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_framework_types_proto_rawDescGZIP(), []int{0} +} + +// For identifying the underlying type of a variant. For variants, the types +// listed here are a subset of the types in the variant type registry, +// corresponding to commonly used variants which must occasionally be +// special-cased. +type SpecializedType int32 + +const ( + // Invalid/unknown specialized type. + SpecializedType_ST_INVALID SpecializedType = 0 + // "tensorflow::TensorList" in the variant type registry. + SpecializedType_ST_TENSOR_LIST SpecializedType = 1 +) + +// Enum value maps for SpecializedType. +var ( + SpecializedType_name = map[int32]string{ + 0: "ST_INVALID", + 1: "ST_TENSOR_LIST", + } + SpecializedType_value = map[string]int32{ + "ST_INVALID": 0, + "ST_TENSOR_LIST": 1, + } +) + +func (x SpecializedType) Enum() *SpecializedType { + p := new(SpecializedType) + *p = x + return p +} + +func (x SpecializedType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (SpecializedType) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_framework_types_proto_enumTypes[1].Descriptor() +} + +func (SpecializedType) Type() protoreflect.EnumType { + return &file_tensorflow_core_framework_types_proto_enumTypes[1] +} + +func (x SpecializedType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use SpecializedType.Descriptor instead. +func (SpecializedType) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_framework_types_proto_rawDescGZIP(), []int{1} +} + +var File_tensorflow_core_framework_types_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_types_proto_rawDesc = "" + + "\n" + + "%tensorflow/core/framework/types.proto\x12\n" + + "tensorflow*\xaa\x06\n" + + "\bDataType\x12\x0e\n" + + "\n" + + "DT_INVALID\x10\x00\x12\f\n" + + "\bDT_FLOAT\x10\x01\x12\r\n" + + "\tDT_DOUBLE\x10\x02\x12\f\n" + + "\bDT_INT32\x10\x03\x12\f\n" + + "\bDT_UINT8\x10\x04\x12\f\n" + + "\bDT_INT16\x10\x05\x12\v\n" + + "\aDT_INT8\x10\x06\x12\r\n" + + "\tDT_STRING\x10\a\x12\x10\n" + + "\fDT_COMPLEX64\x10\b\x12\f\n" + + "\bDT_INT64\x10\t\x12\v\n" + + "\aDT_BOOL\x10\n" + + "\x12\f\n" + + "\bDT_QINT8\x10\v\x12\r\n" + + "\tDT_QUINT8\x10\f\x12\r\n" + + "\tDT_QINT32\x10\r\x12\x0f\n" + + "\vDT_BFLOAT16\x10\x0e\x12\r\n" + + "\tDT_QINT16\x10\x0f\x12\x0e\n" + + "\n" + + "DT_QUINT16\x10\x10\x12\r\n" + + "\tDT_UINT16\x10\x11\x12\x11\n" + + "\rDT_COMPLEX128\x10\x12\x12\v\n" + + "\aDT_HALF\x10\x13\x12\x0f\n" + + "\vDT_RESOURCE\x10\x14\x12\x0e\n" + + "\n" + + "DT_VARIANT\x10\x15\x12\r\n" + + "\tDT_UINT32\x10\x16\x12\r\n" + + "\tDT_UINT64\x10\x17\x12\x10\n" + + "\fDT_FLOAT_REF\x10e\x12\x11\n" + + "\rDT_DOUBLE_REF\x10f\x12\x10\n" + + "\fDT_INT32_REF\x10g\x12\x10\n" + + "\fDT_UINT8_REF\x10h\x12\x10\n" + + "\fDT_INT16_REF\x10i\x12\x0f\n" + + "\vDT_INT8_REF\x10j\x12\x11\n" + + "\rDT_STRING_REF\x10k\x12\x14\n" + + "\x10DT_COMPLEX64_REF\x10l\x12\x10\n" + + "\fDT_INT64_REF\x10m\x12\x0f\n" + + "\vDT_BOOL_REF\x10n\x12\x10\n" + + "\fDT_QINT8_REF\x10o\x12\x11\n" + + "\rDT_QUINT8_REF\x10p\x12\x11\n" + + "\rDT_QINT32_REF\x10q\x12\x13\n" + + "\x0fDT_BFLOAT16_REF\x10r\x12\x11\n" + + "\rDT_QINT16_REF\x10s\x12\x12\n" + + "\x0eDT_QUINT16_REF\x10t\x12\x11\n" + + "\rDT_UINT16_REF\x10u\x12\x15\n" + + "\x11DT_COMPLEX128_REF\x10v\x12\x0f\n" + + "\vDT_HALF_REF\x10w\x12\x13\n" + + "\x0fDT_RESOURCE_REF\x10x\x12\x12\n" + + "\x0eDT_VARIANT_REF\x10y\x12\x11\n" + + "\rDT_UINT32_REF\x10z\x12\x11\n" + + "\rDT_UINT64_REF\x10{*5\n" + + "\x0fSpecializedType\x12\x0e\n" + + "\n" + + "ST_INVALID\x10\x00\x12\x12\n" + + "\x0eST_TENSOR_LIST\x10\x01Bz\n" + + "\x18org.tensorflow.frameworkB\vTypesProtosP\x01ZLgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/types_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_types_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_types_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_types_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_types_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_types_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_types_proto_rawDesc), len(file_tensorflow_core_framework_types_proto_rawDesc))) + }) + return file_tensorflow_core_framework_types_proto_rawDescData +} + +var file_tensorflow_core_framework_types_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_tensorflow_core_framework_types_proto_goTypes = []any{ + (DataType)(0), // 0: tensorflow.DataType + (SpecializedType)(0), // 1: tensorflow.SpecializedType +} +var file_tensorflow_core_framework_types_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_types_proto_init() } +func file_tensorflow_core_framework_types_proto_init() { + if File_tensorflow_core_framework_types_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_types_proto_rawDesc), len(file_tensorflow_core_framework_types_proto_rawDesc)), + NumEnums: 2, + NumMessages: 0, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_types_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_types_proto_depIdxs, + EnumInfos: file_tensorflow_core_framework_types_proto_enumTypes, + }.Build() + File_tensorflow_core_framework_types_proto = out.File + file_tensorflow_core_framework_types_proto_goTypes = nil + file_tensorflow_core_framework_types_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/variable_go_proto/variable.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/variable_go_proto/variable.pb.go new file mode 100644 index 0000000..8aafb07 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/variable_go_proto/variable.pb.go @@ -0,0 +1,428 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/variable.proto + +package variable_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Indicates when a distributed variable will be synced. +type VariableSynchronization int32 + +const ( + // `AUTO`: Indicates that the synchronization will be determined by the + // current `DistributionStrategy` (eg. With `MirroredStrategy` this would be + // `ON_WRITE`). + VariableSynchronization_VARIABLE_SYNCHRONIZATION_AUTO VariableSynchronization = 0 + // `NONE`: Indicates that there will only be one copy of the variable, so + // there is no need to sync. + VariableSynchronization_VARIABLE_SYNCHRONIZATION_NONE VariableSynchronization = 1 + // `ON_WRITE`: Indicates that the variable will be updated across devices + // every time it is written. + VariableSynchronization_VARIABLE_SYNCHRONIZATION_ON_WRITE VariableSynchronization = 2 + // `ON_READ`: Indicates that the variable will be aggregated across devices + // when it is read (eg. when checkpointing or when evaluating an op that uses + // the variable). + VariableSynchronization_VARIABLE_SYNCHRONIZATION_ON_READ VariableSynchronization = 3 +) + +// Enum value maps for VariableSynchronization. +var ( + VariableSynchronization_name = map[int32]string{ + 0: "VARIABLE_SYNCHRONIZATION_AUTO", + 1: "VARIABLE_SYNCHRONIZATION_NONE", + 2: "VARIABLE_SYNCHRONIZATION_ON_WRITE", + 3: "VARIABLE_SYNCHRONIZATION_ON_READ", + } + VariableSynchronization_value = map[string]int32{ + "VARIABLE_SYNCHRONIZATION_AUTO": 0, + "VARIABLE_SYNCHRONIZATION_NONE": 1, + "VARIABLE_SYNCHRONIZATION_ON_WRITE": 2, + "VARIABLE_SYNCHRONIZATION_ON_READ": 3, + } +) + +func (x VariableSynchronization) Enum() *VariableSynchronization { + p := new(VariableSynchronization) + *p = x + return p +} + +func (x VariableSynchronization) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (VariableSynchronization) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_framework_variable_proto_enumTypes[0].Descriptor() +} + +func (VariableSynchronization) Type() protoreflect.EnumType { + return &file_tensorflow_core_framework_variable_proto_enumTypes[0] +} + +func (x VariableSynchronization) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use VariableSynchronization.Descriptor instead. +func (VariableSynchronization) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_framework_variable_proto_rawDescGZIP(), []int{0} +} + +// Indicates how a distributed variable will be aggregated. +type VariableAggregation int32 + +const ( + // `NONE`: This is the default, giving an error if you use a + // variable-update operation with multiple replicas. + VariableAggregation_VARIABLE_AGGREGATION_NONE VariableAggregation = 0 + // `SUM`: Add the updates across replicas. + VariableAggregation_VARIABLE_AGGREGATION_SUM VariableAggregation = 1 + // `MEAN`: Take the arithmetic mean ("average") of the updates across + // replicas. + VariableAggregation_VARIABLE_AGGREGATION_MEAN VariableAggregation = 2 + // `ONLY_FIRST_REPLICA`: This is for when every replica is performing the same + // update, but we only want to perform the update once. Used, e.g., for the + // global step counter. + VariableAggregation_VARIABLE_AGGREGATION_ONLY_FIRST_REPLICA VariableAggregation = 3 +) + +// Enum value maps for VariableAggregation. +var ( + VariableAggregation_name = map[int32]string{ + 0: "VARIABLE_AGGREGATION_NONE", + 1: "VARIABLE_AGGREGATION_SUM", + 2: "VARIABLE_AGGREGATION_MEAN", + 3: "VARIABLE_AGGREGATION_ONLY_FIRST_REPLICA", + } + VariableAggregation_value = map[string]int32{ + "VARIABLE_AGGREGATION_NONE": 0, + "VARIABLE_AGGREGATION_SUM": 1, + "VARIABLE_AGGREGATION_MEAN": 2, + "VARIABLE_AGGREGATION_ONLY_FIRST_REPLICA": 3, + } +) + +func (x VariableAggregation) Enum() *VariableAggregation { + p := new(VariableAggregation) + *p = x + return p +} + +func (x VariableAggregation) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (VariableAggregation) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_framework_variable_proto_enumTypes[1].Descriptor() +} + +func (VariableAggregation) Type() protoreflect.EnumType { + return &file_tensorflow_core_framework_variable_proto_enumTypes[1] +} + +func (x VariableAggregation) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use VariableAggregation.Descriptor instead. +func (VariableAggregation) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_framework_variable_proto_rawDescGZIP(), []int{1} +} + +// Protocol buffer representing a Variable. +type VariableDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Name of the variable tensor. + VariableName string `protobuf:"bytes,1,opt,name=variable_name,json=variableName,proto3" json:"variable_name,omitempty"` + // Name of the tensor holding the variable's initial value. + InitialValueName string `protobuf:"bytes,6,opt,name=initial_value_name,json=initialValueName,proto3" json:"initial_value_name,omitempty"` + // Name of the initializer op. + InitializerName string `protobuf:"bytes,2,opt,name=initializer_name,json=initializerName,proto3" json:"initializer_name,omitempty"` + // Name of the snapshot tensor. + SnapshotName string `protobuf:"bytes,3,opt,name=snapshot_name,json=snapshotName,proto3" json:"snapshot_name,omitempty"` + // Support for saving variables as slices of a larger variable. + SaveSliceInfoDef *SaveSliceInfoDef `protobuf:"bytes,4,opt,name=save_slice_info_def,json=saveSliceInfoDef,proto3" json:"save_slice_info_def,omitempty"` + // Whether to represent this as a ResourceVariable. + IsResource bool `protobuf:"varint,5,opt,name=is_resource,json=isResource,proto3" json:"is_resource,omitempty"` + // Whether this variable should be trained. + Trainable bool `protobuf:"varint,7,opt,name=trainable,proto3" json:"trainable,omitempty"` + // Indicates when a distributed variable will be synced. + Synchronization VariableSynchronization `protobuf:"varint,8,opt,name=synchronization,proto3,enum=tensorflow.VariableSynchronization" json:"synchronization,omitempty"` + // Indicates how a distributed variable will be aggregated. + Aggregation VariableAggregation `protobuf:"varint,9,opt,name=aggregation,proto3,enum=tensorflow.VariableAggregation" json:"aggregation,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *VariableDef) Reset() { + *x = VariableDef{} + mi := &file_tensorflow_core_framework_variable_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *VariableDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VariableDef) ProtoMessage() {} + +func (x *VariableDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_variable_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use VariableDef.ProtoReflect.Descriptor instead. +func (*VariableDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_variable_proto_rawDescGZIP(), []int{0} +} + +func (x *VariableDef) GetVariableName() string { + if x != nil { + return x.VariableName + } + return "" +} + +func (x *VariableDef) GetInitialValueName() string { + if x != nil { + return x.InitialValueName + } + return "" +} + +func (x *VariableDef) GetInitializerName() string { + if x != nil { + return x.InitializerName + } + return "" +} + +func (x *VariableDef) GetSnapshotName() string { + if x != nil { + return x.SnapshotName + } + return "" +} + +func (x *VariableDef) GetSaveSliceInfoDef() *SaveSliceInfoDef { + if x != nil { + return x.SaveSliceInfoDef + } + return nil +} + +func (x *VariableDef) GetIsResource() bool { + if x != nil { + return x.IsResource + } + return false +} + +func (x *VariableDef) GetTrainable() bool { + if x != nil { + return x.Trainable + } + return false +} + +func (x *VariableDef) GetSynchronization() VariableSynchronization { + if x != nil { + return x.Synchronization + } + return VariableSynchronization_VARIABLE_SYNCHRONIZATION_AUTO +} + +func (x *VariableDef) GetAggregation() VariableAggregation { + if x != nil { + return x.Aggregation + } + return VariableAggregation_VARIABLE_AGGREGATION_NONE +} + +type SaveSliceInfoDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Name of the full variable of which this is a slice. + FullName string `protobuf:"bytes,1,opt,name=full_name,json=fullName,proto3" json:"full_name,omitempty"` + // Shape of the full variable. + FullShape []int64 `protobuf:"varint,2,rep,packed,name=full_shape,json=fullShape,proto3" json:"full_shape,omitempty"` + // Offset of this variable into the full variable. + VarOffset []int64 `protobuf:"varint,3,rep,packed,name=var_offset,json=varOffset,proto3" json:"var_offset,omitempty"` + // Shape of this variable. + VarShape []int64 `protobuf:"varint,4,rep,packed,name=var_shape,json=varShape,proto3" json:"var_shape,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SaveSliceInfoDef) Reset() { + *x = SaveSliceInfoDef{} + mi := &file_tensorflow_core_framework_variable_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SaveSliceInfoDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SaveSliceInfoDef) ProtoMessage() {} + +func (x *SaveSliceInfoDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_variable_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SaveSliceInfoDef.ProtoReflect.Descriptor instead. +func (*SaveSliceInfoDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_variable_proto_rawDescGZIP(), []int{1} +} + +func (x *SaveSliceInfoDef) GetFullName() string { + if x != nil { + return x.FullName + } + return "" +} + +func (x *SaveSliceInfoDef) GetFullShape() []int64 { + if x != nil { + return x.FullShape + } + return nil +} + +func (x *SaveSliceInfoDef) GetVarOffset() []int64 { + if x != nil { + return x.VarOffset + } + return nil +} + +func (x *SaveSliceInfoDef) GetVarShape() []int64 { + if x != nil { + return x.VarShape + } + return nil +} + +var File_tensorflow_core_framework_variable_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_variable_proto_rawDesc = "" + + "\n" + + "(tensorflow/core/framework/variable.proto\x12\n" + + "tensorflow\"\xce\x03\n" + + "\vVariableDef\x12#\n" + + "\rvariable_name\x18\x01 \x01(\tR\fvariableName\x12,\n" + + "\x12initial_value_name\x18\x06 \x01(\tR\x10initialValueName\x12)\n" + + "\x10initializer_name\x18\x02 \x01(\tR\x0finitializerName\x12#\n" + + "\rsnapshot_name\x18\x03 \x01(\tR\fsnapshotName\x12K\n" + + "\x13save_slice_info_def\x18\x04 \x01(\v2\x1c.tensorflow.SaveSliceInfoDefR\x10saveSliceInfoDef\x12\x1f\n" + + "\vis_resource\x18\x05 \x01(\bR\n" + + "isResource\x12\x1c\n" + + "\ttrainable\x18\a \x01(\bR\ttrainable\x12M\n" + + "\x0fsynchronization\x18\b \x01(\x0e2#.tensorflow.VariableSynchronizationR\x0fsynchronization\x12A\n" + + "\vaggregation\x18\t \x01(\x0e2\x1f.tensorflow.VariableAggregationR\vaggregation\"\x8a\x01\n" + + "\x10SaveSliceInfoDef\x12\x1b\n" + + "\tfull_name\x18\x01 \x01(\tR\bfullName\x12\x1d\n" + + "\n" + + "full_shape\x18\x02 \x03(\x03R\tfullShape\x12\x1d\n" + + "\n" + + "var_offset\x18\x03 \x03(\x03R\tvarOffset\x12\x1b\n" + + "\tvar_shape\x18\x04 \x03(\x03R\bvarShape*\xac\x01\n" + + "\x17VariableSynchronization\x12!\n" + + "\x1dVARIABLE_SYNCHRONIZATION_AUTO\x10\x00\x12!\n" + + "\x1dVARIABLE_SYNCHRONIZATION_NONE\x10\x01\x12%\n" + + "!VARIABLE_SYNCHRONIZATION_ON_WRITE\x10\x02\x12$\n" + + " VARIABLE_SYNCHRONIZATION_ON_READ\x10\x03*\x9e\x01\n" + + "\x13VariableAggregation\x12\x1d\n" + + "\x19VARIABLE_AGGREGATION_NONE\x10\x00\x12\x1c\n" + + "\x18VARIABLE_AGGREGATION_SUM\x10\x01\x12\x1d\n" + + "\x19VARIABLE_AGGREGATION_MEAN\x10\x02\x12+\n" + + "'VARIABLE_AGGREGATION_ONLY_FIRST_REPLICA\x10\x03B\x80\x01\n" + + "\x18org.tensorflow.frameworkB\x0eVariableProtosP\x01ZOgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/variable_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_variable_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_variable_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_variable_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_variable_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_variable_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_variable_proto_rawDesc), len(file_tensorflow_core_framework_variable_proto_rawDesc))) + }) + return file_tensorflow_core_framework_variable_proto_rawDescData +} + +var file_tensorflow_core_framework_variable_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_tensorflow_core_framework_variable_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_tensorflow_core_framework_variable_proto_goTypes = []any{ + (VariableSynchronization)(0), // 0: tensorflow.VariableSynchronization + (VariableAggregation)(0), // 1: tensorflow.VariableAggregation + (*VariableDef)(nil), // 2: tensorflow.VariableDef + (*SaveSliceInfoDef)(nil), // 3: tensorflow.SaveSliceInfoDef +} +var file_tensorflow_core_framework_variable_proto_depIdxs = []int32{ + 3, // 0: tensorflow.VariableDef.save_slice_info_def:type_name -> tensorflow.SaveSliceInfoDef + 0, // 1: tensorflow.VariableDef.synchronization:type_name -> tensorflow.VariableSynchronization + 1, // 2: tensorflow.VariableDef.aggregation:type_name -> tensorflow.VariableAggregation + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_variable_proto_init() } +func file_tensorflow_core_framework_variable_proto_init() { + if File_tensorflow_core_framework_variable_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_variable_proto_rawDesc), len(file_tensorflow_core_framework_variable_proto_rawDesc)), + NumEnums: 2, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_variable_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_variable_proto_depIdxs, + EnumInfos: file_tensorflow_core_framework_variable_proto_enumTypes, + MessageInfos: file_tensorflow_core_framework_variable_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_variable_proto = out.File + file_tensorflow_core_framework_variable_proto_goTypes = nil + file_tensorflow_core_framework_variable_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/versions_go_proto/versions.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/versions_go_proto/versions.pb.go new file mode 100644 index 0000000..b1d4377 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/framework/versions_go_proto/versions.pb.go @@ -0,0 +1,158 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/framework/versions.proto + +package versions_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Version information for a piece of serialized data +// +// There are different types of versions for each type of data +// (GraphDef, etc.), but they all have the same common shape +// described here. +// +// Each consumer has "consumer" and "min_producer" versions (specified +// elsewhere). A consumer is allowed to consume this data if +// +// producer >= min_producer +// consumer >= min_consumer +// consumer not in bad_consumers +type VersionDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The version of the code that produced this data. + Producer int32 `protobuf:"varint,1,opt,name=producer,proto3" json:"producer,omitempty"` + // Any consumer below this version is not allowed to consume this data. + MinConsumer int32 `protobuf:"varint,2,opt,name=min_consumer,json=minConsumer,proto3" json:"min_consumer,omitempty"` + // Specific consumer versions which are disallowed (e.g. due to bugs). + BadConsumers []int32 `protobuf:"varint,3,rep,packed,name=bad_consumers,json=badConsumers,proto3" json:"bad_consumers,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *VersionDef) Reset() { + *x = VersionDef{} + mi := &file_tensorflow_core_framework_versions_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *VersionDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VersionDef) ProtoMessage() {} + +func (x *VersionDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_framework_versions_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use VersionDef.ProtoReflect.Descriptor instead. +func (*VersionDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_framework_versions_proto_rawDescGZIP(), []int{0} +} + +func (x *VersionDef) GetProducer() int32 { + if x != nil { + return x.Producer + } + return 0 +} + +func (x *VersionDef) GetMinConsumer() int32 { + if x != nil { + return x.MinConsumer + } + return 0 +} + +func (x *VersionDef) GetBadConsumers() []int32 { + if x != nil { + return x.BadConsumers + } + return nil +} + +var File_tensorflow_core_framework_versions_proto protoreflect.FileDescriptor + +const file_tensorflow_core_framework_versions_proto_rawDesc = "" + + "\n" + + "(tensorflow/core/framework/versions.proto\x12\n" + + "tensorflow\"p\n" + + "\n" + + "VersionDef\x12\x1a\n" + + "\bproducer\x18\x01 \x01(\x05R\bproducer\x12!\n" + + "\fmin_consumer\x18\x02 \x01(\x05R\vminConsumer\x12#\n" + + "\rbad_consumers\x18\x03 \x03(\x05R\fbadConsumersB\x80\x01\n" + + "\x18org.tensorflow.frameworkB\x0eVersionsProtosP\x01ZOgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/versions_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_framework_versions_proto_rawDescOnce sync.Once + file_tensorflow_core_framework_versions_proto_rawDescData []byte +) + +func file_tensorflow_core_framework_versions_proto_rawDescGZIP() []byte { + file_tensorflow_core_framework_versions_proto_rawDescOnce.Do(func() { + file_tensorflow_core_framework_versions_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_versions_proto_rawDesc), len(file_tensorflow_core_framework_versions_proto_rawDesc))) + }) + return file_tensorflow_core_framework_versions_proto_rawDescData +} + +var file_tensorflow_core_framework_versions_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_tensorflow_core_framework_versions_proto_goTypes = []any{ + (*VersionDef)(nil), // 0: tensorflow.VersionDef +} +var file_tensorflow_core_framework_versions_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_framework_versions_proto_init() } +func file_tensorflow_core_framework_versions_proto_init() { + if File_tensorflow_core_framework_versions_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_framework_versions_proto_rawDesc), len(file_tensorflow_core_framework_versions_proto_rawDesc)), + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_framework_versions_proto_goTypes, + DependencyIndexes: file_tensorflow_core_framework_versions_proto_depIdxs, + MessageInfos: file_tensorflow_core_framework_versions_proto_msgTypes, + }.Build() + File_tensorflow_core_framework_versions_proto = out.File + file_tensorflow_core_framework_versions_proto_goTypes = nil + file_tensorflow_core_framework_versions_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/autotuning.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/autotuning.pb.go new file mode 100644 index 0000000..afb80c2 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/autotuning.pb.go @@ -0,0 +1,714 @@ +// This file defines protos that store the results of autotuning various +// operations. +// +// They are in proto format because we want to log them structured. They offer +// tremendous statistical, testing, and debugging value. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/autotuning.proto + +package for_core_protos_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + anypb "google.golang.org/protobuf/types/known/anypb" + durationpb "google.golang.org/protobuf/types/known/durationpb" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type AutotuneResult_FailureKind int32 + +const ( + AutotuneResult_UNKNOWN AutotuneResult_FailureKind = 0 + AutotuneResult_REDZONE_MODIFIED AutotuneResult_FailureKind = 1 + AutotuneResult_WRONG_RESULT AutotuneResult_FailureKind = 2 +) + +// Enum value maps for AutotuneResult_FailureKind. +var ( + AutotuneResult_FailureKind_name = map[int32]string{ + 0: "UNKNOWN", + 1: "REDZONE_MODIFIED", + 2: "WRONG_RESULT", + } + AutotuneResult_FailureKind_value = map[string]int32{ + "UNKNOWN": 0, + "REDZONE_MODIFIED": 1, + "WRONG_RESULT": 2, + } +) + +func (x AutotuneResult_FailureKind) Enum() *AutotuneResult_FailureKind { + p := new(AutotuneResult_FailureKind) + *p = x + return p +} + +func (x AutotuneResult_FailureKind) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (AutotuneResult_FailureKind) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_protobuf_autotuning_proto_enumTypes[0].Descriptor() +} + +func (AutotuneResult_FailureKind) Type() protoreflect.EnumType { + return &file_tensorflow_core_protobuf_autotuning_proto_enumTypes[0] +} + +func (x AutotuneResult_FailureKind) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use AutotuneResult_FailureKind.Descriptor instead. +func (AutotuneResult_FailureKind) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_autotuning_proto_rawDescGZIP(), []int{2, 0} +} + +type CudnnVersion struct { + state protoimpl.MessageState `protogen:"open.v1"` + Major int32 `protobuf:"varint,1,opt,name=major,proto3" json:"major,omitempty"` + Minor int32 `protobuf:"varint,2,opt,name=minor,proto3" json:"minor,omitempty"` + Patch int32 `protobuf:"varint,3,opt,name=patch,proto3" json:"patch,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CudnnVersion) Reset() { + *x = CudnnVersion{} + mi := &file_tensorflow_core_protobuf_autotuning_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CudnnVersion) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CudnnVersion) ProtoMessage() {} + +func (x *CudnnVersion) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_autotuning_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CudnnVersion.ProtoReflect.Descriptor instead. +func (*CudnnVersion) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_autotuning_proto_rawDescGZIP(), []int{0} +} + +func (x *CudnnVersion) GetMajor() int32 { + if x != nil { + return x.Major + } + return 0 +} + +func (x *CudnnVersion) GetMinor() int32 { + if x != nil { + return x.Minor + } + return 0 +} + +func (x *CudnnVersion) GetPatch() int32 { + if x != nil { + return x.Patch + } + return 0 +} + +type ComputeCapability struct { + state protoimpl.MessageState `protogen:"open.v1"` + Major int32 `protobuf:"varint,1,opt,name=major,proto3" json:"major,omitempty"` + Minor int32 `protobuf:"varint,2,opt,name=minor,proto3" json:"minor,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ComputeCapability) Reset() { + *x = ComputeCapability{} + mi := &file_tensorflow_core_protobuf_autotuning_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ComputeCapability) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ComputeCapability) ProtoMessage() {} + +func (x *ComputeCapability) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_autotuning_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ComputeCapability.ProtoReflect.Descriptor instead. +func (*ComputeCapability) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_autotuning_proto_rawDescGZIP(), []int{1} +} + +func (x *ComputeCapability) GetMajor() int32 { + if x != nil { + return x.Major + } + return 0 +} + +func (x *ComputeCapability) GetMinor() int32 { + if x != nil { + return x.Minor + } + return 0 +} + +type AutotuneResult struct { + state protoimpl.MessageState `protogen:"open.v1"` + ScratchBytes int64 `protobuf:"varint,8,opt,name=scratch_bytes,json=scratchBytes,proto3" json:"scratch_bytes,omitempty"` + RunTime *durationpb.Duration `protobuf:"bytes,9,opt,name=run_time,json=runTime,proto3" json:"run_time,omitempty"` + Failure *AutotuneResult_FailureResult `protobuf:"bytes,7,opt,name=failure,proto3" json:"failure,omitempty"` + // Types that are valid to be assigned to Key: + // + // *AutotuneResult_Conv + // *AutotuneResult_Gemm + Key isAutotuneResult_Key `protobuf_oneof:"key"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AutotuneResult) Reset() { + *x = AutotuneResult{} + mi := &file_tensorflow_core_protobuf_autotuning_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AutotuneResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AutotuneResult) ProtoMessage() {} + +func (x *AutotuneResult) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_autotuning_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AutotuneResult.ProtoReflect.Descriptor instead. +func (*AutotuneResult) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_autotuning_proto_rawDescGZIP(), []int{2} +} + +func (x *AutotuneResult) GetScratchBytes() int64 { + if x != nil { + return x.ScratchBytes + } + return 0 +} + +func (x *AutotuneResult) GetRunTime() *durationpb.Duration { + if x != nil { + return x.RunTime + } + return nil +} + +func (x *AutotuneResult) GetFailure() *AutotuneResult_FailureResult { + if x != nil { + return x.Failure + } + return nil +} + +func (x *AutotuneResult) GetKey() isAutotuneResult_Key { + if x != nil { + return x.Key + } + return nil +} + +func (x *AutotuneResult) GetConv() *AutotuneResult_ConvKey { + if x != nil { + if x, ok := x.Key.(*AutotuneResult_Conv); ok { + return x.Conv + } + } + return nil +} + +func (x *AutotuneResult) GetGemm() *AutotuneResult_GemmKey { + if x != nil { + if x, ok := x.Key.(*AutotuneResult_Gemm); ok { + return x.Gemm + } + } + return nil +} + +type isAutotuneResult_Key interface { + isAutotuneResult_Key() +} + +type AutotuneResult_Conv struct { + Conv *AutotuneResult_ConvKey `protobuf:"bytes,5,opt,name=conv,proto3,oneof"` +} + +type AutotuneResult_Gemm struct { + Gemm *AutotuneResult_GemmKey `protobuf:"bytes,6,opt,name=gemm,proto3,oneof"` +} + +func (*AutotuneResult_Conv) isAutotuneResult_Key() {} + +func (*AutotuneResult_Gemm) isAutotuneResult_Key() {} + +type AutotuningLog struct { + state protoimpl.MessageState `protogen:"open.v1"` + Instr *anypb.Any `protobuf:"bytes,1,opt,name=instr,proto3" json:"instr,omitempty"` + // Records all auto-tuning results per algorithm. + Results []*AutotuneResult `protobuf:"bytes,2,rep,name=results,proto3" json:"results,omitempty"` + CudnnVersion *CudnnVersion `protobuf:"bytes,3,opt,name=cudnn_version,json=cudnnVersion,proto3" json:"cudnn_version,omitempty"` + ComputeCapability *ComputeCapability `protobuf:"bytes,4,opt,name=compute_capability,json=computeCapability,proto3" json:"compute_capability,omitempty"` + // stream_executor::DeviceDescription::pci_bus_id. + DevicePciBusId string `protobuf:"bytes,5,opt,name=device_pci_bus_id,json=devicePciBusId,proto3" json:"device_pci_bus_id,omitempty"` + BlasVersion string `protobuf:"bytes,6,opt,name=blas_version,json=blasVersion,proto3" json:"blas_version,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AutotuningLog) Reset() { + *x = AutotuningLog{} + mi := &file_tensorflow_core_protobuf_autotuning_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AutotuningLog) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AutotuningLog) ProtoMessage() {} + +func (x *AutotuningLog) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_autotuning_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AutotuningLog.ProtoReflect.Descriptor instead. +func (*AutotuningLog) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_autotuning_proto_rawDescGZIP(), []int{3} +} + +func (x *AutotuningLog) GetInstr() *anypb.Any { + if x != nil { + return x.Instr + } + return nil +} + +func (x *AutotuningLog) GetResults() []*AutotuneResult { + if x != nil { + return x.Results + } + return nil +} + +func (x *AutotuningLog) GetCudnnVersion() *CudnnVersion { + if x != nil { + return x.CudnnVersion + } + return nil +} + +func (x *AutotuningLog) GetComputeCapability() *ComputeCapability { + if x != nil { + return x.ComputeCapability + } + return nil +} + +func (x *AutotuningLog) GetDevicePciBusId() string { + if x != nil { + return x.DevicePciBusId + } + return "" +} + +func (x *AutotuningLog) GetBlasVersion() string { + if x != nil { + return x.BlasVersion + } + return "" +} + +type AutotuneResult_FailureResult struct { + state protoimpl.MessageState `protogen:"open.v1"` + Kind AutotuneResult_FailureKind `protobuf:"varint,1,opt,name=kind,proto3,enum=tensorflow.AutotuneResult_FailureKind" json:"kind,omitempty"` + Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` + // For failure_kind == WRONG_RESULT, this field indicates the reference + // configuration that we compared against. + // + // Note that the reference algorithm isn't always correct. However, + // empirically it's more correct, as it's "algo 0", less fancy than the + // compared one. + // + // Types that are valid to be assigned to Key: + // + // *AutotuneResult_FailureResult_ReferenceConv + // *AutotuneResult_FailureResult_ReferenceGemm + Key isAutotuneResult_FailureResult_Key `protobuf_oneof:"key"` + BufferAddress int64 `protobuf:"varint,13,opt,name=buffer_address,json=bufferAddress,proto3" json:"buffer_address,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AutotuneResult_FailureResult) Reset() { + *x = AutotuneResult_FailureResult{} + mi := &file_tensorflow_core_protobuf_autotuning_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AutotuneResult_FailureResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AutotuneResult_FailureResult) ProtoMessage() {} + +func (x *AutotuneResult_FailureResult) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_autotuning_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AutotuneResult_FailureResult.ProtoReflect.Descriptor instead. +func (*AutotuneResult_FailureResult) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_autotuning_proto_rawDescGZIP(), []int{2, 0} +} + +func (x *AutotuneResult_FailureResult) GetKind() AutotuneResult_FailureKind { + if x != nil { + return x.Kind + } + return AutotuneResult_UNKNOWN +} + +func (x *AutotuneResult_FailureResult) GetMsg() string { + if x != nil { + return x.Msg + } + return "" +} + +func (x *AutotuneResult_FailureResult) GetKey() isAutotuneResult_FailureResult_Key { + if x != nil { + return x.Key + } + return nil +} + +func (x *AutotuneResult_FailureResult) GetReferenceConv() *AutotuneResult_ConvKey { + if x != nil { + if x, ok := x.Key.(*AutotuneResult_FailureResult_ReferenceConv); ok { + return x.ReferenceConv + } + } + return nil +} + +func (x *AutotuneResult_FailureResult) GetReferenceGemm() *AutotuneResult_GemmKey { + if x != nil { + if x, ok := x.Key.(*AutotuneResult_FailureResult_ReferenceGemm); ok { + return x.ReferenceGemm + } + } + return nil +} + +func (x *AutotuneResult_FailureResult) GetBufferAddress() int64 { + if x != nil { + return x.BufferAddress + } + return 0 +} + +type isAutotuneResult_FailureResult_Key interface { + isAutotuneResult_FailureResult_Key() +} + +type AutotuneResult_FailureResult_ReferenceConv struct { + ReferenceConv *AutotuneResult_ConvKey `protobuf:"bytes,11,opt,name=reference_conv,json=referenceConv,proto3,oneof"` +} + +type AutotuneResult_FailureResult_ReferenceGemm struct { + ReferenceGemm *AutotuneResult_GemmKey `protobuf:"bytes,12,opt,name=reference_gemm,json=referenceGemm,proto3,oneof"` +} + +func (*AutotuneResult_FailureResult_ReferenceConv) isAutotuneResult_FailureResult_Key() {} + +func (*AutotuneResult_FailureResult_ReferenceGemm) isAutotuneResult_FailureResult_Key() {} + +type AutotuneResult_ConvKey struct { + state protoimpl.MessageState `protogen:"open.v1"` + Algorithm int64 `protobuf:"varint,1,opt,name=algorithm,proto3" json:"algorithm,omitempty"` + TensorOpsEnabled bool `protobuf:"varint,2,opt,name=tensor_ops_enabled,json=tensorOpsEnabled,proto3" json:"tensor_ops_enabled,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AutotuneResult_ConvKey) Reset() { + *x = AutotuneResult_ConvKey{} + mi := &file_tensorflow_core_protobuf_autotuning_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AutotuneResult_ConvKey) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AutotuneResult_ConvKey) ProtoMessage() {} + +func (x *AutotuneResult_ConvKey) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_autotuning_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AutotuneResult_ConvKey.ProtoReflect.Descriptor instead. +func (*AutotuneResult_ConvKey) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_autotuning_proto_rawDescGZIP(), []int{2, 1} +} + +func (x *AutotuneResult_ConvKey) GetAlgorithm() int64 { + if x != nil { + return x.Algorithm + } + return 0 +} + +func (x *AutotuneResult_ConvKey) GetTensorOpsEnabled() bool { + if x != nil { + return x.TensorOpsEnabled + } + return false +} + +type AutotuneResult_GemmKey struct { + state protoimpl.MessageState `protogen:"open.v1"` + Algorithm int64 `protobuf:"varint,1,opt,name=algorithm,proto3" json:"algorithm,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AutotuneResult_GemmKey) Reset() { + *x = AutotuneResult_GemmKey{} + mi := &file_tensorflow_core_protobuf_autotuning_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AutotuneResult_GemmKey) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AutotuneResult_GemmKey) ProtoMessage() {} + +func (x *AutotuneResult_GemmKey) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_autotuning_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AutotuneResult_GemmKey.ProtoReflect.Descriptor instead. +func (*AutotuneResult_GemmKey) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_autotuning_proto_rawDescGZIP(), []int{2, 2} +} + +func (x *AutotuneResult_GemmKey) GetAlgorithm() int64 { + if x != nil { + return x.Algorithm + } + return 0 +} + +var File_tensorflow_core_protobuf_autotuning_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_autotuning_proto_rawDesc = "" + + "\n" + + ")tensorflow/core/protobuf/autotuning.proto\x12\n" + + "tensorflow\x1a\x19google/protobuf/any.proto\x1a\x1egoogle/protobuf/duration.proto\"P\n" + + "\fCudnnVersion\x12\x14\n" + + "\x05major\x18\x01 \x01(\x05R\x05major\x12\x14\n" + + "\x05minor\x18\x02 \x01(\x05R\x05minor\x12\x14\n" + + "\x05patch\x18\x03 \x01(\x05R\x05patch\"?\n" + + "\x11ComputeCapability\x12\x14\n" + + "\x05major\x18\x01 \x01(\x05R\x05major\x12\x14\n" + + "\x05minor\x18\x02 \x01(\x05R\x05minor\"\x96\x06\n" + + "\x0eAutotuneResult\x12#\n" + + "\rscratch_bytes\x18\b \x01(\x03R\fscratchBytes\x124\n" + + "\brun_time\x18\t \x01(\v2\x19.google.protobuf.DurationR\arunTime\x12B\n" + + "\afailure\x18\a \x01(\v2(.tensorflow.AutotuneResult.FailureResultR\afailure\x128\n" + + "\x04conv\x18\x05 \x01(\v2\".tensorflow.AutotuneResult.ConvKeyH\x00R\x04conv\x128\n" + + "\x04gemm\x18\x06 \x01(\v2\".tensorflow.AutotuneResult.GemmKeyH\x00R\x04gemm\x1a\xa5\x02\n" + + "\rFailureResult\x12:\n" + + "\x04kind\x18\x01 \x01(\x0e2&.tensorflow.AutotuneResult.FailureKindR\x04kind\x12\x10\n" + + "\x03msg\x18\x02 \x01(\tR\x03msg\x12K\n" + + "\x0ereference_conv\x18\v \x01(\v2\".tensorflow.AutotuneResult.ConvKeyH\x00R\rreferenceConv\x12K\n" + + "\x0ereference_gemm\x18\f \x01(\v2\".tensorflow.AutotuneResult.GemmKeyH\x00R\rreferenceGemm\x12%\n" + + "\x0ebuffer_address\x18\r \x01(\x03R\rbufferAddressB\x05\n" + + "\x03key\x1aU\n" + + "\aConvKey\x12\x1c\n" + + "\talgorithm\x18\x01 \x01(\x03R\talgorithm\x12,\n" + + "\x12tensor_ops_enabled\x18\x02 \x01(\bR\x10tensorOpsEnabled\x1a'\n" + + "\aGemmKey\x12\x1c\n" + + "\talgorithm\x18\x01 \x01(\x03R\talgorithm\"B\n" + + "\vFailureKind\x12\v\n" + + "\aUNKNOWN\x10\x00\x12\x14\n" + + "\x10REDZONE_MODIFIED\x10\x01\x12\x10\n" + + "\fWRONG_RESULT\x10\x02B\x05\n" + + "\x03key\"\xcc\x02\n" + + "\rAutotuningLog\x12*\n" + + "\x05instr\x18\x01 \x01(\v2\x14.google.protobuf.AnyR\x05instr\x124\n" + + "\aresults\x18\x02 \x03(\v2\x1a.tensorflow.AutotuneResultR\aresults\x12=\n" + + "\rcudnn_version\x18\x03 \x01(\v2\x18.tensorflow.CudnnVersionR\fcudnnVersion\x12L\n" + + "\x12compute_capability\x18\x04 \x01(\v2\x1d.tensorflow.ComputeCapabilityR\x11computeCapability\x12)\n" + + "\x11device_pci_bus_id\x18\x05 \x01(\tR\x0edevicePciBusId\x12!\n" + + "\fblas_version\x18\x06 \x01(\tR\vblasVersionBWZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_protob\x06proto3" + +var ( + file_tensorflow_core_protobuf_autotuning_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_autotuning_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_autotuning_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_autotuning_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_autotuning_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_autotuning_proto_rawDesc), len(file_tensorflow_core_protobuf_autotuning_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_autotuning_proto_rawDescData +} + +var file_tensorflow_core_protobuf_autotuning_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_tensorflow_core_protobuf_autotuning_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_tensorflow_core_protobuf_autotuning_proto_goTypes = []any{ + (AutotuneResult_FailureKind)(0), // 0: tensorflow.AutotuneResult.FailureKind + (*CudnnVersion)(nil), // 1: tensorflow.CudnnVersion + (*ComputeCapability)(nil), // 2: tensorflow.ComputeCapability + (*AutotuneResult)(nil), // 3: tensorflow.AutotuneResult + (*AutotuningLog)(nil), // 4: tensorflow.AutotuningLog + (*AutotuneResult_FailureResult)(nil), // 5: tensorflow.AutotuneResult.FailureResult + (*AutotuneResult_ConvKey)(nil), // 6: tensorflow.AutotuneResult.ConvKey + (*AutotuneResult_GemmKey)(nil), // 7: tensorflow.AutotuneResult.GemmKey + (*durationpb.Duration)(nil), // 8: google.protobuf.Duration + (*anypb.Any)(nil), // 9: google.protobuf.Any +} +var file_tensorflow_core_protobuf_autotuning_proto_depIdxs = []int32{ + 8, // 0: tensorflow.AutotuneResult.run_time:type_name -> google.protobuf.Duration + 5, // 1: tensorflow.AutotuneResult.failure:type_name -> tensorflow.AutotuneResult.FailureResult + 6, // 2: tensorflow.AutotuneResult.conv:type_name -> tensorflow.AutotuneResult.ConvKey + 7, // 3: tensorflow.AutotuneResult.gemm:type_name -> tensorflow.AutotuneResult.GemmKey + 9, // 4: tensorflow.AutotuningLog.instr:type_name -> google.protobuf.Any + 3, // 5: tensorflow.AutotuningLog.results:type_name -> tensorflow.AutotuneResult + 1, // 6: tensorflow.AutotuningLog.cudnn_version:type_name -> tensorflow.CudnnVersion + 2, // 7: tensorflow.AutotuningLog.compute_capability:type_name -> tensorflow.ComputeCapability + 0, // 8: tensorflow.AutotuneResult.FailureResult.kind:type_name -> tensorflow.AutotuneResult.FailureKind + 6, // 9: tensorflow.AutotuneResult.FailureResult.reference_conv:type_name -> tensorflow.AutotuneResult.ConvKey + 7, // 10: tensorflow.AutotuneResult.FailureResult.reference_gemm:type_name -> tensorflow.AutotuneResult.GemmKey + 11, // [11:11] is the sub-list for method output_type + 11, // [11:11] is the sub-list for method input_type + 11, // [11:11] is the sub-list for extension type_name + 11, // [11:11] is the sub-list for extension extendee + 0, // [0:11] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_autotuning_proto_init() } +func file_tensorflow_core_protobuf_autotuning_proto_init() { + if File_tensorflow_core_protobuf_autotuning_proto != nil { + return + } + file_tensorflow_core_protobuf_autotuning_proto_msgTypes[2].OneofWrappers = []any{ + (*AutotuneResult_Conv)(nil), + (*AutotuneResult_Gemm)(nil), + } + file_tensorflow_core_protobuf_autotuning_proto_msgTypes[4].OneofWrappers = []any{ + (*AutotuneResult_FailureResult_ReferenceConv)(nil), + (*AutotuneResult_FailureResult_ReferenceGemm)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_autotuning_proto_rawDesc), len(file_tensorflow_core_protobuf_autotuning_proto_rawDesc)), + NumEnums: 1, + NumMessages: 7, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_autotuning_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_autotuning_proto_depIdxs, + EnumInfos: file_tensorflow_core_protobuf_autotuning_proto_enumTypes, + MessageInfos: file_tensorflow_core_protobuf_autotuning_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_autotuning_proto = out.File + file_tensorflow_core_protobuf_autotuning_proto_goTypes = nil + file_tensorflow_core_protobuf_autotuning_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/bfc_memory_map.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/bfc_memory_map.pb.go new file mode 100644 index 0000000..3bd352f --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/bfc_memory_map.pb.go @@ -0,0 +1,510 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/bfc_memory_map.proto + +package for_core_protos_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Some of the data from AllocatorStats +type MemAllocatorStats struct { + state protoimpl.MessageState `protogen:"open.v1"` + NumAllocs int64 `protobuf:"varint,1,opt,name=num_allocs,json=numAllocs,proto3" json:"num_allocs,omitempty"` + BytesInUse int64 `protobuf:"varint,2,opt,name=bytes_in_use,json=bytesInUse,proto3" json:"bytes_in_use,omitempty"` + PeakBytesInUse int64 `protobuf:"varint,3,opt,name=peak_bytes_in_use,json=peakBytesInUse,proto3" json:"peak_bytes_in_use,omitempty"` + LargestAllocSize int64 `protobuf:"varint,4,opt,name=largest_alloc_size,json=largestAllocSize,proto3" json:"largest_alloc_size,omitempty"` + FragmentationMetric float32 `protobuf:"fixed32,5,opt,name=fragmentation_metric,json=fragmentationMetric,proto3" json:"fragmentation_metric,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MemAllocatorStats) Reset() { + *x = MemAllocatorStats{} + mi := &file_tensorflow_core_protobuf_bfc_memory_map_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MemAllocatorStats) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MemAllocatorStats) ProtoMessage() {} + +func (x *MemAllocatorStats) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_bfc_memory_map_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MemAllocatorStats.ProtoReflect.Descriptor instead. +func (*MemAllocatorStats) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_bfc_memory_map_proto_rawDescGZIP(), []int{0} +} + +func (x *MemAllocatorStats) GetNumAllocs() int64 { + if x != nil { + return x.NumAllocs + } + return 0 +} + +func (x *MemAllocatorStats) GetBytesInUse() int64 { + if x != nil { + return x.BytesInUse + } + return 0 +} + +func (x *MemAllocatorStats) GetPeakBytesInUse() int64 { + if x != nil { + return x.PeakBytesInUse + } + return 0 +} + +func (x *MemAllocatorStats) GetLargestAllocSize() int64 { + if x != nil { + return x.LargestAllocSize + } + return 0 +} + +func (x *MemAllocatorStats) GetFragmentationMetric() float32 { + if x != nil { + return x.FragmentationMetric + } + return 0 +} + +type MemChunk struct { + state protoimpl.MessageState `protogen:"open.v1"` + Address uint64 `protobuf:"varint,1,opt,name=address,proto3" json:"address,omitempty"` + Size int64 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"` + RequestedSize int64 `protobuf:"varint,3,opt,name=requested_size,json=requestedSize,proto3" json:"requested_size,omitempty"` + Bin int32 `protobuf:"varint,4,opt,name=bin,proto3" json:"bin,omitempty"` + OpName string `protobuf:"bytes,5,opt,name=op_name,json=opName,proto3" json:"op_name,omitempty"` + FreedAtCount uint64 `protobuf:"varint,6,opt,name=freed_at_count,json=freedAtCount,proto3" json:"freed_at_count,omitempty"` + ActionCount uint64 `protobuf:"varint,7,opt,name=action_count,json=actionCount,proto3" json:"action_count,omitempty"` + InUse bool `protobuf:"varint,8,opt,name=in_use,json=inUse,proto3" json:"in_use,omitempty"` + StepId uint64 `protobuf:"varint,9,opt,name=step_id,json=stepId,proto3" json:"step_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MemChunk) Reset() { + *x = MemChunk{} + mi := &file_tensorflow_core_protobuf_bfc_memory_map_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MemChunk) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MemChunk) ProtoMessage() {} + +func (x *MemChunk) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_bfc_memory_map_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MemChunk.ProtoReflect.Descriptor instead. +func (*MemChunk) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_bfc_memory_map_proto_rawDescGZIP(), []int{1} +} + +func (x *MemChunk) GetAddress() uint64 { + if x != nil { + return x.Address + } + return 0 +} + +func (x *MemChunk) GetSize() int64 { + if x != nil { + return x.Size + } + return 0 +} + +func (x *MemChunk) GetRequestedSize() int64 { + if x != nil { + return x.RequestedSize + } + return 0 +} + +func (x *MemChunk) GetBin() int32 { + if x != nil { + return x.Bin + } + return 0 +} + +func (x *MemChunk) GetOpName() string { + if x != nil { + return x.OpName + } + return "" +} + +func (x *MemChunk) GetFreedAtCount() uint64 { + if x != nil { + return x.FreedAtCount + } + return 0 +} + +func (x *MemChunk) GetActionCount() uint64 { + if x != nil { + return x.ActionCount + } + return 0 +} + +func (x *MemChunk) GetInUse() bool { + if x != nil { + return x.InUse + } + return false +} + +func (x *MemChunk) GetStepId() uint64 { + if x != nil { + return x.StepId + } + return 0 +} + +type BinSummary struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bin int32 `protobuf:"varint,1,opt,name=bin,proto3" json:"bin,omitempty"` + TotalBytesInUse int64 `protobuf:"varint,2,opt,name=total_bytes_in_use,json=totalBytesInUse,proto3" json:"total_bytes_in_use,omitempty"` + TotalBytesInBin int64 `protobuf:"varint,3,opt,name=total_bytes_in_bin,json=totalBytesInBin,proto3" json:"total_bytes_in_bin,omitempty"` + TotalChunksInUse int64 `protobuf:"varint,4,opt,name=total_chunks_in_use,json=totalChunksInUse,proto3" json:"total_chunks_in_use,omitempty"` + TotalChunksInBin int64 `protobuf:"varint,5,opt,name=total_chunks_in_bin,json=totalChunksInBin,proto3" json:"total_chunks_in_bin,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BinSummary) Reset() { + *x = BinSummary{} + mi := &file_tensorflow_core_protobuf_bfc_memory_map_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BinSummary) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BinSummary) ProtoMessage() {} + +func (x *BinSummary) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_bfc_memory_map_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BinSummary.ProtoReflect.Descriptor instead. +func (*BinSummary) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_bfc_memory_map_proto_rawDescGZIP(), []int{2} +} + +func (x *BinSummary) GetBin() int32 { + if x != nil { + return x.Bin + } + return 0 +} + +func (x *BinSummary) GetTotalBytesInUse() int64 { + if x != nil { + return x.TotalBytesInUse + } + return 0 +} + +func (x *BinSummary) GetTotalBytesInBin() int64 { + if x != nil { + return x.TotalBytesInBin + } + return 0 +} + +func (x *BinSummary) GetTotalChunksInUse() int64 { + if x != nil { + return x.TotalChunksInUse + } + return 0 +} + +func (x *BinSummary) GetTotalChunksInBin() int64 { + if x != nil { + return x.TotalChunksInBin + } + return 0 +} + +type SnapShot struct { + state protoimpl.MessageState `protogen:"open.v1"` + ActionCount uint64 `protobuf:"varint,1,opt,name=action_count,json=actionCount,proto3" json:"action_count,omitempty"` + Size int64 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SnapShot) Reset() { + *x = SnapShot{} + mi := &file_tensorflow_core_protobuf_bfc_memory_map_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SnapShot) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SnapShot) ProtoMessage() {} + +func (x *SnapShot) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_bfc_memory_map_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SnapShot.ProtoReflect.Descriptor instead. +func (*SnapShot) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_bfc_memory_map_proto_rawDescGZIP(), []int{3} +} + +func (x *SnapShot) GetActionCount() uint64 { + if x != nil { + return x.ActionCount + } + return 0 +} + +func (x *SnapShot) GetSize() int64 { + if x != nil { + return x.Size + } + return 0 +} + +type MemoryDump struct { + state protoimpl.MessageState `protogen:"open.v1"` + AllocatorName string `protobuf:"bytes,1,opt,name=allocator_name,json=allocatorName,proto3" json:"allocator_name,omitempty"` + BinSummary []*BinSummary `protobuf:"bytes,2,rep,name=bin_summary,json=binSummary,proto3" json:"bin_summary,omitempty"` + Chunk []*MemChunk `protobuf:"bytes,3,rep,name=chunk,proto3" json:"chunk,omitempty"` + SnapShot []*SnapShot `protobuf:"bytes,4,rep,name=snap_shot,json=snapShot,proto3" json:"snap_shot,omitempty"` + Stats *MemAllocatorStats `protobuf:"bytes,5,opt,name=stats,proto3" json:"stats,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MemoryDump) Reset() { + *x = MemoryDump{} + mi := &file_tensorflow_core_protobuf_bfc_memory_map_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MemoryDump) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MemoryDump) ProtoMessage() {} + +func (x *MemoryDump) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_bfc_memory_map_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MemoryDump.ProtoReflect.Descriptor instead. +func (*MemoryDump) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_bfc_memory_map_proto_rawDescGZIP(), []int{4} +} + +func (x *MemoryDump) GetAllocatorName() string { + if x != nil { + return x.AllocatorName + } + return "" +} + +func (x *MemoryDump) GetBinSummary() []*BinSummary { + if x != nil { + return x.BinSummary + } + return nil +} + +func (x *MemoryDump) GetChunk() []*MemChunk { + if x != nil { + return x.Chunk + } + return nil +} + +func (x *MemoryDump) GetSnapShot() []*SnapShot { + if x != nil { + return x.SnapShot + } + return nil +} + +func (x *MemoryDump) GetStats() *MemAllocatorStats { + if x != nil { + return x.Stats + } + return nil +} + +var File_tensorflow_core_protobuf_bfc_memory_map_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_bfc_memory_map_proto_rawDesc = "" + + "\n" + + "-tensorflow/core/protobuf/bfc_memory_map.proto\x12\n" + + "tensorflow\"\xe0\x01\n" + + "\x11MemAllocatorStats\x12\x1d\n" + + "\n" + + "num_allocs\x18\x01 \x01(\x03R\tnumAllocs\x12 \n" + + "\fbytes_in_use\x18\x02 \x01(\x03R\n" + + "bytesInUse\x12)\n" + + "\x11peak_bytes_in_use\x18\x03 \x01(\x03R\x0epeakBytesInUse\x12,\n" + + "\x12largest_alloc_size\x18\x04 \x01(\x03R\x10largestAllocSize\x121\n" + + "\x14fragmentation_metric\x18\x05 \x01(\x02R\x13fragmentationMetric\"\x83\x02\n" + + "\bMemChunk\x12\x18\n" + + "\aaddress\x18\x01 \x01(\x04R\aaddress\x12\x12\n" + + "\x04size\x18\x02 \x01(\x03R\x04size\x12%\n" + + "\x0erequested_size\x18\x03 \x01(\x03R\rrequestedSize\x12\x10\n" + + "\x03bin\x18\x04 \x01(\x05R\x03bin\x12\x17\n" + + "\aop_name\x18\x05 \x01(\tR\x06opName\x12$\n" + + "\x0efreed_at_count\x18\x06 \x01(\x04R\ffreedAtCount\x12!\n" + + "\faction_count\x18\a \x01(\x04R\vactionCount\x12\x15\n" + + "\x06in_use\x18\b \x01(\bR\x05inUse\x12\x17\n" + + "\astep_id\x18\t \x01(\x04R\x06stepId\"\xd6\x01\n" + + "\n" + + "BinSummary\x12\x10\n" + + "\x03bin\x18\x01 \x01(\x05R\x03bin\x12+\n" + + "\x12total_bytes_in_use\x18\x02 \x01(\x03R\x0ftotalBytesInUse\x12+\n" + + "\x12total_bytes_in_bin\x18\x03 \x01(\x03R\x0ftotalBytesInBin\x12-\n" + + "\x13total_chunks_in_use\x18\x04 \x01(\x03R\x10totalChunksInUse\x12-\n" + + "\x13total_chunks_in_bin\x18\x05 \x01(\x03R\x10totalChunksInBin\"A\n" + + "\bSnapShot\x12!\n" + + "\faction_count\x18\x01 \x01(\x04R\vactionCount\x12\x12\n" + + "\x04size\x18\x02 \x01(\x03R\x04size\"\x80\x02\n" + + "\n" + + "MemoryDump\x12%\n" + + "\x0eallocator_name\x18\x01 \x01(\tR\rallocatorName\x127\n" + + "\vbin_summary\x18\x02 \x03(\v2\x16.tensorflow.BinSummaryR\n" + + "binSummary\x12*\n" + + "\x05chunk\x18\x03 \x03(\v2\x14.tensorflow.MemChunkR\x05chunk\x121\n" + + "\tsnap_shot\x18\x04 \x03(\v2\x14.tensorflow.SnapShotR\bsnapShot\x123\n" + + "\x05stats\x18\x05 \x01(\v2\x1d.tensorflow.MemAllocatorStatsR\x05statsBWZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_protob\x06proto3" + +var ( + file_tensorflow_core_protobuf_bfc_memory_map_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_bfc_memory_map_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_bfc_memory_map_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_bfc_memory_map_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_bfc_memory_map_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_bfc_memory_map_proto_rawDesc), len(file_tensorflow_core_protobuf_bfc_memory_map_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_bfc_memory_map_proto_rawDescData +} + +var file_tensorflow_core_protobuf_bfc_memory_map_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_tensorflow_core_protobuf_bfc_memory_map_proto_goTypes = []any{ + (*MemAllocatorStats)(nil), // 0: tensorflow.MemAllocatorStats + (*MemChunk)(nil), // 1: tensorflow.MemChunk + (*BinSummary)(nil), // 2: tensorflow.BinSummary + (*SnapShot)(nil), // 3: tensorflow.SnapShot + (*MemoryDump)(nil), // 4: tensorflow.MemoryDump +} +var file_tensorflow_core_protobuf_bfc_memory_map_proto_depIdxs = []int32{ + 2, // 0: tensorflow.MemoryDump.bin_summary:type_name -> tensorflow.BinSummary + 1, // 1: tensorflow.MemoryDump.chunk:type_name -> tensorflow.MemChunk + 3, // 2: tensorflow.MemoryDump.snap_shot:type_name -> tensorflow.SnapShot + 0, // 3: tensorflow.MemoryDump.stats:type_name -> tensorflow.MemAllocatorStats + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_bfc_memory_map_proto_init() } +func file_tensorflow_core_protobuf_bfc_memory_map_proto_init() { + if File_tensorflow_core_protobuf_bfc_memory_map_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_bfc_memory_map_proto_rawDesc), len(file_tensorflow_core_protobuf_bfc_memory_map_proto_rawDesc)), + NumEnums: 0, + NumMessages: 5, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_bfc_memory_map_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_bfc_memory_map_proto_depIdxs, + MessageInfos: file_tensorflow_core_protobuf_bfc_memory_map_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_bfc_memory_map_proto = out.File + file_tensorflow_core_protobuf_bfc_memory_map_proto_goTypes = nil + file_tensorflow_core_protobuf_bfc_memory_map_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/cluster.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/cluster.pb.go new file mode 100644 index 0000000..827b6cd --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/cluster.pb.go @@ -0,0 +1,212 @@ +// Copyright 2016 The TensorFlow Authors. All Rights Reserved. +// +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +//============================================================================== + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/cluster.proto + +package for_core_protos_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Defines a single job in a TensorFlow cluster. +type JobDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The name of this job. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Mapping from task ID to "hostname:port" string. + // + // If the `name` field contains "worker", and the `tasks` map contains a + // mapping from 7 to "example.org:2222", then the device prefix + // "/job:worker/task:7" will be assigned to "example.org:2222". + Tasks map[int32]string `protobuf:"bytes,2,rep,name=tasks,proto3" json:"tasks,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *JobDef) Reset() { + *x = JobDef{} + mi := &file_tensorflow_core_protobuf_cluster_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *JobDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*JobDef) ProtoMessage() {} + +func (x *JobDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_cluster_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use JobDef.ProtoReflect.Descriptor instead. +func (*JobDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_cluster_proto_rawDescGZIP(), []int{0} +} + +func (x *JobDef) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *JobDef) GetTasks() map[int32]string { + if x != nil { + return x.Tasks + } + return nil +} + +// Defines a TensorFlow cluster as a set of jobs. +type ClusterDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The jobs that comprise the cluster. + Job []*JobDef `protobuf:"bytes,1,rep,name=job,proto3" json:"job,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ClusterDef) Reset() { + *x = ClusterDef{} + mi := &file_tensorflow_core_protobuf_cluster_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ClusterDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ClusterDef) ProtoMessage() {} + +func (x *ClusterDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_cluster_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ClusterDef.ProtoReflect.Descriptor instead. +func (*ClusterDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_cluster_proto_rawDescGZIP(), []int{1} +} + +func (x *ClusterDef) GetJob() []*JobDef { + if x != nil { + return x.Job + } + return nil +} + +var File_tensorflow_core_protobuf_cluster_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_cluster_proto_rawDesc = "" + + "\n" + + "&tensorflow/core/protobuf/cluster.proto\x12\n" + + "tensorflow\"\x8b\x01\n" + + "\x06JobDef\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x123\n" + + "\x05tasks\x18\x02 \x03(\v2\x1d.tensorflow.JobDef.TasksEntryR\x05tasks\x1a8\n" + + "\n" + + "TasksEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\x05R\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"2\n" + + "\n" + + "ClusterDef\x12$\n" + + "\x03job\x18\x01 \x03(\v2\x12.tensorflow.JobDefR\x03jobB\x87\x01\n" + + "\x1aorg.tensorflow.distruntimeB\rClusterProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_cluster_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_cluster_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_cluster_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_cluster_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_cluster_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_cluster_proto_rawDesc), len(file_tensorflow_core_protobuf_cluster_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_cluster_proto_rawDescData +} + +var file_tensorflow_core_protobuf_cluster_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_tensorflow_core_protobuf_cluster_proto_goTypes = []any{ + (*JobDef)(nil), // 0: tensorflow.JobDef + (*ClusterDef)(nil), // 1: tensorflow.ClusterDef + nil, // 2: tensorflow.JobDef.TasksEntry +} +var file_tensorflow_core_protobuf_cluster_proto_depIdxs = []int32{ + 2, // 0: tensorflow.JobDef.tasks:type_name -> tensorflow.JobDef.TasksEntry + 0, // 1: tensorflow.ClusterDef.job:type_name -> tensorflow.JobDef + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_cluster_proto_init() } +func file_tensorflow_core_protobuf_cluster_proto_init() { + if File_tensorflow_core_protobuf_cluster_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_cluster_proto_rawDesc), len(file_tensorflow_core_protobuf_cluster_proto_rawDesc)), + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_cluster_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_cluster_proto_depIdxs, + MessageInfos: file_tensorflow_core_protobuf_cluster_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_cluster_proto = out.File + file_tensorflow_core_protobuf_cluster_proto_goTypes = nil + file_tensorflow_core_protobuf_cluster_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/config.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/config.pb.go new file mode 100644 index 0000000..612494a --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/config.pb.go @@ -0,0 +1,2496 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/config.proto + +package for_core_protos_go_proto + +import ( + cost_graph_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/cost_graph_go_proto" + graph_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/graph_go_proto" + step_stats_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/step_stats_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Optimization level +type OptimizerOptions_Level int32 + +const ( + // L1 is the default level. + // Optimization performed at L1 : + // 1. Common subexpression elimination + // 2. Constant folding + OptimizerOptions_L1 OptimizerOptions_Level = 0 + // No optimizations + OptimizerOptions_L0 OptimizerOptions_Level = -1 +) + +// Enum value maps for OptimizerOptions_Level. +var ( + OptimizerOptions_Level_name = map[int32]string{ + 0: "L1", + -1: "L0", + } + OptimizerOptions_Level_value = map[string]int32{ + "L1": 0, + "L0": -1, + } +) + +func (x OptimizerOptions_Level) Enum() *OptimizerOptions_Level { + p := new(OptimizerOptions_Level) + *p = x + return p +} + +func (x OptimizerOptions_Level) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (OptimizerOptions_Level) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_protobuf_config_proto_enumTypes[0].Descriptor() +} + +func (OptimizerOptions_Level) Type() protoreflect.EnumType { + return &file_tensorflow_core_protobuf_config_proto_enumTypes[0] +} + +func (x OptimizerOptions_Level) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use OptimizerOptions_Level.Descriptor instead. +func (OptimizerOptions_Level) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_config_proto_rawDescGZIP(), []int{1, 0} +} + +// Control the use of the compiler/jit. Experimental. +type OptimizerOptions_GlobalJitLevel int32 + +const ( + OptimizerOptions_DEFAULT OptimizerOptions_GlobalJitLevel = 0 // Default setting ("off" now, but later expected to be "on") + OptimizerOptions_OFF OptimizerOptions_GlobalJitLevel = -1 + // The following settings turn on compilation, with higher values being + // more aggressive. Higher values may reduce opportunities for parallelism + // and may use more memory. (At present, there is no distinction, but this + // is expected to change.) + OptimizerOptions_ON_1 OptimizerOptions_GlobalJitLevel = 1 + OptimizerOptions_ON_2 OptimizerOptions_GlobalJitLevel = 2 +) + +// Enum value maps for OptimizerOptions_GlobalJitLevel. +var ( + OptimizerOptions_GlobalJitLevel_name = map[int32]string{ + 0: "DEFAULT", + -1: "OFF", + 1: "ON_1", + 2: "ON_2", + } + OptimizerOptions_GlobalJitLevel_value = map[string]int32{ + "DEFAULT": 0, + "OFF": -1, + "ON_1": 1, + "ON_2": 2, + } +) + +func (x OptimizerOptions_GlobalJitLevel) Enum() *OptimizerOptions_GlobalJitLevel { + p := new(OptimizerOptions_GlobalJitLevel) + *p = x + return p +} + +func (x OptimizerOptions_GlobalJitLevel) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (OptimizerOptions_GlobalJitLevel) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_protobuf_config_proto_enumTypes[1].Descriptor() +} + +func (OptimizerOptions_GlobalJitLevel) Type() protoreflect.EnumType { + return &file_tensorflow_core_protobuf_config_proto_enumTypes[1] +} + +func (x OptimizerOptions_GlobalJitLevel) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use OptimizerOptions_GlobalJitLevel.Descriptor instead. +func (OptimizerOptions_GlobalJitLevel) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_config_proto_rawDescGZIP(), []int{1, 1} +} + +// An enum that describes the state of the MLIR bridge rollout. +type ConfigProto_Experimental_MlirBridgeRollout int32 + +const ( + // If this field is left unspecified, the MLIR bridge may be selectively + // enabled on a per graph basis. + ConfigProto_Experimental_MLIR_BRIDGE_ROLLOUT_UNSPECIFIED ConfigProto_Experimental_MlirBridgeRollout = 0 + // Enabling the MLIR bridge enables it for all graphs in this session. + ConfigProto_Experimental_MLIR_BRIDGE_ROLLOUT_ENABLED ConfigProto_Experimental_MlirBridgeRollout = 1 + // Disabling the MLIR bridge disables it for all graphs in this session. + ConfigProto_Experimental_MLIR_BRIDGE_ROLLOUT_DISABLED ConfigProto_Experimental_MlirBridgeRollout = 2 +) + +// Enum value maps for ConfigProto_Experimental_MlirBridgeRollout. +var ( + ConfigProto_Experimental_MlirBridgeRollout_name = map[int32]string{ + 0: "MLIR_BRIDGE_ROLLOUT_UNSPECIFIED", + 1: "MLIR_BRIDGE_ROLLOUT_ENABLED", + 2: "MLIR_BRIDGE_ROLLOUT_DISABLED", + } + ConfigProto_Experimental_MlirBridgeRollout_value = map[string]int32{ + "MLIR_BRIDGE_ROLLOUT_UNSPECIFIED": 0, + "MLIR_BRIDGE_ROLLOUT_ENABLED": 1, + "MLIR_BRIDGE_ROLLOUT_DISABLED": 2, + } +) + +func (x ConfigProto_Experimental_MlirBridgeRollout) Enum() *ConfigProto_Experimental_MlirBridgeRollout { + p := new(ConfigProto_Experimental_MlirBridgeRollout) + *p = x + return p +} + +func (x ConfigProto_Experimental_MlirBridgeRollout) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ConfigProto_Experimental_MlirBridgeRollout) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_protobuf_config_proto_enumTypes[2].Descriptor() +} + +func (ConfigProto_Experimental_MlirBridgeRollout) Type() protoreflect.EnumType { + return &file_tensorflow_core_protobuf_config_proto_enumTypes[2] +} + +func (x ConfigProto_Experimental_MlirBridgeRollout) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ConfigProto_Experimental_MlirBridgeRollout.Descriptor instead. +func (ConfigProto_Experimental_MlirBridgeRollout) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_config_proto_rawDescGZIP(), []int{6, 1, 0} +} + +// TODO(pbar) Turn this into a TraceOptions proto which allows +// tracing to be controlled in a more orthogonal manner? +type RunOptions_TraceLevel int32 + +const ( + RunOptions_NO_TRACE RunOptions_TraceLevel = 0 + RunOptions_SOFTWARE_TRACE RunOptions_TraceLevel = 1 + RunOptions_HARDWARE_TRACE RunOptions_TraceLevel = 2 + RunOptions_FULL_TRACE RunOptions_TraceLevel = 3 +) + +// Enum value maps for RunOptions_TraceLevel. +var ( + RunOptions_TraceLevel_name = map[int32]string{ + 0: "NO_TRACE", + 1: "SOFTWARE_TRACE", + 2: "HARDWARE_TRACE", + 3: "FULL_TRACE", + } + RunOptions_TraceLevel_value = map[string]int32{ + "NO_TRACE": 0, + "SOFTWARE_TRACE": 1, + "HARDWARE_TRACE": 2, + "FULL_TRACE": 3, + } +) + +func (x RunOptions_TraceLevel) Enum() *RunOptions_TraceLevel { + p := new(RunOptions_TraceLevel) + *p = x + return p +} + +func (x RunOptions_TraceLevel) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (RunOptions_TraceLevel) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_protobuf_config_proto_enumTypes[3].Descriptor() +} + +func (RunOptions_TraceLevel) Type() protoreflect.EnumType { + return &file_tensorflow_core_protobuf_config_proto_enumTypes[3] +} + +func (x RunOptions_TraceLevel) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use RunOptions_TraceLevel.Descriptor instead. +func (RunOptions_TraceLevel) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_config_proto_rawDescGZIP(), []int{7, 0} +} + +type GPUOptions struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Fraction of the available GPU memory to allocate for each process. + // 1 means to allocate all of the GPU memory, 0.5 means the process + // allocates up to ~50% of the available GPU memory. + // + // GPU memory is pre-allocated unless the allow_growth option is enabled. + // + // If greater than 1.0, uses CUDA unified memory to potentially oversubscribe + // the amount of memory available on the GPU device by using host memory as a + // swap space. Accessing memory not available on the device will be + // significantly slower as that would require memory transfer between the host + // and the device. Options to reduce the memory requirement should be + // considered before enabling this option as this may come with a negative + // performance impact. Oversubscription using the unified memory requires + // Pascal class or newer GPUs and it is currently only supported on the Linux + // operating system. See + // https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#um-requirements + // for the detailed requirements. + PerProcessGpuMemoryFraction float64 `protobuf:"fixed64,1,opt,name=per_process_gpu_memory_fraction,json=perProcessGpuMemoryFraction,proto3" json:"per_process_gpu_memory_fraction,omitempty"` + // If true, the allocator does not pre-allocate the entire specified + // GPU memory region, instead starting small and growing as needed. + AllowGrowth bool `protobuf:"varint,4,opt,name=allow_growth,json=allowGrowth,proto3" json:"allow_growth,omitempty"` + // The type of GPU allocation strategy to use. + // + // Allowed values: + // "": The empty string (default) uses a system-chosen default + // + // which may change over time. + // + // "BFC": A "Best-fit with coalescing" algorithm, simplified from a + // + // version of dlmalloc. + AllocatorType string `protobuf:"bytes,2,opt,name=allocator_type,json=allocatorType,proto3" json:"allocator_type,omitempty"` + // Delay deletion of up to this many bytes to reduce the number of + // interactions with gpu driver code. If 0, the system chooses + // a reasonable default (several MBs). + DeferredDeletionBytes int64 `protobuf:"varint,3,opt,name=deferred_deletion_bytes,json=deferredDeletionBytes,proto3" json:"deferred_deletion_bytes,omitempty"` + // A comma-separated list of GPU ids that determines the 'visible' + // to 'virtual' mapping of GPU devices. For example, if TensorFlow + // can see 8 GPU devices in the process, and one wanted to map + // visible GPU devices 5 and 3 as "/device:GPU:0", and "/device:GPU:1", + // then one would specify this field as "5,3". This field is similar in + // spirit to the CUDA_VISIBLE_DEVICES environment variable, except + // it applies to the visible GPU devices in the process. + // + // NOTE: + // 1. The GPU driver provides the process with the visible GPUs + // in an order which is not guaranteed to have any correlation to + // the *physical* GPU id in the machine. This field is used for + // remapping "visible" to "virtual", which means this operates only + // after the process starts. Users are required to use vendor + // specific mechanisms (e.g., CUDA_VISIBLE_DEVICES) to control the + // physical to visible device mapping prior to invoking TensorFlow. + // 2. In the code, the ids in this list are also called "platform GPU id"s, + // and the 'virtual' ids of GPU devices (i.e. the ids in the device + // name "/device:GPU:") are also called "TF GPU id"s. Please + // refer to third_party/tensorflow/core/common_runtime/gpu/gpu_id.h + // for more information. + VisibleDeviceList string `protobuf:"bytes,5,opt,name=visible_device_list,json=visibleDeviceList,proto3" json:"visible_device_list,omitempty"` + // In the event polling loop sleep this many microseconds between + // PollEvents calls, when the queue is not empty. If value is not + // set or set to 0, gets set to a non-zero default. + PollingActiveDelayUsecs int32 `protobuf:"varint,6,opt,name=polling_active_delay_usecs,json=pollingActiveDelayUsecs,proto3" json:"polling_active_delay_usecs,omitempty"` + // This field is deprecated and ignored. + PollingInactiveDelayMsecs int32 `protobuf:"varint,7,opt,name=polling_inactive_delay_msecs,json=pollingInactiveDelayMsecs,proto3" json:"polling_inactive_delay_msecs,omitempty"` + // Force all tensors to be gpu_compatible. On a GPU-enabled TensorFlow, + // enabling this option forces all CPU tensors to be allocated with Cuda + // pinned memory. Normally, TensorFlow will infer which tensors should be + // allocated as the pinned memory. But in case where the inference is + // incomplete, this option can significantly speed up the cross-device memory + // copy performance as long as it fits the memory. + // Note that this option is not something that should be + // enabled by default for unknown or very large models, since all Cuda pinned + // memory is unpageable, having too much pinned memory might negatively impact + // the overall host system performance. + ForceGpuCompatible bool `protobuf:"varint,8,opt,name=force_gpu_compatible,json=forceGpuCompatible,proto3" json:"force_gpu_compatible,omitempty"` + // Everything inside experimental is subject to change and is not subject + // to API stability guarantees in + // https://www.tensorflow.org/guide/version_compat. + Experimental *GPUOptions_Experimental `protobuf:"bytes,9,opt,name=experimental,proto3" json:"experimental,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GPUOptions) Reset() { + *x = GPUOptions{} + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GPUOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GPUOptions) ProtoMessage() {} + +func (x *GPUOptions) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GPUOptions.ProtoReflect.Descriptor instead. +func (*GPUOptions) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_config_proto_rawDescGZIP(), []int{0} +} + +func (x *GPUOptions) GetPerProcessGpuMemoryFraction() float64 { + if x != nil { + return x.PerProcessGpuMemoryFraction + } + return 0 +} + +func (x *GPUOptions) GetAllowGrowth() bool { + if x != nil { + return x.AllowGrowth + } + return false +} + +func (x *GPUOptions) GetAllocatorType() string { + if x != nil { + return x.AllocatorType + } + return "" +} + +func (x *GPUOptions) GetDeferredDeletionBytes() int64 { + if x != nil { + return x.DeferredDeletionBytes + } + return 0 +} + +func (x *GPUOptions) GetVisibleDeviceList() string { + if x != nil { + return x.VisibleDeviceList + } + return "" +} + +func (x *GPUOptions) GetPollingActiveDelayUsecs() int32 { + if x != nil { + return x.PollingActiveDelayUsecs + } + return 0 +} + +func (x *GPUOptions) GetPollingInactiveDelayMsecs() int32 { + if x != nil { + return x.PollingInactiveDelayMsecs + } + return 0 +} + +func (x *GPUOptions) GetForceGpuCompatible() bool { + if x != nil { + return x.ForceGpuCompatible + } + return false +} + +func (x *GPUOptions) GetExperimental() *GPUOptions_Experimental { + if x != nil { + return x.Experimental + } + return nil +} + +// Options passed to the graph optimizer +type OptimizerOptions struct { + state protoimpl.MessageState `protogen:"open.v1"` + // If true, optimize the graph using common subexpression elimination. + DoCommonSubexpressionElimination bool `protobuf:"varint,1,opt,name=do_common_subexpression_elimination,json=doCommonSubexpressionElimination,proto3" json:"do_common_subexpression_elimination,omitempty"` + // If true, perform constant folding optimization on the graph. + DoConstantFolding bool `protobuf:"varint,2,opt,name=do_constant_folding,json=doConstantFolding,proto3" json:"do_constant_folding,omitempty"` + // Constant folding optimization replaces tensors whose values can be + // predetermined, with constant nodes. To avoid inserting too large constants, + // the size of each constant created can be limited. If this value is zero, a + // default limit of 10 MiB will be applied. If constant folding optimization + // is disabled, this value is ignored. + MaxFoldedConstantInBytes int64 `protobuf:"varint,6,opt,name=max_folded_constant_in_bytes,json=maxFoldedConstantInBytes,proto3" json:"max_folded_constant_in_bytes,omitempty"` + // If true, perform function inlining on the graph. + DoFunctionInlining bool `protobuf:"varint,4,opt,name=do_function_inlining,json=doFunctionInlining,proto3" json:"do_function_inlining,omitempty"` + // Overall optimization level. The actual optimizations applied will be the + // logical OR of the flags that this level implies and any flags already set. + OptLevel OptimizerOptions_Level `protobuf:"varint,3,opt,name=opt_level,json=optLevel,proto3,enum=tensorflow.OptimizerOptions_Level" json:"opt_level,omitempty"` + GlobalJitLevel OptimizerOptions_GlobalJitLevel `protobuf:"varint,5,opt,name=global_jit_level,json=globalJitLevel,proto3,enum=tensorflow.OptimizerOptions_GlobalJitLevel" json:"global_jit_level,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *OptimizerOptions) Reset() { + *x = OptimizerOptions{} + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *OptimizerOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OptimizerOptions) ProtoMessage() {} + +func (x *OptimizerOptions) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OptimizerOptions.ProtoReflect.Descriptor instead. +func (*OptimizerOptions) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_config_proto_rawDescGZIP(), []int{1} +} + +func (x *OptimizerOptions) GetDoCommonSubexpressionElimination() bool { + if x != nil { + return x.DoCommonSubexpressionElimination + } + return false +} + +func (x *OptimizerOptions) GetDoConstantFolding() bool { + if x != nil { + return x.DoConstantFolding + } + return false +} + +func (x *OptimizerOptions) GetMaxFoldedConstantInBytes() int64 { + if x != nil { + return x.MaxFoldedConstantInBytes + } + return 0 +} + +func (x *OptimizerOptions) GetDoFunctionInlining() bool { + if x != nil { + return x.DoFunctionInlining + } + return false +} + +func (x *OptimizerOptions) GetOptLevel() OptimizerOptions_Level { + if x != nil { + return x.OptLevel + } + return OptimizerOptions_L1 +} + +func (x *OptimizerOptions) GetGlobalJitLevel() OptimizerOptions_GlobalJitLevel { + if x != nil { + return x.GlobalJitLevel + } + return OptimizerOptions_DEFAULT +} + +type GraphOptions struct { + state protoimpl.MessageState `protogen:"open.v1"` + // If true, use control flow to schedule the activation of Recv nodes. + // (Currently ignored.) + EnableRecvScheduling bool `protobuf:"varint,2,opt,name=enable_recv_scheduling,json=enableRecvScheduling,proto3" json:"enable_recv_scheduling,omitempty"` + // Options controlling how graph is optimized. + OptimizerOptions *OptimizerOptions `protobuf:"bytes,3,opt,name=optimizer_options,json=optimizerOptions,proto3" json:"optimizer_options,omitempty"` + // The number of steps to run before returning a cost model detailing + // the memory usage and performance of each node of the graph. 0 means + // no cost model. + BuildCostModel int64 `protobuf:"varint,4,opt,name=build_cost_model,json=buildCostModel,proto3" json:"build_cost_model,omitempty"` + // The number of steps to skip before collecting statistics for the + // cost model. + BuildCostModelAfter int64 `protobuf:"varint,9,opt,name=build_cost_model_after,json=buildCostModelAfter,proto3" json:"build_cost_model_after,omitempty"` + // Annotate each Node with Op output shape data, to the extent it can + // be statically inferred. + InferShapes bool `protobuf:"varint,5,opt,name=infer_shapes,json=inferShapes,proto3" json:"infer_shapes,omitempty"` + // Only place the subgraphs that are run, rather than the entire graph. + // + // This is useful for interactive graph building, where one might + // produce graphs that cannot be placed during the debugging + // process. In particular, it allows the client to continue work in + // a session after adding a node to a graph whose placement + // constraints are unsatisfiable. + PlacePrunedGraph bool `protobuf:"varint,6,opt,name=place_pruned_graph,json=placePrunedGraph,proto3" json:"place_pruned_graph,omitempty"` + // If true, transfer float values between processes as bfloat16. + EnableBfloat16Sendrecv bool `protobuf:"varint,7,opt,name=enable_bfloat16_sendrecv,json=enableBfloat16Sendrecv,proto3" json:"enable_bfloat16_sendrecv,omitempty"` + // If > 0, record a timeline every this many steps. + // EXPERIMENTAL: This currently has no effect in MasterSession. + TimelineStep int32 `protobuf:"varint,8,opt,name=timeline_step,json=timelineStep,proto3" json:"timeline_step,omitempty"` + // Options that control the type and amount of graph rewriting. + // Not currently configurable via the public Python API (i.e. there is no API + // stability guarantee if you import RewriterConfig explicitly). + RewriteOptions *RewriterConfig `protobuf:"bytes,10,opt,name=rewrite_options,json=rewriteOptions,proto3" json:"rewrite_options,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GraphOptions) Reset() { + *x = GraphOptions{} + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GraphOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GraphOptions) ProtoMessage() {} + +func (x *GraphOptions) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GraphOptions.ProtoReflect.Descriptor instead. +func (*GraphOptions) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_config_proto_rawDescGZIP(), []int{2} +} + +func (x *GraphOptions) GetEnableRecvScheduling() bool { + if x != nil { + return x.EnableRecvScheduling + } + return false +} + +func (x *GraphOptions) GetOptimizerOptions() *OptimizerOptions { + if x != nil { + return x.OptimizerOptions + } + return nil +} + +func (x *GraphOptions) GetBuildCostModel() int64 { + if x != nil { + return x.BuildCostModel + } + return 0 +} + +func (x *GraphOptions) GetBuildCostModelAfter() int64 { + if x != nil { + return x.BuildCostModelAfter + } + return 0 +} + +func (x *GraphOptions) GetInferShapes() bool { + if x != nil { + return x.InferShapes + } + return false +} + +func (x *GraphOptions) GetPlacePrunedGraph() bool { + if x != nil { + return x.PlacePrunedGraph + } + return false +} + +func (x *GraphOptions) GetEnableBfloat16Sendrecv() bool { + if x != nil { + return x.EnableBfloat16Sendrecv + } + return false +} + +func (x *GraphOptions) GetTimelineStep() int32 { + if x != nil { + return x.TimelineStep + } + return 0 +} + +func (x *GraphOptions) GetRewriteOptions() *RewriterConfig { + if x != nil { + return x.RewriteOptions + } + return nil +} + +type ThreadPoolOptionProto struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The number of threads in the pool. + // + // 0 means the system picks a value based on where this option proto is used + // (see the declaration of the specific field for more info). + NumThreads int32 `protobuf:"varint,1,opt,name=num_threads,json=numThreads,proto3" json:"num_threads,omitempty"` + // The global name of the threadpool. + // + // If empty, then the threadpool is made and used according to the scope it's + // in - e.g., for a session threadpool, it is used by that session only. + // + // If non-empty, then: + // - a global threadpool associated with this name is looked + // up or created. This allows, for example, sharing one threadpool across + // many sessions (e.g., like the default behavior, if + // inter_op_parallelism_threads is not configured), but still partitioning + // into a large and small pool. + // - if the threadpool for this global_name already exists, then it is an + // error if the existing pool was created using a different num_threads + // value as is specified on this call. + // - threadpools created this way are never garbage collected. + GlobalName string `protobuf:"bytes,2,opt,name=global_name,json=globalName,proto3" json:"global_name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ThreadPoolOptionProto) Reset() { + *x = ThreadPoolOptionProto{} + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ThreadPoolOptionProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ThreadPoolOptionProto) ProtoMessage() {} + +func (x *ThreadPoolOptionProto) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ThreadPoolOptionProto.ProtoReflect.Descriptor instead. +func (*ThreadPoolOptionProto) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_config_proto_rawDescGZIP(), []int{3} +} + +func (x *ThreadPoolOptionProto) GetNumThreads() int32 { + if x != nil { + return x.NumThreads + } + return 0 +} + +func (x *ThreadPoolOptionProto) GetGlobalName() string { + if x != nil { + return x.GlobalName + } + return "" +} + +type RPCOptions struct { + state protoimpl.MessageState `protogen:"open.v1"` + // If true, always use RPC to contact the session target. + // + // If false (the default option), TensorFlow may use an optimized + // transport for client-master communication that avoids the RPC + // stack. This option is primarily for used testing the RPC stack. + UseRpcForInprocessMaster bool `protobuf:"varint,1,opt,name=use_rpc_for_inprocess_master,json=useRpcForInprocessMaster,proto3" json:"use_rpc_for_inprocess_master,omitempty"` + // The compression algorithm to be used. One of "deflate", "gzip". + CompressionAlgorithm string `protobuf:"bytes,2,opt,name=compression_algorithm,json=compressionAlgorithm,proto3" json:"compression_algorithm,omitempty"` + // If compression_algorithm is set, the compression level to be used. + // From 0 (no compression), up to 3. + CompressionLevel int32 `protobuf:"varint,3,opt,name=compression_level,json=compressionLevel,proto3" json:"compression_level,omitempty"` + // Setting cache_rpc_response to true will enable sender side caching of + // response for RecvTensorAsync and RecvBufAsync to allow receiver to retry + // requests . This is only necessary when the network fabric is experiencing a + // significant error rate. Without it we'll fail a step on an network error, + // while with it we'll be able to complete long steps (like complex + // initializations) in the face of some network errors during RecvTensor. + CacheRpcResponse bool `protobuf:"varint,4,opt,name=cache_rpc_response,json=cacheRpcResponse,proto3" json:"cache_rpc_response,omitempty"` + // Disables TCP connection sharing when opening a new RPC channel. + DisableSessionConnectionSharing bool `protobuf:"varint,5,opt,name=disable_session_connection_sharing,json=disableSessionConnectionSharing,proto3" json:"disable_session_connection_sharing,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RPCOptions) Reset() { + *x = RPCOptions{} + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RPCOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RPCOptions) ProtoMessage() {} + +func (x *RPCOptions) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RPCOptions.ProtoReflect.Descriptor instead. +func (*RPCOptions) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_config_proto_rawDescGZIP(), []int{4} +} + +func (x *RPCOptions) GetUseRpcForInprocessMaster() bool { + if x != nil { + return x.UseRpcForInprocessMaster + } + return false +} + +func (x *RPCOptions) GetCompressionAlgorithm() string { + if x != nil { + return x.CompressionAlgorithm + } + return "" +} + +func (x *RPCOptions) GetCompressionLevel() int32 { + if x != nil { + return x.CompressionLevel + } + return 0 +} + +func (x *RPCOptions) GetCacheRpcResponse() bool { + if x != nil { + return x.CacheRpcResponse + } + return false +} + +func (x *RPCOptions) GetDisableSessionConnectionSharing() bool { + if x != nil { + return x.DisableSessionConnectionSharing + } + return false +} + +// 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. +type SessionMetadata struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // The version is optional. If set, needs to be >= 0. + Version int64 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SessionMetadata) Reset() { + *x = SessionMetadata{} + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SessionMetadata) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SessionMetadata) ProtoMessage() {} + +func (x *SessionMetadata) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SessionMetadata.ProtoReflect.Descriptor instead. +func (*SessionMetadata) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_config_proto_rawDescGZIP(), []int{5} +} + +func (x *SessionMetadata) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *SessionMetadata) GetVersion() int64 { + if x != nil { + return x.Version + } + return 0 +} + +// Session configuration parameters. +// The system picks appropriate values for fields that are not set. +type ConfigProto struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Map from device type name (e.g., "CPU" or "GPU" ) to maximum + // number of devices of that type to use. If a particular device + // type is not found in the map, the system picks an appropriate + // number. + DeviceCount map[string]int32 `protobuf:"bytes,1,rep,name=device_count,json=deviceCount,proto3" json:"device_count,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"` + // The execution of an individual op (for some op types) can be + // parallelized on a pool of intra_op_parallelism_threads. + // 0 means the system picks an appropriate number. + // + // If you create an ordinary session, e.g., from Python or C++, + // then there is exactly one intra op thread pool per process. + // The first session created determines the number of threads in this pool. + // All subsequent sessions reuse/share this one global pool. + // + // There are notable exceptions to the default behavior describe above: + // 1. There is an environment variable for overriding this thread pool, + // named TF_OVERRIDE_GLOBAL_THREADPOOL. + // 2. When connecting to a server, such as a remote `tf.train.Server` + // instance, then this option will be ignored altogether. + IntraOpParallelismThreads int32 `protobuf:"varint,2,opt,name=intra_op_parallelism_threads,json=intraOpParallelismThreads,proto3" json:"intra_op_parallelism_threads,omitempty"` + // Nodes that perform blocking operations are enqueued on a pool of + // inter_op_parallelism_threads available in each process. + // + // 0 means the system picks an appropriate number. + // Negative means all operations are performed in caller's thread. + // + // Note that the first Session created in the process sets the + // number of threads for all future sessions unless use_per_session_threads is + // true or session_inter_op_thread_pool is configured. + InterOpParallelismThreads int32 `protobuf:"varint,5,opt,name=inter_op_parallelism_threads,json=interOpParallelismThreads,proto3" json:"inter_op_parallelism_threads,omitempty"` + // If true, use a new set of threads for this session rather than the global + // pool of threads. Only supported by direct sessions. + // + // If false, use the global threads created by the first session, or the + // per-session thread pools configured by session_inter_op_thread_pool. + // + // This option is deprecated. The same effect can be achieved by setting + // session_inter_op_thread_pool to have one element, whose num_threads equals + // inter_op_parallelism_threads. + UsePerSessionThreads bool `protobuf:"varint,9,opt,name=use_per_session_threads,json=usePerSessionThreads,proto3" json:"use_per_session_threads,omitempty"` + // This option is experimental - it may be replaced with a different mechanism + // in the future. + // + // Configures session thread pools. If this is configured, then RunOptions for + // a Run call can select the thread pool to use. + // + // The intended use is for when some session invocations need to run in a + // background pool limited to a small number of threads: + // - For example, a session may be configured to have one large pool (for + // regular compute) and one small pool (for periodic, low priority work); + // using the small pool is currently the mechanism for limiting the inter-op + // parallelism of the low priority work. Note that it does not limit the + // parallelism of work spawned by a single op kernel implementation. + // - Using this setting is normally not needed in training, but may help some + // serving use cases. + // - It is also generally recommended to set the global_name field of this + // proto, to avoid creating multiple large pools. It is typically better to + // run the non-low-priority work, even across sessions, in a single large + // pool. + SessionInterOpThreadPool []*ThreadPoolOptionProto `protobuf:"bytes,12,rep,name=session_inter_op_thread_pool,json=sessionInterOpThreadPool,proto3" json:"session_inter_op_thread_pool,omitempty"` + // Assignment of Nodes to Devices is recomputed every placement_period + // steps until the system warms up (at which point the recomputation + // typically slows down automatically). + PlacementPeriod int32 `protobuf:"varint,3,opt,name=placement_period,json=placementPeriod,proto3" json:"placement_period,omitempty"` + // When any filters are present sessions will ignore all devices which do not + // match the filters. Each filter can be partially specified, e.g. "/job:ps" + // "/job:worker/replica:3", etc. + DeviceFilters []string `protobuf:"bytes,4,rep,name=device_filters,json=deviceFilters,proto3" json:"device_filters,omitempty"` + // Options that apply to all GPUs. + GpuOptions *GPUOptions `protobuf:"bytes,6,opt,name=gpu_options,json=gpuOptions,proto3" json:"gpu_options,omitempty"` + // Whether soft placement is allowed. If allow_soft_placement is true, + // an op will be placed on CPU if + // 1. there's no GPU implementation for the OP + // + // or + // 2. no GPU devices are known or registered + // + // or + // 3. need to co-locate with reftype input(s) which are from CPU. + AllowSoftPlacement bool `protobuf:"varint,7,opt,name=allow_soft_placement,json=allowSoftPlacement,proto3" json:"allow_soft_placement,omitempty"` + // Whether device placements should be logged. + LogDevicePlacement bool `protobuf:"varint,8,opt,name=log_device_placement,json=logDevicePlacement,proto3" json:"log_device_placement,omitempty"` + // Options that apply to all graphs. + GraphOptions *GraphOptions `protobuf:"bytes,10,opt,name=graph_options,json=graphOptions,proto3" json:"graph_options,omitempty"` + // Global timeout for all blocking operations in this session. If non-zero, + // and not overridden on a per-operation basis, this value will be used as the + // deadline for all blocking operations. + OperationTimeoutInMs int64 `protobuf:"varint,11,opt,name=operation_timeout_in_ms,json=operationTimeoutInMs,proto3" json:"operation_timeout_in_ms,omitempty"` + // Options that apply when this session uses the distributed runtime. + RpcOptions *RPCOptions `protobuf:"bytes,13,opt,name=rpc_options,json=rpcOptions,proto3" json:"rpc_options,omitempty"` + // Optional list of all workers to use in this session. + ClusterDef *ClusterDef `protobuf:"bytes,14,opt,name=cluster_def,json=clusterDef,proto3" json:"cluster_def,omitempty"` + // If true, any resources such as Variables used in the session will not be + // shared with other sessions. However, when clusterspec propagation is + // enabled, this field is ignored and sessions are always isolated. + IsolateSessionState bool `protobuf:"varint,15,opt,name=isolate_session_state,json=isolateSessionState,proto3" json:"isolate_session_state,omitempty"` + // When true, WorkerSessions are created with device attributes from the + // full cluster. + // This is helpful when a worker wants to partition a graph + // (for example during a PartitionedCallOp). + ShareClusterDevicesInSession bool `protobuf:"varint,17,opt,name=share_cluster_devices_in_session,json=shareClusterDevicesInSession,proto3" json:"share_cluster_devices_in_session,omitempty"` + Experimental *ConfigProto_Experimental `protobuf:"bytes,16,opt,name=experimental,proto3" json:"experimental,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ConfigProto) Reset() { + *x = ConfigProto{} + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ConfigProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConfigProto) ProtoMessage() {} + +func (x *ConfigProto) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConfigProto.ProtoReflect.Descriptor instead. +func (*ConfigProto) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_config_proto_rawDescGZIP(), []int{6} +} + +func (x *ConfigProto) GetDeviceCount() map[string]int32 { + if x != nil { + return x.DeviceCount + } + return nil +} + +func (x *ConfigProto) GetIntraOpParallelismThreads() int32 { + if x != nil { + return x.IntraOpParallelismThreads + } + return 0 +} + +func (x *ConfigProto) GetInterOpParallelismThreads() int32 { + if x != nil { + return x.InterOpParallelismThreads + } + return 0 +} + +func (x *ConfigProto) GetUsePerSessionThreads() bool { + if x != nil { + return x.UsePerSessionThreads + } + return false +} + +func (x *ConfigProto) GetSessionInterOpThreadPool() []*ThreadPoolOptionProto { + if x != nil { + return x.SessionInterOpThreadPool + } + return nil +} + +func (x *ConfigProto) GetPlacementPeriod() int32 { + if x != nil { + return x.PlacementPeriod + } + return 0 +} + +func (x *ConfigProto) GetDeviceFilters() []string { + if x != nil { + return x.DeviceFilters + } + return nil +} + +func (x *ConfigProto) GetGpuOptions() *GPUOptions { + if x != nil { + return x.GpuOptions + } + return nil +} + +func (x *ConfigProto) GetAllowSoftPlacement() bool { + if x != nil { + return x.AllowSoftPlacement + } + return false +} + +func (x *ConfigProto) GetLogDevicePlacement() bool { + if x != nil { + return x.LogDevicePlacement + } + return false +} + +func (x *ConfigProto) GetGraphOptions() *GraphOptions { + if x != nil { + return x.GraphOptions + } + return nil +} + +func (x *ConfigProto) GetOperationTimeoutInMs() int64 { + if x != nil { + return x.OperationTimeoutInMs + } + return 0 +} + +func (x *ConfigProto) GetRpcOptions() *RPCOptions { + if x != nil { + return x.RpcOptions + } + return nil +} + +func (x *ConfigProto) GetClusterDef() *ClusterDef { + if x != nil { + return x.ClusterDef + } + return nil +} + +func (x *ConfigProto) GetIsolateSessionState() bool { + if x != nil { + return x.IsolateSessionState + } + return false +} + +func (x *ConfigProto) GetShareClusterDevicesInSession() bool { + if x != nil { + return x.ShareClusterDevicesInSession + } + return false +} + +func (x *ConfigProto) GetExperimental() *ConfigProto_Experimental { + if x != nil { + return x.Experimental + } + return nil +} + +// Options for a single Run() call. +type RunOptions struct { + state protoimpl.MessageState `protogen:"open.v1"` + TraceLevel RunOptions_TraceLevel `protobuf:"varint,1,opt,name=trace_level,json=traceLevel,proto3,enum=tensorflow.RunOptions_TraceLevel" json:"trace_level,omitempty"` + // Time to wait for operation to complete in milliseconds. + TimeoutInMs int64 `protobuf:"varint,2,opt,name=timeout_in_ms,json=timeoutInMs,proto3" json:"timeout_in_ms,omitempty"` + // The thread pool to use, if session_inter_op_thread_pool is configured. + // To use the caller thread set this to -1 - this uses the caller thread + // to execute Session::Run() and thus avoids a context switch. Using the + // caller thread to execute Session::Run() should be done ONLY for simple + // graphs, where the overhead of an additional context switch is + // comparable with the overhead of Session::Run(). + InterOpThreadPool int32 `protobuf:"varint,3,opt,name=inter_op_thread_pool,json=interOpThreadPool,proto3" json:"inter_op_thread_pool,omitempty"` + // Whether the partition graph(s) executed by the executor(s) should be + // outputted via RunMetadata. + OutputPartitionGraphs bool `protobuf:"varint,5,opt,name=output_partition_graphs,json=outputPartitionGraphs,proto3" json:"output_partition_graphs,omitempty"` + // EXPERIMENTAL. Options used to initialize DebuggerState, if enabled. + DebugOptions *DebugOptions `protobuf:"bytes,6,opt,name=debug_options,json=debugOptions,proto3" json:"debug_options,omitempty"` + // When enabled, causes tensor allocation information to be included in + // the error message when the Run() call fails because the allocator ran + // out of memory (OOM). + // + // Enabling this option can slow down the Run() call. + ReportTensorAllocationsUponOom bool `protobuf:"varint,7,opt,name=report_tensor_allocations_upon_oom,json=reportTensorAllocationsUponOom,proto3" json:"report_tensor_allocations_upon_oom,omitempty"` + Experimental *RunOptions_Experimental `protobuf:"bytes,8,opt,name=experimental,proto3" json:"experimental,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RunOptions) Reset() { + *x = RunOptions{} + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RunOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RunOptions) ProtoMessage() {} + +func (x *RunOptions) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RunOptions.ProtoReflect.Descriptor instead. +func (*RunOptions) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_config_proto_rawDescGZIP(), []int{7} +} + +func (x *RunOptions) GetTraceLevel() RunOptions_TraceLevel { + if x != nil { + return x.TraceLevel + } + return RunOptions_NO_TRACE +} + +func (x *RunOptions) GetTimeoutInMs() int64 { + if x != nil { + return x.TimeoutInMs + } + return 0 +} + +func (x *RunOptions) GetInterOpThreadPool() int32 { + if x != nil { + return x.InterOpThreadPool + } + return 0 +} + +func (x *RunOptions) GetOutputPartitionGraphs() bool { + if x != nil { + return x.OutputPartitionGraphs + } + return false +} + +func (x *RunOptions) GetDebugOptions() *DebugOptions { + if x != nil { + return x.DebugOptions + } + return nil +} + +func (x *RunOptions) GetReportTensorAllocationsUponOom() bool { + if x != nil { + return x.ReportTensorAllocationsUponOom + } + return false +} + +func (x *RunOptions) GetExperimental() *RunOptions_Experimental { + if x != nil { + return x.Experimental + } + return nil +} + +// Metadata output (i.e., non-Tensor) for a single Run() call. +type RunMetadata struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Statistics traced for this step. Populated if tracing is turned on via the + // "RunOptions" proto. + // EXPERIMENTAL: The format and set of events may change in future versions. + StepStats *step_stats_go_proto.StepStats `protobuf:"bytes,1,opt,name=step_stats,json=stepStats,proto3" json:"step_stats,omitempty"` + // The cost graph for the computation defined by the run call. + CostGraph *cost_graph_go_proto.CostGraphDef `protobuf:"bytes,2,opt,name=cost_graph,json=costGraph,proto3" json:"cost_graph,omitempty"` + // Graphs of the partitions executed by executors. + PartitionGraphs []*graph_go_proto.GraphDef `protobuf:"bytes,3,rep,name=partition_graphs,json=partitionGraphs,proto3" json:"partition_graphs,omitempty"` + // This is only populated for graphs that are run as functions in TensorFlow + // V2. There will be an entry below for each function that is traced. + // The main use cases of the post_optimization_graph and the partition_graphs + // is to give the caller insight into the graphs that were actually run by the + // runtime. Additional information (such as those in step_stats) will match + // these graphs. + // We also include the pre_optimization_graph since it is usually easier to + // read, and is helpful in situations where the caller wants to get a high + // level idea of what the built graph looks like (since the various graph + // optimization passes might change the structure of the graph significantly). + FunctionGraphs []*RunMetadata_FunctionGraphs `protobuf:"bytes,4,rep,name=function_graphs,json=functionGraphs,proto3" json:"function_graphs,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RunMetadata) Reset() { + *x = RunMetadata{} + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RunMetadata) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RunMetadata) ProtoMessage() {} + +func (x *RunMetadata) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RunMetadata.ProtoReflect.Descriptor instead. +func (*RunMetadata) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_config_proto_rawDescGZIP(), []int{8} +} + +func (x *RunMetadata) GetStepStats() *step_stats_go_proto.StepStats { + if x != nil { + return x.StepStats + } + return nil +} + +func (x *RunMetadata) GetCostGraph() *cost_graph_go_proto.CostGraphDef { + if x != nil { + return x.CostGraph + } + return nil +} + +func (x *RunMetadata) GetPartitionGraphs() []*graph_go_proto.GraphDef { + if x != nil { + return x.PartitionGraphs + } + return nil +} + +func (x *RunMetadata) GetFunctionGraphs() []*RunMetadata_FunctionGraphs { + if x != nil { + return x.FunctionGraphs + } + return nil +} + +// Defines a connection between two tensors in a `GraphDef`. +type TensorConnection struct { + state protoimpl.MessageState `protogen:"open.v1"` + // A tensor name. The value of this tensor will be substituted for + // the tensor named in `to_tensor`. + FromTensor string `protobuf:"bytes,1,opt,name=from_tensor,json=fromTensor,proto3" json:"from_tensor,omitempty"` + // A tensor name. The value of this tensor will be bound to the + // value of the tensor named in `from_tensor`. + ToTensor string `protobuf:"bytes,2,opt,name=to_tensor,json=toTensor,proto3" json:"to_tensor,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TensorConnection) Reset() { + *x = TensorConnection{} + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TensorConnection) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TensorConnection) ProtoMessage() {} + +func (x *TensorConnection) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TensorConnection.ProtoReflect.Descriptor instead. +func (*TensorConnection) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_config_proto_rawDescGZIP(), []int{9} +} + +func (x *TensorConnection) GetFromTensor() string { + if x != nil { + return x.FromTensor + } + return "" +} + +func (x *TensorConnection) GetToTensor() string { + if x != nil { + return x.ToTensor + } + return "" +} + +// Defines a subgraph in another `GraphDef` as a set of feed points and nodes +// to be fetched or executed. +// +// Compare with the arguments to `Session::Run()`. +type CallableOptions struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Tensors to be fed in the callable. Each feed is the name of a tensor. + Feed []string `protobuf:"bytes,1,rep,name=feed,proto3" json:"feed,omitempty"` + // Fetches. A list of tensor names. The caller of the callable expects a + // tensor to be returned for each fetch[i] (see RunStepResponse.tensor). The + // order of specified fetches does not change the execution order. + Fetch []string `protobuf:"bytes,2,rep,name=fetch,proto3" json:"fetch,omitempty"` + // Target Nodes. A list of node names. The named nodes will be run by the + // callable but their outputs will not be returned. + Target []string `protobuf:"bytes,3,rep,name=target,proto3" json:"target,omitempty"` + // Options that will be applied to each run. + RunOptions *RunOptions `protobuf:"bytes,4,opt,name=run_options,json=runOptions,proto3" json:"run_options,omitempty"` + // Tensors to be connected in the callable. Each TensorConnection denotes + // a pair of tensors in the graph, between which an edge will be created + // in the callable. + TensorConnection []*TensorConnection `protobuf:"bytes,5,rep,name=tensor_connection,json=tensorConnection,proto3" json:"tensor_connection,omitempty"` + // The Tensor objects fed in the callable and fetched from the callable + // are expected to be backed by host (CPU) memory by default. + // + // The options below allow changing that - feeding tensors backed by + // device memory, or returning tensors that are backed by device memory. + // + // The maps below map the name of a feed/fetch tensor (which appears in + // 'feed' or 'fetch' fields above), to the fully qualified name of the device + // owning the memory backing the contents of the tensor. + // + // For example, creating a callable with the following options: + // + // CallableOptions { + // feed: "a:0" + // feed: "b:0" + // + // fetch: "x:0" + // fetch: "y:0" + // + // feed_devices: { + // "a:0": "/job:localhost/replica:0/task:0/device:GPU:0" + // } + // + // fetch_devices: { + // "y:0": "/job:localhost/replica:0/task:0/device:GPU:0" + // } + // } + // + // means that the Callable expects: + // - The first argument ("a:0") is a Tensor backed by GPU memory. + // - The second argument ("b:0") is a Tensor backed by host memory. + // and of its return values: + // - The first output ("x:0") will be backed by host memory. + // - The second output ("y:0") will be backed by GPU memory. + // + // FEEDS: + // It is the responsibility of the caller to ensure that the memory of the fed + // tensors will be correctly initialized and synchronized before it is + // accessed by operations executed during the call to Session::RunCallable(). + // + // This is typically ensured by using the TensorFlow memory allocators + // (Device::GetAllocator()) to create the Tensor to be fed. + // + // Alternatively, for CUDA-enabled GPU devices, this typically means that the + // operation that produced the contents of the tensor has completed, i.e., the + // CUDA stream has been synchronized (e.g., via cuCtxSynchronize() or + // cuStreamSynchronize()). + FeedDevices map[string]string `protobuf:"bytes,6,rep,name=feed_devices,json=feedDevices,proto3" json:"feed_devices,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + FetchDevices map[string]string `protobuf:"bytes,7,rep,name=fetch_devices,json=fetchDevices,proto3" json:"fetch_devices,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // By default, RunCallable() will synchronize the GPU stream before returning + // fetched tensors on a GPU device, to ensure that the values in those tensors + // have been produced. This simplifies interacting with the tensors, but + // potentially incurs a performance hit. + // + // If this options is set to true, the caller is responsible for ensuring + // that the values in the fetched tensors have been produced before they are + // used. The caller can do this by invoking `Device::Sync()` on the underlying + // device(s), or by feeding the tensors back to the same Session using + // `feed_devices` with the same corresponding device name. + FetchSkipSync bool `protobuf:"varint,8,opt,name=fetch_skip_sync,json=fetchSkipSync,proto3" json:"fetch_skip_sync,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CallableOptions) Reset() { + *x = CallableOptions{} + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CallableOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CallableOptions) ProtoMessage() {} + +func (x *CallableOptions) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CallableOptions.ProtoReflect.Descriptor instead. +func (*CallableOptions) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_config_proto_rawDescGZIP(), []int{10} +} + +func (x *CallableOptions) GetFeed() []string { + if x != nil { + return x.Feed + } + return nil +} + +func (x *CallableOptions) GetFetch() []string { + if x != nil { + return x.Fetch + } + return nil +} + +func (x *CallableOptions) GetTarget() []string { + if x != nil { + return x.Target + } + return nil +} + +func (x *CallableOptions) GetRunOptions() *RunOptions { + if x != nil { + return x.RunOptions + } + return nil +} + +func (x *CallableOptions) GetTensorConnection() []*TensorConnection { + if x != nil { + return x.TensorConnection + } + return nil +} + +func (x *CallableOptions) GetFeedDevices() map[string]string { + if x != nil { + return x.FeedDevices + } + return nil +} + +func (x *CallableOptions) GetFetchDevices() map[string]string { + if x != nil { + return x.FetchDevices + } + return nil +} + +func (x *CallableOptions) GetFetchSkipSync() bool { + if x != nil { + return x.FetchSkipSync + } + return false +} + +type GPUOptions_Experimental struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The multi virtual device settings. If empty (not set), it will create + // single virtual device on each visible GPU, according to the settings + // in "visible_device_list" above. Otherwise, the number of elements in the + // list must be the same as the number of visible GPUs (after + // "visible_device_list" filtering if it is set), and the string represented + // device names (e.g. /device:GPU:) will refer to the virtual + // devices and have the 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, + // + // visible_device_list = "1,0" + // virtual_devices { memory_limit: 1GB memory_limit: 2GB } + // virtual_devices {} + // + // will create three 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 + // + // NOTE: + // 1. It's invalid to set both this and "per_process_gpu_memory_fraction" + // at the same time. + // 2. Currently this setting is per-process, not per-session. Using + // different settings in different sessions within same process will + // result in undefined behavior. + VirtualDevices []*GPUOptions_Experimental_VirtualDevices `protobuf:"bytes,1,rep,name=virtual_devices,json=virtualDevices,proto3" json:"virtual_devices,omitempty"` + // If true, uses CUDA unified memory for memory allocations. If + // per_process_gpu_memory_fraction option is greater than 1.0, then unified + // memory is used regardless of the value for this field. See comments for + // per_process_gpu_memory_fraction field for more details and requirements + // of the unified memory. This option is useful to oversubscribe memory if + // multiple processes are sharing a single GPU while individually using less + // than 1.0 per process memory fraction. + UseUnifiedMemory bool `protobuf:"varint,2,opt,name=use_unified_memory,json=useUnifiedMemory,proto3" json:"use_unified_memory,omitempty"` + // If > 1, the number of device-to-device copy streams to create + // for each GPUDevice. Default value is 0, which is automatically + // converted to 1. + NumDevToDevCopyStreams int32 `protobuf:"varint,3,opt,name=num_dev_to_dev_copy_streams,json=numDevToDevCopyStreams,proto3" json:"num_dev_to_dev_copy_streams,omitempty"` + // If non-empty, defines a good GPU ring order on a single worker based on + // device interconnect. This assumes that all workers have the same GPU + // topology. Specify as a comma-separated string, e.g. "3,2,1,0,7,6,5,4". + // This ring order is used by the RingReducer implementation of + // CollectiveReduce, and serves as an override to automatic ring order + // generation in OrderTaskDeviceMap() during CollectiveParam resolution. + CollectiveRingOrder string `protobuf:"bytes,4,opt,name=collective_ring_order,json=collectiveRingOrder,proto3" json:"collective_ring_order,omitempty"` + // If true then extra work is done by GPUDevice and GPUBFCAllocator to + // keep track of when GPU memory is freed and when kernels actually + // complete so that we can know when a nominally free memory chunk + // is really not subject to pending use. + TimestampedAllocator bool `protobuf:"varint,5,opt,name=timestamped_allocator,json=timestampedAllocator,proto3" json:"timestamped_allocator,omitempty"` + // Parameters for GPUKernelTracker. By default no kernel tracking is done. + // Note that timestamped_allocator is only effective if some tracking is + // specified. + // + // If kernel_tracker_max_interval = n > 0, then a tracking event + // is inserted after every n kernels without an event. + KernelTrackerMaxInterval int32 `protobuf:"varint,7,opt,name=kernel_tracker_max_interval,json=kernelTrackerMaxInterval,proto3" json:"kernel_tracker_max_interval,omitempty"` + // If kernel_tracker_max_bytes = n > 0, then a tracking event is + // inserted after every series of kernels allocating a sum of + // memory >= n. If one kernel allocates b * n bytes, then one + // event will be inserted after it, but it will count as b against + // the pending limit. + KernelTrackerMaxBytes int32 `protobuf:"varint,8,opt,name=kernel_tracker_max_bytes,json=kernelTrackerMaxBytes,proto3" json:"kernel_tracker_max_bytes,omitempty"` + // If kernel_tracker_max_pending > 0 then no more than this many + // tracking events can be outstanding at a time. An attempt to + // launch an additional kernel will stall until an event + // completes. + KernelTrackerMaxPending int32 `protobuf:"varint,9,opt,name=kernel_tracker_max_pending,json=kernelTrackerMaxPending,proto3" json:"kernel_tracker_max_pending,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GPUOptions_Experimental) Reset() { + *x = GPUOptions_Experimental{} + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GPUOptions_Experimental) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GPUOptions_Experimental) ProtoMessage() {} + +func (x *GPUOptions_Experimental) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GPUOptions_Experimental.ProtoReflect.Descriptor instead. +func (*GPUOptions_Experimental) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_config_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *GPUOptions_Experimental) GetVirtualDevices() []*GPUOptions_Experimental_VirtualDevices { + if x != nil { + return x.VirtualDevices + } + return nil +} + +func (x *GPUOptions_Experimental) GetUseUnifiedMemory() bool { + if x != nil { + return x.UseUnifiedMemory + } + return false +} + +func (x *GPUOptions_Experimental) GetNumDevToDevCopyStreams() int32 { + if x != nil { + return x.NumDevToDevCopyStreams + } + return 0 +} + +func (x *GPUOptions_Experimental) GetCollectiveRingOrder() string { + if x != nil { + return x.CollectiveRingOrder + } + return "" +} + +func (x *GPUOptions_Experimental) GetTimestampedAllocator() bool { + if x != nil { + return x.TimestampedAllocator + } + return false +} + +func (x *GPUOptions_Experimental) GetKernelTrackerMaxInterval() int32 { + if x != nil { + return x.KernelTrackerMaxInterval + } + return 0 +} + +func (x *GPUOptions_Experimental) GetKernelTrackerMaxBytes() int32 { + if x != nil { + return x.KernelTrackerMaxBytes + } + return 0 +} + +func (x *GPUOptions_Experimental) GetKernelTrackerMaxPending() int32 { + if x != nil { + return x.KernelTrackerMaxPending + } + return 0 +} + +// Configuration for breaking down a visible GPU into multiple "virtual" +// devices. +type GPUOptions_Experimental_VirtualDevices struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Per "virtual" device memory limit, in MB. The number of elements in + // the list is the number of virtual devices to create on the + // corresponding visible GPU (see "virtual_devices" below). + // If empty, it will create single virtual device taking all available + // memory from the device. + // + // For the concept of "visible" and "virtual" GPU, see the comments for + // "visible_device_list" above for more information. + MemoryLimitMb []float32 `protobuf:"fixed32,1,rep,packed,name=memory_limit_mb,json=memoryLimitMb,proto3" json:"memory_limit_mb,omitempty"` + // Priority values to use with the virtual devices. Use the cuda function + // cudaDeviceGetStreamPriorityRange to query for valid range of values for + // priority. + // + // On a P4000 GPU with cuda 10.1, the priority range reported was 0 for + // least priority and -1 for greatest priority. + // + // If this field is not specified, then the virtual devices will be + // created with the default. If this field has values set, then the size + // of this must match with the above memory_limit_mb. + Priority []int32 `protobuf:"varint,2,rep,packed,name=priority,proto3" json:"priority,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GPUOptions_Experimental_VirtualDevices) Reset() { + *x = GPUOptions_Experimental_VirtualDevices{} + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GPUOptions_Experimental_VirtualDevices) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GPUOptions_Experimental_VirtualDevices) ProtoMessage() {} + +func (x *GPUOptions_Experimental_VirtualDevices) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GPUOptions_Experimental_VirtualDevices.ProtoReflect.Descriptor instead. +func (*GPUOptions_Experimental_VirtualDevices) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_config_proto_rawDescGZIP(), []int{0, 0, 0} +} + +func (x *GPUOptions_Experimental_VirtualDevices) GetMemoryLimitMb() []float32 { + if x != nil { + return x.MemoryLimitMb + } + return nil +} + +func (x *GPUOptions_Experimental_VirtualDevices) GetPriority() []int32 { + if x != nil { + return x.Priority + } + return nil +} + +// Everything inside Experimental is subject to change and is not subject +// to API stability guarantees in +// https://www.tensorflow.org/guide/version_compat. +type ConfigProto_Experimental struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Task name for group resolution. + CollectiveGroupLeader string `protobuf:"bytes,1,opt,name=collective_group_leader,json=collectiveGroupLeader,proto3" json:"collective_group_leader,omitempty"` + // Which executor to use, the default executor will be used + // if it is an empty string or "DEFAULT" + ExecutorType string `protobuf:"bytes,3,opt,name=executor_type,json=executorType,proto3" json:"executor_type,omitempty"` + // Guidance to formatting of large RecvBuf fields for transfer. + // Any positive value sets the max chunk size. 0 defaults to 4096. + // Any negative value indicates no max, i.e. one chunk only. + RecvBufMaxChunk int32 `protobuf:"varint,4,opt,name=recv_buf_max_chunk,json=recvBufMaxChunk,proto3" json:"recv_buf_max_chunk,omitempty"` + // If true, and supported by the platform, the runtime will attempt to + // use NUMA affinity where applicable. One consequence will be the + // existence of as many CPU devices as there are available NUMA nodes. + UseNumaAffinity bool `protobuf:"varint,5,opt,name=use_numa_affinity,json=useNumaAffinity,proto3" json:"use_numa_affinity,omitempty"` + // If true, make collective op execution order sequential and deterministic + // for potentially concurrent collective instances. + CollectiveDeterministicSequentialExecution bool `protobuf:"varint,6,opt,name=collective_deterministic_sequential_execution,json=collectiveDeterministicSequentialExecution,proto3" json:"collective_deterministic_sequential_execution,omitempty"` + // If true, use NCCL for CollectiveOps. This feature is highly + // experimental. + CollectiveNccl bool `protobuf:"varint,7,opt,name=collective_nccl,json=collectiveNccl,proto3" json:"collective_nccl,omitempty"` + // In the following, session state means the value of a variable, elements + // in a hash table, or any other resource, accessible by worker sessions + // held by a TF server. + // + // When ClusterSpec propagation is enabled, the value of + // isolate_session_state is ignored when deciding whether to share session + // states in a TF server (for backwards compatibility reasons). + // - If share_session_state_in_clusterspec_propagation is true, the session + // states are shared. + // - If share_session_state_in_clusterspec_propagation is false, session + // states are isolated. + // + // When clusterspec propagation is not used, the value of + // share_session_state_in_clusterspec_propagation is ignored when deciding + // whether to share session states in a TF server. + // - If isolate_session_state is true, session states are isolated. + // - If isolate_session_state is false, session states are shared. + // + // TODO(b/129330037): Add a single API that consistently treats + // isolate_session_state and ClusterSpec propagation. + ShareSessionStateInClusterspecPropagation bool `protobuf:"varint,8,opt,name=share_session_state_in_clusterspec_propagation,json=shareSessionStateInClusterspecPropagation,proto3" json:"share_session_state_in_clusterspec_propagation,omitempty"` + // If using a direct session, disable spinning while waiting for work in + // the thread pool. This may result in higher latency for completing ops, + // but in the case where there is a lot of spinning may result in lower + // CPU usage. + DisableThreadSpinning bool `protobuf:"varint,9,opt,name=disable_thread_spinning,json=disableThreadSpinning,proto3" json:"disable_thread_spinning,omitempty"` + // This was promoted to a non-experimental API. Please use + // ConfigProto.share_cluster_devices_in_session instead. + ShareClusterDevicesInSession bool `protobuf:"varint,10,opt,name=share_cluster_devices_in_session,json=shareClusterDevicesInSession,proto3" json:"share_cluster_devices_in_session,omitempty"` + // Metadata about the session. + // + // If set, this can be used by the runtime and the Ops for debugging, + // monitoring, etc. + // + // NOTE: This is currently used and propagated only by the direct session. + SessionMetadata *SessionMetadata `protobuf:"bytes,11,opt,name=session_metadata,json=sessionMetadata,proto3" json:"session_metadata,omitempty"` + // If true, the session may treat the graph as being static for optimization + // purposes. + // + // If this option is set to true when a session is created, the full + // GraphDef must be passed in a single call to Session::Create(), and + // Session::Extend() may not be supported. + OptimizeForStaticGraph bool `protobuf:"varint,12,opt,name=optimize_for_static_graph,json=optimizeForStaticGraph,proto3" json:"optimize_for_static_graph,omitempty"` + // This field will eventually be deprecated and replaced by + // mlir_bridge_rollout (b/166038521). + // + // Whether to enable the MLIR-based TF->XLA bridge. + // + // This is a replacement to the existing bridge, and not ready for + // production usage yet. + // If this option is set to true when a session is created, MLIR is used to + // perform the set of graph transformations to put the graph in a form that + // can be executed with delegation of some computations to an accelerator. + // This builds on the model of XLA where a subset of the graph is + // encapsulated and attached to a "compile" operation, whose result is fed + // to an "execute" operation. The kernel for these operations is responsible + // to lower the encapsulated graph to a particular device. + EnableMlirBridge bool `protobuf:"varint,13,opt,name=enable_mlir_bridge,json=enableMlirBridge,proto3" json:"enable_mlir_bridge,omitempty"` + // This field is underdevelopment, for now use enable_mlir_bridge + // (b/166038521). + // + // Whether to enable the MLIR-based TF->XLA bridge. + MlirBridgeRollout ConfigProto_Experimental_MlirBridgeRollout `protobuf:"varint,17,opt,name=mlir_bridge_rollout,json=mlirBridgeRollout,proto3,enum=tensorflow.ConfigProto_Experimental_MlirBridgeRollout" json:"mlir_bridge_rollout,omitempty"` + // Whether to enable the MLIR-based Graph optimizations. + // + // This will become a part of standard Tensorflow graph optimization + // pipeline, currently this is only used for gradual migration and testing + // new passes that are replacing existing optimizations in Grappler. + EnableMlirGraphOptimization bool `protobuf:"varint,16,opt,name=enable_mlir_graph_optimization,json=enableMlirGraphOptimization,proto3" json:"enable_mlir_graph_optimization,omitempty"` + // If true, the session will not store an additional copy of the graph for + // each subgraph. + // + // If this option is set to true when a session is created, the + // `RunOptions.output_partition_graphs` options must not be set. + DisableOutputPartitionGraphs bool `protobuf:"varint,14,opt,name=disable_output_partition_graphs,json=disableOutputPartitionGraphs,proto3" json:"disable_output_partition_graphs,omitempty"` + // Minimum number of batches run through the XLA graph before XLA fusion + // autotuner is enabled. Default value of zero disables the autotuner. + // + // The XLA fusion autotuner can improve performance by executing a heuristic + // search on the compiler parameters. + XlaFusionAutotunerThresh int64 `protobuf:"varint,15,opt,name=xla_fusion_autotuner_thresh,json=xlaFusionAutotunerThresh,proto3" json:"xla_fusion_autotuner_thresh,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ConfigProto_Experimental) Reset() { + *x = ConfigProto_Experimental{} + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ConfigProto_Experimental) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConfigProto_Experimental) ProtoMessage() {} + +func (x *ConfigProto_Experimental) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[14] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConfigProto_Experimental.ProtoReflect.Descriptor instead. +func (*ConfigProto_Experimental) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_config_proto_rawDescGZIP(), []int{6, 1} +} + +func (x *ConfigProto_Experimental) GetCollectiveGroupLeader() string { + if x != nil { + return x.CollectiveGroupLeader + } + return "" +} + +func (x *ConfigProto_Experimental) GetExecutorType() string { + if x != nil { + return x.ExecutorType + } + return "" +} + +func (x *ConfigProto_Experimental) GetRecvBufMaxChunk() int32 { + if x != nil { + return x.RecvBufMaxChunk + } + return 0 +} + +func (x *ConfigProto_Experimental) GetUseNumaAffinity() bool { + if x != nil { + return x.UseNumaAffinity + } + return false +} + +func (x *ConfigProto_Experimental) GetCollectiveDeterministicSequentialExecution() bool { + if x != nil { + return x.CollectiveDeterministicSequentialExecution + } + return false +} + +func (x *ConfigProto_Experimental) GetCollectiveNccl() bool { + if x != nil { + return x.CollectiveNccl + } + return false +} + +func (x *ConfigProto_Experimental) GetShareSessionStateInClusterspecPropagation() bool { + if x != nil { + return x.ShareSessionStateInClusterspecPropagation + } + return false +} + +func (x *ConfigProto_Experimental) GetDisableThreadSpinning() bool { + if x != nil { + return x.DisableThreadSpinning + } + return false +} + +func (x *ConfigProto_Experimental) GetShareClusterDevicesInSession() bool { + if x != nil { + return x.ShareClusterDevicesInSession + } + return false +} + +func (x *ConfigProto_Experimental) GetSessionMetadata() *SessionMetadata { + if x != nil { + return x.SessionMetadata + } + return nil +} + +func (x *ConfigProto_Experimental) GetOptimizeForStaticGraph() bool { + if x != nil { + return x.OptimizeForStaticGraph + } + return false +} + +func (x *ConfigProto_Experimental) GetEnableMlirBridge() bool { + if x != nil { + return x.EnableMlirBridge + } + return false +} + +func (x *ConfigProto_Experimental) GetMlirBridgeRollout() ConfigProto_Experimental_MlirBridgeRollout { + if x != nil { + return x.MlirBridgeRollout + } + return ConfigProto_Experimental_MLIR_BRIDGE_ROLLOUT_UNSPECIFIED +} + +func (x *ConfigProto_Experimental) GetEnableMlirGraphOptimization() bool { + if x != nil { + return x.EnableMlirGraphOptimization + } + return false +} + +func (x *ConfigProto_Experimental) GetDisableOutputPartitionGraphs() bool { + if x != nil { + return x.DisableOutputPartitionGraphs + } + return false +} + +func (x *ConfigProto_Experimental) GetXlaFusionAutotunerThresh() int64 { + if x != nil { + return x.XlaFusionAutotunerThresh + } + return 0 +} + +// Everything inside Experimental is subject to change and is not subject +// to API stability guarantees in +// https://www.tensorflow.org/guide/version_compat. +type RunOptions_Experimental struct { + state protoimpl.MessageState `protogen:"open.v1"` + // If non-zero, declares that this graph is going to use collective + // ops and must synchronize step_ids with any other graph with this + // same group_key value (in a distributed computation where tasks + // run disjoint graphs). + CollectiveGraphKey int64 `protobuf:"varint,1,opt,name=collective_graph_key,json=collectiveGraphKey,proto3" json:"collective_graph_key,omitempty"` + // If true, then operations (using the inter-op pool) across all + // session::run() calls will be centrally scheduled, optimizing for (median + // and tail) latency. + // Consider using this option for CPU-bound workloads like inference. + UseRunHandlerPool bool `protobuf:"varint,2,opt,name=use_run_handler_pool,json=useRunHandlerPool,proto3" json:"use_run_handler_pool,omitempty"` + RunHandlerPoolOptions *RunOptions_Experimental_RunHandlerPoolOptions `protobuf:"bytes,3,opt,name=run_handler_pool_options,json=runHandlerPoolOptions,proto3" json:"run_handler_pool_options,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RunOptions_Experimental) Reset() { + *x = RunOptions_Experimental{} + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RunOptions_Experimental) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RunOptions_Experimental) ProtoMessage() {} + +func (x *RunOptions_Experimental) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[15] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RunOptions_Experimental.ProtoReflect.Descriptor instead. +func (*RunOptions_Experimental) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_config_proto_rawDescGZIP(), []int{7, 0} +} + +func (x *RunOptions_Experimental) GetCollectiveGraphKey() int64 { + if x != nil { + return x.CollectiveGraphKey + } + return 0 +} + +func (x *RunOptions_Experimental) GetUseRunHandlerPool() bool { + if x != nil { + return x.UseRunHandlerPool + } + return false +} + +func (x *RunOptions_Experimental) GetRunHandlerPoolOptions() *RunOptions_Experimental_RunHandlerPoolOptions { + if x != nil { + return x.RunHandlerPoolOptions + } + return nil +} + +// Options for run handler thread pool. +type RunOptions_Experimental_RunHandlerPoolOptions struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Priority of the request. The run handler thread pool will schedule ops + // based on the priority number. The larger number means higher priority. + Priority int64 `protobuf:"varint,1,opt,name=priority,proto3" json:"priority,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RunOptions_Experimental_RunHandlerPoolOptions) Reset() { + *x = RunOptions_Experimental_RunHandlerPoolOptions{} + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RunOptions_Experimental_RunHandlerPoolOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RunOptions_Experimental_RunHandlerPoolOptions) ProtoMessage() {} + +func (x *RunOptions_Experimental_RunHandlerPoolOptions) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[16] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RunOptions_Experimental_RunHandlerPoolOptions.ProtoReflect.Descriptor instead. +func (*RunOptions_Experimental_RunHandlerPoolOptions) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_config_proto_rawDescGZIP(), []int{7, 0, 0} +} + +func (x *RunOptions_Experimental_RunHandlerPoolOptions) GetPriority() int64 { + if x != nil { + return x.Priority + } + return 0 +} + +type RunMetadata_FunctionGraphs struct { + state protoimpl.MessageState `protogen:"open.v1"` + // TODO(nareshmodi): Include some sort of function/cache-key identifier? + PartitionGraphs []*graph_go_proto.GraphDef `protobuf:"bytes,1,rep,name=partition_graphs,json=partitionGraphs,proto3" json:"partition_graphs,omitempty"` + PreOptimizationGraph *graph_go_proto.GraphDef `protobuf:"bytes,2,opt,name=pre_optimization_graph,json=preOptimizationGraph,proto3" json:"pre_optimization_graph,omitempty"` + PostOptimizationGraph *graph_go_proto.GraphDef `protobuf:"bytes,3,opt,name=post_optimization_graph,json=postOptimizationGraph,proto3" json:"post_optimization_graph,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RunMetadata_FunctionGraphs) Reset() { + *x = RunMetadata_FunctionGraphs{} + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RunMetadata_FunctionGraphs) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RunMetadata_FunctionGraphs) ProtoMessage() {} + +func (x *RunMetadata_FunctionGraphs) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_config_proto_msgTypes[17] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RunMetadata_FunctionGraphs.ProtoReflect.Descriptor instead. +func (*RunMetadata_FunctionGraphs) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_config_proto_rawDescGZIP(), []int{8, 0} +} + +func (x *RunMetadata_FunctionGraphs) GetPartitionGraphs() []*graph_go_proto.GraphDef { + if x != nil { + return x.PartitionGraphs + } + return nil +} + +func (x *RunMetadata_FunctionGraphs) GetPreOptimizationGraph() *graph_go_proto.GraphDef { + if x != nil { + return x.PreOptimizationGraph + } + return nil +} + +func (x *RunMetadata_FunctionGraphs) GetPostOptimizationGraph() *graph_go_proto.GraphDef { + if x != nil { + return x.PostOptimizationGraph + } + return nil +} + +var File_tensorflow_core_protobuf_config_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_config_proto_rawDesc = "" + + "\n" + + "%tensorflow/core/protobuf/config.proto\x12\n" + + "tensorflow\x1a*tensorflow/core/framework/cost_graph.proto\x1a%tensorflow/core/framework/graph.proto\x1a*tensorflow/core/framework/step_stats.proto\x1a&tensorflow/core/protobuf/cluster.proto\x1a$tensorflow/core/protobuf/debug.proto\x1a.tensorflow/core/protobuf/rewriter_config.proto\"\xca\b\n" + + "\n" + + "GPUOptions\x12D\n" + + "\x1fper_process_gpu_memory_fraction\x18\x01 \x01(\x01R\x1bperProcessGpuMemoryFraction\x12!\n" + + "\fallow_growth\x18\x04 \x01(\bR\vallowGrowth\x12%\n" + + "\x0eallocator_type\x18\x02 \x01(\tR\rallocatorType\x126\n" + + "\x17deferred_deletion_bytes\x18\x03 \x01(\x03R\x15deferredDeletionBytes\x12.\n" + + "\x13visible_device_list\x18\x05 \x01(\tR\x11visibleDeviceList\x12;\n" + + "\x1apolling_active_delay_usecs\x18\x06 \x01(\x05R\x17pollingActiveDelayUsecs\x12?\n" + + "\x1cpolling_inactive_delay_msecs\x18\a \x01(\x05R\x19pollingInactiveDelayMsecs\x120\n" + + "\x14force_gpu_compatible\x18\b \x01(\bR\x12forceGpuCompatible\x12G\n" + + "\fexperimental\x18\t \x01(\v2#.tensorflow.GPUOptions.ExperimentalR\fexperimental\x1a\xca\x04\n" + + "\fExperimental\x12[\n" + + "\x0fvirtual_devices\x18\x01 \x03(\v22.tensorflow.GPUOptions.Experimental.VirtualDevicesR\x0evirtualDevices\x12,\n" + + "\x12use_unified_memory\x18\x02 \x01(\bR\x10useUnifiedMemory\x12;\n" + + "\x1bnum_dev_to_dev_copy_streams\x18\x03 \x01(\x05R\x16numDevToDevCopyStreams\x122\n" + + "\x15collective_ring_order\x18\x04 \x01(\tR\x13collectiveRingOrder\x123\n" + + "\x15timestamped_allocator\x18\x05 \x01(\bR\x14timestampedAllocator\x12=\n" + + "\x1bkernel_tracker_max_interval\x18\a \x01(\x05R\x18kernelTrackerMaxInterval\x127\n" + + "\x18kernel_tracker_max_bytes\x18\b \x01(\x05R\x15kernelTrackerMaxBytes\x12;\n" + + "\x1akernel_tracker_max_pending\x18\t \x01(\x05R\x17kernelTrackerMaxPending\x1aT\n" + + "\x0eVirtualDevices\x12&\n" + + "\x0fmemory_limit_mb\x18\x01 \x03(\x02R\rmemoryLimitMb\x12\x1a\n" + + "\bpriority\x18\x02 \x03(\x05R\bpriority\"\x82\x04\n" + + "\x10OptimizerOptions\x12M\n" + + "#do_common_subexpression_elimination\x18\x01 \x01(\bR doCommonSubexpressionElimination\x12.\n" + + "\x13do_constant_folding\x18\x02 \x01(\bR\x11doConstantFolding\x12>\n" + + "\x1cmax_folded_constant_in_bytes\x18\x06 \x01(\x03R\x18maxFoldedConstantInBytes\x120\n" + + "\x14do_function_inlining\x18\x04 \x01(\bR\x12doFunctionInlining\x12?\n" + + "\topt_level\x18\x03 \x01(\x0e2\".tensorflow.OptimizerOptions.LevelR\boptLevel\x12U\n" + + "\x10global_jit_level\x18\x05 \x01(\x0e2+.tensorflow.OptimizerOptions.GlobalJitLevelR\x0eglobalJitLevel\" \n" + + "\x05Level\x12\x06\n" + + "\x02L1\x10\x00\x12\x0f\n" + + "\x02L0\x10\xff\xff\xff\xff\xff\xff\xff\xff\xff\x01\"C\n" + + "\x0eGlobalJitLevel\x12\v\n" + + "\aDEFAULT\x10\x00\x12\x10\n" + + "\x03OFF\x10\xff\xff\xff\xff\xff\xff\xff\xff\xff\x01\x12\b\n" + + "\x04ON_1\x10\x01\x12\b\n" + + "\x04ON_2\x10\x02\"\x90\x04\n" + + "\fGraphOptions\x124\n" + + "\x16enable_recv_scheduling\x18\x02 \x01(\bR\x14enableRecvScheduling\x12I\n" + + "\x11optimizer_options\x18\x03 \x01(\v2\x1c.tensorflow.OptimizerOptionsR\x10optimizerOptions\x12(\n" + + "\x10build_cost_model\x18\x04 \x01(\x03R\x0ebuildCostModel\x123\n" + + "\x16build_cost_model_after\x18\t \x01(\x03R\x13buildCostModelAfter\x12!\n" + + "\finfer_shapes\x18\x05 \x01(\bR\vinferShapes\x12,\n" + + "\x12place_pruned_graph\x18\x06 \x01(\bR\x10placePrunedGraph\x128\n" + + "\x18enable_bfloat16_sendrecv\x18\a \x01(\bR\x16enableBfloat16Sendrecv\x12#\n" + + "\rtimeline_step\x18\b \x01(\x05R\ftimelineStep\x12C\n" + + "\x0frewrite_options\x18\n" + + " \x01(\v2\x1a.tensorflow.RewriterConfigR\x0erewriteOptionsJ\x04\b\x01\x10\x02R%skip_common_subexpression_elimination\"Y\n" + + "\x15ThreadPoolOptionProto\x12\x1f\n" + + "\vnum_threads\x18\x01 \x01(\x05R\n" + + "numThreads\x12\x1f\n" + + "\vglobal_name\x18\x02 \x01(\tR\n" + + "globalName\"\xa9\x02\n" + + "\n" + + "RPCOptions\x12>\n" + + "\x1cuse_rpc_for_inprocess_master\x18\x01 \x01(\bR\x18useRpcForInprocessMaster\x123\n" + + "\x15compression_algorithm\x18\x02 \x01(\tR\x14compressionAlgorithm\x12+\n" + + "\x11compression_level\x18\x03 \x01(\x05R\x10compressionLevel\x12,\n" + + "\x12cache_rpc_response\x18\x04 \x01(\bR\x10cacheRpcResponse\x12K\n" + + "\"disable_session_connection_sharing\x18\x05 \x01(\bR\x1fdisableSessionConnectionSharing\"?\n" + + "\x0fSessionMetadata\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x18\n" + + "\aversion\x18\x02 \x01(\x03R\aversion\"\xf0\x11\n" + + "\vConfigProto\x12K\n" + + "\fdevice_count\x18\x01 \x03(\v2(.tensorflow.ConfigProto.DeviceCountEntryR\vdeviceCount\x12?\n" + + "\x1cintra_op_parallelism_threads\x18\x02 \x01(\x05R\x19intraOpParallelismThreads\x12?\n" + + "\x1cinter_op_parallelism_threads\x18\x05 \x01(\x05R\x19interOpParallelismThreads\x125\n" + + "\x17use_per_session_threads\x18\t \x01(\bR\x14usePerSessionThreads\x12a\n" + + "\x1csession_inter_op_thread_pool\x18\f \x03(\v2!.tensorflow.ThreadPoolOptionProtoR\x18sessionInterOpThreadPool\x12)\n" + + "\x10placement_period\x18\x03 \x01(\x05R\x0fplacementPeriod\x12%\n" + + "\x0edevice_filters\x18\x04 \x03(\tR\rdeviceFilters\x127\n" + + "\vgpu_options\x18\x06 \x01(\v2\x16.tensorflow.GPUOptionsR\n" + + "gpuOptions\x120\n" + + "\x14allow_soft_placement\x18\a \x01(\bR\x12allowSoftPlacement\x120\n" + + "\x14log_device_placement\x18\b \x01(\bR\x12logDevicePlacement\x12=\n" + + "\rgraph_options\x18\n" + + " \x01(\v2\x18.tensorflow.GraphOptionsR\fgraphOptions\x125\n" + + "\x17operation_timeout_in_ms\x18\v \x01(\x03R\x14operationTimeoutInMs\x127\n" + + "\vrpc_options\x18\r \x01(\v2\x16.tensorflow.RPCOptionsR\n" + + "rpcOptions\x127\n" + + "\vcluster_def\x18\x0e \x01(\v2\x16.tensorflow.ClusterDefR\n" + + "clusterDef\x122\n" + + "\x15isolate_session_state\x18\x0f \x01(\bR\x13isolateSessionState\x12F\n" + + " share_cluster_devices_in_session\x18\x11 \x01(\bR\x1cshareClusterDevicesInSession\x12H\n" + + "\fexperimental\x18\x10 \x01(\v2$.tensorflow.ConfigProto.ExperimentalR\fexperimental\x1a>\n" + + "\x10DeviceCountEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\x05R\x05value:\x028\x01\x1a\x9a\t\n" + + "\fExperimental\x126\n" + + "\x17collective_group_leader\x18\x01 \x01(\tR\x15collectiveGroupLeader\x12#\n" + + "\rexecutor_type\x18\x03 \x01(\tR\fexecutorType\x12+\n" + + "\x12recv_buf_max_chunk\x18\x04 \x01(\x05R\x0frecvBufMaxChunk\x12*\n" + + "\x11use_numa_affinity\x18\x05 \x01(\bR\x0fuseNumaAffinity\x12a\n" + + "-collective_deterministic_sequential_execution\x18\x06 \x01(\bR*collectiveDeterministicSequentialExecution\x12'\n" + + "\x0fcollective_nccl\x18\a \x01(\bR\x0ecollectiveNccl\x12a\n" + + ".share_session_state_in_clusterspec_propagation\x18\b \x01(\bR)shareSessionStateInClusterspecPropagation\x126\n" + + "\x17disable_thread_spinning\x18\t \x01(\bR\x15disableThreadSpinning\x12F\n" + + " share_cluster_devices_in_session\x18\n" + + " \x01(\bR\x1cshareClusterDevicesInSession\x12F\n" + + "\x10session_metadata\x18\v \x01(\v2\x1b.tensorflow.SessionMetadataR\x0fsessionMetadata\x129\n" + + "\x19optimize_for_static_graph\x18\f \x01(\bR\x16optimizeForStaticGraph\x12,\n" + + "\x12enable_mlir_bridge\x18\r \x01(\bR\x10enableMlirBridge\x12f\n" + + "\x13mlir_bridge_rollout\x18\x11 \x01(\x0e26.tensorflow.ConfigProto.Experimental.MlirBridgeRolloutR\x11mlirBridgeRollout\x12C\n" + + "\x1eenable_mlir_graph_optimization\x18\x10 \x01(\bR\x1benableMlirGraphOptimization\x12E\n" + + "\x1fdisable_output_partition_graphs\x18\x0e \x01(\bR\x1cdisableOutputPartitionGraphs\x12=\n" + + "\x1bxla_fusion_autotuner_thresh\x18\x0f \x01(\x03R\x18xlaFusionAutotunerThresh\"{\n" + + "\x11MlirBridgeRollout\x12#\n" + + "\x1fMLIR_BRIDGE_ROLLOUT_UNSPECIFIED\x10\x00\x12\x1f\n" + + "\x1bMLIR_BRIDGE_ROLLOUT_ENABLED\x10\x01\x12 \n" + + "\x1cMLIR_BRIDGE_ROLLOUT_DISABLED\x10\x02J\x04\b\x02\x10\x03\"\xa8\x06\n" + + "\n" + + "RunOptions\x12B\n" + + "\vtrace_level\x18\x01 \x01(\x0e2!.tensorflow.RunOptions.TraceLevelR\n" + + "traceLevel\x12\"\n" + + "\rtimeout_in_ms\x18\x02 \x01(\x03R\vtimeoutInMs\x12/\n" + + "\x14inter_op_thread_pool\x18\x03 \x01(\x05R\x11interOpThreadPool\x126\n" + + "\x17output_partition_graphs\x18\x05 \x01(\bR\x15outputPartitionGraphs\x12=\n" + + "\rdebug_options\x18\x06 \x01(\v2\x18.tensorflow.DebugOptionsR\fdebugOptions\x12J\n" + + "\"report_tensor_allocations_upon_oom\x18\a \x01(\bR\x1ereportTensorAllocationsUponOom\x12G\n" + + "\fexperimental\x18\b \x01(\v2#.tensorflow.RunOptions.ExperimentalR\fexperimental\x1a\x9a\x02\n" + + "\fExperimental\x120\n" + + "\x14collective_graph_key\x18\x01 \x01(\x03R\x12collectiveGraphKey\x12/\n" + + "\x14use_run_handler_pool\x18\x02 \x01(\bR\x11useRunHandlerPool\x12r\n" + + "\x18run_handler_pool_options\x18\x03 \x01(\v29.tensorflow.RunOptions.Experimental.RunHandlerPoolOptionsR\x15runHandlerPoolOptions\x1a3\n" + + "\x15RunHandlerPoolOptions\x12\x1a\n" + + "\bpriority\x18\x01 \x01(\x03R\bpriority\"R\n" + + "\n" + + "TraceLevel\x12\f\n" + + "\bNO_TRACE\x10\x00\x12\x12\n" + + "\x0eSOFTWARE_TRACE\x10\x01\x12\x12\n" + + "\x0eHARDWARE_TRACE\x10\x02\x12\x0e\n" + + "\n" + + "FULL_TRACE\x10\x03J\x04\b\x04\x10\x05\"\xfc\x03\n" + + "\vRunMetadata\x124\n" + + "\n" + + "step_stats\x18\x01 \x01(\v2\x15.tensorflow.StepStatsR\tstepStats\x127\n" + + "\n" + + "cost_graph\x18\x02 \x01(\v2\x18.tensorflow.CostGraphDefR\tcostGraph\x12?\n" + + "\x10partition_graphs\x18\x03 \x03(\v2\x14.tensorflow.GraphDefR\x0fpartitionGraphs\x12O\n" + + "\x0ffunction_graphs\x18\x04 \x03(\v2&.tensorflow.RunMetadata.FunctionGraphsR\x0efunctionGraphs\x1a\xeb\x01\n" + + "\x0eFunctionGraphs\x12?\n" + + "\x10partition_graphs\x18\x01 \x03(\v2\x14.tensorflow.GraphDefR\x0fpartitionGraphs\x12J\n" + + "\x16pre_optimization_graph\x18\x02 \x01(\v2\x14.tensorflow.GraphDefR\x14preOptimizationGraph\x12L\n" + + "\x17post_optimization_graph\x18\x03 \x01(\v2\x14.tensorflow.GraphDefR\x15postOptimizationGraph\"P\n" + + "\x10TensorConnection\x12\x1f\n" + + "\vfrom_tensor\x18\x01 \x01(\tR\n" + + "fromTensor\x12\x1b\n" + + "\tto_tensor\x18\x02 \x01(\tR\btoTensor\"\xa5\x04\n" + + "\x0fCallableOptions\x12\x12\n" + + "\x04feed\x18\x01 \x03(\tR\x04feed\x12\x14\n" + + "\x05fetch\x18\x02 \x03(\tR\x05fetch\x12\x16\n" + + "\x06target\x18\x03 \x03(\tR\x06target\x127\n" + + "\vrun_options\x18\x04 \x01(\v2\x16.tensorflow.RunOptionsR\n" + + "runOptions\x12I\n" + + "\x11tensor_connection\x18\x05 \x03(\v2\x1c.tensorflow.TensorConnectionR\x10tensorConnection\x12O\n" + + "\ffeed_devices\x18\x06 \x03(\v2,.tensorflow.CallableOptions.FeedDevicesEntryR\vfeedDevices\x12R\n" + + "\rfetch_devices\x18\a \x03(\v2-.tensorflow.CallableOptions.FetchDevicesEntryR\ffetchDevices\x12&\n" + + "\x0ffetch_skip_sync\x18\b \x01(\bR\rfetchSkipSync\x1a>\n" + + "\x10FeedDevicesEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\x1a?\n" + + "\x11FetchDevicesEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01B\x84\x01\n" + + "\x18org.tensorflow.frameworkB\fConfigProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_config_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_config_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_config_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_config_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_config_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_config_proto_rawDesc), len(file_tensorflow_core_protobuf_config_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_config_proto_rawDescData +} + +var file_tensorflow_core_protobuf_config_proto_enumTypes = make([]protoimpl.EnumInfo, 4) +var file_tensorflow_core_protobuf_config_proto_msgTypes = make([]protoimpl.MessageInfo, 20) +var file_tensorflow_core_protobuf_config_proto_goTypes = []any{ + (OptimizerOptions_Level)(0), // 0: tensorflow.OptimizerOptions.Level + (OptimizerOptions_GlobalJitLevel)(0), // 1: tensorflow.OptimizerOptions.GlobalJitLevel + (ConfigProto_Experimental_MlirBridgeRollout)(0), // 2: tensorflow.ConfigProto.Experimental.MlirBridgeRollout + (RunOptions_TraceLevel)(0), // 3: tensorflow.RunOptions.TraceLevel + (*GPUOptions)(nil), // 4: tensorflow.GPUOptions + (*OptimizerOptions)(nil), // 5: tensorflow.OptimizerOptions + (*GraphOptions)(nil), // 6: tensorflow.GraphOptions + (*ThreadPoolOptionProto)(nil), // 7: tensorflow.ThreadPoolOptionProto + (*RPCOptions)(nil), // 8: tensorflow.RPCOptions + (*SessionMetadata)(nil), // 9: tensorflow.SessionMetadata + (*ConfigProto)(nil), // 10: tensorflow.ConfigProto + (*RunOptions)(nil), // 11: tensorflow.RunOptions + (*RunMetadata)(nil), // 12: tensorflow.RunMetadata + (*TensorConnection)(nil), // 13: tensorflow.TensorConnection + (*CallableOptions)(nil), // 14: tensorflow.CallableOptions + (*GPUOptions_Experimental)(nil), // 15: tensorflow.GPUOptions.Experimental + (*GPUOptions_Experimental_VirtualDevices)(nil), // 16: tensorflow.GPUOptions.Experimental.VirtualDevices + nil, // 17: tensorflow.ConfigProto.DeviceCountEntry + (*ConfigProto_Experimental)(nil), // 18: tensorflow.ConfigProto.Experimental + (*RunOptions_Experimental)(nil), // 19: tensorflow.RunOptions.Experimental + (*RunOptions_Experimental_RunHandlerPoolOptions)(nil), // 20: tensorflow.RunOptions.Experimental.RunHandlerPoolOptions + (*RunMetadata_FunctionGraphs)(nil), // 21: tensorflow.RunMetadata.FunctionGraphs + nil, // 22: tensorflow.CallableOptions.FeedDevicesEntry + nil, // 23: tensorflow.CallableOptions.FetchDevicesEntry + (*RewriterConfig)(nil), // 24: tensorflow.RewriterConfig + (*ClusterDef)(nil), // 25: tensorflow.ClusterDef + (*DebugOptions)(nil), // 26: tensorflow.DebugOptions + (*step_stats_go_proto.StepStats)(nil), // 27: tensorflow.StepStats + (*cost_graph_go_proto.CostGraphDef)(nil), // 28: tensorflow.CostGraphDef + (*graph_go_proto.GraphDef)(nil), // 29: tensorflow.GraphDef +} +var file_tensorflow_core_protobuf_config_proto_depIdxs = []int32{ + 15, // 0: tensorflow.GPUOptions.experimental:type_name -> tensorflow.GPUOptions.Experimental + 0, // 1: tensorflow.OptimizerOptions.opt_level:type_name -> tensorflow.OptimizerOptions.Level + 1, // 2: tensorflow.OptimizerOptions.global_jit_level:type_name -> tensorflow.OptimizerOptions.GlobalJitLevel + 5, // 3: tensorflow.GraphOptions.optimizer_options:type_name -> tensorflow.OptimizerOptions + 24, // 4: tensorflow.GraphOptions.rewrite_options:type_name -> tensorflow.RewriterConfig + 17, // 5: tensorflow.ConfigProto.device_count:type_name -> tensorflow.ConfigProto.DeviceCountEntry + 7, // 6: tensorflow.ConfigProto.session_inter_op_thread_pool:type_name -> tensorflow.ThreadPoolOptionProto + 4, // 7: tensorflow.ConfigProto.gpu_options:type_name -> tensorflow.GPUOptions + 6, // 8: tensorflow.ConfigProto.graph_options:type_name -> tensorflow.GraphOptions + 8, // 9: tensorflow.ConfigProto.rpc_options:type_name -> tensorflow.RPCOptions + 25, // 10: tensorflow.ConfigProto.cluster_def:type_name -> tensorflow.ClusterDef + 18, // 11: tensorflow.ConfigProto.experimental:type_name -> tensorflow.ConfigProto.Experimental + 3, // 12: tensorflow.RunOptions.trace_level:type_name -> tensorflow.RunOptions.TraceLevel + 26, // 13: tensorflow.RunOptions.debug_options:type_name -> tensorflow.DebugOptions + 19, // 14: tensorflow.RunOptions.experimental:type_name -> tensorflow.RunOptions.Experimental + 27, // 15: tensorflow.RunMetadata.step_stats:type_name -> tensorflow.StepStats + 28, // 16: tensorflow.RunMetadata.cost_graph:type_name -> tensorflow.CostGraphDef + 29, // 17: tensorflow.RunMetadata.partition_graphs:type_name -> tensorflow.GraphDef + 21, // 18: tensorflow.RunMetadata.function_graphs:type_name -> tensorflow.RunMetadata.FunctionGraphs + 11, // 19: tensorflow.CallableOptions.run_options:type_name -> tensorflow.RunOptions + 13, // 20: tensorflow.CallableOptions.tensor_connection:type_name -> tensorflow.TensorConnection + 22, // 21: tensorflow.CallableOptions.feed_devices:type_name -> tensorflow.CallableOptions.FeedDevicesEntry + 23, // 22: tensorflow.CallableOptions.fetch_devices:type_name -> tensorflow.CallableOptions.FetchDevicesEntry + 16, // 23: tensorflow.GPUOptions.Experimental.virtual_devices:type_name -> tensorflow.GPUOptions.Experimental.VirtualDevices + 9, // 24: tensorflow.ConfigProto.Experimental.session_metadata:type_name -> tensorflow.SessionMetadata + 2, // 25: tensorflow.ConfigProto.Experimental.mlir_bridge_rollout:type_name -> tensorflow.ConfigProto.Experimental.MlirBridgeRollout + 20, // 26: tensorflow.RunOptions.Experimental.run_handler_pool_options:type_name -> tensorflow.RunOptions.Experimental.RunHandlerPoolOptions + 29, // 27: tensorflow.RunMetadata.FunctionGraphs.partition_graphs:type_name -> tensorflow.GraphDef + 29, // 28: tensorflow.RunMetadata.FunctionGraphs.pre_optimization_graph:type_name -> tensorflow.GraphDef + 29, // 29: tensorflow.RunMetadata.FunctionGraphs.post_optimization_graph:type_name -> tensorflow.GraphDef + 30, // [30:30] is the sub-list for method output_type + 30, // [30:30] is the sub-list for method input_type + 30, // [30:30] is the sub-list for extension type_name + 30, // [30:30] is the sub-list for extension extendee + 0, // [0:30] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_config_proto_init() } +func file_tensorflow_core_protobuf_config_proto_init() { + if File_tensorflow_core_protobuf_config_proto != nil { + return + } + file_tensorflow_core_protobuf_cluster_proto_init() + file_tensorflow_core_protobuf_debug_proto_init() + file_tensorflow_core_protobuf_rewriter_config_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_config_proto_rawDesc), len(file_tensorflow_core_protobuf_config_proto_rawDesc)), + NumEnums: 4, + NumMessages: 20, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_config_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_config_proto_depIdxs, + EnumInfos: file_tensorflow_core_protobuf_config_proto_enumTypes, + MessageInfos: file_tensorflow_core_protobuf_config_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_config_proto = out.File + file_tensorflow_core_protobuf_config_proto_goTypes = nil + file_tensorflow_core_protobuf_config_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/control_flow.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/control_flow.pb.go new file mode 100644 index 0000000..af927f9 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/control_flow.pb.go @@ -0,0 +1,505 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/control_flow.proto + +package for_core_protos_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Protocol buffer representing the values in ControlFlowContext. +type ValuesDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Value names that have been seen in this context. + Values []string `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"` + // Value names referenced by but external to this context. + ExternalValues map[string]string `protobuf:"bytes,2,rep,name=external_values,json=externalValues,proto3" json:"external_values,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ValuesDef) Reset() { + *x = ValuesDef{} + mi := &file_tensorflow_core_protobuf_control_flow_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ValuesDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ValuesDef) ProtoMessage() {} + +func (x *ValuesDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_control_flow_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ValuesDef.ProtoReflect.Descriptor instead. +func (*ValuesDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_control_flow_proto_rawDescGZIP(), []int{0} +} + +func (x *ValuesDef) GetValues() []string { + if x != nil { + return x.Values + } + return nil +} + +func (x *ValuesDef) GetExternalValues() map[string]string { + if x != nil { + return x.ExternalValues + } + return nil +} + +// Container for any kind of control flow context. Any other control flow +// contexts that are added below should also be added here. +type ControlFlowContextDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Ctxt: + // + // *ControlFlowContextDef_CondCtxt + // *ControlFlowContextDef_WhileCtxt + Ctxt isControlFlowContextDef_Ctxt `protobuf_oneof:"ctxt"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ControlFlowContextDef) Reset() { + *x = ControlFlowContextDef{} + mi := &file_tensorflow_core_protobuf_control_flow_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ControlFlowContextDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ControlFlowContextDef) ProtoMessage() {} + +func (x *ControlFlowContextDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_control_flow_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ControlFlowContextDef.ProtoReflect.Descriptor instead. +func (*ControlFlowContextDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_control_flow_proto_rawDescGZIP(), []int{1} +} + +func (x *ControlFlowContextDef) GetCtxt() isControlFlowContextDef_Ctxt { + if x != nil { + return x.Ctxt + } + return nil +} + +func (x *ControlFlowContextDef) GetCondCtxt() *CondContextDef { + if x != nil { + if x, ok := x.Ctxt.(*ControlFlowContextDef_CondCtxt); ok { + return x.CondCtxt + } + } + return nil +} + +func (x *ControlFlowContextDef) GetWhileCtxt() *WhileContextDef { + if x != nil { + if x, ok := x.Ctxt.(*ControlFlowContextDef_WhileCtxt); ok { + return x.WhileCtxt + } + } + return nil +} + +type isControlFlowContextDef_Ctxt interface { + isControlFlowContextDef_Ctxt() +} + +type ControlFlowContextDef_CondCtxt struct { + CondCtxt *CondContextDef `protobuf:"bytes,1,opt,name=cond_ctxt,json=condCtxt,proto3,oneof"` +} + +type ControlFlowContextDef_WhileCtxt struct { + WhileCtxt *WhileContextDef `protobuf:"bytes,2,opt,name=while_ctxt,json=whileCtxt,proto3,oneof"` +} + +func (*ControlFlowContextDef_CondCtxt) isControlFlowContextDef_Ctxt() {} + +func (*ControlFlowContextDef_WhileCtxt) isControlFlowContextDef_Ctxt() {} + +// Protocol buffer representing a CondContext object. +type CondContextDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Name of the context. + ContextName string `protobuf:"bytes,1,opt,name=context_name,json=contextName,proto3" json:"context_name,omitempty"` + // Name of the pred tensor. + PredName string `protobuf:"bytes,2,opt,name=pred_name,json=predName,proto3" json:"pred_name,omitempty"` + // Name of the pivot tensor. + PivotName string `protobuf:"bytes,3,opt,name=pivot_name,json=pivotName,proto3" json:"pivot_name,omitempty"` + // Branch prediction. 0 or 1. + Branch int32 `protobuf:"varint,4,opt,name=branch,proto3" json:"branch,omitempty"` + // Values and external values in control flow context. + ValuesDef *ValuesDef `protobuf:"bytes,5,opt,name=values_def,json=valuesDef,proto3" json:"values_def,omitempty"` + // Contexts contained inside this context (e.g. nested conds). + NestedContexts []*ControlFlowContextDef `protobuf:"bytes,6,rep,name=nested_contexts,json=nestedContexts,proto3" json:"nested_contexts,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CondContextDef) Reset() { + *x = CondContextDef{} + mi := &file_tensorflow_core_protobuf_control_flow_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CondContextDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CondContextDef) ProtoMessage() {} + +func (x *CondContextDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_control_flow_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CondContextDef.ProtoReflect.Descriptor instead. +func (*CondContextDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_control_flow_proto_rawDescGZIP(), []int{2} +} + +func (x *CondContextDef) GetContextName() string { + if x != nil { + return x.ContextName + } + return "" +} + +func (x *CondContextDef) GetPredName() string { + if x != nil { + return x.PredName + } + return "" +} + +func (x *CondContextDef) GetPivotName() string { + if x != nil { + return x.PivotName + } + return "" +} + +func (x *CondContextDef) GetBranch() int32 { + if x != nil { + return x.Branch + } + return 0 +} + +func (x *CondContextDef) GetValuesDef() *ValuesDef { + if x != nil { + return x.ValuesDef + } + return nil +} + +func (x *CondContextDef) GetNestedContexts() []*ControlFlowContextDef { + if x != nil { + return x.NestedContexts + } + return nil +} + +// Protocol buffer representing a WhileContext object. +type WhileContextDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Name of the context. + ContextName string `protobuf:"bytes,1,opt,name=context_name,json=contextName,proto3" json:"context_name,omitempty"` + // The number of iterations allowed to run in parallel. + ParallelIterations int32 `protobuf:"varint,2,opt,name=parallel_iterations,json=parallelIterations,proto3" json:"parallel_iterations,omitempty"` + // Whether backprop is enabled for this while loop. + BackProp bool `protobuf:"varint,3,opt,name=back_prop,json=backProp,proto3" json:"back_prop,omitempty"` + // Whether GPU-CPU memory swap is enabled for this loop. + SwapMemory bool `protobuf:"varint,4,opt,name=swap_memory,json=swapMemory,proto3" json:"swap_memory,omitempty"` + // Name of the pivot tensor. + PivotName string `protobuf:"bytes,5,opt,name=pivot_name,json=pivotName,proto3" json:"pivot_name,omitempty"` + // Name of the pivot_for_pred tensor. + PivotForPredName string `protobuf:"bytes,6,opt,name=pivot_for_pred_name,json=pivotForPredName,proto3" json:"pivot_for_pred_name,omitempty"` + // Name of the pivot_for_body tensor. + PivotForBodyName string `protobuf:"bytes,7,opt,name=pivot_for_body_name,json=pivotForBodyName,proto3" json:"pivot_for_body_name,omitempty"` + // List of names for exit tensors. + LoopExitNames []string `protobuf:"bytes,8,rep,name=loop_exit_names,json=loopExitNames,proto3" json:"loop_exit_names,omitempty"` + // List of names for enter tensors. + LoopEnterNames []string `protobuf:"bytes,10,rep,name=loop_enter_names,json=loopEnterNames,proto3" json:"loop_enter_names,omitempty"` + // Values and external values in control flow context. + ValuesDef *ValuesDef `protobuf:"bytes,9,opt,name=values_def,json=valuesDef,proto3" json:"values_def,omitempty"` + // Optional name of the maximum_iterations tensor. + MaximumIterationsName string `protobuf:"bytes,11,opt,name=maximum_iterations_name,json=maximumIterationsName,proto3" json:"maximum_iterations_name,omitempty"` + // Contexts contained inside this context (e.g. nested whiles). + NestedContexts []*ControlFlowContextDef `protobuf:"bytes,12,rep,name=nested_contexts,json=nestedContexts,proto3" json:"nested_contexts,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *WhileContextDef) Reset() { + *x = WhileContextDef{} + mi := &file_tensorflow_core_protobuf_control_flow_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *WhileContextDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WhileContextDef) ProtoMessage() {} + +func (x *WhileContextDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_control_flow_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WhileContextDef.ProtoReflect.Descriptor instead. +func (*WhileContextDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_control_flow_proto_rawDescGZIP(), []int{3} +} + +func (x *WhileContextDef) GetContextName() string { + if x != nil { + return x.ContextName + } + return "" +} + +func (x *WhileContextDef) GetParallelIterations() int32 { + if x != nil { + return x.ParallelIterations + } + return 0 +} + +func (x *WhileContextDef) GetBackProp() bool { + if x != nil { + return x.BackProp + } + return false +} + +func (x *WhileContextDef) GetSwapMemory() bool { + if x != nil { + return x.SwapMemory + } + return false +} + +func (x *WhileContextDef) GetPivotName() string { + if x != nil { + return x.PivotName + } + return "" +} + +func (x *WhileContextDef) GetPivotForPredName() string { + if x != nil { + return x.PivotForPredName + } + return "" +} + +func (x *WhileContextDef) GetPivotForBodyName() string { + if x != nil { + return x.PivotForBodyName + } + return "" +} + +func (x *WhileContextDef) GetLoopExitNames() []string { + if x != nil { + return x.LoopExitNames + } + return nil +} + +func (x *WhileContextDef) GetLoopEnterNames() []string { + if x != nil { + return x.LoopEnterNames + } + return nil +} + +func (x *WhileContextDef) GetValuesDef() *ValuesDef { + if x != nil { + return x.ValuesDef + } + return nil +} + +func (x *WhileContextDef) GetMaximumIterationsName() string { + if x != nil { + return x.MaximumIterationsName + } + return "" +} + +func (x *WhileContextDef) GetNestedContexts() []*ControlFlowContextDef { + if x != nil { + return x.NestedContexts + } + return nil +} + +var File_tensorflow_core_protobuf_control_flow_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_control_flow_proto_rawDesc = "" + + "\n" + + "+tensorflow/core/protobuf/control_flow.proto\x12\n" + + "tensorflow\"\xba\x01\n" + + "\tValuesDef\x12\x16\n" + + "\x06values\x18\x01 \x03(\tR\x06values\x12R\n" + + "\x0fexternal_values\x18\x02 \x03(\v2).tensorflow.ValuesDef.ExternalValuesEntryR\x0eexternalValues\x1aA\n" + + "\x13ExternalValuesEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\x98\x01\n" + + "\x15ControlFlowContextDef\x129\n" + + "\tcond_ctxt\x18\x01 \x01(\v2\x1a.tensorflow.CondContextDefH\x00R\bcondCtxt\x12<\n" + + "\n" + + "while_ctxt\x18\x02 \x01(\v2\x1b.tensorflow.WhileContextDefH\x00R\twhileCtxtB\x06\n" + + "\x04ctxt\"\x89\x02\n" + + "\x0eCondContextDef\x12!\n" + + "\fcontext_name\x18\x01 \x01(\tR\vcontextName\x12\x1b\n" + + "\tpred_name\x18\x02 \x01(\tR\bpredName\x12\x1d\n" + + "\n" + + "pivot_name\x18\x03 \x01(\tR\tpivotName\x12\x16\n" + + "\x06branch\x18\x04 \x01(\x05R\x06branch\x124\n" + + "\n" + + "values_def\x18\x05 \x01(\v2\x15.tensorflow.ValuesDefR\tvaluesDef\x12J\n" + + "\x0fnested_contexts\x18\x06 \x03(\v2!.tensorflow.ControlFlowContextDefR\x0enestedContexts\"\xac\x04\n" + + "\x0fWhileContextDef\x12!\n" + + "\fcontext_name\x18\x01 \x01(\tR\vcontextName\x12/\n" + + "\x13parallel_iterations\x18\x02 \x01(\x05R\x12parallelIterations\x12\x1b\n" + + "\tback_prop\x18\x03 \x01(\bR\bbackProp\x12\x1f\n" + + "\vswap_memory\x18\x04 \x01(\bR\n" + + "swapMemory\x12\x1d\n" + + "\n" + + "pivot_name\x18\x05 \x01(\tR\tpivotName\x12-\n" + + "\x13pivot_for_pred_name\x18\x06 \x01(\tR\x10pivotForPredName\x12-\n" + + "\x13pivot_for_body_name\x18\a \x01(\tR\x10pivotForBodyName\x12&\n" + + "\x0floop_exit_names\x18\b \x03(\tR\rloopExitNames\x12(\n" + + "\x10loop_enter_names\x18\n" + + " \x03(\tR\x0eloopEnterNames\x124\n" + + "\n" + + "values_def\x18\t \x01(\v2\x15.tensorflow.ValuesDefR\tvaluesDef\x126\n" + + "\x17maximum_iterations_name\x18\v \x01(\tR\x15maximumIterationsName\x12J\n" + + "\x0fnested_contexts\x18\f \x03(\v2!.tensorflow.ControlFlowContextDefR\x0enestedContextsB\x89\x01\n" + + "\x18org.tensorflow.frameworkB\x11ControlFlowProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_control_flow_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_control_flow_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_control_flow_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_control_flow_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_control_flow_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_control_flow_proto_rawDesc), len(file_tensorflow_core_protobuf_control_flow_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_control_flow_proto_rawDescData +} + +var file_tensorflow_core_protobuf_control_flow_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_tensorflow_core_protobuf_control_flow_proto_goTypes = []any{ + (*ValuesDef)(nil), // 0: tensorflow.ValuesDef + (*ControlFlowContextDef)(nil), // 1: tensorflow.ControlFlowContextDef + (*CondContextDef)(nil), // 2: tensorflow.CondContextDef + (*WhileContextDef)(nil), // 3: tensorflow.WhileContextDef + nil, // 4: tensorflow.ValuesDef.ExternalValuesEntry +} +var file_tensorflow_core_protobuf_control_flow_proto_depIdxs = []int32{ + 4, // 0: tensorflow.ValuesDef.external_values:type_name -> tensorflow.ValuesDef.ExternalValuesEntry + 2, // 1: tensorflow.ControlFlowContextDef.cond_ctxt:type_name -> tensorflow.CondContextDef + 3, // 2: tensorflow.ControlFlowContextDef.while_ctxt:type_name -> tensorflow.WhileContextDef + 0, // 3: tensorflow.CondContextDef.values_def:type_name -> tensorflow.ValuesDef + 1, // 4: tensorflow.CondContextDef.nested_contexts:type_name -> tensorflow.ControlFlowContextDef + 0, // 5: tensorflow.WhileContextDef.values_def:type_name -> tensorflow.ValuesDef + 1, // 6: tensorflow.WhileContextDef.nested_contexts:type_name -> tensorflow.ControlFlowContextDef + 7, // [7:7] is the sub-list for method output_type + 7, // [7:7] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_control_flow_proto_init() } +func file_tensorflow_core_protobuf_control_flow_proto_init() { + if File_tensorflow_core_protobuf_control_flow_proto != nil { + return + } + file_tensorflow_core_protobuf_control_flow_proto_msgTypes[1].OneofWrappers = []any{ + (*ControlFlowContextDef_CondCtxt)(nil), + (*ControlFlowContextDef_WhileCtxt)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_control_flow_proto_rawDesc), len(file_tensorflow_core_protobuf_control_flow_proto_rawDesc)), + NumEnums: 0, + NumMessages: 5, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_control_flow_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_control_flow_proto_depIdxs, + MessageInfos: file_tensorflow_core_protobuf_control_flow_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_control_flow_proto = out.File + file_tensorflow_core_protobuf_control_flow_proto_goTypes = nil + file_tensorflow_core_protobuf_control_flow_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/conv_autotuning.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/conv_autotuning.pb.go new file mode 100644 index 0000000..81d033e --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/conv_autotuning.pb.go @@ -0,0 +1,254 @@ +// This is used for convolution logging. Also see +// tensorflow/core/protobuf/autotuing.h + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/conv_autotuning.proto + +package for_core_protos_go_proto + +import ( + stream_executor "github.com/tensorflow/tensorflow/tensorflow/go/stream_executor" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// A convolution. Currently it's only used for logging. In the future, we may +// want to use it in the API as well. +type ConvolutionProto struct { + state protoimpl.MessageState `protogen:"open.v1"` + Kind stream_executor.ConvolutionKind `protobuf:"varint,1,opt,name=kind,proto3,enum=stream_executor.dnn.ConvolutionKind" json:"kind,omitempty"` + Input *stream_executor.TensorDescriptorProto `protobuf:"bytes,2,opt,name=input,proto3" json:"input,omitempty"` + Filter *stream_executor.TensorDescriptorProto `protobuf:"bytes,3,opt,name=filter,proto3" json:"filter,omitempty"` + Output *stream_executor.TensorDescriptorProto `protobuf:"bytes,4,opt,name=output,proto3" json:"output,omitempty"` + ConvDesc *stream_executor.ConvolutionDescriptorProto `protobuf:"bytes,5,opt,name=conv_desc,json=convDesc,proto3" json:"conv_desc,omitempty"` + // result = conv_scale * conv(...) + side_value_scale * side_value. + // side_value is an arbitrary buffer if activation is not none. Otherwise, it + // has to be the result buffer (using its old values). + ConvScale float64 `protobuf:"fixed64,6,opt,name=conv_scale,json=convScale,proto3" json:"conv_scale,omitempty"` + SideValueScale float64 `protobuf:"fixed64,7,opt,name=side_value_scale,json=sideValueScale,proto3" json:"side_value_scale,omitempty"` + Activation stream_executor.ActivationMode `protobuf:"varint,8,opt,name=activation,proto3,enum=stream_executor.dnn.ActivationMode" json:"activation,omitempty"` + InputAddress int64 `protobuf:"varint,9,opt,name=input_address,json=inputAddress,proto3" json:"input_address,omitempty"` + FilterAddress int64 `protobuf:"varint,10,opt,name=filter_address,json=filterAddress,proto3" json:"filter_address,omitempty"` + OutputAddress int64 `protobuf:"varint,11,opt,name=output_address,json=outputAddress,proto3" json:"output_address,omitempty"` + BiasAddress int64 `protobuf:"varint,12,opt,name=bias_address,json=biasAddress,proto3" json:"bias_address,omitempty"` + SideInputAddress int64 `protobuf:"varint,13,opt,name=side_input_address,json=sideInputAddress,proto3" json:"side_input_address,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ConvolutionProto) Reset() { + *x = ConvolutionProto{} + mi := &file_tensorflow_core_protobuf_conv_autotuning_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ConvolutionProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConvolutionProto) ProtoMessage() {} + +func (x *ConvolutionProto) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_conv_autotuning_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConvolutionProto.ProtoReflect.Descriptor instead. +func (*ConvolutionProto) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_conv_autotuning_proto_rawDescGZIP(), []int{0} +} + +func (x *ConvolutionProto) GetKind() stream_executor.ConvolutionKind { + if x != nil { + return x.Kind + } + return stream_executor.ConvolutionKind(0) +} + +func (x *ConvolutionProto) GetInput() *stream_executor.TensorDescriptorProto { + if x != nil { + return x.Input + } + return nil +} + +func (x *ConvolutionProto) GetFilter() *stream_executor.TensorDescriptorProto { + if x != nil { + return x.Filter + } + return nil +} + +func (x *ConvolutionProto) GetOutput() *stream_executor.TensorDescriptorProto { + if x != nil { + return x.Output + } + return nil +} + +func (x *ConvolutionProto) GetConvDesc() *stream_executor.ConvolutionDescriptorProto { + if x != nil { + return x.ConvDesc + } + return nil +} + +func (x *ConvolutionProto) GetConvScale() float64 { + if x != nil { + return x.ConvScale + } + return 0 +} + +func (x *ConvolutionProto) GetSideValueScale() float64 { + if x != nil { + return x.SideValueScale + } + return 0 +} + +func (x *ConvolutionProto) GetActivation() stream_executor.ActivationMode { + if x != nil { + return x.Activation + } + return stream_executor.ActivationMode(0) +} + +func (x *ConvolutionProto) GetInputAddress() int64 { + if x != nil { + return x.InputAddress + } + return 0 +} + +func (x *ConvolutionProto) GetFilterAddress() int64 { + if x != nil { + return x.FilterAddress + } + return 0 +} + +func (x *ConvolutionProto) GetOutputAddress() int64 { + if x != nil { + return x.OutputAddress + } + return 0 +} + +func (x *ConvolutionProto) GetBiasAddress() int64 { + if x != nil { + return x.BiasAddress + } + return 0 +} + +func (x *ConvolutionProto) GetSideInputAddress() int64 { + if x != nil { + return x.SideInputAddress + } + return 0 +} + +var File_tensorflow_core_protobuf_conv_autotuning_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_conv_autotuning_proto_rawDesc = "" + + "\n" + + ".tensorflow/core/protobuf/conv_autotuning.proto\x12\n" + + "tensorflow\x1a$tensorflow/stream_executor/dnn.proto\"\xb6\x05\n" + + "\x10ConvolutionProto\x128\n" + + "\x04kind\x18\x01 \x01(\x0e2$.stream_executor.dnn.ConvolutionKindR\x04kind\x12@\n" + + "\x05input\x18\x02 \x01(\v2*.stream_executor.dnn.TensorDescriptorProtoR\x05input\x12B\n" + + "\x06filter\x18\x03 \x01(\v2*.stream_executor.dnn.TensorDescriptorProtoR\x06filter\x12B\n" + + "\x06output\x18\x04 \x01(\v2*.stream_executor.dnn.TensorDescriptorProtoR\x06output\x12L\n" + + "\tconv_desc\x18\x05 \x01(\v2/.stream_executor.dnn.ConvolutionDescriptorProtoR\bconvDesc\x12\x1d\n" + + "\n" + + "conv_scale\x18\x06 \x01(\x01R\tconvScale\x12(\n" + + "\x10side_value_scale\x18\a \x01(\x01R\x0esideValueScale\x12C\n" + + "\n" + + "activation\x18\b \x01(\x0e2#.stream_executor.dnn.ActivationModeR\n" + + "activation\x12#\n" + + "\rinput_address\x18\t \x01(\x03R\finputAddress\x12%\n" + + "\x0efilter_address\x18\n" + + " \x01(\x03R\rfilterAddress\x12%\n" + + "\x0eoutput_address\x18\v \x01(\x03R\routputAddress\x12!\n" + + "\fbias_address\x18\f \x01(\x03R\vbiasAddress\x12,\n" + + "\x12side_input_address\x18\r \x01(\x03R\x10sideInputAddressBWZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_protob\x06proto3" + +var ( + file_tensorflow_core_protobuf_conv_autotuning_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_conv_autotuning_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_conv_autotuning_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_conv_autotuning_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_conv_autotuning_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_conv_autotuning_proto_rawDesc), len(file_tensorflow_core_protobuf_conv_autotuning_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_conv_autotuning_proto_rawDescData +} + +var file_tensorflow_core_protobuf_conv_autotuning_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_tensorflow_core_protobuf_conv_autotuning_proto_goTypes = []any{ + (*ConvolutionProto)(nil), // 0: tensorflow.ConvolutionProto + (stream_executor.ConvolutionKind)(0), // 1: stream_executor.dnn.ConvolutionKind + (*stream_executor.TensorDescriptorProto)(nil), // 2: stream_executor.dnn.TensorDescriptorProto + (*stream_executor.ConvolutionDescriptorProto)(nil), // 3: stream_executor.dnn.ConvolutionDescriptorProto + (stream_executor.ActivationMode)(0), // 4: stream_executor.dnn.ActivationMode +} +var file_tensorflow_core_protobuf_conv_autotuning_proto_depIdxs = []int32{ + 1, // 0: tensorflow.ConvolutionProto.kind:type_name -> stream_executor.dnn.ConvolutionKind + 2, // 1: tensorflow.ConvolutionProto.input:type_name -> stream_executor.dnn.TensorDescriptorProto + 2, // 2: tensorflow.ConvolutionProto.filter:type_name -> stream_executor.dnn.TensorDescriptorProto + 2, // 3: tensorflow.ConvolutionProto.output:type_name -> stream_executor.dnn.TensorDescriptorProto + 3, // 4: tensorflow.ConvolutionProto.conv_desc:type_name -> stream_executor.dnn.ConvolutionDescriptorProto + 4, // 5: tensorflow.ConvolutionProto.activation:type_name -> stream_executor.dnn.ActivationMode + 6, // [6:6] is the sub-list for method output_type + 6, // [6:6] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_conv_autotuning_proto_init() } +func file_tensorflow_core_protobuf_conv_autotuning_proto_init() { + if File_tensorflow_core_protobuf_conv_autotuning_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_conv_autotuning_proto_rawDesc), len(file_tensorflow_core_protobuf_conv_autotuning_proto_rawDesc)), + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_conv_autotuning_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_conv_autotuning_proto_depIdxs, + MessageInfos: file_tensorflow_core_protobuf_conv_autotuning_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_conv_autotuning_proto = out.File + file_tensorflow_core_protobuf_conv_autotuning_proto_goTypes = nil + file_tensorflow_core_protobuf_conv_autotuning_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/critical_section.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/critical_section.pb.go new file mode 100644 index 0000000..be27b5e --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/critical_section.pb.go @@ -0,0 +1,186 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/critical_section.proto + +package for_core_protos_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Protocol buffer representing a CriticalSection. +type CriticalSectionDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Name of the critical section handle. + CriticalSectionName string `protobuf:"bytes,1,opt,name=critical_section_name,json=criticalSectionName,proto3" json:"critical_section_name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CriticalSectionDef) Reset() { + *x = CriticalSectionDef{} + mi := &file_tensorflow_core_protobuf_critical_section_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CriticalSectionDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CriticalSectionDef) ProtoMessage() {} + +func (x *CriticalSectionDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_critical_section_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CriticalSectionDef.ProtoReflect.Descriptor instead. +func (*CriticalSectionDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_critical_section_proto_rawDescGZIP(), []int{0} +} + +func (x *CriticalSectionDef) GetCriticalSectionName() string { + if x != nil { + return x.CriticalSectionName + } + return "" +} + +// Protocol buffer representing a CriticalSection execution. +type CriticalSectionExecutionDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Name of the critical section handle. + ExecuteInCriticalSectionName string `protobuf:"bytes,1,opt,name=execute_in_critical_section_name,json=executeInCriticalSectionName,proto3" json:"execute_in_critical_section_name,omitempty"` + // Whether this operation requires exclusive access to its resources, + // (i.e., no other CriticalSections may request the same resources). + ExclusiveResourceAccess bool `protobuf:"varint,2,opt,name=exclusive_resource_access,json=exclusiveResourceAccess,proto3" json:"exclusive_resource_access,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CriticalSectionExecutionDef) Reset() { + *x = CriticalSectionExecutionDef{} + mi := &file_tensorflow_core_protobuf_critical_section_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CriticalSectionExecutionDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CriticalSectionExecutionDef) ProtoMessage() {} + +func (x *CriticalSectionExecutionDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_critical_section_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CriticalSectionExecutionDef.ProtoReflect.Descriptor instead. +func (*CriticalSectionExecutionDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_critical_section_proto_rawDescGZIP(), []int{1} +} + +func (x *CriticalSectionExecutionDef) GetExecuteInCriticalSectionName() string { + if x != nil { + return x.ExecuteInCriticalSectionName + } + return "" +} + +func (x *CriticalSectionExecutionDef) GetExclusiveResourceAccess() bool { + if x != nil { + return x.ExclusiveResourceAccess + } + return false +} + +var File_tensorflow_core_protobuf_critical_section_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_critical_section_proto_rawDesc = "" + + "\n" + + "/tensorflow/core/protobuf/critical_section.proto\x12\n" + + "tensorflow\"H\n" + + "\x12CriticalSectionDef\x122\n" + + "\x15critical_section_name\x18\x01 \x01(\tR\x13criticalSectionName\"\xa1\x01\n" + + "\x1bCriticalSectionExecutionDef\x12F\n" + + " execute_in_critical_section_name\x18\x01 \x01(\tR\x1cexecuteInCriticalSectionName\x12:\n" + + "\x19exclusive_resource_access\x18\x02 \x01(\bR\x17exclusiveResourceAccessB\x8d\x01\n" + + "\x18org.tensorflow.frameworkB\x15CriticalSectionProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_critical_section_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_critical_section_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_critical_section_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_critical_section_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_critical_section_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_critical_section_proto_rawDesc), len(file_tensorflow_core_protobuf_critical_section_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_critical_section_proto_rawDescData +} + +var file_tensorflow_core_protobuf_critical_section_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_tensorflow_core_protobuf_critical_section_proto_goTypes = []any{ + (*CriticalSectionDef)(nil), // 0: tensorflow.CriticalSectionDef + (*CriticalSectionExecutionDef)(nil), // 1: tensorflow.CriticalSectionExecutionDef +} +var file_tensorflow_core_protobuf_critical_section_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_critical_section_proto_init() } +func file_tensorflow_core_protobuf_critical_section_proto_init() { + if File_tensorflow_core_protobuf_critical_section_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_critical_section_proto_rawDesc), len(file_tensorflow_core_protobuf_critical_section_proto_rawDesc)), + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_critical_section_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_critical_section_proto_depIdxs, + MessageInfos: file_tensorflow_core_protobuf_critical_section_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_critical_section_proto = out.File + file_tensorflow_core_protobuf_critical_section_proto_goTypes = nil + file_tensorflow_core_protobuf_critical_section_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/debug.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/debug.pb.go new file mode 100644 index 0000000..f6c4cf4 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/debug.pb.go @@ -0,0 +1,410 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/debug.proto + +package for_core_protos_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Option for watching a node in TensorFlow Debugger (tfdbg). +type DebugTensorWatch struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Name of the node to watch. + // Use "*" for wildcard. But note: currently, regex is not supported in + // general. + NodeName string `protobuf:"bytes,1,opt,name=node_name,json=nodeName,proto3" json:"node_name,omitempty"` + // Output slot to watch. + // The semantics of output_slot == -1 is that all outputs of the node + // will be watched (i.e., a wildcard). + // Other negative values of output_slot are invalid and will lead to + // errors currently. + OutputSlot int32 `protobuf:"varint,2,opt,name=output_slot,json=outputSlot,proto3" json:"output_slot,omitempty"` + // Name(s) of the debugging op(s). + // One or more than one probes on a tensor. + // e.g., {"DebugIdentity", "DebugNanCount"} + DebugOps []string `protobuf:"bytes,3,rep,name=debug_ops,json=debugOps,proto3" json:"debug_ops,omitempty"` + // URL(s) for debug targets(s). + // + // Supported URL formats are: + // - file:///foo/tfdbg_dump: Writes out Event content to file + // /foo/tfdbg_dump. Assumes all directories can be created if they don't + // already exist. + // - grpc://localhost:11011: Sends an RPC request to an EventListener + // service running at localhost:11011 with the event. + // - memcbk:///event_key: Routes tensors to clients using the + // callback registered with the DebugCallbackRegistry for event_key. + // + // Each debug op listed in debug_ops will publish its output tensor (debug + // signal) to all URLs in debug_urls. + // + // N.B. Session::Run() supports concurrent invocations of the same inputs + // (feed keys), outputs and target nodes. If such concurrent invocations + // are to be debugged, the callers of Session::Run() must use distinct + // debug_urls to make sure that the streamed or dumped events do not overlap + // among the invocations. + // TODO(cais): More visible documentation of this in g3docs. + DebugUrls []string `protobuf:"bytes,4,rep,name=debug_urls,json=debugUrls,proto3" json:"debug_urls,omitempty"` + // Do not error out if debug op creation fails (e.g., due to dtype + // incompatibility). Instead, just log the failure. + TolerateDebugOpCreationFailures bool `protobuf:"varint,5,opt,name=tolerate_debug_op_creation_failures,json=tolerateDebugOpCreationFailures,proto3" json:"tolerate_debug_op_creation_failures,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DebugTensorWatch) Reset() { + *x = DebugTensorWatch{} + mi := &file_tensorflow_core_protobuf_debug_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DebugTensorWatch) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DebugTensorWatch) ProtoMessage() {} + +func (x *DebugTensorWatch) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_debug_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DebugTensorWatch.ProtoReflect.Descriptor instead. +func (*DebugTensorWatch) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_debug_proto_rawDescGZIP(), []int{0} +} + +func (x *DebugTensorWatch) GetNodeName() string { + if x != nil { + return x.NodeName + } + return "" +} + +func (x *DebugTensorWatch) GetOutputSlot() int32 { + if x != nil { + return x.OutputSlot + } + return 0 +} + +func (x *DebugTensorWatch) GetDebugOps() []string { + if x != nil { + return x.DebugOps + } + return nil +} + +func (x *DebugTensorWatch) GetDebugUrls() []string { + if x != nil { + return x.DebugUrls + } + return nil +} + +func (x *DebugTensorWatch) GetTolerateDebugOpCreationFailures() bool { + if x != nil { + return x.TolerateDebugOpCreationFailures + } + return false +} + +// Options for initializing DebuggerState in TensorFlow Debugger (tfdbg). +type DebugOptions struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Debugging options + DebugTensorWatchOpts []*DebugTensorWatch `protobuf:"bytes,4,rep,name=debug_tensor_watch_opts,json=debugTensorWatchOpts,proto3" json:"debug_tensor_watch_opts,omitempty"` + // Caller-specified global step count. + // Note that this is distinct from the session run count and the executor + // step count. + GlobalStep int64 `protobuf:"varint,10,opt,name=global_step,json=globalStep,proto3" json:"global_step,omitempty"` + // Whether the total disk usage of tfdbg is to be reset to zero + // in this Session.run call. This is used by wrappers and hooks + // such as the local CLI ones to indicate that the dumped tensors + // are cleaned up from the disk after each Session.run. + ResetDiskByteUsage bool `protobuf:"varint,11,opt,name=reset_disk_byte_usage,json=resetDiskByteUsage,proto3" json:"reset_disk_byte_usage,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DebugOptions) Reset() { + *x = DebugOptions{} + mi := &file_tensorflow_core_protobuf_debug_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DebugOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DebugOptions) ProtoMessage() {} + +func (x *DebugOptions) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_debug_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DebugOptions.ProtoReflect.Descriptor instead. +func (*DebugOptions) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_debug_proto_rawDescGZIP(), []int{1} +} + +func (x *DebugOptions) GetDebugTensorWatchOpts() []*DebugTensorWatch { + if x != nil { + return x.DebugTensorWatchOpts + } + return nil +} + +func (x *DebugOptions) GetGlobalStep() int64 { + if x != nil { + return x.GlobalStep + } + return 0 +} + +func (x *DebugOptions) GetResetDiskByteUsage() bool { + if x != nil { + return x.ResetDiskByteUsage + } + return false +} + +type DebuggedSourceFile struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The host name on which a source code file is located. + Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"` + // Path to the source code file. + FilePath string `protobuf:"bytes,2,opt,name=file_path,json=filePath,proto3" json:"file_path,omitempty"` + // The timestamp at which the source code file is last modified. + LastModified int64 `protobuf:"varint,3,opt,name=last_modified,json=lastModified,proto3" json:"last_modified,omitempty"` + // Byte size of the file. + Bytes int64 `protobuf:"varint,4,opt,name=bytes,proto3" json:"bytes,omitempty"` + // Line-by-line content of the source code file. + Lines []string `protobuf:"bytes,5,rep,name=lines,proto3" json:"lines,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DebuggedSourceFile) Reset() { + *x = DebuggedSourceFile{} + mi := &file_tensorflow_core_protobuf_debug_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DebuggedSourceFile) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DebuggedSourceFile) ProtoMessage() {} + +func (x *DebuggedSourceFile) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_debug_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DebuggedSourceFile.ProtoReflect.Descriptor instead. +func (*DebuggedSourceFile) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_debug_proto_rawDescGZIP(), []int{2} +} + +func (x *DebuggedSourceFile) GetHost() string { + if x != nil { + return x.Host + } + return "" +} + +func (x *DebuggedSourceFile) GetFilePath() string { + if x != nil { + return x.FilePath + } + return "" +} + +func (x *DebuggedSourceFile) GetLastModified() int64 { + if x != nil { + return x.LastModified + } + return 0 +} + +func (x *DebuggedSourceFile) GetBytes() int64 { + if x != nil { + return x.Bytes + } + return 0 +} + +func (x *DebuggedSourceFile) GetLines() []string { + if x != nil { + return x.Lines + } + return nil +} + +type DebuggedSourceFiles struct { + state protoimpl.MessageState `protogen:"open.v1"` + // A collection of source code files. + SourceFiles []*DebuggedSourceFile `protobuf:"bytes,1,rep,name=source_files,json=sourceFiles,proto3" json:"source_files,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DebuggedSourceFiles) Reset() { + *x = DebuggedSourceFiles{} + mi := &file_tensorflow_core_protobuf_debug_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DebuggedSourceFiles) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DebuggedSourceFiles) ProtoMessage() {} + +func (x *DebuggedSourceFiles) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_debug_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DebuggedSourceFiles.ProtoReflect.Descriptor instead. +func (*DebuggedSourceFiles) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_debug_proto_rawDescGZIP(), []int{3} +} + +func (x *DebuggedSourceFiles) GetSourceFiles() []*DebuggedSourceFile { + if x != nil { + return x.SourceFiles + } + return nil +} + +var File_tensorflow_core_protobuf_debug_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_debug_proto_rawDesc = "" + + "\n" + + "$tensorflow/core/protobuf/debug.proto\x12\n" + + "tensorflow\"\xda\x01\n" + + "\x10DebugTensorWatch\x12\x1b\n" + + "\tnode_name\x18\x01 \x01(\tR\bnodeName\x12\x1f\n" + + "\voutput_slot\x18\x02 \x01(\x05R\n" + + "outputSlot\x12\x1b\n" + + "\tdebug_ops\x18\x03 \x03(\tR\bdebugOps\x12\x1d\n" + + "\n" + + "debug_urls\x18\x04 \x03(\tR\tdebugUrls\x12L\n" + + "#tolerate_debug_op_creation_failures\x18\x05 \x01(\bR\x1ftolerateDebugOpCreationFailures\"\xb7\x01\n" + + "\fDebugOptions\x12S\n" + + "\x17debug_tensor_watch_opts\x18\x04 \x03(\v2\x1c.tensorflow.DebugTensorWatchR\x14debugTensorWatchOpts\x12\x1f\n" + + "\vglobal_step\x18\n" + + " \x01(\x03R\n" + + "globalStep\x121\n" + + "\x15reset_disk_byte_usage\x18\v \x01(\bR\x12resetDiskByteUsage\"\x96\x01\n" + + "\x12DebuggedSourceFile\x12\x12\n" + + "\x04host\x18\x01 \x01(\tR\x04host\x12\x1b\n" + + "\tfile_path\x18\x02 \x01(\tR\bfilePath\x12#\n" + + "\rlast_modified\x18\x03 \x01(\x03R\flastModified\x12\x14\n" + + "\x05bytes\x18\x04 \x01(\x03R\x05bytes\x12\x14\n" + + "\x05lines\x18\x05 \x03(\tR\x05lines\"X\n" + + "\x13DebuggedSourceFiles\x12A\n" + + "\fsource_files\x18\x01 \x03(\v2\x1e.tensorflow.DebuggedSourceFileR\vsourceFilesB\x83\x01\n" + + "\x18org.tensorflow.frameworkB\vDebugProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_debug_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_debug_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_debug_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_debug_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_debug_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_debug_proto_rawDesc), len(file_tensorflow_core_protobuf_debug_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_debug_proto_rawDescData +} + +var file_tensorflow_core_protobuf_debug_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_tensorflow_core_protobuf_debug_proto_goTypes = []any{ + (*DebugTensorWatch)(nil), // 0: tensorflow.DebugTensorWatch + (*DebugOptions)(nil), // 1: tensorflow.DebugOptions + (*DebuggedSourceFile)(nil), // 2: tensorflow.DebuggedSourceFile + (*DebuggedSourceFiles)(nil), // 3: tensorflow.DebuggedSourceFiles +} +var file_tensorflow_core_protobuf_debug_proto_depIdxs = []int32{ + 0, // 0: tensorflow.DebugOptions.debug_tensor_watch_opts:type_name -> tensorflow.DebugTensorWatch + 2, // 1: tensorflow.DebuggedSourceFiles.source_files:type_name -> tensorflow.DebuggedSourceFile + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_debug_proto_init() } +func file_tensorflow_core_protobuf_debug_proto_init() { + if File_tensorflow_core_protobuf_debug_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_debug_proto_rawDesc), len(file_tensorflow_core_protobuf_debug_proto_rawDesc)), + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_debug_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_debug_proto_depIdxs, + MessageInfos: file_tensorflow_core_protobuf_debug_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_debug_proto = out.File + file_tensorflow_core_protobuf_debug_proto_goTypes = nil + file_tensorflow_core_protobuf_debug_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/debug_event.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/debug_event.pb.go new file mode 100644 index 0000000..6adc6ae --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/debug_event.pb.go @@ -0,0 +1,1282 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/debug_event.proto + +package for_core_protos_go_proto + +import ( + tensor_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Available modes for extracting debugging information from a Tensor. +// TODO(cais): Document the detailed column names and semantics in a separate +// markdown file once the implementation settles. +type TensorDebugMode int32 + +const ( + TensorDebugMode_UNSPECIFIED TensorDebugMode = 0 + // Only records what tensors are computed, eagerly or in graphs. + // No information regarding the value of the tensor is available. + TensorDebugMode_NO_TENSOR TensorDebugMode = 1 + // A minimalist health summary for float-type tensors. + // Contains information only about the presence/absence of pathological + // values including Infinity and NaN. + // Applicable only to float dtypes. + TensorDebugMode_CURT_HEALTH TensorDebugMode = 2 + // A concise health summary for float-type tensors. + // Contains more information that CURT_HEALTH. + // Infinity and NaN are treated differently. + // Applicable only to float and integer dtypes. + TensorDebugMode_CONCISE_HEALTH TensorDebugMode = 3 + // A detailed health summary. + // Contains further detailed information than `CONCISE_HEALTH`. + // Information about device, dtype and shape are included. + // Counts for various types of values (Infinity, NaN, negative, zero, + // positive) are included. + // Applicable to float, integer and boolean dtypes. + TensorDebugMode_FULL_HEALTH TensorDebugMode = 4 + // Provides full runtime shape information, up to a maximum rank, beyond + // which the dimension sizes are truncated. + TensorDebugMode_SHAPE TensorDebugMode = 5 + // Full numeric summary. + // Including device, dtype, shape, counts of various types of values + // (Infinity, NaN, negative, zero, positive), and summary statistics + // (minimum, maximum, mean and variance). + // Applicable to float, integer and boolean dtypes. + TensorDebugMode_FULL_NUMERICS TensorDebugMode = 6 + // Full tensor value. + TensorDebugMode_FULL_TENSOR TensorDebugMode = 7 + // Reduce the elements of a tensor to a rank-1 tensor of shape [3], in which + // - the 1st element is -inf if any element of the tensor is -inf, + // or zero otherwise. + // - the 2nd element is +inf if any element of the tensor is +inf, + // or zero otherwise. + // - the 3rd element is nan if any element of the tensor is nan, or zero + // otherwise. + TensorDebugMode_REDUCE_INF_NAN_THREE_SLOTS TensorDebugMode = 8 +) + +// Enum value maps for TensorDebugMode. +var ( + TensorDebugMode_name = map[int32]string{ + 0: "UNSPECIFIED", + 1: "NO_TENSOR", + 2: "CURT_HEALTH", + 3: "CONCISE_HEALTH", + 4: "FULL_HEALTH", + 5: "SHAPE", + 6: "FULL_NUMERICS", + 7: "FULL_TENSOR", + 8: "REDUCE_INF_NAN_THREE_SLOTS", + } + TensorDebugMode_value = map[string]int32{ + "UNSPECIFIED": 0, + "NO_TENSOR": 1, + "CURT_HEALTH": 2, + "CONCISE_HEALTH": 3, + "FULL_HEALTH": 4, + "SHAPE": 5, + "FULL_NUMERICS": 6, + "FULL_TENSOR": 7, + "REDUCE_INF_NAN_THREE_SLOTS": 8, + } +) + +func (x TensorDebugMode) Enum() *TensorDebugMode { + p := new(TensorDebugMode) + *p = x + return p +} + +func (x TensorDebugMode) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (TensorDebugMode) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_protobuf_debug_event_proto_enumTypes[0].Descriptor() +} + +func (TensorDebugMode) Type() protoreflect.EnumType { + return &file_tensorflow_core_protobuf_debug_event_proto_enumTypes[0] +} + +func (x TensorDebugMode) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use TensorDebugMode.Descriptor instead. +func (TensorDebugMode) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_debug_event_proto_rawDescGZIP(), []int{0} +} + +// An Event related to the debugging of a TensorFlow program. +type DebugEvent struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Timestamp in seconds (with microsecond precision). + WallTime float64 `protobuf:"fixed64,1,opt,name=wall_time,json=wallTime,proto3" json:"wall_time,omitempty"` + // Step of training (if available). + Step int64 `protobuf:"varint,2,opt,name=step,proto3" json:"step,omitempty"` + // Types that are valid to be assigned to What: + // + // *DebugEvent_DebugMetadata + // *DebugEvent_SourceFile + // *DebugEvent_StackFrameWithId + // *DebugEvent_GraphOpCreation + // *DebugEvent_DebuggedGraph + // *DebugEvent_Execution + // *DebugEvent_GraphExecutionTrace + // *DebugEvent_GraphId + // *DebugEvent_DebuggedDevice + What isDebugEvent_What `protobuf_oneof:"what"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DebugEvent) Reset() { + *x = DebugEvent{} + mi := &file_tensorflow_core_protobuf_debug_event_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DebugEvent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DebugEvent) ProtoMessage() {} + +func (x *DebugEvent) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_debug_event_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DebugEvent.ProtoReflect.Descriptor instead. +func (*DebugEvent) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_debug_event_proto_rawDescGZIP(), []int{0} +} + +func (x *DebugEvent) GetWallTime() float64 { + if x != nil { + return x.WallTime + } + return 0 +} + +func (x *DebugEvent) GetStep() int64 { + if x != nil { + return x.Step + } + return 0 +} + +func (x *DebugEvent) GetWhat() isDebugEvent_What { + if x != nil { + return x.What + } + return nil +} + +func (x *DebugEvent) GetDebugMetadata() *DebugMetadata { + if x != nil { + if x, ok := x.What.(*DebugEvent_DebugMetadata); ok { + return x.DebugMetadata + } + } + return nil +} + +func (x *DebugEvent) GetSourceFile() *SourceFile { + if x != nil { + if x, ok := x.What.(*DebugEvent_SourceFile); ok { + return x.SourceFile + } + } + return nil +} + +func (x *DebugEvent) GetStackFrameWithId() *StackFrameWithId { + if x != nil { + if x, ok := x.What.(*DebugEvent_StackFrameWithId); ok { + return x.StackFrameWithId + } + } + return nil +} + +func (x *DebugEvent) GetGraphOpCreation() *GraphOpCreation { + if x != nil { + if x, ok := x.What.(*DebugEvent_GraphOpCreation); ok { + return x.GraphOpCreation + } + } + return nil +} + +func (x *DebugEvent) GetDebuggedGraph() *DebuggedGraph { + if x != nil { + if x, ok := x.What.(*DebugEvent_DebuggedGraph); ok { + return x.DebuggedGraph + } + } + return nil +} + +func (x *DebugEvent) GetExecution() *Execution { + if x != nil { + if x, ok := x.What.(*DebugEvent_Execution); ok { + return x.Execution + } + } + return nil +} + +func (x *DebugEvent) GetGraphExecutionTrace() *GraphExecutionTrace { + if x != nil { + if x, ok := x.What.(*DebugEvent_GraphExecutionTrace); ok { + return x.GraphExecutionTrace + } + } + return nil +} + +func (x *DebugEvent) GetGraphId() string { + if x != nil { + if x, ok := x.What.(*DebugEvent_GraphId); ok { + return x.GraphId + } + } + return "" +} + +func (x *DebugEvent) GetDebuggedDevice() *DebuggedDevice { + if x != nil { + if x, ok := x.What.(*DebugEvent_DebuggedDevice); ok { + return x.DebuggedDevice + } + } + return nil +} + +type isDebugEvent_What interface { + isDebugEvent_What() +} + +type DebugEvent_DebugMetadata struct { + // Metadata related to this debugging data. + DebugMetadata *DebugMetadata `protobuf:"bytes,3,opt,name=debug_metadata,json=debugMetadata,proto3,oneof"` +} + +type DebugEvent_SourceFile struct { + // The content of a source file. + SourceFile *SourceFile `protobuf:"bytes,4,opt,name=source_file,json=sourceFile,proto3,oneof"` +} + +type DebugEvent_StackFrameWithId struct { + // A stack frame (filename, line number and column number, function name and + // code string) with ID. + StackFrameWithId *StackFrameWithId `protobuf:"bytes,6,opt,name=stack_frame_with_id,json=stackFrameWithId,proto3,oneof"` +} + +type DebugEvent_GraphOpCreation struct { + // The creation of an op within a graph (e.g., a FuncGraph compiled from + // a Python function). + GraphOpCreation *GraphOpCreation `protobuf:"bytes,7,opt,name=graph_op_creation,json=graphOpCreation,proto3,oneof"` +} + +type DebugEvent_DebuggedGraph struct { + // Information about a debugged graph. + DebuggedGraph *DebuggedGraph `protobuf:"bytes,8,opt,name=debugged_graph,json=debuggedGraph,proto3,oneof"` +} + +type DebugEvent_Execution struct { + // Execution of an op or a Graph (e.g., a tf.function). + Execution *Execution `protobuf:"bytes,9,opt,name=execution,proto3,oneof"` +} + +type DebugEvent_GraphExecutionTrace struct { + // A graph execution trace: Contains information about the intermediate + // tensors computed during the graph execution. + GraphExecutionTrace *GraphExecutionTrace `protobuf:"bytes,10,opt,name=graph_execution_trace,json=graphExecutionTrace,proto3,oneof"` +} + +type DebugEvent_GraphId struct { + // The ID of the graph (i.e., FuncGraph) executed here: applicable only + // to the execution of a FuncGraph. + GraphId string `protobuf:"bytes,11,opt,name=graph_id,json=graphId,proto3,oneof"` +} + +type DebugEvent_DebuggedDevice struct { + // A device on which debugger-instrumented ops and/or tensors reside. + DebuggedDevice *DebuggedDevice `protobuf:"bytes,12,opt,name=debugged_device,json=debuggedDevice,proto3,oneof"` +} + +func (*DebugEvent_DebugMetadata) isDebugEvent_What() {} + +func (*DebugEvent_SourceFile) isDebugEvent_What() {} + +func (*DebugEvent_StackFrameWithId) isDebugEvent_What() {} + +func (*DebugEvent_GraphOpCreation) isDebugEvent_What() {} + +func (*DebugEvent_DebuggedGraph) isDebugEvent_What() {} + +func (*DebugEvent_Execution) isDebugEvent_What() {} + +func (*DebugEvent_GraphExecutionTrace) isDebugEvent_What() {} + +func (*DebugEvent_GraphId) isDebugEvent_What() {} + +func (*DebugEvent_DebuggedDevice) isDebugEvent_What() {} + +// Metadata about the debugger and the debugged TensorFlow program. +type DebugMetadata struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Version of TensorFlow. + TensorflowVersion string `protobuf:"bytes,1,opt,name=tensorflow_version,json=tensorflowVersion,proto3" json:"tensorflow_version,omitempty"` + // Version of the DebugEvent file format. + // Has a format of "debug.Event:", e.g., "debug.Event:1". + FileVersion string `protobuf:"bytes,2,opt,name=file_version,json=fileVersion,proto3" json:"file_version,omitempty"` + // A unique ID for the current run of tfdbg. + // A run of tfdbg is defined as a TensorFlow job instrumented by tfdbg. + // Multiple hosts in a distributed TensorFlow job instrumented by tfdbg + // have the same ID. + TfdbgRunId string `protobuf:"bytes,3,opt,name=tfdbg_run_id,json=tfdbgRunId,proto3" json:"tfdbg_run_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DebugMetadata) Reset() { + *x = DebugMetadata{} + mi := &file_tensorflow_core_protobuf_debug_event_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DebugMetadata) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DebugMetadata) ProtoMessage() {} + +func (x *DebugMetadata) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_debug_event_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DebugMetadata.ProtoReflect.Descriptor instead. +func (*DebugMetadata) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_debug_event_proto_rawDescGZIP(), []int{1} +} + +func (x *DebugMetadata) GetTensorflowVersion() string { + if x != nil { + return x.TensorflowVersion + } + return "" +} + +func (x *DebugMetadata) GetFileVersion() string { + if x != nil { + return x.FileVersion + } + return "" +} + +func (x *DebugMetadata) GetTfdbgRunId() string { + if x != nil { + return x.TfdbgRunId + } + return "" +} + +// Content of a source file involved in the execution of the debugged TensorFlow +// program. +type SourceFile struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Path to the file. + FilePath string `protobuf:"bytes,1,opt,name=file_path,json=filePath,proto3" json:"file_path,omitempty"` + // Name of the host on which the file is located. + HostName string `protobuf:"bytes,2,opt,name=host_name,json=hostName,proto3" json:"host_name,omitempty"` + // Line-by-line content of the file. + Lines []string `protobuf:"bytes,3,rep,name=lines,proto3" json:"lines,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SourceFile) Reset() { + *x = SourceFile{} + mi := &file_tensorflow_core_protobuf_debug_event_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SourceFile) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SourceFile) ProtoMessage() {} + +func (x *SourceFile) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_debug_event_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SourceFile.ProtoReflect.Descriptor instead. +func (*SourceFile) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_debug_event_proto_rawDescGZIP(), []int{2} +} + +func (x *SourceFile) GetFilePath() string { + if x != nil { + return x.FilePath + } + return "" +} + +func (x *SourceFile) GetHostName() string { + if x != nil { + return x.HostName + } + return "" +} + +func (x *SourceFile) GetLines() []string { + if x != nil { + return x.Lines + } + return nil +} + +// A stack frame with ID. +type StackFrameWithId struct { + state protoimpl.MessageState `protogen:"open.v1"` + // A unique ID for the stack frame: A UUID-like string. + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // Stack frame, i.e., a frame of a stack trace, containing information + // regarding the file name, line number, function name, code content + // of the line, and column number (if available). + FileLineCol *GraphDebugInfo_FileLineCol `protobuf:"bytes,2,opt,name=file_line_col,json=fileLineCol,proto3" json:"file_line_col,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *StackFrameWithId) Reset() { + *x = StackFrameWithId{} + mi := &file_tensorflow_core_protobuf_debug_event_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *StackFrameWithId) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StackFrameWithId) ProtoMessage() {} + +func (x *StackFrameWithId) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_debug_event_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StackFrameWithId.ProtoReflect.Descriptor instead. +func (*StackFrameWithId) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_debug_event_proto_rawDescGZIP(), []int{3} +} + +func (x *StackFrameWithId) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *StackFrameWithId) GetFileLineCol() *GraphDebugInfo_FileLineCol { + if x != nil { + return x.FileLineCol + } + return nil +} + +// Code location information: A stack trace with host-name information. +// Instead of encoding the detailed stack trace, this proto refers to IDs of +// stack frames stored as `StackFrameWithId` protos. +type CodeLocation struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Host name on which the source files are located. + HostName string `protobuf:"bytes,1,opt,name=host_name,json=hostName,proto3" json:"host_name,omitempty"` + // ID to a stack frame, each of which is pointed to + // by a unique ID. The ordering of the frames is consistent with Python's + // `traceback.extract_tb()`. + StackFrameIds []string `protobuf:"bytes,2,rep,name=stack_frame_ids,json=stackFrameIds,proto3" json:"stack_frame_ids,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CodeLocation) Reset() { + *x = CodeLocation{} + mi := &file_tensorflow_core_protobuf_debug_event_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CodeLocation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CodeLocation) ProtoMessage() {} + +func (x *CodeLocation) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_debug_event_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CodeLocation.ProtoReflect.Descriptor instead. +func (*CodeLocation) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_debug_event_proto_rawDescGZIP(), []int{4} +} + +func (x *CodeLocation) GetHostName() string { + if x != nil { + return x.HostName + } + return "" +} + +func (x *CodeLocation) GetStackFrameIds() []string { + if x != nil { + return x.StackFrameIds + } + return nil +} + +// The creation of an op in a TensorFlow Graph (e.g., FuncGraph in TF2). +type GraphOpCreation struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Type of the op (e.g., "MatMul"). + OpType string `protobuf:"bytes,1,opt,name=op_type,json=opType,proto3" json:"op_type,omitempty"` + // Name of the op (e.g., "Dense/MatMul_1"). + OpName string `protobuf:"bytes,2,opt,name=op_name,json=opName,proto3" json:"op_name,omitempty"` + // Name of the graph that the op is a part of (if available). + GraphName string `protobuf:"bytes,3,opt,name=graph_name,json=graphName,proto3" json:"graph_name,omitempty"` + // Unique ID of the graph (generated by debugger). + // This is the ID of the immediately-enclosing graph. + GraphId string `protobuf:"bytes,4,opt,name=graph_id,json=graphId,proto3" json:"graph_id,omitempty"` + // Name of the device that the op is assigned to (if available). + DeviceName string `protobuf:"bytes,5,opt,name=device_name,json=deviceName,proto3" json:"device_name,omitempty"` + // Names of the input tensors to the op. + InputNames []string `protobuf:"bytes,6,rep,name=input_names,json=inputNames,proto3" json:"input_names,omitempty"` + // Number of output tensors emitted by the op. + NumOutputs int32 `protobuf:"varint,7,opt,name=num_outputs,json=numOutputs,proto3" json:"num_outputs,omitempty"` + // The unique ID for code location (stack trace) of the op's creation. + CodeLocation *CodeLocation `protobuf:"bytes,8,opt,name=code_location,json=codeLocation,proto3" json:"code_location,omitempty"` + // Unique IDs for the output tensors of this op. + OutputTensorIds []int32 `protobuf:"varint,9,rep,packed,name=output_tensor_ids,json=outputTensorIds,proto3" json:"output_tensor_ids,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GraphOpCreation) Reset() { + *x = GraphOpCreation{} + mi := &file_tensorflow_core_protobuf_debug_event_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GraphOpCreation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GraphOpCreation) ProtoMessage() {} + +func (x *GraphOpCreation) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_debug_event_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GraphOpCreation.ProtoReflect.Descriptor instead. +func (*GraphOpCreation) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_debug_event_proto_rawDescGZIP(), []int{5} +} + +func (x *GraphOpCreation) GetOpType() string { + if x != nil { + return x.OpType + } + return "" +} + +func (x *GraphOpCreation) GetOpName() string { + if x != nil { + return x.OpName + } + return "" +} + +func (x *GraphOpCreation) GetGraphName() string { + if x != nil { + return x.GraphName + } + return "" +} + +func (x *GraphOpCreation) GetGraphId() string { + if x != nil { + return x.GraphId + } + return "" +} + +func (x *GraphOpCreation) GetDeviceName() string { + if x != nil { + return x.DeviceName + } + return "" +} + +func (x *GraphOpCreation) GetInputNames() []string { + if x != nil { + return x.InputNames + } + return nil +} + +func (x *GraphOpCreation) GetNumOutputs() int32 { + if x != nil { + return x.NumOutputs + } + return 0 +} + +func (x *GraphOpCreation) GetCodeLocation() *CodeLocation { + if x != nil { + return x.CodeLocation + } + return nil +} + +func (x *GraphOpCreation) GetOutputTensorIds() []int32 { + if x != nil { + return x.OutputTensorIds + } + return nil +} + +// A debugger-instrumented graph. +type DebuggedGraph struct { + state protoimpl.MessageState `protogen:"open.v1"` + // An ID for the graph. + // This can be used up to look up graph names. Generated by the debugger. + GraphId string `protobuf:"bytes,1,opt,name=graph_id,json=graphId,proto3" json:"graph_id,omitempty"` + // Name of the graph (if available). + GraphName string `protobuf:"bytes,2,opt,name=graph_name,json=graphName,proto3" json:"graph_name,omitempty"` + // Names of the instrumented ops. This can be used to look up op name + // based on the numeric-summary tensors (2nd column). + InstrumentedOps []string `protobuf:"bytes,3,rep,name=instrumented_ops,json=instrumentedOps,proto3" json:"instrumented_ops,omitempty"` + // Original (uninstrumented) GraphDef (if available). + OriginalGraphDef []byte `protobuf:"bytes,4,opt,name=original_graph_def,json=originalGraphDef,proto3" json:"original_graph_def,omitempty"` + // An encoded version of a GraphDef. + // This graph may include the debugger-inserted ops. + InstrumentedGraphDef []byte `protobuf:"bytes,5,opt,name=instrumented_graph_def,json=instrumentedGraphDef,proto3" json:"instrumented_graph_def,omitempty"` + // IDs of the immediate enclosing context (graph), if any. + OuterContextId string `protobuf:"bytes,6,opt,name=outer_context_id,json=outerContextId,proto3" json:"outer_context_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DebuggedGraph) Reset() { + *x = DebuggedGraph{} + mi := &file_tensorflow_core_protobuf_debug_event_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DebuggedGraph) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DebuggedGraph) ProtoMessage() {} + +func (x *DebuggedGraph) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_debug_event_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DebuggedGraph.ProtoReflect.Descriptor instead. +func (*DebuggedGraph) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_debug_event_proto_rawDescGZIP(), []int{6} +} + +func (x *DebuggedGraph) GetGraphId() string { + if x != nil { + return x.GraphId + } + return "" +} + +func (x *DebuggedGraph) GetGraphName() string { + if x != nil { + return x.GraphName + } + return "" +} + +func (x *DebuggedGraph) GetInstrumentedOps() []string { + if x != nil { + return x.InstrumentedOps + } + return nil +} + +func (x *DebuggedGraph) GetOriginalGraphDef() []byte { + if x != nil { + return x.OriginalGraphDef + } + return nil +} + +func (x *DebuggedGraph) GetInstrumentedGraphDef() []byte { + if x != nil { + return x.InstrumentedGraphDef + } + return nil +} + +func (x *DebuggedGraph) GetOuterContextId() string { + if x != nil { + return x.OuterContextId + } + return "" +} + +// A device on which ops and/or tensors are instrumented by the debugger. +type DebuggedDevice struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Name of the device. + DeviceName string `protobuf:"bytes,1,opt,name=device_name,json=deviceName,proto3" json:"device_name,omitempty"` + // A debugger-generated ID for the device. Guaranteed to be unique within + // the scope of the debugged TensorFlow program, including single-host and + // multi-host settings. + // TODO(cais): Test the uniqueness guarantee in multi-host settings. + DeviceId int32 `protobuf:"varint,2,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DebuggedDevice) Reset() { + *x = DebuggedDevice{} + mi := &file_tensorflow_core_protobuf_debug_event_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DebuggedDevice) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DebuggedDevice) ProtoMessage() {} + +func (x *DebuggedDevice) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_debug_event_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DebuggedDevice.ProtoReflect.Descriptor instead. +func (*DebuggedDevice) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_debug_event_proto_rawDescGZIP(), []int{7} +} + +func (x *DebuggedDevice) GetDeviceName() string { + if x != nil { + return x.DeviceName + } + return "" +} + +func (x *DebuggedDevice) GetDeviceId() int32 { + if x != nil { + return x.DeviceId + } + return 0 +} + +// Data relating to the eager execution of an op or a Graph. +// For a op that generates N output tensors (N >= 0), only one +// Execution proto will be used to describe the execution event. +type Execution struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Op type (e.g., "MatMul"). + // In the case of a Graph, this is the name of the Graph. + OpType string `protobuf:"bytes,1,opt,name=op_type,json=opType,proto3" json:"op_type,omitempty"` + // Number of output tensors. + NumOutputs int32 `protobuf:"varint,2,opt,name=num_outputs,json=numOutputs,proto3" json:"num_outputs,omitempty"` + // The graph that's executed: applicable only to the eager + // execution of a FuncGraph. + GraphId string `protobuf:"bytes,3,opt,name=graph_id,json=graphId,proto3" json:"graph_id,omitempty"` + // IDs of the input tensors (if available). + InputTensorIds []int64 `protobuf:"varint,4,rep,packed,name=input_tensor_ids,json=inputTensorIds,proto3" json:"input_tensor_ids,omitempty"` + // IDs of the output tensors (if availbable). + // If specified, must have the same length as tensor_protos. + OutputTensorIds []int64 `protobuf:"varint,5,rep,packed,name=output_tensor_ids,json=outputTensorIds,proto3" json:"output_tensor_ids,omitempty"` + // Type of the tensor value encapsulated in this proto. + TensorDebugMode TensorDebugMode `protobuf:"varint,6,opt,name=tensor_debug_mode,json=tensorDebugMode,proto3,enum=tensorflow.TensorDebugMode" json:"tensor_debug_mode,omitempty"` + // Output Tensor values in the type described by `tensor_value_type`. + // The length of this should match `num_outputs`. + TensorProtos []*tensor_go_proto.TensorProto `protobuf:"bytes,7,rep,name=tensor_protos,json=tensorProtos,proto3" json:"tensor_protos,omitempty"` + // Stack trace of the eager execution. + CodeLocation *CodeLocation `protobuf:"bytes,8,opt,name=code_location,json=codeLocation,proto3" json:"code_location,omitempty"` + // Debugged-generated IDs of the devices on which the output tensors reside. + // To look up details about the device (e.g., name), cross-reference this + // field with the DebuggedDevice messages. + OutputTensorDeviceIds []int32 `protobuf:"varint,9,rep,packed,name=output_tensor_device_ids,json=outputTensorDeviceIds,proto3" json:"output_tensor_device_ids,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Execution) Reset() { + *x = Execution{} + mi := &file_tensorflow_core_protobuf_debug_event_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Execution) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Execution) ProtoMessage() {} + +func (x *Execution) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_debug_event_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Execution.ProtoReflect.Descriptor instead. +func (*Execution) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_debug_event_proto_rawDescGZIP(), []int{8} +} + +func (x *Execution) GetOpType() string { + if x != nil { + return x.OpType + } + return "" +} + +func (x *Execution) GetNumOutputs() int32 { + if x != nil { + return x.NumOutputs + } + return 0 +} + +func (x *Execution) GetGraphId() string { + if x != nil { + return x.GraphId + } + return "" +} + +func (x *Execution) GetInputTensorIds() []int64 { + if x != nil { + return x.InputTensorIds + } + return nil +} + +func (x *Execution) GetOutputTensorIds() []int64 { + if x != nil { + return x.OutputTensorIds + } + return nil +} + +func (x *Execution) GetTensorDebugMode() TensorDebugMode { + if x != nil { + return x.TensorDebugMode + } + return TensorDebugMode_UNSPECIFIED +} + +func (x *Execution) GetTensorProtos() []*tensor_go_proto.TensorProto { + if x != nil { + return x.TensorProtos + } + return nil +} + +func (x *Execution) GetCodeLocation() *CodeLocation { + if x != nil { + return x.CodeLocation + } + return nil +} + +func (x *Execution) GetOutputTensorDeviceIds() []int32 { + if x != nil { + return x.OutputTensorDeviceIds + } + return nil +} + +// Data relating to an execution of a Graph (e.g., an eager execution of a +// FuncGraph). +// The values of the intermediate tensors computed in the graph are recorded +// in this proto. A graph execution may correspond to one or more pieces of +// `GraphExecutionTrace`, depending on whether the instrumented tensor values +// are summarized in an aggregated or separate fashion. +type GraphExecutionTrace struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Unique ID of the context that the executed op(s) belong to (e.g., a + // compiled concrete tf.function). + TfdbgContextId string `protobuf:"bytes,1,opt,name=tfdbg_context_id,json=tfdbgContextId,proto3" json:"tfdbg_context_id,omitempty"` + // Name of the op (applicable only in the case of the `FULL_TENSOR` trace + // level). + OpName string `protobuf:"bytes,2,opt,name=op_name,json=opName,proto3" json:"op_name,omitempty"` + // Output slot of the tensor (applicable only in the case of the `FULL_TENSOR` + // trace level). + OutputSlot int32 `protobuf:"varint,3,opt,name=output_slot,json=outputSlot,proto3" json:"output_slot,omitempty"` + // Type of the tensor value encapsulated in this proto. + TensorDebugMode TensorDebugMode `protobuf:"varint,4,opt,name=tensor_debug_mode,json=tensorDebugMode,proto3,enum=tensorflow.TensorDebugMode" json:"tensor_debug_mode,omitempty"` + // Tensor value in the type described by `tensor_value_type`. + // This tensor may summarize the value of a single intermediate op of the + // graph, or those of multiple intermediate tensors. + TensorProto *tensor_go_proto.TensorProto `protobuf:"bytes,5,opt,name=tensor_proto,json=tensorProto,proto3" json:"tensor_proto,omitempty"` + // Name of the device that the op belongs to. + DeviceName string `protobuf:"bytes,6,opt,name=device_name,json=deviceName,proto3" json:"device_name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GraphExecutionTrace) Reset() { + *x = GraphExecutionTrace{} + mi := &file_tensorflow_core_protobuf_debug_event_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GraphExecutionTrace) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GraphExecutionTrace) ProtoMessage() {} + +func (x *GraphExecutionTrace) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_debug_event_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GraphExecutionTrace.ProtoReflect.Descriptor instead. +func (*GraphExecutionTrace) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_debug_event_proto_rawDescGZIP(), []int{9} +} + +func (x *GraphExecutionTrace) GetTfdbgContextId() string { + if x != nil { + return x.TfdbgContextId + } + return "" +} + +func (x *GraphExecutionTrace) GetOpName() string { + if x != nil { + return x.OpName + } + return "" +} + +func (x *GraphExecutionTrace) GetOutputSlot() int32 { + if x != nil { + return x.OutputSlot + } + return 0 +} + +func (x *GraphExecutionTrace) GetTensorDebugMode() TensorDebugMode { + if x != nil { + return x.TensorDebugMode + } + return TensorDebugMode_UNSPECIFIED +} + +func (x *GraphExecutionTrace) GetTensorProto() *tensor_go_proto.TensorProto { + if x != nil { + return x.TensorProto + } + return nil +} + +func (x *GraphExecutionTrace) GetDeviceName() string { + if x != nil { + return x.DeviceName + } + return "" +} + +var File_tensorflow_core_protobuf_debug_event_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_debug_event_proto_rawDesc = "" + + "\n" + + "*tensorflow/core/protobuf/debug_event.proto\x12\n" + + "tensorflow\x1a&tensorflow/core/framework/tensor.proto\x1a/tensorflow/core/protobuf/graph_debug_info.proto\"\x94\x05\n" + + "\n" + + "DebugEvent\x12\x1b\n" + + "\twall_time\x18\x01 \x01(\x01R\bwallTime\x12\x12\n" + + "\x04step\x18\x02 \x01(\x03R\x04step\x12B\n" + + "\x0edebug_metadata\x18\x03 \x01(\v2\x19.tensorflow.DebugMetadataH\x00R\rdebugMetadata\x129\n" + + "\vsource_file\x18\x04 \x01(\v2\x16.tensorflow.SourceFileH\x00R\n" + + "sourceFile\x12M\n" + + "\x13stack_frame_with_id\x18\x06 \x01(\v2\x1c.tensorflow.StackFrameWithIdH\x00R\x10stackFrameWithId\x12I\n" + + "\x11graph_op_creation\x18\a \x01(\v2\x1b.tensorflow.GraphOpCreationH\x00R\x0fgraphOpCreation\x12B\n" + + "\x0edebugged_graph\x18\b \x01(\v2\x19.tensorflow.DebuggedGraphH\x00R\rdebuggedGraph\x125\n" + + "\texecution\x18\t \x01(\v2\x15.tensorflow.ExecutionH\x00R\texecution\x12U\n" + + "\x15graph_execution_trace\x18\n" + + " \x01(\v2\x1f.tensorflow.GraphExecutionTraceH\x00R\x13graphExecutionTrace\x12\x1b\n" + + "\bgraph_id\x18\v \x01(\tH\x00R\agraphId\x12E\n" + + "\x0fdebugged_device\x18\f \x01(\v2\x1a.tensorflow.DebuggedDeviceH\x00R\x0edebuggedDeviceB\x06\n" + + "\x04what\"\x83\x01\n" + + "\rDebugMetadata\x12-\n" + + "\x12tensorflow_version\x18\x01 \x01(\tR\x11tensorflowVersion\x12!\n" + + "\ffile_version\x18\x02 \x01(\tR\vfileVersion\x12 \n" + + "\ftfdbg_run_id\x18\x03 \x01(\tR\n" + + "tfdbgRunId\"\\\n" + + "\n" + + "SourceFile\x12\x1b\n" + + "\tfile_path\x18\x01 \x01(\tR\bfilePath\x12\x1b\n" + + "\thost_name\x18\x02 \x01(\tR\bhostName\x12\x14\n" + + "\x05lines\x18\x03 \x03(\tR\x05lines\"n\n" + + "\x10StackFrameWithId\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12J\n" + + "\rfile_line_col\x18\x02 \x01(\v2&.tensorflow.GraphDebugInfo.FileLineColR\vfileLineCol\"S\n" + + "\fCodeLocation\x12\x1b\n" + + "\thost_name\x18\x01 \x01(\tR\bhostName\x12&\n" + + "\x0fstack_frame_ids\x18\x02 \x03(\tR\rstackFrameIds\"\xcb\x02\n" + + "\x0fGraphOpCreation\x12\x17\n" + + "\aop_type\x18\x01 \x01(\tR\x06opType\x12\x17\n" + + "\aop_name\x18\x02 \x01(\tR\x06opName\x12\x1d\n" + + "\n" + + "graph_name\x18\x03 \x01(\tR\tgraphName\x12\x19\n" + + "\bgraph_id\x18\x04 \x01(\tR\agraphId\x12\x1f\n" + + "\vdevice_name\x18\x05 \x01(\tR\n" + + "deviceName\x12\x1f\n" + + "\vinput_names\x18\x06 \x03(\tR\n" + + "inputNames\x12\x1f\n" + + "\vnum_outputs\x18\a \x01(\x05R\n" + + "numOutputs\x12=\n" + + "\rcode_location\x18\b \x01(\v2\x18.tensorflow.CodeLocationR\fcodeLocation\x12*\n" + + "\x11output_tensor_ids\x18\t \x03(\x05R\x0foutputTensorIds\"\x82\x02\n" + + "\rDebuggedGraph\x12\x19\n" + + "\bgraph_id\x18\x01 \x01(\tR\agraphId\x12\x1d\n" + + "\n" + + "graph_name\x18\x02 \x01(\tR\tgraphName\x12)\n" + + "\x10instrumented_ops\x18\x03 \x03(\tR\x0finstrumentedOps\x12,\n" + + "\x12original_graph_def\x18\x04 \x01(\fR\x10originalGraphDef\x124\n" + + "\x16instrumented_graph_def\x18\x05 \x01(\fR\x14instrumentedGraphDef\x12(\n" + + "\x10outer_context_id\x18\x06 \x01(\tR\x0eouterContextId\"N\n" + + "\x0eDebuggedDevice\x12\x1f\n" + + "\vdevice_name\x18\x01 \x01(\tR\n" + + "deviceName\x12\x1b\n" + + "\tdevice_id\x18\x02 \x01(\x05R\bdeviceId\"\xb5\x03\n" + + "\tExecution\x12\x17\n" + + "\aop_type\x18\x01 \x01(\tR\x06opType\x12\x1f\n" + + "\vnum_outputs\x18\x02 \x01(\x05R\n" + + "numOutputs\x12\x19\n" + + "\bgraph_id\x18\x03 \x01(\tR\agraphId\x12(\n" + + "\x10input_tensor_ids\x18\x04 \x03(\x03R\x0einputTensorIds\x12*\n" + + "\x11output_tensor_ids\x18\x05 \x03(\x03R\x0foutputTensorIds\x12G\n" + + "\x11tensor_debug_mode\x18\x06 \x01(\x0e2\x1b.tensorflow.TensorDebugModeR\x0ftensorDebugMode\x12<\n" + + "\rtensor_protos\x18\a \x03(\v2\x17.tensorflow.TensorProtoR\ftensorProtos\x12=\n" + + "\rcode_location\x18\b \x01(\v2\x18.tensorflow.CodeLocationR\fcodeLocation\x127\n" + + "\x18output_tensor_device_ids\x18\t \x03(\x05R\x15outputTensorDeviceIds\"\x9f\x02\n" + + "\x13GraphExecutionTrace\x12(\n" + + "\x10tfdbg_context_id\x18\x01 \x01(\tR\x0etfdbgContextId\x12\x17\n" + + "\aop_name\x18\x02 \x01(\tR\x06opName\x12\x1f\n" + + "\voutput_slot\x18\x03 \x01(\x05R\n" + + "outputSlot\x12G\n" + + "\x11tensor_debug_mode\x18\x04 \x01(\x0e2\x1b.tensorflow.TensorDebugModeR\x0ftensorDebugMode\x12:\n" + + "\ftensor_proto\x18\x05 \x01(\v2\x17.tensorflow.TensorProtoR\vtensorProto\x12\x1f\n" + + "\vdevice_name\x18\x06 \x01(\tR\n" + + "deviceName*\xb6\x01\n" + + "\x0fTensorDebugMode\x12\x0f\n" + + "\vUNSPECIFIED\x10\x00\x12\r\n" + + "\tNO_TENSOR\x10\x01\x12\x0f\n" + + "\vCURT_HEALTH\x10\x02\x12\x12\n" + + "\x0eCONCISE_HEALTH\x10\x03\x12\x0f\n" + + "\vFULL_HEALTH\x10\x04\x12\t\n" + + "\x05SHAPE\x10\x05\x12\x11\n" + + "\rFULL_NUMERICS\x10\x06\x12\x0f\n" + + "\vFULL_TENSOR\x10\a\x12\x1e\n" + + "\x1aREDUCE_INF_NAN_THREE_SLOTS\x10\bB\x83\x01\n" + + "\x13org.tensorflow.utilB\x10DebugEventProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_debug_event_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_debug_event_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_debug_event_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_debug_event_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_debug_event_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_debug_event_proto_rawDesc), len(file_tensorflow_core_protobuf_debug_event_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_debug_event_proto_rawDescData +} + +var file_tensorflow_core_protobuf_debug_event_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_tensorflow_core_protobuf_debug_event_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_tensorflow_core_protobuf_debug_event_proto_goTypes = []any{ + (TensorDebugMode)(0), // 0: tensorflow.TensorDebugMode + (*DebugEvent)(nil), // 1: tensorflow.DebugEvent + (*DebugMetadata)(nil), // 2: tensorflow.DebugMetadata + (*SourceFile)(nil), // 3: tensorflow.SourceFile + (*StackFrameWithId)(nil), // 4: tensorflow.StackFrameWithId + (*CodeLocation)(nil), // 5: tensorflow.CodeLocation + (*GraphOpCreation)(nil), // 6: tensorflow.GraphOpCreation + (*DebuggedGraph)(nil), // 7: tensorflow.DebuggedGraph + (*DebuggedDevice)(nil), // 8: tensorflow.DebuggedDevice + (*Execution)(nil), // 9: tensorflow.Execution + (*GraphExecutionTrace)(nil), // 10: tensorflow.GraphExecutionTrace + (*GraphDebugInfo_FileLineCol)(nil), // 11: tensorflow.GraphDebugInfo.FileLineCol + (*tensor_go_proto.TensorProto)(nil), // 12: tensorflow.TensorProto +} +var file_tensorflow_core_protobuf_debug_event_proto_depIdxs = []int32{ + 2, // 0: tensorflow.DebugEvent.debug_metadata:type_name -> tensorflow.DebugMetadata + 3, // 1: tensorflow.DebugEvent.source_file:type_name -> tensorflow.SourceFile + 4, // 2: tensorflow.DebugEvent.stack_frame_with_id:type_name -> tensorflow.StackFrameWithId + 6, // 3: tensorflow.DebugEvent.graph_op_creation:type_name -> tensorflow.GraphOpCreation + 7, // 4: tensorflow.DebugEvent.debugged_graph:type_name -> tensorflow.DebuggedGraph + 9, // 5: tensorflow.DebugEvent.execution:type_name -> tensorflow.Execution + 10, // 6: tensorflow.DebugEvent.graph_execution_trace:type_name -> tensorflow.GraphExecutionTrace + 8, // 7: tensorflow.DebugEvent.debugged_device:type_name -> tensorflow.DebuggedDevice + 11, // 8: tensorflow.StackFrameWithId.file_line_col:type_name -> tensorflow.GraphDebugInfo.FileLineCol + 5, // 9: tensorflow.GraphOpCreation.code_location:type_name -> tensorflow.CodeLocation + 0, // 10: tensorflow.Execution.tensor_debug_mode:type_name -> tensorflow.TensorDebugMode + 12, // 11: tensorflow.Execution.tensor_protos:type_name -> tensorflow.TensorProto + 5, // 12: tensorflow.Execution.code_location:type_name -> tensorflow.CodeLocation + 0, // 13: tensorflow.GraphExecutionTrace.tensor_debug_mode:type_name -> tensorflow.TensorDebugMode + 12, // 14: tensorflow.GraphExecutionTrace.tensor_proto:type_name -> tensorflow.TensorProto + 15, // [15:15] is the sub-list for method output_type + 15, // [15:15] is the sub-list for method input_type + 15, // [15:15] is the sub-list for extension type_name + 15, // [15:15] is the sub-list for extension extendee + 0, // [0:15] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_debug_event_proto_init() } +func file_tensorflow_core_protobuf_debug_event_proto_init() { + if File_tensorflow_core_protobuf_debug_event_proto != nil { + return + } + file_tensorflow_core_protobuf_graph_debug_info_proto_init() + file_tensorflow_core_protobuf_debug_event_proto_msgTypes[0].OneofWrappers = []any{ + (*DebugEvent_DebugMetadata)(nil), + (*DebugEvent_SourceFile)(nil), + (*DebugEvent_StackFrameWithId)(nil), + (*DebugEvent_GraphOpCreation)(nil), + (*DebugEvent_DebuggedGraph)(nil), + (*DebugEvent_Execution)(nil), + (*DebugEvent_GraphExecutionTrace)(nil), + (*DebugEvent_GraphId)(nil), + (*DebugEvent_DebuggedDevice)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_debug_event_proto_rawDesc), len(file_tensorflow_core_protobuf_debug_event_proto_rawDesc)), + NumEnums: 1, + NumMessages: 10, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_debug_event_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_debug_event_proto_depIdxs, + EnumInfos: file_tensorflow_core_protobuf_debug_event_proto_enumTypes, + MessageInfos: file_tensorflow_core_protobuf_debug_event_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_debug_event_proto = out.File + file_tensorflow_core_protobuf_debug_event_proto_goTypes = nil + file_tensorflow_core_protobuf_debug_event_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/device_filters.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/device_filters.pb.go new file mode 100644 index 0000000..54b448d --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/device_filters.pb.go @@ -0,0 +1,255 @@ +// Copyright 2020 The TensorFlow Authors. All Rights Reserved. +// +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +//============================================================================== + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/device_filters.proto + +package for_core_protos_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Defines the device filters for a remote task. +type TaskDeviceFilters struct { + state protoimpl.MessageState `protogen:"open.v1"` + DeviceFilters []string `protobuf:"bytes,1,rep,name=device_filters,json=deviceFilters,proto3" json:"device_filters,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TaskDeviceFilters) Reset() { + *x = TaskDeviceFilters{} + mi := &file_tensorflow_core_protobuf_device_filters_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TaskDeviceFilters) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TaskDeviceFilters) ProtoMessage() {} + +func (x *TaskDeviceFilters) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_device_filters_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TaskDeviceFilters.ProtoReflect.Descriptor instead. +func (*TaskDeviceFilters) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_device_filters_proto_rawDescGZIP(), []int{0} +} + +func (x *TaskDeviceFilters) GetDeviceFilters() []string { + if x != nil { + return x.DeviceFilters + } + return nil +} + +// Defines the device filters for tasks in a job. +type JobDeviceFilters struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The name of this job. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Mapping from task ID to task device filters. + Tasks map[int32]*TaskDeviceFilters `protobuf:"bytes,2,rep,name=tasks,proto3" json:"tasks,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *JobDeviceFilters) Reset() { + *x = JobDeviceFilters{} + mi := &file_tensorflow_core_protobuf_device_filters_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *JobDeviceFilters) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*JobDeviceFilters) ProtoMessage() {} + +func (x *JobDeviceFilters) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_device_filters_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use JobDeviceFilters.ProtoReflect.Descriptor instead. +func (*JobDeviceFilters) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_device_filters_proto_rawDescGZIP(), []int{1} +} + +func (x *JobDeviceFilters) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *JobDeviceFilters) GetTasks() map[int32]*TaskDeviceFilters { + if x != nil { + return x.Tasks + } + return nil +} + +// Defines the device filters for jobs in a cluster. +type ClusterDeviceFilters struct { + state protoimpl.MessageState `protogen:"open.v1"` + Jobs []*JobDeviceFilters `protobuf:"bytes,1,rep,name=jobs,proto3" json:"jobs,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ClusterDeviceFilters) Reset() { + *x = ClusterDeviceFilters{} + mi := &file_tensorflow_core_protobuf_device_filters_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ClusterDeviceFilters) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ClusterDeviceFilters) ProtoMessage() {} + +func (x *ClusterDeviceFilters) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_device_filters_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ClusterDeviceFilters.ProtoReflect.Descriptor instead. +func (*ClusterDeviceFilters) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_device_filters_proto_rawDescGZIP(), []int{2} +} + +func (x *ClusterDeviceFilters) GetJobs() []*JobDeviceFilters { + if x != nil { + return x.Jobs + } + return nil +} + +var File_tensorflow_core_protobuf_device_filters_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_device_filters_proto_rawDesc = "" + + "\n" + + "-tensorflow/core/protobuf/device_filters.proto\x12\n" + + "tensorflow\":\n" + + "\x11TaskDeviceFilters\x12%\n" + + "\x0edevice_filters\x18\x01 \x03(\tR\rdeviceFilters\"\xbe\x01\n" + + "\x10JobDeviceFilters\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12=\n" + + "\x05tasks\x18\x02 \x03(\v2'.tensorflow.JobDeviceFilters.TasksEntryR\x05tasks\x1aW\n" + + "\n" + + "TasksEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\x05R\x03key\x123\n" + + "\x05value\x18\x02 \x01(\v2\x1d.tensorflow.TaskDeviceFiltersR\x05value:\x028\x01\"H\n" + + "\x14ClusterDeviceFilters\x120\n" + + "\x04jobs\x18\x01 \x03(\v2\x1c.tensorflow.JobDeviceFiltersR\x04jobsB\x8d\x01\n" + + "\x1aorg.tensorflow.distruntimeB\x13DeviceFiltersProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_device_filters_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_device_filters_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_device_filters_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_device_filters_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_device_filters_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_device_filters_proto_rawDesc), len(file_tensorflow_core_protobuf_device_filters_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_device_filters_proto_rawDescData +} + +var file_tensorflow_core_protobuf_device_filters_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_tensorflow_core_protobuf_device_filters_proto_goTypes = []any{ + (*TaskDeviceFilters)(nil), // 0: tensorflow.TaskDeviceFilters + (*JobDeviceFilters)(nil), // 1: tensorflow.JobDeviceFilters + (*ClusterDeviceFilters)(nil), // 2: tensorflow.ClusterDeviceFilters + nil, // 3: tensorflow.JobDeviceFilters.TasksEntry +} +var file_tensorflow_core_protobuf_device_filters_proto_depIdxs = []int32{ + 3, // 0: tensorflow.JobDeviceFilters.tasks:type_name -> tensorflow.JobDeviceFilters.TasksEntry + 1, // 1: tensorflow.ClusterDeviceFilters.jobs:type_name -> tensorflow.JobDeviceFilters + 0, // 2: tensorflow.JobDeviceFilters.TasksEntry.value:type_name -> tensorflow.TaskDeviceFilters + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_device_filters_proto_init() } +func file_tensorflow_core_protobuf_device_filters_proto_init() { + if File_tensorflow_core_protobuf_device_filters_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_device_filters_proto_rawDesc), len(file_tensorflow_core_protobuf_device_filters_proto_rawDesc)), + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_device_filters_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_device_filters_proto_depIdxs, + MessageInfos: file_tensorflow_core_protobuf_device_filters_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_device_filters_proto = out.File + file_tensorflow_core_protobuf_device_filters_proto_goTypes = nil + file_tensorflow_core_protobuf_device_filters_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/device_properties.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/device_properties.pb.go new file mode 100644 index 0000000..f27f9f9 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/device_properties.pb.go @@ -0,0 +1,327 @@ +// Copyright 2017 The TensorFlow Authors. All Rights Reserved. +// +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +//============================================================================== + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/device_properties.proto + +package for_core_protos_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type DeviceProperties struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Device type (CPU, GPU, ...) + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + // Vendor (Intel, nvidia, ...) + Vendor string `protobuf:"bytes,2,opt,name=vendor,proto3" json:"vendor,omitempty"` + // Model (Haswell, K40, ...) + Model string `protobuf:"bytes,3,opt,name=model,proto3" json:"model,omitempty"` + // Core Frequency in Mhz + Frequency int64 `protobuf:"varint,4,opt,name=frequency,proto3" json:"frequency,omitempty"` + // Number of cores + NumCores int64 `protobuf:"varint,5,opt,name=num_cores,json=numCores,proto3" json:"num_cores,omitempty"` + // Version of the tools and libraries used with this device (e.g. gcc 4.9, + // cudnn 5.1) + Environment map[string]string `protobuf:"bytes,6,rep,name=environment,proto3" json:"environment,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // Number of registers per core. + NumRegisters int64 `protobuf:"varint,7,opt,name=num_registers,json=numRegisters,proto3" json:"num_registers,omitempty"` + // L1 cache size in bytes + L1CacheSize int64 `protobuf:"varint,8,opt,name=l1_cache_size,json=l1CacheSize,proto3" json:"l1_cache_size,omitempty"` + // L2 cache size in bytes + L2CacheSize int64 `protobuf:"varint,9,opt,name=l2_cache_size,json=l2CacheSize,proto3" json:"l2_cache_size,omitempty"` + // L3 cache size in bytes + L3CacheSize int64 `protobuf:"varint,10,opt,name=l3_cache_size,json=l3CacheSize,proto3" json:"l3_cache_size,omitempty"` + // Shared memory size per multiprocessor in bytes. This field is + // applicable to GPUs only. + SharedMemorySizePerMultiprocessor int64 `protobuf:"varint,11,opt,name=shared_memory_size_per_multiprocessor,json=sharedMemorySizePerMultiprocessor,proto3" json:"shared_memory_size_per_multiprocessor,omitempty"` + // Memory size in bytes + MemorySize int64 `protobuf:"varint,12,opt,name=memory_size,json=memorySize,proto3" json:"memory_size,omitempty"` + // Memory bandwidth in KB/s + Bandwidth int64 `protobuf:"varint,13,opt,name=bandwidth,proto3" json:"bandwidth,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeviceProperties) Reset() { + *x = DeviceProperties{} + mi := &file_tensorflow_core_protobuf_device_properties_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeviceProperties) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeviceProperties) ProtoMessage() {} + +func (x *DeviceProperties) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_device_properties_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeviceProperties.ProtoReflect.Descriptor instead. +func (*DeviceProperties) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_device_properties_proto_rawDescGZIP(), []int{0} +} + +func (x *DeviceProperties) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *DeviceProperties) GetVendor() string { + if x != nil { + return x.Vendor + } + return "" +} + +func (x *DeviceProperties) GetModel() string { + if x != nil { + return x.Model + } + return "" +} + +func (x *DeviceProperties) GetFrequency() int64 { + if x != nil { + return x.Frequency + } + return 0 +} + +func (x *DeviceProperties) GetNumCores() int64 { + if x != nil { + return x.NumCores + } + return 0 +} + +func (x *DeviceProperties) GetEnvironment() map[string]string { + if x != nil { + return x.Environment + } + return nil +} + +func (x *DeviceProperties) GetNumRegisters() int64 { + if x != nil { + return x.NumRegisters + } + return 0 +} + +func (x *DeviceProperties) GetL1CacheSize() int64 { + if x != nil { + return x.L1CacheSize + } + return 0 +} + +func (x *DeviceProperties) GetL2CacheSize() int64 { + if x != nil { + return x.L2CacheSize + } + return 0 +} + +func (x *DeviceProperties) GetL3CacheSize() int64 { + if x != nil { + return x.L3CacheSize + } + return 0 +} + +func (x *DeviceProperties) GetSharedMemorySizePerMultiprocessor() int64 { + if x != nil { + return x.SharedMemorySizePerMultiprocessor + } + return 0 +} + +func (x *DeviceProperties) GetMemorySize() int64 { + if x != nil { + return x.MemorySize + } + return 0 +} + +func (x *DeviceProperties) GetBandwidth() int64 { + if x != nil { + return x.Bandwidth + } + return 0 +} + +type NamedDevice struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Properties *DeviceProperties `protobuf:"bytes,2,opt,name=properties,proto3" json:"properties,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NamedDevice) Reset() { + *x = NamedDevice{} + mi := &file_tensorflow_core_protobuf_device_properties_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NamedDevice) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NamedDevice) ProtoMessage() {} + +func (x *NamedDevice) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_device_properties_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NamedDevice.ProtoReflect.Descriptor instead. +func (*NamedDevice) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_device_properties_proto_rawDescGZIP(), []int{1} +} + +func (x *NamedDevice) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *NamedDevice) GetProperties() *DeviceProperties { + if x != nil { + return x.Properties + } + return nil +} + +var File_tensorflow_core_protobuf_device_properties_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_device_properties_proto_rawDesc = "" + + "\n" + + "0tensorflow/core/protobuf/device_properties.proto\x12\n" + + "tensorflow\"\xc2\x04\n" + + "\x10DeviceProperties\x12\x12\n" + + "\x04type\x18\x01 \x01(\tR\x04type\x12\x16\n" + + "\x06vendor\x18\x02 \x01(\tR\x06vendor\x12\x14\n" + + "\x05model\x18\x03 \x01(\tR\x05model\x12\x1c\n" + + "\tfrequency\x18\x04 \x01(\x03R\tfrequency\x12\x1b\n" + + "\tnum_cores\x18\x05 \x01(\x03R\bnumCores\x12O\n" + + "\venvironment\x18\x06 \x03(\v2-.tensorflow.DeviceProperties.EnvironmentEntryR\venvironment\x12#\n" + + "\rnum_registers\x18\a \x01(\x03R\fnumRegisters\x12\"\n" + + "\rl1_cache_size\x18\b \x01(\x03R\vl1CacheSize\x12\"\n" + + "\rl2_cache_size\x18\t \x01(\x03R\vl2CacheSize\x12\"\n" + + "\rl3_cache_size\x18\n" + + " \x01(\x03R\vl3CacheSize\x12P\n" + + "%shared_memory_size_per_multiprocessor\x18\v \x01(\x03R!sharedMemorySizePerMultiprocessor\x12\x1f\n" + + "\vmemory_size\x18\f \x01(\x03R\n" + + "memorySize\x12\x1c\n" + + "\tbandwidth\x18\r \x01(\x03R\tbandwidth\x1a>\n" + + "\x10EnvironmentEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"_\n" + + "\vNamedDevice\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12<\n" + + "\n" + + "properties\x18\x02 \x01(\v2\x1c.tensorflow.DevicePropertiesR\n" + + "propertiesBrB\x16DevicePropertiesProtosZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_device_properties_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_device_properties_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_device_properties_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_device_properties_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_device_properties_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_device_properties_proto_rawDesc), len(file_tensorflow_core_protobuf_device_properties_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_device_properties_proto_rawDescData +} + +var file_tensorflow_core_protobuf_device_properties_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_tensorflow_core_protobuf_device_properties_proto_goTypes = []any{ + (*DeviceProperties)(nil), // 0: tensorflow.DeviceProperties + (*NamedDevice)(nil), // 1: tensorflow.NamedDevice + nil, // 2: tensorflow.DeviceProperties.EnvironmentEntry +} +var file_tensorflow_core_protobuf_device_properties_proto_depIdxs = []int32{ + 2, // 0: tensorflow.DeviceProperties.environment:type_name -> tensorflow.DeviceProperties.EnvironmentEntry + 0, // 1: tensorflow.NamedDevice.properties:type_name -> tensorflow.DeviceProperties + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_device_properties_proto_init() } +func file_tensorflow_core_protobuf_device_properties_proto_init() { + if File_tensorflow_core_protobuf_device_properties_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_device_properties_proto_rawDesc), len(file_tensorflow_core_protobuf_device_properties_proto_rawDesc)), + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_device_properties_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_device_properties_proto_depIdxs, + MessageInfos: file_tensorflow_core_protobuf_device_properties_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_device_properties_proto = out.File + file_tensorflow_core_protobuf_device_properties_proto_goTypes = nil + file_tensorflow_core_protobuf_device_properties_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/eager_service.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/eager_service.pb.go new file mode 100644 index 0000000..024e019 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/eager_service.pb.go @@ -0,0 +1,1920 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/eager_service.proto + +package for_core_protos_go_proto + +import ( + attr_value_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/attr_value_go_proto" + device_attributes_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/device_attributes_go_proto" + function_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/function_go_proto" + tensor_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_go_proto" + tensor_shape_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_shape_go_proto" + versions_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/versions_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// A proto representation of an eager operation. +type Operation struct { + state protoimpl.MessageState `protogen:"open.v1"` + // A unique identifier for the operation. Set by the client so that the client + // can uniquely identify the outputs of the scheduled operation. + // + // In the initial implementation, sending duplicate IDs has undefined + // behaviour, but additional constraints may be placed upon this in the + // future. + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + OpInputs []*Operation_Input `protobuf:"bytes,10,rep,name=op_inputs,json=opInputs,proto3" json:"op_inputs,omitempty"` + // Control Operation IDs that will be respected when ops are re-ordered by + // async execution. If async execution (+ op re-ordering) is not enabled, this + // should have no effect. + ControlOpIds []int64 `protobuf:"varint,4,rep,packed,name=control_op_ids,json=controlOpIds,proto3" json:"control_op_ids,omitempty"` + Attrs map[string]*attr_value_go_proto.AttrValue `protobuf:"bytes,5,rep,name=attrs,proto3" json:"attrs,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + Device string `protobuf:"bytes,6,opt,name=device,proto3" json:"device,omitempty"` + // Indicates whether the op is a component of a multi-device function. + IsComponentFunction bool `protobuf:"varint,7,opt,name=is_component_function,json=isComponentFunction,proto3" json:"is_component_function,omitempty"` + // Set when is_component_function is true. It's initially generated + // when we create an FunctionLibraryRuntime::Options (negative value) and used + // to create Rendezvous for function execution. All components of a + // multi-device function should use the same step id to make sure that they + // can communicate through Send/Recv ops. + FuncStepId int64 `protobuf:"varint,8,opt,name=func_step_id,json=funcStepId,proto3" json:"func_step_id,omitempty"` + // Indicates whether the op is a function. + IsFunction bool `protobuf:"varint,9,opt,name=is_function,json=isFunction,proto3" json:"is_function,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Operation) Reset() { + *x = Operation{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Operation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Operation) ProtoMessage() {} + +func (x *Operation) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Operation.ProtoReflect.Descriptor instead. +func (*Operation) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{0} +} + +func (x *Operation) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *Operation) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Operation) GetOpInputs() []*Operation_Input { + if x != nil { + return x.OpInputs + } + return nil +} + +func (x *Operation) GetControlOpIds() []int64 { + if x != nil { + return x.ControlOpIds + } + return nil +} + +func (x *Operation) GetAttrs() map[string]*attr_value_go_proto.AttrValue { + if x != nil { + return x.Attrs + } + return nil +} + +func (x *Operation) GetDevice() string { + if x != nil { + return x.Device + } + return "" +} + +func (x *Operation) GetIsComponentFunction() bool { + if x != nil { + return x.IsComponentFunction + } + return false +} + +func (x *Operation) GetFuncStepId() int64 { + if x != nil { + return x.FuncStepId + } + return 0 +} + +func (x *Operation) GetIsFunction() bool { + if x != nil { + return x.IsFunction + } + return false +} + +type QueueItem struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The remote executor should be able to handle either executing ops directly, + // or releasing any unused tensor handles, since the tensor lifetime is + // maintained by the client. + // + // Types that are valid to be assigned to Item: + // + // *QueueItem_HandleToDecref + // *QueueItem_Operation + // *QueueItem_SendTensor + // *QueueItem_RegisterFunction + // *QueueItem_CleanupFunction + // *QueueItem_SyncRemoteExecutorForStream + // *QueueItem_SendPackedHandle + Item isQueueItem_Item `protobuf_oneof:"item"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *QueueItem) Reset() { + *x = QueueItem{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *QueueItem) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueueItem) ProtoMessage() {} + +func (x *QueueItem) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use QueueItem.ProtoReflect.Descriptor instead. +func (*QueueItem) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{1} +} + +func (x *QueueItem) GetItem() isQueueItem_Item { + if x != nil { + return x.Item + } + return nil +} + +func (x *QueueItem) GetHandleToDecref() *RemoteTensorHandle { + if x != nil { + if x, ok := x.Item.(*QueueItem_HandleToDecref); ok { + return x.HandleToDecref + } + } + return nil +} + +func (x *QueueItem) GetOperation() *Operation { + if x != nil { + if x, ok := x.Item.(*QueueItem_Operation); ok { + return x.Operation + } + } + return nil +} + +func (x *QueueItem) GetSendTensor() *SendTensorOp { + if x != nil { + if x, ok := x.Item.(*QueueItem_SendTensor); ok { + return x.SendTensor + } + } + return nil +} + +func (x *QueueItem) GetRegisterFunction() *RegisterFunctionOp { + if x != nil { + if x, ok := x.Item.(*QueueItem_RegisterFunction); ok { + return x.RegisterFunction + } + } + return nil +} + +func (x *QueueItem) GetCleanupFunction() *CleanupFunctionOp { + if x != nil { + if x, ok := x.Item.(*QueueItem_CleanupFunction); ok { + return x.CleanupFunction + } + } + return nil +} + +func (x *QueueItem) GetSyncRemoteExecutorForStream() *SyncRemoteExecutorForStream { + if x != nil { + if x, ok := x.Item.(*QueueItem_SyncRemoteExecutorForStream); ok { + return x.SyncRemoteExecutorForStream + } + } + return nil +} + +func (x *QueueItem) GetSendPackedHandle() *SendPackedHandleOp { + if x != nil { + if x, ok := x.Item.(*QueueItem_SendPackedHandle); ok { + return x.SendPackedHandle + } + } + return nil +} + +type isQueueItem_Item interface { + isQueueItem_Item() +} + +type QueueItem_HandleToDecref struct { + HandleToDecref *RemoteTensorHandle `protobuf:"bytes,1,opt,name=handle_to_decref,json=handleToDecref,proto3,oneof"` +} + +type QueueItem_Operation struct { + Operation *Operation `protobuf:"bytes,2,opt,name=operation,proto3,oneof"` +} + +type QueueItem_SendTensor struct { + SendTensor *SendTensorOp `protobuf:"bytes,3,opt,name=send_tensor,json=sendTensor,proto3,oneof"` +} + +type QueueItem_RegisterFunction struct { + // Takes a FunctionDef and makes it enqueable on the remote worker. + RegisterFunction *RegisterFunctionOp `protobuf:"bytes,4,opt,name=register_function,json=registerFunction,proto3,oneof"` +} + +type QueueItem_CleanupFunction struct { + CleanupFunction *CleanupFunctionOp `protobuf:"bytes,5,opt,name=cleanup_function,json=cleanupFunction,proto3,oneof"` +} + +type QueueItem_SyncRemoteExecutorForStream struct { + // A remote executor is created to execute ops/functions asynchronously + // enqueued in streaming call. Request with this item type waits for pending + // nodes to finish on the remote executor and report status. + SyncRemoteExecutorForStream *SyncRemoteExecutorForStream `protobuf:"bytes,6,opt,name=sync_remote_executor_for_stream,json=syncRemoteExecutorForStream,proto3,oneof"` +} + +type QueueItem_SendPackedHandle struct { + SendPackedHandle *SendPackedHandleOp `protobuf:"bytes,7,opt,name=send_packed_handle,json=sendPackedHandle,proto3,oneof"` +} + +func (*QueueItem_HandleToDecref) isQueueItem_Item() {} + +func (*QueueItem_Operation) isQueueItem_Item() {} + +func (*QueueItem_SendTensor) isQueueItem_Item() {} + +func (*QueueItem_RegisterFunction) isQueueItem_Item() {} + +func (*QueueItem_CleanupFunction) isQueueItem_Item() {} + +func (*QueueItem_SyncRemoteExecutorForStream) isQueueItem_Item() {} + +func (*QueueItem_SendPackedHandle) isQueueItem_Item() {} + +type QueueResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // `shape` and `tensor` cannot be set in the same response. + // Shapes of output tensors for creating remote TensorHandles. + Shape []*tensor_shape_go_proto.TensorShapeProto `protobuf:"bytes,1,rep,name=shape,proto3" json:"shape,omitempty"` + // Optional. If set, represents the output devices of a function. + Device []string `protobuf:"bytes,3,rep,name=device,proto3" json:"device,omitempty"` + // Output tensors of a remote function. Set when Operation.id is invalid. + Tensor []*tensor_go_proto.TensorProto `protobuf:"bytes,2,rep,name=tensor,proto3" json:"tensor,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *QueueResponse) Reset() { + *x = QueueResponse{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *QueueResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueueResponse) ProtoMessage() {} + +func (x *QueueResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use QueueResponse.ProtoReflect.Descriptor instead. +func (*QueueResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{2} +} + +func (x *QueueResponse) GetShape() []*tensor_shape_go_proto.TensorShapeProto { + if x != nil { + return x.Shape + } + return nil +} + +func (x *QueueResponse) GetDevice() []string { + if x != nil { + return x.Device + } + return nil +} + +func (x *QueueResponse) GetTensor() []*tensor_go_proto.TensorProto { + if x != nil { + return x.Tensor + } + return nil +} + +type CreateContextRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Identifies the full cluster, and this particular worker's position within. + ServerDef *ServerDef `protobuf:"bytes,1,opt,name=server_def,json=serverDef,proto3" json:"server_def,omitempty"` + // Whether the ops on the worker should be executed synchronously or + // asynchronously. By default, ops are executed synchronously. + Async bool `protobuf:"varint,2,opt,name=async,proto3" json:"async,omitempty"` + // Number of seconds to keep the context alive. If more than keep_alive_secs + // has passed since a particular context has been communicated with, it will + // be garbage collected. + KeepAliveSecs int64 `protobuf:"varint,3,opt,name=keep_alive_secs,json=keepAliveSecs,proto3" json:"keep_alive_secs,omitempty"` + // This is the version for all the ops that will be enqueued by the client. + VersionDef *versions_go_proto.VersionDef `protobuf:"bytes,4,opt,name=version_def,json=versionDef,proto3" json:"version_def,omitempty"` + // Device attributes in the cluster + ClusterDeviceAttributes []*device_attributes_go_proto.DeviceAttributes `protobuf:"bytes,6,rep,name=cluster_device_attributes,json=clusterDeviceAttributes,proto3" json:"cluster_device_attributes,omitempty"` + // The ID of the created context. This is usually a randomly generated number, + // that will be used to identify the context in future requests to the + // service. Contexts are not persisted through server restarts. + // This ID will be used for all future communications as well. It is essential + // that both ends use this ID for selecting a rendezvous to get everything to + // match. + ContextId uint64 `protobuf:"fixed64,7,opt,name=context_id,json=contextId,proto3" json:"context_id,omitempty"` + // The view ID of the context. + ContextViewId uint64 `protobuf:"fixed64,8,opt,name=context_view_id,json=contextViewId,proto3" json:"context_view_id,omitempty"` + // For a multi device function, if false, eagerly copy all remote inputs to + // the default function device; if true, lazily copy remote inputs to their + // target devices after function instantiation to avoid redundant copies. + LazyCopyRemoteFunctionInputs bool `protobuf:"varint,9,opt,name=lazy_copy_remote_function_inputs,json=lazyCopyRemoteFunctionInputs,proto3" json:"lazy_copy_remote_function_inputs,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateContextRequest) Reset() { + *x = CreateContextRequest{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateContextRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateContextRequest) ProtoMessage() {} + +func (x *CreateContextRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateContextRequest.ProtoReflect.Descriptor instead. +func (*CreateContextRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{3} +} + +func (x *CreateContextRequest) GetServerDef() *ServerDef { + if x != nil { + return x.ServerDef + } + return nil +} + +func (x *CreateContextRequest) GetAsync() bool { + if x != nil { + return x.Async + } + return false +} + +func (x *CreateContextRequest) GetKeepAliveSecs() int64 { + if x != nil { + return x.KeepAliveSecs + } + return 0 +} + +func (x *CreateContextRequest) GetVersionDef() *versions_go_proto.VersionDef { + if x != nil { + return x.VersionDef + } + return nil +} + +func (x *CreateContextRequest) GetClusterDeviceAttributes() []*device_attributes_go_proto.DeviceAttributes { + if x != nil { + return x.ClusterDeviceAttributes + } + return nil +} + +func (x *CreateContextRequest) GetContextId() uint64 { + if x != nil { + return x.ContextId + } + return 0 +} + +func (x *CreateContextRequest) GetContextViewId() uint64 { + if x != nil { + return x.ContextViewId + } + return 0 +} + +func (x *CreateContextRequest) GetLazyCopyRemoteFunctionInputs() bool { + if x != nil { + return x.LazyCopyRemoteFunctionInputs + } + return false +} + +type CreateContextResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // List of devices that are locally accessible to the worker. + DeviceAttributes []*device_attributes_go_proto.DeviceAttributes `protobuf:"bytes,2,rep,name=device_attributes,json=deviceAttributes,proto3" json:"device_attributes,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateContextResponse) Reset() { + *x = CreateContextResponse{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateContextResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateContextResponse) ProtoMessage() {} + +func (x *CreateContextResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateContextResponse.ProtoReflect.Descriptor instead. +func (*CreateContextResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{4} +} + +func (x *CreateContextResponse) GetDeviceAttributes() []*device_attributes_go_proto.DeviceAttributes { + if x != nil { + return x.DeviceAttributes + } + return nil +} + +type UpdateContextRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Identifies the full cluster, and this particular worker's position within. + ServerDef *ServerDef `protobuf:"bytes,1,opt,name=server_def,json=serverDef,proto3" json:"server_def,omitempty"` + // Device attributes in the cluster. + // If this field is empty, it indicates that this is a simple update request + // that only increments the cluster view ID and does not require changes to + // the workers it connects to. + ClusterDeviceAttributes []*device_attributes_go_proto.DeviceAttributes `protobuf:"bytes,2,rep,name=cluster_device_attributes,json=clusterDeviceAttributes,proto3" json:"cluster_device_attributes,omitempty"` + // The ID of the context to be updated. A context with the specified ID must + // already exist on the recepient server of this request. + ContextId uint64 `protobuf:"fixed64,3,opt,name=context_id,json=contextId,proto3" json:"context_id,omitempty"` + // The view ID of the context, which should be contiguously incremented when + // updating the same context. + ContextViewId uint64 `protobuf:"fixed64,4,opt,name=context_view_id,json=contextViewId,proto3" json:"context_view_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateContextRequest) Reset() { + *x = UpdateContextRequest{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateContextRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateContextRequest) ProtoMessage() {} + +func (x *UpdateContextRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateContextRequest.ProtoReflect.Descriptor instead. +func (*UpdateContextRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{5} +} + +func (x *UpdateContextRequest) GetServerDef() *ServerDef { + if x != nil { + return x.ServerDef + } + return nil +} + +func (x *UpdateContextRequest) GetClusterDeviceAttributes() []*device_attributes_go_proto.DeviceAttributes { + if x != nil { + return x.ClusterDeviceAttributes + } + return nil +} + +func (x *UpdateContextRequest) GetContextId() uint64 { + if x != nil { + return x.ContextId + } + return 0 +} + +func (x *UpdateContextRequest) GetContextViewId() uint64 { + if x != nil { + return x.ContextViewId + } + return 0 +} + +type UpdateContextResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // List of devices that are locally accessible to the worker. + DeviceAttributes []*device_attributes_go_proto.DeviceAttributes `protobuf:"bytes,1,rep,name=device_attributes,json=deviceAttributes,proto3" json:"device_attributes,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateContextResponse) Reset() { + *x = UpdateContextResponse{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateContextResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateContextResponse) ProtoMessage() {} + +func (x *UpdateContextResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateContextResponse.ProtoReflect.Descriptor instead. +func (*UpdateContextResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{6} +} + +func (x *UpdateContextResponse) GetDeviceAttributes() []*device_attributes_go_proto.DeviceAttributes { + if x != nil { + return x.DeviceAttributes + } + return nil +} + +type EnqueueRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ContextId uint64 `protobuf:"fixed64,1,opt,name=context_id,json=contextId,proto3" json:"context_id,omitempty"` + Queue []*QueueItem `protobuf:"bytes,3,rep,name=queue,proto3" json:"queue,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *EnqueueRequest) Reset() { + *x = EnqueueRequest{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *EnqueueRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EnqueueRequest) ProtoMessage() {} + +func (x *EnqueueRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EnqueueRequest.ProtoReflect.Descriptor instead. +func (*EnqueueRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{7} +} + +func (x *EnqueueRequest) GetContextId() uint64 { + if x != nil { + return x.ContextId + } + return 0 +} + +func (x *EnqueueRequest) GetQueue() []*QueueItem { + if x != nil { + return x.Queue + } + return nil +} + +type EnqueueResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // A single operation response for every item in the request. + QueueResponse []*QueueResponse `protobuf:"bytes,1,rep,name=queue_response,json=queueResponse,proto3" json:"queue_response,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *EnqueueResponse) Reset() { + *x = EnqueueResponse{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *EnqueueResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EnqueueResponse) ProtoMessage() {} + +func (x *EnqueueResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EnqueueResponse.ProtoReflect.Descriptor instead. +func (*EnqueueResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{8} +} + +func (x *EnqueueResponse) GetQueueResponse() []*QueueResponse { + if x != nil { + return x.QueueResponse + } + return nil +} + +type WaitQueueDoneRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ContextId uint64 `protobuf:"fixed64,1,opt,name=context_id,json=contextId,proto3" json:"context_id,omitempty"` + // Ids to wait on. If empty, wait on everything currently pending. + OpId []int64 `protobuf:"varint,2,rep,packed,name=op_id,json=opId,proto3" json:"op_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *WaitQueueDoneRequest) Reset() { + *x = WaitQueueDoneRequest{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *WaitQueueDoneRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WaitQueueDoneRequest) ProtoMessage() {} + +func (x *WaitQueueDoneRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WaitQueueDoneRequest.ProtoReflect.Descriptor instead. +func (*WaitQueueDoneRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{9} +} + +func (x *WaitQueueDoneRequest) GetContextId() uint64 { + if x != nil { + return x.ContextId + } + return 0 +} + +func (x *WaitQueueDoneRequest) GetOpId() []int64 { + if x != nil { + return x.OpId + } + return nil +} + +type WaitQueueDoneResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *WaitQueueDoneResponse) Reset() { + *x = WaitQueueDoneResponse{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *WaitQueueDoneResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WaitQueueDoneResponse) ProtoMessage() {} + +func (x *WaitQueueDoneResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WaitQueueDoneResponse.ProtoReflect.Descriptor instead. +func (*WaitQueueDoneResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{10} +} + +type RunComponentFunctionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ContextId uint64 `protobuf:"fixed64,1,opt,name=context_id,json=contextId,proto3" json:"context_id,omitempty"` + Operation *Operation `protobuf:"bytes,2,opt,name=operation,proto3" json:"operation,omitempty"` + // The output indices of its parent function. + OutputNum []int32 `protobuf:"varint,3,rep,packed,name=output_num,json=outputNum,proto3" json:"output_num,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RunComponentFunctionRequest) Reset() { + *x = RunComponentFunctionRequest{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RunComponentFunctionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RunComponentFunctionRequest) ProtoMessage() {} + +func (x *RunComponentFunctionRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RunComponentFunctionRequest.ProtoReflect.Descriptor instead. +func (*RunComponentFunctionRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{11} +} + +func (x *RunComponentFunctionRequest) GetContextId() uint64 { + if x != nil { + return x.ContextId + } + return 0 +} + +func (x *RunComponentFunctionRequest) GetOperation() *Operation { + if x != nil { + return x.Operation + } + return nil +} + +func (x *RunComponentFunctionRequest) GetOutputNum() []int32 { + if x != nil { + return x.OutputNum + } + return nil +} + +type RunComponentFunctionResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Shape []*tensor_shape_go_proto.TensorShapeProto `protobuf:"bytes,1,rep,name=shape,proto3" json:"shape,omitempty"` + Tensor []*tensor_go_proto.TensorProto `protobuf:"bytes,2,rep,name=tensor,proto3" json:"tensor,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RunComponentFunctionResponse) Reset() { + *x = RunComponentFunctionResponse{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RunComponentFunctionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RunComponentFunctionResponse) ProtoMessage() {} + +func (x *RunComponentFunctionResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RunComponentFunctionResponse.ProtoReflect.Descriptor instead. +func (*RunComponentFunctionResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{12} +} + +func (x *RunComponentFunctionResponse) GetShape() []*tensor_shape_go_proto.TensorShapeProto { + if x != nil { + return x.Shape + } + return nil +} + +func (x *RunComponentFunctionResponse) GetTensor() []*tensor_go_proto.TensorProto { + if x != nil { + return x.Tensor + } + return nil +} + +type KeepAliveRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ContextId uint64 `protobuf:"fixed64,1,opt,name=context_id,json=contextId,proto3" json:"context_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KeepAliveRequest) Reset() { + *x = KeepAliveRequest{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KeepAliveRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KeepAliveRequest) ProtoMessage() {} + +func (x *KeepAliveRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[13] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KeepAliveRequest.ProtoReflect.Descriptor instead. +func (*KeepAliveRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{13} +} + +func (x *KeepAliveRequest) GetContextId() uint64 { + if x != nil { + return x.ContextId + } + return 0 +} + +type KeepAliveResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // If the requested context_id is on the remote host, set the context view ID. + ContextViewId uint64 `protobuf:"fixed64,1,opt,name=context_view_id,json=contextViewId,proto3" json:"context_view_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KeepAliveResponse) Reset() { + *x = KeepAliveResponse{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KeepAliveResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KeepAliveResponse) ProtoMessage() {} + +func (x *KeepAliveResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[14] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KeepAliveResponse.ProtoReflect.Descriptor instead. +func (*KeepAliveResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{14} +} + +func (x *KeepAliveResponse) GetContextViewId() uint64 { + if x != nil { + return x.ContextViewId + } + return 0 +} + +type CloseContextRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ContextId uint64 `protobuf:"fixed64,1,opt,name=context_id,json=contextId,proto3" json:"context_id,omitempty"` + ContextViewId uint64 `protobuf:"fixed64,2,opt,name=context_view_id,json=contextViewId,proto3" json:"context_view_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CloseContextRequest) Reset() { + *x = CloseContextRequest{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CloseContextRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CloseContextRequest) ProtoMessage() {} + +func (x *CloseContextRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[15] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CloseContextRequest.ProtoReflect.Descriptor instead. +func (*CloseContextRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{15} +} + +func (x *CloseContextRequest) GetContextId() uint64 { + if x != nil { + return x.ContextId + } + return 0 +} + +func (x *CloseContextRequest) GetContextViewId() uint64 { + if x != nil { + return x.ContextViewId + } + return 0 +} + +type CloseContextResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CloseContextResponse) Reset() { + *x = CloseContextResponse{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CloseContextResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CloseContextResponse) ProtoMessage() {} + +func (x *CloseContextResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[16] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CloseContextResponse.ProtoReflect.Descriptor instead. +func (*CloseContextResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{16} +} + +type RegisterFunctionOp struct { + state protoimpl.MessageState `protogen:"open.v1"` + FunctionDef *function_go_proto.FunctionDef `protobuf:"bytes,1,opt,name=function_def,json=functionDef,proto3" json:"function_def,omitempty"` + // If true, it means that function_def is produced by graph partition during + // multi-device function instantiation. + IsComponentFunction bool `protobuf:"varint,2,opt,name=is_component_function,json=isComponentFunction,proto3" json:"is_component_function,omitempty"` + // All necessary FunctionDefs and GradientDefs to expand `function_def`. + // When is_component_function is true, `function_def` could be a nested + // function, since some nodes in its parent's function body could be + // replaced with a new function by the graph optimization passes. No need to + // add FunctionDefs here to the function cache in EagerContext since they + // won't be executed as KernelAndDevices. + Library *function_go_proto.FunctionDefLibrary `protobuf:"bytes,3,opt,name=library,proto3" json:"library,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RegisterFunctionOp) Reset() { + *x = RegisterFunctionOp{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RegisterFunctionOp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RegisterFunctionOp) ProtoMessage() {} + +func (x *RegisterFunctionOp) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[17] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RegisterFunctionOp.ProtoReflect.Descriptor instead. +func (*RegisterFunctionOp) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{17} +} + +func (x *RegisterFunctionOp) GetFunctionDef() *function_go_proto.FunctionDef { + if x != nil { + return x.FunctionDef + } + return nil +} + +func (x *RegisterFunctionOp) GetIsComponentFunction() bool { + if x != nil { + return x.IsComponentFunction + } + return false +} + +func (x *RegisterFunctionOp) GetLibrary() *function_go_proto.FunctionDefLibrary { + if x != nil { + return x.Library + } + return nil +} + +// Cleanup the step state of a multi-device function (e.g. tensors buffered by +// a `Send` op but not picked up by its corresponding `Recv` op). +type CleanupFunctionOp struct { + state protoimpl.MessageState `protogen:"open.v1"` + StepId int64 `protobuf:"varint,1,opt,name=step_id,json=stepId,proto3" json:"step_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CleanupFunctionOp) Reset() { + *x = CleanupFunctionOp{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CleanupFunctionOp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CleanupFunctionOp) ProtoMessage() {} + +func (x *CleanupFunctionOp) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[18] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CleanupFunctionOp.ProtoReflect.Descriptor instead. +func (*CleanupFunctionOp) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{18} +} + +func (x *CleanupFunctionOp) GetStepId() int64 { + if x != nil { + return x.StepId + } + return 0 +} + +type SyncRemoteExecutorForStream struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SyncRemoteExecutorForStream) Reset() { + *x = SyncRemoteExecutorForStream{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SyncRemoteExecutorForStream) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SyncRemoteExecutorForStream) ProtoMessage() {} + +func (x *SyncRemoteExecutorForStream) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[19] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SyncRemoteExecutorForStream.ProtoReflect.Descriptor instead. +func (*SyncRemoteExecutorForStream) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{19} +} + +type SendTensorOp struct { + state protoimpl.MessageState `protogen:"open.v1"` + // All remote tensors are identified by . To mimic this + // situation when directly sending tensors, we include an "artificial" op ID + // (which would have corresponded to the _Recv op when not using SendTensor). + OpId int64 `protobuf:"varint,1,opt,name=op_id,json=opId,proto3" json:"op_id,omitempty"` + // The index within the repeated field is the output number that will help + // uniquely identify (along with the above op_id) the particular tensor. + Tensors []*tensor_go_proto.TensorProto `protobuf:"bytes,2,rep,name=tensors,proto3" json:"tensors,omitempty"` + // The device on which the tensors should be resident. + DeviceName string `protobuf:"bytes,3,opt,name=device_name,json=deviceName,proto3" json:"device_name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SendTensorOp) Reset() { + *x = SendTensorOp{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SendTensorOp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SendTensorOp) ProtoMessage() {} + +func (x *SendTensorOp) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[20] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SendTensorOp.ProtoReflect.Descriptor instead. +func (*SendTensorOp) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{20} +} + +func (x *SendTensorOp) GetOpId() int64 { + if x != nil { + return x.OpId + } + return 0 +} + +func (x *SendTensorOp) GetTensors() []*tensor_go_proto.TensorProto { + if x != nil { + return x.Tensors + } + return nil +} + +func (x *SendTensorOp) GetDeviceName() string { + if x != nil { + return x.DeviceName + } + return "" +} + +// Send a packed TensorHandle to a remote worker. +type SendPackedHandleOp struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Op id of the remote packed TensorHandle. + OpId int64 `protobuf:"varint,1,opt,name=op_id,json=opId,proto3" json:"op_id,omitempty"` + Handles []*SendPackedHandleOp_Handle `protobuf:"bytes,2,rep,name=handles,proto3" json:"handles,omitempty"` + DeviceName string `protobuf:"bytes,3,opt,name=device_name,json=deviceName,proto3" json:"device_name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SendPackedHandleOp) Reset() { + *x = SendPackedHandleOp{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SendPackedHandleOp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SendPackedHandleOp) ProtoMessage() {} + +func (x *SendPackedHandleOp) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[21] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SendPackedHandleOp.ProtoReflect.Descriptor instead. +func (*SendPackedHandleOp) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{21} +} + +func (x *SendPackedHandleOp) GetOpId() int64 { + if x != nil { + return x.OpId + } + return 0 +} + +func (x *SendPackedHandleOp) GetHandles() []*SendPackedHandleOp_Handle { + if x != nil { + return x.Handles + } + return nil +} + +func (x *SendPackedHandleOp) GetDeviceName() string { + if x != nil { + return x.DeviceName + } + return "" +} + +type Operation_Input struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Item: + // + // *Operation_Input_RemoteHandle + // *Operation_Input_Tensor + Item isOperation_Input_Item `protobuf_oneof:"item"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Operation_Input) Reset() { + *x = Operation_Input{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Operation_Input) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Operation_Input) ProtoMessage() {} + +func (x *Operation_Input) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[22] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Operation_Input.ProtoReflect.Descriptor instead. +func (*Operation_Input) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *Operation_Input) GetItem() isOperation_Input_Item { + if x != nil { + return x.Item + } + return nil +} + +func (x *Operation_Input) GetRemoteHandle() *RemoteTensorHandle { + if x != nil { + if x, ok := x.Item.(*Operation_Input_RemoteHandle); ok { + return x.RemoteHandle + } + } + return nil +} + +func (x *Operation_Input) GetTensor() *tensor_go_proto.TensorProto { + if x != nil { + if x, ok := x.Item.(*Operation_Input_Tensor); ok { + return x.Tensor + } + } + return nil +} + +type isOperation_Input_Item interface { + isOperation_Input_Item() +} + +type Operation_Input_RemoteHandle struct { + RemoteHandle *RemoteTensorHandle `protobuf:"bytes,1,opt,name=remote_handle,json=remoteHandle,proto3,oneof"` +} + +type Operation_Input_Tensor struct { + Tensor *tensor_go_proto.TensorProto `protobuf:"bytes,2,opt,name=tensor,proto3,oneof"` +} + +func (*Operation_Input_RemoteHandle) isOperation_Input_Item() {} + +func (*Operation_Input_Tensor) isOperation_Input_Item() {} + +type SendPackedHandleOp_LocalTensorHandle struct { + state protoimpl.MessageState `protogen:"open.v1"` + Tensor *tensor_go_proto.TensorProto `protobuf:"bytes,1,opt,name=tensor,proto3" json:"tensor,omitempty"` + // Device where the tensor is produced. + Device string `protobuf:"bytes,2,opt,name=device,proto3" json:"device,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SendPackedHandleOp_LocalTensorHandle) Reset() { + *x = SendPackedHandleOp_LocalTensorHandle{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SendPackedHandleOp_LocalTensorHandle) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SendPackedHandleOp_LocalTensorHandle) ProtoMessage() {} + +func (x *SendPackedHandleOp_LocalTensorHandle) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[24] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SendPackedHandleOp_LocalTensorHandle.ProtoReflect.Descriptor instead. +func (*SendPackedHandleOp_LocalTensorHandle) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{21, 0} +} + +func (x *SendPackedHandleOp_LocalTensorHandle) GetTensor() *tensor_go_proto.TensorProto { + if x != nil { + return x.Tensor + } + return nil +} + +func (x *SendPackedHandleOp_LocalTensorHandle) GetDevice() string { + if x != nil { + return x.Device + } + return "" +} + +type SendPackedHandleOp_Handle struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Item: + // + // *SendPackedHandleOp_Handle_LocalHandle + // *SendPackedHandleOp_Handle_RemoteHandle + Item isSendPackedHandleOp_Handle_Item `protobuf_oneof:"item"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SendPackedHandleOp_Handle) Reset() { + *x = SendPackedHandleOp_Handle{} + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SendPackedHandleOp_Handle) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SendPackedHandleOp_Handle) ProtoMessage() {} + +func (x *SendPackedHandleOp_Handle) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_eager_service_proto_msgTypes[25] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SendPackedHandleOp_Handle.ProtoReflect.Descriptor instead. +func (*SendPackedHandleOp_Handle) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP(), []int{21, 1} +} + +func (x *SendPackedHandleOp_Handle) GetItem() isSendPackedHandleOp_Handle_Item { + if x != nil { + return x.Item + } + return nil +} + +func (x *SendPackedHandleOp_Handle) GetLocalHandle() *SendPackedHandleOp_LocalTensorHandle { + if x != nil { + if x, ok := x.Item.(*SendPackedHandleOp_Handle_LocalHandle); ok { + return x.LocalHandle + } + } + return nil +} + +func (x *SendPackedHandleOp_Handle) GetRemoteHandle() *RemoteTensorHandle { + if x != nil { + if x, ok := x.Item.(*SendPackedHandleOp_Handle_RemoteHandle); ok { + return x.RemoteHandle + } + } + return nil +} + +type isSendPackedHandleOp_Handle_Item interface { + isSendPackedHandleOp_Handle_Item() +} + +type SendPackedHandleOp_Handle_LocalHandle struct { + LocalHandle *SendPackedHandleOp_LocalTensorHandle `protobuf:"bytes,1,opt,name=local_handle,json=localHandle,proto3,oneof"` +} + +type SendPackedHandleOp_Handle_RemoteHandle struct { + RemoteHandle *RemoteTensorHandle `protobuf:"bytes,2,opt,name=remote_handle,json=remoteHandle,proto3,oneof"` +} + +func (*SendPackedHandleOp_Handle_LocalHandle) isSendPackedHandleOp_Handle_Item() {} + +func (*SendPackedHandleOp_Handle_RemoteHandle) isSendPackedHandleOp_Handle_Item() {} + +var File_tensorflow_core_protobuf_eager_service_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_eager_service_proto_rawDesc = "" + + "\n" + + ",tensorflow/core/protobuf/eager_service.proto\x12\x10tensorflow.eager\x1a*tensorflow/core/framework/attr_value.proto\x1a1tensorflow/core/framework/device_attributes.proto\x1a(tensorflow/core/framework/function.proto\x1a&tensorflow/core/framework/tensor.proto\x1a,tensorflow/core/framework/tensor_shape.proto\x1a(tensorflow/core/framework/versions.proto\x1a3tensorflow/core/protobuf/remote_tensor_handle.proto\x1a0tensorflow/core/protobuf/tensorflow_server.proto\"\xcb\x04\n" + + "\tOperation\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x03R\x02id\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x12>\n" + + "\top_inputs\x18\n" + + " \x03(\v2!.tensorflow.eager.Operation.InputR\bopInputs\x12$\n" + + "\x0econtrol_op_ids\x18\x04 \x03(\x03R\fcontrolOpIds\x12<\n" + + "\x05attrs\x18\x05 \x03(\v2&.tensorflow.eager.Operation.AttrsEntryR\x05attrs\x12\x16\n" + + "\x06device\x18\x06 \x01(\tR\x06device\x122\n" + + "\x15is_component_function\x18\a \x01(\bR\x13isComponentFunction\x12 \n" + + "\ffunc_step_id\x18\b \x01(\x03R\n" + + "funcStepId\x12\x1f\n" + + "\vis_function\x18\t \x01(\bR\n" + + "isFunction\x1a\x8f\x01\n" + + "\x05Input\x12K\n" + + "\rremote_handle\x18\x01 \x01(\v2$.tensorflow.eager.RemoteTensorHandleH\x00R\fremoteHandle\x121\n" + + "\x06tensor\x18\x02 \x01(\v2\x17.tensorflow.TensorProtoH\x00R\x06tensorB\x06\n" + + "\x04item\x1aO\n" + + "\n" + + "AttrsEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12+\n" + + "\x05value\x18\x02 \x01(\v2\x15.tensorflow.AttrValueR\x05value:\x028\x01J\x04\b\x03\x10\x04\"\xd9\x04\n" + + "\tQueueItem\x12P\n" + + "\x10handle_to_decref\x18\x01 \x01(\v2$.tensorflow.eager.RemoteTensorHandleH\x00R\x0ehandleToDecref\x12;\n" + + "\toperation\x18\x02 \x01(\v2\x1b.tensorflow.eager.OperationH\x00R\toperation\x12A\n" + + "\vsend_tensor\x18\x03 \x01(\v2\x1e.tensorflow.eager.SendTensorOpH\x00R\n" + + "sendTensor\x12S\n" + + "\x11register_function\x18\x04 \x01(\v2$.tensorflow.eager.RegisterFunctionOpH\x00R\x10registerFunction\x12P\n" + + "\x10cleanup_function\x18\x05 \x01(\v2#.tensorflow.eager.CleanupFunctionOpH\x00R\x0fcleanupFunction\x12u\n" + + "\x1fsync_remote_executor_for_stream\x18\x06 \x01(\v2-.tensorflow.eager.SyncRemoteExecutorForStreamH\x00R\x1bsyncRemoteExecutorForStream\x12T\n" + + "\x12send_packed_handle\x18\a \x01(\v2$.tensorflow.eager.SendPackedHandleOpH\x00R\x10sendPackedHandleB\x06\n" + + "\x04item\"\x8c\x01\n" + + "\rQueueResponse\x122\n" + + "\x05shape\x18\x01 \x03(\v2\x1c.tensorflow.TensorShapeProtoR\x05shape\x12\x16\n" + + "\x06device\x18\x03 \x03(\tR\x06device\x12/\n" + + "\x06tensor\x18\x02 \x03(\v2\x17.tensorflow.TensorProtoR\x06tensor\"\xb2\x03\n" + + "\x14CreateContextRequest\x124\n" + + "\n" + + "server_def\x18\x01 \x01(\v2\x15.tensorflow.ServerDefR\tserverDef\x12\x14\n" + + "\x05async\x18\x02 \x01(\bR\x05async\x12&\n" + + "\x0fkeep_alive_secs\x18\x03 \x01(\x03R\rkeepAliveSecs\x127\n" + + "\vversion_def\x18\x04 \x01(\v2\x16.tensorflow.VersionDefR\n" + + "versionDef\x12X\n" + + "\x19cluster_device_attributes\x18\x06 \x03(\v2\x1c.tensorflow.DeviceAttributesR\x17clusterDeviceAttributes\x12\x1d\n" + + "\n" + + "context_id\x18\a \x01(\x06R\tcontextId\x12&\n" + + "\x0fcontext_view_id\x18\b \x01(\x06R\rcontextViewId\x12F\n" + + " lazy_copy_remote_function_inputs\x18\t \x01(\bR\x1clazyCopyRemoteFunctionInputsJ\x04\b\x05\x10\x06\"h\n" + + "\x15CreateContextResponse\x12I\n" + + "\x11device_attributes\x18\x02 \x03(\v2\x1c.tensorflow.DeviceAttributesR\x10deviceAttributesJ\x04\b\x01\x10\x02\"\xed\x01\n" + + "\x14UpdateContextRequest\x124\n" + + "\n" + + "server_def\x18\x01 \x01(\v2\x15.tensorflow.ServerDefR\tserverDef\x12X\n" + + "\x19cluster_device_attributes\x18\x02 \x03(\v2\x1c.tensorflow.DeviceAttributesR\x17clusterDeviceAttributes\x12\x1d\n" + + "\n" + + "context_id\x18\x03 \x01(\x06R\tcontextId\x12&\n" + + "\x0fcontext_view_id\x18\x04 \x01(\x06R\rcontextViewId\"b\n" + + "\x15UpdateContextResponse\x12I\n" + + "\x11device_attributes\x18\x01 \x03(\v2\x1c.tensorflow.DeviceAttributesR\x10deviceAttributes\"b\n" + + "\x0eEnqueueRequest\x12\x1d\n" + + "\n" + + "context_id\x18\x01 \x01(\x06R\tcontextId\x121\n" + + "\x05queue\x18\x03 \x03(\v2\x1b.tensorflow.eager.QueueItemR\x05queue\"Y\n" + + "\x0fEnqueueResponse\x12F\n" + + "\x0equeue_response\x18\x01 \x03(\v2\x1f.tensorflow.eager.QueueResponseR\rqueueResponse\"J\n" + + "\x14WaitQueueDoneRequest\x12\x1d\n" + + "\n" + + "context_id\x18\x01 \x01(\x06R\tcontextId\x12\x13\n" + + "\x05op_id\x18\x02 \x03(\x03R\x04opId\"\x17\n" + + "\x15WaitQueueDoneResponse\"\x96\x01\n" + + "\x1bRunComponentFunctionRequest\x12\x1d\n" + + "\n" + + "context_id\x18\x01 \x01(\x06R\tcontextId\x129\n" + + "\toperation\x18\x02 \x01(\v2\x1b.tensorflow.eager.OperationR\toperation\x12\x1d\n" + + "\n" + + "output_num\x18\x03 \x03(\x05R\toutputNum\"\x83\x01\n" + + "\x1cRunComponentFunctionResponse\x122\n" + + "\x05shape\x18\x01 \x03(\v2\x1c.tensorflow.TensorShapeProtoR\x05shape\x12/\n" + + "\x06tensor\x18\x02 \x03(\v2\x17.tensorflow.TensorProtoR\x06tensor\"1\n" + + "\x10KeepAliveRequest\x12\x1d\n" + + "\n" + + "context_id\x18\x01 \x01(\x06R\tcontextId\";\n" + + "\x11KeepAliveResponse\x12&\n" + + "\x0fcontext_view_id\x18\x01 \x01(\x06R\rcontextViewId\"\\\n" + + "\x13CloseContextRequest\x12\x1d\n" + + "\n" + + "context_id\x18\x01 \x01(\x06R\tcontextId\x12&\n" + + "\x0fcontext_view_id\x18\x02 \x01(\x06R\rcontextViewId\"\x16\n" + + "\x14CloseContextResponse\"\xbe\x01\n" + + "\x12RegisterFunctionOp\x12:\n" + + "\ffunction_def\x18\x01 \x01(\v2\x17.tensorflow.FunctionDefR\vfunctionDef\x122\n" + + "\x15is_component_function\x18\x02 \x01(\bR\x13isComponentFunction\x128\n" + + "\alibrary\x18\x03 \x01(\v2\x1e.tensorflow.FunctionDefLibraryR\alibrary\",\n" + + "\x11CleanupFunctionOp\x12\x17\n" + + "\astep_id\x18\x01 \x01(\x03R\x06stepId\"\x1d\n" + + "\x1bSyncRemoteExecutorForStream\"w\n" + + "\fSendTensorOp\x12\x13\n" + + "\x05op_id\x18\x01 \x01(\x03R\x04opId\x121\n" + + "\atensors\x18\x02 \x03(\v2\x17.tensorflow.TensorProtoR\atensors\x12\x1f\n" + + "\vdevice_name\x18\x03 \x01(\tR\n" + + "deviceName\"\xac\x03\n" + + "\x12SendPackedHandleOp\x12\x13\n" + + "\x05op_id\x18\x01 \x01(\x03R\x04opId\x12E\n" + + "\ahandles\x18\x02 \x03(\v2+.tensorflow.eager.SendPackedHandleOp.HandleR\ahandles\x12\x1f\n" + + "\vdevice_name\x18\x03 \x01(\tR\n" + + "deviceName\x1a\\\n" + + "\x11LocalTensorHandle\x12/\n" + + "\x06tensor\x18\x01 \x01(\v2\x17.tensorflow.TensorProtoR\x06tensor\x12\x16\n" + + "\x06device\x18\x02 \x01(\tR\x06device\x1a\xba\x01\n" + + "\x06Handle\x12[\n" + + "\flocal_handle\x18\x01 \x01(\v26.tensorflow.eager.SendPackedHandleOp.LocalTensorHandleH\x00R\vlocalHandle\x12K\n" + + "\rremote_handle\x18\x02 \x01(\v2$.tensorflow.eager.RemoteTensorHandleH\x00R\fremoteHandleB\x06\n" + + "\x04item2\x8d\x06\n" + + "\fEagerService\x12`\n" + + "\rCreateContext\x12&.tensorflow.eager.CreateContextRequest\x1a'.tensorflow.eager.CreateContextResponse\x12`\n" + + "\rUpdateContext\x12&.tensorflow.eager.UpdateContextRequest\x1a'.tensorflow.eager.UpdateContextResponse\x12N\n" + + "\aEnqueue\x12 .tensorflow.eager.EnqueueRequest\x1a!.tensorflow.eager.EnqueueResponse\x12[\n" + + "\x10StreamingEnqueue\x12 .tensorflow.eager.EnqueueRequest\x1a!.tensorflow.eager.EnqueueResponse(\x010\x01\x12`\n" + + "\rWaitQueueDone\x12&.tensorflow.eager.WaitQueueDoneRequest\x1a'.tensorflow.eager.WaitQueueDoneResponse\x12u\n" + + "\x14RunComponentFunction\x12-.tensorflow.eager.RunComponentFunctionRequest\x1a..tensorflow.eager.RunComponentFunctionResponse\x12T\n" + + "\tKeepAlive\x12\".tensorflow.eager.KeepAliveRequest\x1a#.tensorflow.eager.KeepAliveResponse\x12]\n" + + "\fCloseContext\x12%.tensorflow.eager.CloseContextRequest\x1a&.tensorflow.eager.CloseContextResponseBWZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_protob\x06proto3" + +var ( + file_tensorflow_core_protobuf_eager_service_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_eager_service_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_eager_service_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_eager_service_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_eager_service_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_eager_service_proto_rawDesc), len(file_tensorflow_core_protobuf_eager_service_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_eager_service_proto_rawDescData +} + +var file_tensorflow_core_protobuf_eager_service_proto_msgTypes = make([]protoimpl.MessageInfo, 26) +var file_tensorflow_core_protobuf_eager_service_proto_goTypes = []any{ + (*Operation)(nil), // 0: tensorflow.eager.Operation + (*QueueItem)(nil), // 1: tensorflow.eager.QueueItem + (*QueueResponse)(nil), // 2: tensorflow.eager.QueueResponse + (*CreateContextRequest)(nil), // 3: tensorflow.eager.CreateContextRequest + (*CreateContextResponse)(nil), // 4: tensorflow.eager.CreateContextResponse + (*UpdateContextRequest)(nil), // 5: tensorflow.eager.UpdateContextRequest + (*UpdateContextResponse)(nil), // 6: tensorflow.eager.UpdateContextResponse + (*EnqueueRequest)(nil), // 7: tensorflow.eager.EnqueueRequest + (*EnqueueResponse)(nil), // 8: tensorflow.eager.EnqueueResponse + (*WaitQueueDoneRequest)(nil), // 9: tensorflow.eager.WaitQueueDoneRequest + (*WaitQueueDoneResponse)(nil), // 10: tensorflow.eager.WaitQueueDoneResponse + (*RunComponentFunctionRequest)(nil), // 11: tensorflow.eager.RunComponentFunctionRequest + (*RunComponentFunctionResponse)(nil), // 12: tensorflow.eager.RunComponentFunctionResponse + (*KeepAliveRequest)(nil), // 13: tensorflow.eager.KeepAliveRequest + (*KeepAliveResponse)(nil), // 14: tensorflow.eager.KeepAliveResponse + (*CloseContextRequest)(nil), // 15: tensorflow.eager.CloseContextRequest + (*CloseContextResponse)(nil), // 16: tensorflow.eager.CloseContextResponse + (*RegisterFunctionOp)(nil), // 17: tensorflow.eager.RegisterFunctionOp + (*CleanupFunctionOp)(nil), // 18: tensorflow.eager.CleanupFunctionOp + (*SyncRemoteExecutorForStream)(nil), // 19: tensorflow.eager.SyncRemoteExecutorForStream + (*SendTensorOp)(nil), // 20: tensorflow.eager.SendTensorOp + (*SendPackedHandleOp)(nil), // 21: tensorflow.eager.SendPackedHandleOp + (*Operation_Input)(nil), // 22: tensorflow.eager.Operation.Input + nil, // 23: tensorflow.eager.Operation.AttrsEntry + (*SendPackedHandleOp_LocalTensorHandle)(nil), // 24: tensorflow.eager.SendPackedHandleOp.LocalTensorHandle + (*SendPackedHandleOp_Handle)(nil), // 25: tensorflow.eager.SendPackedHandleOp.Handle + (*RemoteTensorHandle)(nil), // 26: tensorflow.eager.RemoteTensorHandle + (*tensor_shape_go_proto.TensorShapeProto)(nil), // 27: tensorflow.TensorShapeProto + (*tensor_go_proto.TensorProto)(nil), // 28: tensorflow.TensorProto + (*ServerDef)(nil), // 29: tensorflow.ServerDef + (*versions_go_proto.VersionDef)(nil), // 30: tensorflow.VersionDef + (*device_attributes_go_proto.DeviceAttributes)(nil), // 31: tensorflow.DeviceAttributes + (*function_go_proto.FunctionDef)(nil), // 32: tensorflow.FunctionDef + (*function_go_proto.FunctionDefLibrary)(nil), // 33: tensorflow.FunctionDefLibrary + (*attr_value_go_proto.AttrValue)(nil), // 34: tensorflow.AttrValue +} +var file_tensorflow_core_protobuf_eager_service_proto_depIdxs = []int32{ + 22, // 0: tensorflow.eager.Operation.op_inputs:type_name -> tensorflow.eager.Operation.Input + 23, // 1: tensorflow.eager.Operation.attrs:type_name -> tensorflow.eager.Operation.AttrsEntry + 26, // 2: tensorflow.eager.QueueItem.handle_to_decref:type_name -> tensorflow.eager.RemoteTensorHandle + 0, // 3: tensorflow.eager.QueueItem.operation:type_name -> tensorflow.eager.Operation + 20, // 4: tensorflow.eager.QueueItem.send_tensor:type_name -> tensorflow.eager.SendTensorOp + 17, // 5: tensorflow.eager.QueueItem.register_function:type_name -> tensorflow.eager.RegisterFunctionOp + 18, // 6: tensorflow.eager.QueueItem.cleanup_function:type_name -> tensorflow.eager.CleanupFunctionOp + 19, // 7: tensorflow.eager.QueueItem.sync_remote_executor_for_stream:type_name -> tensorflow.eager.SyncRemoteExecutorForStream + 21, // 8: tensorflow.eager.QueueItem.send_packed_handle:type_name -> tensorflow.eager.SendPackedHandleOp + 27, // 9: tensorflow.eager.QueueResponse.shape:type_name -> tensorflow.TensorShapeProto + 28, // 10: tensorflow.eager.QueueResponse.tensor:type_name -> tensorflow.TensorProto + 29, // 11: tensorflow.eager.CreateContextRequest.server_def:type_name -> tensorflow.ServerDef + 30, // 12: tensorflow.eager.CreateContextRequest.version_def:type_name -> tensorflow.VersionDef + 31, // 13: tensorflow.eager.CreateContextRequest.cluster_device_attributes:type_name -> tensorflow.DeviceAttributes + 31, // 14: tensorflow.eager.CreateContextResponse.device_attributes:type_name -> tensorflow.DeviceAttributes + 29, // 15: tensorflow.eager.UpdateContextRequest.server_def:type_name -> tensorflow.ServerDef + 31, // 16: tensorflow.eager.UpdateContextRequest.cluster_device_attributes:type_name -> tensorflow.DeviceAttributes + 31, // 17: tensorflow.eager.UpdateContextResponse.device_attributes:type_name -> tensorflow.DeviceAttributes + 1, // 18: tensorflow.eager.EnqueueRequest.queue:type_name -> tensorflow.eager.QueueItem + 2, // 19: tensorflow.eager.EnqueueResponse.queue_response:type_name -> tensorflow.eager.QueueResponse + 0, // 20: tensorflow.eager.RunComponentFunctionRequest.operation:type_name -> tensorflow.eager.Operation + 27, // 21: tensorflow.eager.RunComponentFunctionResponse.shape:type_name -> tensorflow.TensorShapeProto + 28, // 22: tensorflow.eager.RunComponentFunctionResponse.tensor:type_name -> tensorflow.TensorProto + 32, // 23: tensorflow.eager.RegisterFunctionOp.function_def:type_name -> tensorflow.FunctionDef + 33, // 24: tensorflow.eager.RegisterFunctionOp.library:type_name -> tensorflow.FunctionDefLibrary + 28, // 25: tensorflow.eager.SendTensorOp.tensors:type_name -> tensorflow.TensorProto + 25, // 26: tensorflow.eager.SendPackedHandleOp.handles:type_name -> tensorflow.eager.SendPackedHandleOp.Handle + 26, // 27: tensorflow.eager.Operation.Input.remote_handle:type_name -> tensorflow.eager.RemoteTensorHandle + 28, // 28: tensorflow.eager.Operation.Input.tensor:type_name -> tensorflow.TensorProto + 34, // 29: tensorflow.eager.Operation.AttrsEntry.value:type_name -> tensorflow.AttrValue + 28, // 30: tensorflow.eager.SendPackedHandleOp.LocalTensorHandle.tensor:type_name -> tensorflow.TensorProto + 24, // 31: tensorflow.eager.SendPackedHandleOp.Handle.local_handle:type_name -> tensorflow.eager.SendPackedHandleOp.LocalTensorHandle + 26, // 32: tensorflow.eager.SendPackedHandleOp.Handle.remote_handle:type_name -> tensorflow.eager.RemoteTensorHandle + 3, // 33: tensorflow.eager.EagerService.CreateContext:input_type -> tensorflow.eager.CreateContextRequest + 5, // 34: tensorflow.eager.EagerService.UpdateContext:input_type -> tensorflow.eager.UpdateContextRequest + 7, // 35: tensorflow.eager.EagerService.Enqueue:input_type -> tensorflow.eager.EnqueueRequest + 7, // 36: tensorflow.eager.EagerService.StreamingEnqueue:input_type -> tensorflow.eager.EnqueueRequest + 9, // 37: tensorflow.eager.EagerService.WaitQueueDone:input_type -> tensorflow.eager.WaitQueueDoneRequest + 11, // 38: tensorflow.eager.EagerService.RunComponentFunction:input_type -> tensorflow.eager.RunComponentFunctionRequest + 13, // 39: tensorflow.eager.EagerService.KeepAlive:input_type -> tensorflow.eager.KeepAliveRequest + 15, // 40: tensorflow.eager.EagerService.CloseContext:input_type -> tensorflow.eager.CloseContextRequest + 4, // 41: tensorflow.eager.EagerService.CreateContext:output_type -> tensorflow.eager.CreateContextResponse + 6, // 42: tensorflow.eager.EagerService.UpdateContext:output_type -> tensorflow.eager.UpdateContextResponse + 8, // 43: tensorflow.eager.EagerService.Enqueue:output_type -> tensorflow.eager.EnqueueResponse + 8, // 44: tensorflow.eager.EagerService.StreamingEnqueue:output_type -> tensorflow.eager.EnqueueResponse + 10, // 45: tensorflow.eager.EagerService.WaitQueueDone:output_type -> tensorflow.eager.WaitQueueDoneResponse + 12, // 46: tensorflow.eager.EagerService.RunComponentFunction:output_type -> tensorflow.eager.RunComponentFunctionResponse + 14, // 47: tensorflow.eager.EagerService.KeepAlive:output_type -> tensorflow.eager.KeepAliveResponse + 16, // 48: tensorflow.eager.EagerService.CloseContext:output_type -> tensorflow.eager.CloseContextResponse + 41, // [41:49] is the sub-list for method output_type + 33, // [33:41] is the sub-list for method input_type + 33, // [33:33] is the sub-list for extension type_name + 33, // [33:33] is the sub-list for extension extendee + 0, // [0:33] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_eager_service_proto_init() } +func file_tensorflow_core_protobuf_eager_service_proto_init() { + if File_tensorflow_core_protobuf_eager_service_proto != nil { + return + } + file_tensorflow_core_protobuf_remote_tensor_handle_proto_init() + file_tensorflow_core_protobuf_tensorflow_server_proto_init() + file_tensorflow_core_protobuf_eager_service_proto_msgTypes[1].OneofWrappers = []any{ + (*QueueItem_HandleToDecref)(nil), + (*QueueItem_Operation)(nil), + (*QueueItem_SendTensor)(nil), + (*QueueItem_RegisterFunction)(nil), + (*QueueItem_CleanupFunction)(nil), + (*QueueItem_SyncRemoteExecutorForStream)(nil), + (*QueueItem_SendPackedHandle)(nil), + } + file_tensorflow_core_protobuf_eager_service_proto_msgTypes[22].OneofWrappers = []any{ + (*Operation_Input_RemoteHandle)(nil), + (*Operation_Input_Tensor)(nil), + } + file_tensorflow_core_protobuf_eager_service_proto_msgTypes[25].OneofWrappers = []any{ + (*SendPackedHandleOp_Handle_LocalHandle)(nil), + (*SendPackedHandleOp_Handle_RemoteHandle)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_eager_service_proto_rawDesc), len(file_tensorflow_core_protobuf_eager_service_proto_rawDesc)), + NumEnums: 0, + NumMessages: 26, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_tensorflow_core_protobuf_eager_service_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_eager_service_proto_depIdxs, + MessageInfos: file_tensorflow_core_protobuf_eager_service_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_eager_service_proto = out.File + file_tensorflow_core_protobuf_eager_service_proto_goTypes = nil + file_tensorflow_core_protobuf_eager_service_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/error_codes.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/error_codes.pb.go new file mode 100644 index 0000000..5b85053 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/error_codes.pb.go @@ -0,0 +1,297 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/error_codes.proto + +package for_core_protos_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// The canonical error codes for TensorFlow APIs. +// +// Warnings: +// +// - Do not change any numeric assignments. +// - Changes to this list should only be made if there is a compelling +// need that can't be satisfied in another way. Such changes +// must be approved by at least two OWNERS. +// - These error codes must match gRPC and protobuf error codes (except for +// DO_NOT_USE_RESERVED_FOR_FUTURE_EXPANSION_USE_DEFAULT_IN_SWITCH_INSTEAD_). +// +// Sometimes multiple error codes may apply. Services should return +// the most specific error code that applies. For example, prefer +// OUT_OF_RANGE over FAILED_PRECONDITION if both codes apply. +// Similarly prefer NOT_FOUND or ALREADY_EXISTS over FAILED_PRECONDITION. +type Code int32 + +const ( + // Not an error; returned on success + Code_OK Code = 0 + // The operation was cancelled (typically by the caller). + Code_CANCELLED Code = 1 + // Unknown error. An example of where this error may be returned is + // if a Status value received from another address space belongs to + // an error-space that is not known in this address space. Also + // errors raised by APIs that do not return enough error information + // may be converted to this error. + Code_UNKNOWN Code = 2 + // Client specified an invalid argument. Note that this differs + // from FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments + // that are problematic regardless of the state of the system + // (e.g., a malformed file name). + Code_INVALID_ARGUMENT Code = 3 + // Deadline expired before operation could complete. For operations + // that change the state of the system, this error may be returned + // even if the operation has completed successfully. For example, a + // successful response from a server could have been delayed long + // enough for the deadline to expire. + Code_DEADLINE_EXCEEDED Code = 4 + // Some requested entity (e.g., file or directory) was not found. + // For privacy reasons, this code *may* be returned when the client + // does not have the access right to the entity. + Code_NOT_FOUND Code = 5 + // Some entity that we attempted to create (e.g., file or directory) + // already exists. + Code_ALREADY_EXISTS Code = 6 + // The caller does not have permission to execute the specified + // operation. PERMISSION_DENIED must not be used for rejections + // caused by exhausting some resource (use RESOURCE_EXHAUSTED + // instead for those errors). PERMISSION_DENIED must not be + // used if the caller can not be identified (use UNAUTHENTICATED + // instead for those errors). + Code_PERMISSION_DENIED Code = 7 + // The request does not have valid authentication credentials for the + // operation. + Code_UNAUTHENTICATED Code = 16 + // Some resource has been exhausted, perhaps a per-user quota, or + // perhaps the entire file system is out of space. + Code_RESOURCE_EXHAUSTED Code = 8 + // Operation was rejected because the system is not in a state + // required for the operation's execution. For example, directory + // to be deleted may be non-empty, an rmdir operation is applied to + // a non-directory, etc. + // + // A litmus test that may help a service implementor in deciding + // between FAILED_PRECONDITION, ABORTED, and UNAVAILABLE: + // + // (a) Use UNAVAILABLE if the client can retry just the failing call. + // (b) Use ABORTED if the client should retry at a higher-level + // (e.g., restarting a read-modify-write sequence). + // (c) Use FAILED_PRECONDITION if the client should not retry until + // the system state has been explicitly fixed. E.g., if an "rmdir" + // fails because the directory is non-empty, FAILED_PRECONDITION + // should be returned since the client should not retry unless + // they have first fixed up the directory by deleting files from it. + // (d) Use FAILED_PRECONDITION if the client performs conditional + // REST Get/Update/Delete on a resource and the resource on the + // server does not match the condition. E.g., conflicting + // read-modify-write on the same resource. + Code_FAILED_PRECONDITION Code = 9 + // The operation was aborted, typically due to a concurrency issue + // like sequencer check failures, transaction aborts, etc. + // + // See litmus test above for deciding between FAILED_PRECONDITION, + // ABORTED, and UNAVAILABLE. + Code_ABORTED Code = 10 + // Operation tried to iterate past the valid input range. E.g., seeking or + // reading past end of file. + // + // Unlike INVALID_ARGUMENT, this error indicates a problem that may + // be fixed if the system state changes. For example, a 32-bit file + // system will generate INVALID_ARGUMENT if asked to read at an + // offset that is not in the range [0,2^32-1], but it will generate + // OUT_OF_RANGE if asked to read from an offset past the current + // file size. + // + // There is a fair bit of overlap between FAILED_PRECONDITION and + // OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific + // error) when it applies so that callers who are iterating through + // a space can easily look for an OUT_OF_RANGE error to detect when + // they are done. + Code_OUT_OF_RANGE Code = 11 + // Operation is not implemented or not supported/enabled in this service. + Code_UNIMPLEMENTED Code = 12 + // Internal errors. Means some invariant expected by the underlying + // system has been broken. If you see one of these errors, + // something is very broken. + Code_INTERNAL Code = 13 + // The service is currently unavailable. This is a most likely a + // transient condition and may be corrected by retrying with + // a backoff. + // + // See litmus test above for deciding between FAILED_PRECONDITION, + // ABORTED, and UNAVAILABLE. + Code_UNAVAILABLE Code = 14 + // Unrecoverable data loss or corruption. + Code_DATA_LOSS Code = 15 + // An extra enum entry to prevent people from writing code that + // fails to compile when a new code is added. + // + // Nobody should ever reference this enumeration entry. In particular, + // if you write C++ code that switches on this enumeration, add a default: + // case instead of a case that mentions this enumeration entry. + // + // Nobody should rely on the value (currently 20) listed here. It + // may change in the future. + Code_DO_NOT_USE_RESERVED_FOR_FUTURE_EXPANSION_USE_DEFAULT_IN_SWITCH_INSTEAD_ Code = 20 +) + +// Enum value maps for Code. +var ( + Code_name = map[int32]string{ + 0: "OK", + 1: "CANCELLED", + 2: "UNKNOWN", + 3: "INVALID_ARGUMENT", + 4: "DEADLINE_EXCEEDED", + 5: "NOT_FOUND", + 6: "ALREADY_EXISTS", + 7: "PERMISSION_DENIED", + 16: "UNAUTHENTICATED", + 8: "RESOURCE_EXHAUSTED", + 9: "FAILED_PRECONDITION", + 10: "ABORTED", + 11: "OUT_OF_RANGE", + 12: "UNIMPLEMENTED", + 13: "INTERNAL", + 14: "UNAVAILABLE", + 15: "DATA_LOSS", + 20: "DO_NOT_USE_RESERVED_FOR_FUTURE_EXPANSION_USE_DEFAULT_IN_SWITCH_INSTEAD_", + } + Code_value = map[string]int32{ + "OK": 0, + "CANCELLED": 1, + "UNKNOWN": 2, + "INVALID_ARGUMENT": 3, + "DEADLINE_EXCEEDED": 4, + "NOT_FOUND": 5, + "ALREADY_EXISTS": 6, + "PERMISSION_DENIED": 7, + "UNAUTHENTICATED": 16, + "RESOURCE_EXHAUSTED": 8, + "FAILED_PRECONDITION": 9, + "ABORTED": 10, + "OUT_OF_RANGE": 11, + "UNIMPLEMENTED": 12, + "INTERNAL": 13, + "UNAVAILABLE": 14, + "DATA_LOSS": 15, + "DO_NOT_USE_RESERVED_FOR_FUTURE_EXPANSION_USE_DEFAULT_IN_SWITCH_INSTEAD_": 20, + } +) + +func (x Code) Enum() *Code { + p := new(Code) + *p = x + return p +} + +func (x Code) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Code) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_protobuf_error_codes_proto_enumTypes[0].Descriptor() +} + +func (Code) Type() protoreflect.EnumType { + return &file_tensorflow_core_protobuf_error_codes_proto_enumTypes[0] +} + +func (x Code) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Code.Descriptor instead. +func (Code) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_error_codes_proto_rawDescGZIP(), []int{0} +} + +var File_tensorflow_core_protobuf_error_codes_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_error_codes_proto_rawDesc = "" + + "\n" + + "*tensorflow/core/protobuf/error_codes.proto\x12\x10tensorflow.error*\x84\x03\n" + + "\x04Code\x12\x06\n" + + "\x02OK\x10\x00\x12\r\n" + + "\tCANCELLED\x10\x01\x12\v\n" + + "\aUNKNOWN\x10\x02\x12\x14\n" + + "\x10INVALID_ARGUMENT\x10\x03\x12\x15\n" + + "\x11DEADLINE_EXCEEDED\x10\x04\x12\r\n" + + "\tNOT_FOUND\x10\x05\x12\x12\n" + + "\x0eALREADY_EXISTS\x10\x06\x12\x15\n" + + "\x11PERMISSION_DENIED\x10\a\x12\x13\n" + + "\x0fUNAUTHENTICATED\x10\x10\x12\x16\n" + + "\x12RESOURCE_EXHAUSTED\x10\b\x12\x17\n" + + "\x13FAILED_PRECONDITION\x10\t\x12\v\n" + + "\aABORTED\x10\n" + + "\x12\x10\n" + + "\fOUT_OF_RANGE\x10\v\x12\x11\n" + + "\rUNIMPLEMENTED\x10\f\x12\f\n" + + "\bINTERNAL\x10\r\x12\x0f\n" + + "\vUNAVAILABLE\x10\x0e\x12\r\n" + + "\tDATA_LOSS\x10\x0f\x12K\n" + + "GDO_NOT_USE_RESERVED_FOR_FUTURE_EXPANSION_USE_DEFAULT_IN_SWITCH_INSTEAD_\x10\x14B\x88\x01\n" + + "\x18org.tensorflow.frameworkB\x10ErrorCodesProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_error_codes_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_error_codes_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_error_codes_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_error_codes_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_error_codes_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_error_codes_proto_rawDesc), len(file_tensorflow_core_protobuf_error_codes_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_error_codes_proto_rawDescData +} + +var file_tensorflow_core_protobuf_error_codes_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_tensorflow_core_protobuf_error_codes_proto_goTypes = []any{ + (Code)(0), // 0: tensorflow.error.Code +} +var file_tensorflow_core_protobuf_error_codes_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_error_codes_proto_init() } +func file_tensorflow_core_protobuf_error_codes_proto_init() { + if File_tensorflow_core_protobuf_error_codes_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_error_codes_proto_rawDesc), len(file_tensorflow_core_protobuf_error_codes_proto_rawDesc)), + NumEnums: 1, + NumMessages: 0, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_error_codes_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_error_codes_proto_depIdxs, + EnumInfos: file_tensorflow_core_protobuf_error_codes_proto_enumTypes, + }.Build() + File_tensorflow_core_protobuf_error_codes_proto = out.File + file_tensorflow_core_protobuf_error_codes_proto_goTypes = nil + file_tensorflow_core_protobuf_error_codes_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/graph_debug_info.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/graph_debug_info.pb.go new file mode 100644 index 0000000..c856012 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/graph_debug_info.pb.go @@ -0,0 +1,295 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/graph_debug_info.proto + +package for_core_protos_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type GraphDebugInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + // This stores all the source code file names and can be indexed by the + // `file_index`. + Files []string `protobuf:"bytes,1,rep,name=files,proto3" json:"files,omitempty"` + // This maps a node name to a stack trace in the source code. + // The map key is a mangling of the containing function and op name with + // syntax: + // + // op.name '@' func_name + // + // For ops in the top-level graph, the func_name is the empty string. + // Note that op names are restricted to a small number of characters which + // exclude '@', making it impossible to collide keys of this form. Function + // names accept a much wider set of characters. + // It would be preferable to avoid mangling and use a tuple key of (op.name, + // func_name), but this is not supported with protocol buffers. + Traces map[string]*GraphDebugInfo_StackTrace `protobuf:"bytes,2,rep,name=traces,proto3" json:"traces,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GraphDebugInfo) Reset() { + *x = GraphDebugInfo{} + mi := &file_tensorflow_core_protobuf_graph_debug_info_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GraphDebugInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GraphDebugInfo) ProtoMessage() {} + +func (x *GraphDebugInfo) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_graph_debug_info_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GraphDebugInfo.ProtoReflect.Descriptor instead. +func (*GraphDebugInfo) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_graph_debug_info_proto_rawDescGZIP(), []int{0} +} + +func (x *GraphDebugInfo) GetFiles() []string { + if x != nil { + return x.Files + } + return nil +} + +func (x *GraphDebugInfo) GetTraces() map[string]*GraphDebugInfo_StackTrace { + if x != nil { + return x.Traces + } + return nil +} + +// This represents a file/line location in the source code. +type GraphDebugInfo_FileLineCol struct { + state protoimpl.MessageState `protogen:"open.v1"` + // File name index, which can be used to retrieve the file name string from + // `files`. The value should be between 0 and (len(files)-1) + FileIndex int32 `protobuf:"varint,1,opt,name=file_index,json=fileIndex,proto3" json:"file_index,omitempty"` + // Line number in the file. + Line int32 `protobuf:"varint,2,opt,name=line,proto3" json:"line,omitempty"` + // Col number in the file line. + Col int32 `protobuf:"varint,3,opt,name=col,proto3" json:"col,omitempty"` + // Name of function contains the file line. + Func string `protobuf:"bytes,4,opt,name=func,proto3" json:"func,omitempty"` + // Source code contained in this file line. + Code string `protobuf:"bytes,5,opt,name=code,proto3" json:"code,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GraphDebugInfo_FileLineCol) Reset() { + *x = GraphDebugInfo_FileLineCol{} + mi := &file_tensorflow_core_protobuf_graph_debug_info_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GraphDebugInfo_FileLineCol) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GraphDebugInfo_FileLineCol) ProtoMessage() {} + +func (x *GraphDebugInfo_FileLineCol) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_graph_debug_info_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GraphDebugInfo_FileLineCol.ProtoReflect.Descriptor instead. +func (*GraphDebugInfo_FileLineCol) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_graph_debug_info_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *GraphDebugInfo_FileLineCol) GetFileIndex() int32 { + if x != nil { + return x.FileIndex + } + return 0 +} + +func (x *GraphDebugInfo_FileLineCol) GetLine() int32 { + if x != nil { + return x.Line + } + return 0 +} + +func (x *GraphDebugInfo_FileLineCol) GetCol() int32 { + if x != nil { + return x.Col + } + return 0 +} + +func (x *GraphDebugInfo_FileLineCol) GetFunc() string { + if x != nil { + return x.Func + } + return "" +} + +func (x *GraphDebugInfo_FileLineCol) GetCode() string { + if x != nil { + return x.Code + } + return "" +} + +// This represents a stack trace which is a ordered list of `FileLineCol`. +type GraphDebugInfo_StackTrace struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Each line in the stack trace. + FileLineCols []*GraphDebugInfo_FileLineCol `protobuf:"bytes,1,rep,name=file_line_cols,json=fileLineCols,proto3" json:"file_line_cols,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GraphDebugInfo_StackTrace) Reset() { + *x = GraphDebugInfo_StackTrace{} + mi := &file_tensorflow_core_protobuf_graph_debug_info_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GraphDebugInfo_StackTrace) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GraphDebugInfo_StackTrace) ProtoMessage() {} + +func (x *GraphDebugInfo_StackTrace) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_graph_debug_info_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GraphDebugInfo_StackTrace.ProtoReflect.Descriptor instead. +func (*GraphDebugInfo_StackTrace) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_graph_debug_info_proto_rawDescGZIP(), []int{0, 1} +} + +func (x *GraphDebugInfo_StackTrace) GetFileLineCols() []*GraphDebugInfo_FileLineCol { + if x != nil { + return x.FileLineCols + } + return nil +} + +var File_tensorflow_core_protobuf_graph_debug_info_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_graph_debug_info_proto_rawDesc = "" + + "\n" + + "/tensorflow/core/protobuf/graph_debug_info.proto\x12\n" + + "tensorflow\"\xa0\x03\n" + + "\x0eGraphDebugInfo\x12\x14\n" + + "\x05files\x18\x01 \x03(\tR\x05files\x12>\n" + + "\x06traces\x18\x02 \x03(\v2&.tensorflow.GraphDebugInfo.TracesEntryR\x06traces\x1az\n" + + "\vFileLineCol\x12\x1d\n" + + "\n" + + "file_index\x18\x01 \x01(\x05R\tfileIndex\x12\x12\n" + + "\x04line\x18\x02 \x01(\x05R\x04line\x12\x10\n" + + "\x03col\x18\x03 \x01(\x05R\x03col\x12\x12\n" + + "\x04func\x18\x04 \x01(\tR\x04func\x12\x12\n" + + "\x04code\x18\x05 \x01(\tR\x04code\x1aZ\n" + + "\n" + + "StackTrace\x12L\n" + + "\x0efile_line_cols\x18\x01 \x03(\v2&.tensorflow.GraphDebugInfo.FileLineColR\ffileLineCols\x1a`\n" + + "\vTracesEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12;\n" + + "\x05value\x18\x02 \x01(\v2%.tensorflow.GraphDebugInfo.StackTraceR\x05value:\x028\x01B\x8c\x01\n" + + "\x18org.tensorflow.frameworkB\x14GraphDebugInfoProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_graph_debug_info_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_graph_debug_info_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_graph_debug_info_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_graph_debug_info_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_graph_debug_info_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_graph_debug_info_proto_rawDesc), len(file_tensorflow_core_protobuf_graph_debug_info_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_graph_debug_info_proto_rawDescData +} + +var file_tensorflow_core_protobuf_graph_debug_info_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_tensorflow_core_protobuf_graph_debug_info_proto_goTypes = []any{ + (*GraphDebugInfo)(nil), // 0: tensorflow.GraphDebugInfo + (*GraphDebugInfo_FileLineCol)(nil), // 1: tensorflow.GraphDebugInfo.FileLineCol + (*GraphDebugInfo_StackTrace)(nil), // 2: tensorflow.GraphDebugInfo.StackTrace + nil, // 3: tensorflow.GraphDebugInfo.TracesEntry +} +var file_tensorflow_core_protobuf_graph_debug_info_proto_depIdxs = []int32{ + 3, // 0: tensorflow.GraphDebugInfo.traces:type_name -> tensorflow.GraphDebugInfo.TracesEntry + 1, // 1: tensorflow.GraphDebugInfo.StackTrace.file_line_cols:type_name -> tensorflow.GraphDebugInfo.FileLineCol + 2, // 2: tensorflow.GraphDebugInfo.TracesEntry.value:type_name -> tensorflow.GraphDebugInfo.StackTrace + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_graph_debug_info_proto_init() } +func file_tensorflow_core_protobuf_graph_debug_info_proto_init() { + if File_tensorflow_core_protobuf_graph_debug_info_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_graph_debug_info_proto_rawDesc), len(file_tensorflow_core_protobuf_graph_debug_info_proto_rawDesc)), + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_graph_debug_info_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_graph_debug_info_proto_depIdxs, + MessageInfos: file_tensorflow_core_protobuf_graph_debug_info_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_graph_debug_info_proto = out.File + file_tensorflow_core_protobuf_graph_debug_info_proto_goTypes = nil + file_tensorflow_core_protobuf_graph_debug_info_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/master.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/master.pb.go new file mode 100644 index 0000000..7e7c94b --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/master.pb.go @@ -0,0 +1,1408 @@ +// Copyright 2016 The TensorFlow Authors. All Rights Reserved. +// +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +//============================================================================== + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/master.proto + +package for_core_protos_go_proto + +import ( + device_attributes_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/device_attributes_go_proto" + graph_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/graph_go_proto" + tensor_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type CreateSessionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The initial graph definition. + GraphDef *graph_go_proto.GraphDef `protobuf:"bytes,1,opt,name=graph_def,json=graphDef,proto3" json:"graph_def,omitempty"` + // Configuration options. + Config *ConfigProto `protobuf:"bytes,2,opt,name=config,proto3" json:"config,omitempty"` + // The target string used from the client's perspective. + Target string `protobuf:"bytes,3,opt,name=target,proto3" json:"target,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateSessionRequest) Reset() { + *x = CreateSessionRequest{} + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateSessionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateSessionRequest) ProtoMessage() {} + +func (x *CreateSessionRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateSessionRequest.ProtoReflect.Descriptor instead. +func (*CreateSessionRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_master_proto_rawDescGZIP(), []int{0} +} + +func (x *CreateSessionRequest) GetGraphDef() *graph_go_proto.GraphDef { + if x != nil { + return x.GraphDef + } + return nil +} + +func (x *CreateSessionRequest) GetConfig() *ConfigProto { + if x != nil { + return x.Config + } + return nil +} + +func (x *CreateSessionRequest) GetTarget() string { + if x != nil { + return x.Target + } + return "" +} + +type CreateSessionResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The session handle to be used in subsequent calls for the created session. + // + // The client must arrange to call CloseSession with this returned + // session handle to close the session. + SessionHandle string `protobuf:"bytes,1,opt,name=session_handle,json=sessionHandle,proto3" json:"session_handle,omitempty"` + // The initial version number for the graph, to be used in the next call + // to ExtendSession. + GraphVersion int64 `protobuf:"varint,2,opt,name=graph_version,json=graphVersion,proto3" json:"graph_version,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateSessionResponse) Reset() { + *x = CreateSessionResponse{} + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateSessionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateSessionResponse) ProtoMessage() {} + +func (x *CreateSessionResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateSessionResponse.ProtoReflect.Descriptor instead. +func (*CreateSessionResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_master_proto_rawDescGZIP(), []int{1} +} + +func (x *CreateSessionResponse) GetSessionHandle() string { + if x != nil { + return x.SessionHandle + } + return "" +} + +func (x *CreateSessionResponse) GetGraphVersion() int64 { + if x != nil { + return x.GraphVersion + } + return 0 +} + +type ExtendSessionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // REQUIRED: session_handle must be returned by a CreateSession call + // to the same master service. + SessionHandle string `protobuf:"bytes,1,opt,name=session_handle,json=sessionHandle,proto3" json:"session_handle,omitempty"` + // REQUIRED: The nodes to be added to the session's graph. If any node has + // the same name as an existing node, the operation will fail with + // ILLEGAL_ARGUMENT. + GraphDef *graph_go_proto.GraphDef `protobuf:"bytes,2,opt,name=graph_def,json=graphDef,proto3" json:"graph_def,omitempty"` + // REQUIRED: The version number of the graph to be extended. This will be + // tested against the current server-side version number, and the operation + // will fail with FAILED_PRECONDITION if they do not match. + CurrentGraphVersion int64 `protobuf:"varint,3,opt,name=current_graph_version,json=currentGraphVersion,proto3" json:"current_graph_version,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ExtendSessionRequest) Reset() { + *x = ExtendSessionRequest{} + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ExtendSessionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExtendSessionRequest) ProtoMessage() {} + +func (x *ExtendSessionRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ExtendSessionRequest.ProtoReflect.Descriptor instead. +func (*ExtendSessionRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_master_proto_rawDescGZIP(), []int{2} +} + +func (x *ExtendSessionRequest) GetSessionHandle() string { + if x != nil { + return x.SessionHandle + } + return "" +} + +func (x *ExtendSessionRequest) GetGraphDef() *graph_go_proto.GraphDef { + if x != nil { + return x.GraphDef + } + return nil +} + +func (x *ExtendSessionRequest) GetCurrentGraphVersion() int64 { + if x != nil { + return x.CurrentGraphVersion + } + return 0 +} + +type ExtendSessionResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The new version number for the extended graph, to be used in the next call + // to ExtendSession. + NewGraphVersion int64 `protobuf:"varint,4,opt,name=new_graph_version,json=newGraphVersion,proto3" json:"new_graph_version,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ExtendSessionResponse) Reset() { + *x = ExtendSessionResponse{} + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ExtendSessionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExtendSessionResponse) ProtoMessage() {} + +func (x *ExtendSessionResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ExtendSessionResponse.ProtoReflect.Descriptor instead. +func (*ExtendSessionResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_master_proto_rawDescGZIP(), []int{3} +} + +func (x *ExtendSessionResponse) GetNewGraphVersion() int64 { + if x != nil { + return x.NewGraphVersion + } + return 0 +} + +type RunStepRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // REQUIRED: session_handle must be returned by a CreateSession call + // to the same master service. + SessionHandle string `protobuf:"bytes,1,opt,name=session_handle,json=sessionHandle,proto3" json:"session_handle,omitempty"` + // Tensors to be fed in the step. Each feed is a named tensor. + Feed []*NamedTensorProto `protobuf:"bytes,2,rep,name=feed,proto3" json:"feed,omitempty"` + // Fetches. A list of tensor names. The caller expects a tensor to + // be returned for each fetch[i] (see RunStepResponse.tensor). The + // order of specified fetches does not change the execution order. + Fetch []string `protobuf:"bytes,3,rep,name=fetch,proto3" json:"fetch,omitempty"` + // Target Nodes. A list of node names. The named nodes will be run + // to but their outputs will not be fetched. + Target []string `protobuf:"bytes,4,rep,name=target,proto3" json:"target,omitempty"` + // Options for the run call. + Options *RunOptions `protobuf:"bytes,5,opt,name=options,proto3" json:"options,omitempty"` + // Partial run handle (optional). If specified, this will be a partial run + // execution, run up to the specified fetches. + PartialRunHandle string `protobuf:"bytes,6,opt,name=partial_run_handle,json=partialRunHandle,proto3" json:"partial_run_handle,omitempty"` + // If true then some errors, e.g., execution errors that have long + // error messages, may return an OK RunStepResponse with the actual + // error saved in the status_code/status_error_message fields of the + // response body. This is a workaround since the RPC subsystem may + // truncate long metadata messages. + StoreErrorsInResponseBody bool `protobuf:"varint,7,opt,name=store_errors_in_response_body,json=storeErrorsInResponseBody,proto3" json:"store_errors_in_response_body,omitempty"` + // Unique identifier for this request. Every RunStepRequest must + // have a unique request_id, and retried RunStepRequest must have + // the same request_id. If request_id is zero, retry detection is disabled. + RequestId int64 `protobuf:"varint,8,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RunStepRequest) Reset() { + *x = RunStepRequest{} + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RunStepRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RunStepRequest) ProtoMessage() {} + +func (x *RunStepRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RunStepRequest.ProtoReflect.Descriptor instead. +func (*RunStepRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_master_proto_rawDescGZIP(), []int{4} +} + +func (x *RunStepRequest) GetSessionHandle() string { + if x != nil { + return x.SessionHandle + } + return "" +} + +func (x *RunStepRequest) GetFeed() []*NamedTensorProto { + if x != nil { + return x.Feed + } + return nil +} + +func (x *RunStepRequest) GetFetch() []string { + if x != nil { + return x.Fetch + } + return nil +} + +func (x *RunStepRequest) GetTarget() []string { + if x != nil { + return x.Target + } + return nil +} + +func (x *RunStepRequest) GetOptions() *RunOptions { + if x != nil { + return x.Options + } + return nil +} + +func (x *RunStepRequest) GetPartialRunHandle() string { + if x != nil { + return x.PartialRunHandle + } + return "" +} + +func (x *RunStepRequest) GetStoreErrorsInResponseBody() bool { + if x != nil { + return x.StoreErrorsInResponseBody + } + return false +} + +func (x *RunStepRequest) GetRequestId() int64 { + if x != nil { + return x.RequestId + } + return 0 +} + +type RunStepResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // NOTE: The order of the returned tensors may or may not match + // the fetch order specified in RunStepRequest. + Tensor []*NamedTensorProto `protobuf:"bytes,1,rep,name=tensor,proto3" json:"tensor,omitempty"` + // Returned metadata if requested in the options. + Metadata *RunMetadata `protobuf:"bytes,2,opt,name=metadata,proto3" json:"metadata,omitempty"` + // If store_errors_in_response_body is true in the request, then + // optionally the server may return an OK status for the RPC and + // fill the true status into the fields below, to allow for messages + // that are too long to fit in metadata. + StatusCode Code `protobuf:"varint,3,opt,name=status_code,json=statusCode,proto3,enum=tensorflow.error.Code" json:"status_code,omitempty"` + StatusErrorMessage string `protobuf:"bytes,4,opt,name=status_error_message,json=statusErrorMessage,proto3" json:"status_error_message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RunStepResponse) Reset() { + *x = RunStepResponse{} + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RunStepResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RunStepResponse) ProtoMessage() {} + +func (x *RunStepResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RunStepResponse.ProtoReflect.Descriptor instead. +func (*RunStepResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_master_proto_rawDescGZIP(), []int{5} +} + +func (x *RunStepResponse) GetTensor() []*NamedTensorProto { + if x != nil { + return x.Tensor + } + return nil +} + +func (x *RunStepResponse) GetMetadata() *RunMetadata { + if x != nil { + return x.Metadata + } + return nil +} + +func (x *RunStepResponse) GetStatusCode() Code { + if x != nil { + return x.StatusCode + } + return Code_OK +} + +func (x *RunStepResponse) GetStatusErrorMessage() string { + if x != nil { + return x.StatusErrorMessage + } + return "" +} + +type PartialRunSetupRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // REQUIRED: session_handle must be returned by a CreateSession call + // to the same master service. + SessionHandle string `protobuf:"bytes,1,opt,name=session_handle,json=sessionHandle,proto3" json:"session_handle,omitempty"` + // Tensors to be fed in future steps. + Feed []string `protobuf:"bytes,2,rep,name=feed,proto3" json:"feed,omitempty"` + // Fetches. A list of tensor names. The caller expects a tensor to be returned + // for each fetch[i] (see RunStepResponse.tensor), for corresponding partial + // RunStepRequests. The order of specified fetches does not change the + // execution order. + Fetch []string `protobuf:"bytes,3,rep,name=fetch,proto3" json:"fetch,omitempty"` + // Target Nodes. A list of node names. The named nodes will be run in future + // steps, but their outputs will not be fetched. + Target []string `protobuf:"bytes,4,rep,name=target,proto3" json:"target,omitempty"` + // Unique identifier for this request. Every PartialRunSetupRequest must + // have a unique request_id, and retried PartialRunSetupRequest must have + // the same request_id. If request_id is zero, retry detection is disabled. + RequestId int64 `protobuf:"varint,5,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PartialRunSetupRequest) Reset() { + *x = PartialRunSetupRequest{} + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PartialRunSetupRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PartialRunSetupRequest) ProtoMessage() {} + +func (x *PartialRunSetupRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PartialRunSetupRequest.ProtoReflect.Descriptor instead. +func (*PartialRunSetupRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_master_proto_rawDescGZIP(), []int{6} +} + +func (x *PartialRunSetupRequest) GetSessionHandle() string { + if x != nil { + return x.SessionHandle + } + return "" +} + +func (x *PartialRunSetupRequest) GetFeed() []string { + if x != nil { + return x.Feed + } + return nil +} + +func (x *PartialRunSetupRequest) GetFetch() []string { + if x != nil { + return x.Fetch + } + return nil +} + +func (x *PartialRunSetupRequest) GetTarget() []string { + if x != nil { + return x.Target + } + return nil +} + +func (x *PartialRunSetupRequest) GetRequestId() int64 { + if x != nil { + return x.RequestId + } + return 0 +} + +type PartialRunSetupResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The unique handle corresponding to the ongoing partial run call setup by + // the invocation to PartialRunSetup. This handle may be passed to + // RunStepRequest to send and receive tensors for this partial run. + PartialRunHandle string `protobuf:"bytes,1,opt,name=partial_run_handle,json=partialRunHandle,proto3" json:"partial_run_handle,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PartialRunSetupResponse) Reset() { + *x = PartialRunSetupResponse{} + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PartialRunSetupResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PartialRunSetupResponse) ProtoMessage() {} + +func (x *PartialRunSetupResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PartialRunSetupResponse.ProtoReflect.Descriptor instead. +func (*PartialRunSetupResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_master_proto_rawDescGZIP(), []int{7} +} + +func (x *PartialRunSetupResponse) GetPartialRunHandle() string { + if x != nil { + return x.PartialRunHandle + } + return "" +} + +type CloseSessionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // REQUIRED: session_handle must be returned by a CreateSession call + // to the same master service. + SessionHandle string `protobuf:"bytes,1,opt,name=session_handle,json=sessionHandle,proto3" json:"session_handle,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CloseSessionRequest) Reset() { + *x = CloseSessionRequest{} + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CloseSessionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CloseSessionRequest) ProtoMessage() {} + +func (x *CloseSessionRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CloseSessionRequest.ProtoReflect.Descriptor instead. +func (*CloseSessionRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_master_proto_rawDescGZIP(), []int{8} +} + +func (x *CloseSessionRequest) GetSessionHandle() string { + if x != nil { + return x.SessionHandle + } + return "" +} + +type CloseSessionResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CloseSessionResponse) Reset() { + *x = CloseSessionResponse{} + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CloseSessionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CloseSessionResponse) ProtoMessage() {} + +func (x *CloseSessionResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CloseSessionResponse.ProtoReflect.Descriptor instead. +func (*CloseSessionResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_master_proto_rawDescGZIP(), []int{9} +} + +// Reset() allows misbehaving or slow sessions to be aborted and closed, and +// causes their resources eventually to be released. Reset() does not wait +// for the computations in old sessions to cease; it merely starts the +// process of tearing them down. However, if a new session is started after +// a Reset(), the new session is isolated from changes that old sessions +// (started prior to the Reset()) may continue to make to resources, provided +// all those resources are in containers listed in "containers". +// +// Old sessions may continue to have side-effects on resources not in +// containers listed in "containers", and thus may affect future +// sessions' results in ways that are hard to predict. Thus, if well-defined +// behavior is desired, is it recommended that all containers be listed in +// "containers". Similarly, if a device_filter is specified, results may be +// hard to predict. +type ResetRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // A list of container names, which may be empty. + // + // If 'container' is not empty, releases resources in the given + // containers in all devices. + // + // If 'container' is empty, releases resources in the default + // container in all devices. + Container []string `protobuf:"bytes,1,rep,name=container,proto3" json:"container,omitempty"` + // When any filters are present, only devices that match the filters + // will be reset. Each filter can be partially specified, + // e.g. "/job:ps" "/job:worker/replica:3", etc. + DeviceFilters []string `protobuf:"bytes,2,rep,name=device_filters,json=deviceFilters,proto3" json:"device_filters,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ResetRequest) Reset() { + *x = ResetRequest{} + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ResetRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResetRequest) ProtoMessage() {} + +func (x *ResetRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ResetRequest.ProtoReflect.Descriptor instead. +func (*ResetRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_master_proto_rawDescGZIP(), []int{10} +} + +func (x *ResetRequest) GetContainer() []string { + if x != nil { + return x.Container + } + return nil +} + +func (x *ResetRequest) GetDeviceFilters() []string { + if x != nil { + return x.DeviceFilters + } + return nil +} + +type ResetResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ResetResponse) Reset() { + *x = ResetResponse{} + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ResetResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResetResponse) ProtoMessage() {} + +func (x *ResetResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ResetResponse.ProtoReflect.Descriptor instead. +func (*ResetResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_master_proto_rawDescGZIP(), []int{11} +} + +type ListDevicesRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Optional: session_handle must be returned by a CreateSession call to the + // same master service. + // + // When session_handle is empty, the ClusterSpec provided when the master was + // started is used to compute the available devices. If the session_handle is + // provided but not recognized, an error is returned. Finally, if a valid + // session_handle is provided, the cluster configuration for that session is + // used when computing the response. + SessionHandle string `protobuf:"bytes,1,opt,name=session_handle,json=sessionHandle,proto3" json:"session_handle,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListDevicesRequest) Reset() { + *x = ListDevicesRequest{} + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListDevicesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListDevicesRequest) ProtoMessage() {} + +func (x *ListDevicesRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListDevicesRequest.ProtoReflect.Descriptor instead. +func (*ListDevicesRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_master_proto_rawDescGZIP(), []int{12} +} + +func (x *ListDevicesRequest) GetSessionHandle() string { + if x != nil { + return x.SessionHandle + } + return "" +} + +type ListDevicesResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + LocalDevice []*device_attributes_go_proto.DeviceAttributes `protobuf:"bytes,1,rep,name=local_device,json=localDevice,proto3" json:"local_device,omitempty"` + RemoteDevice []*device_attributes_go_proto.DeviceAttributes `protobuf:"bytes,2,rep,name=remote_device,json=remoteDevice,proto3" json:"remote_device,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListDevicesResponse) Reset() { + *x = ListDevicesResponse{} + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListDevicesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListDevicesResponse) ProtoMessage() {} + +func (x *ListDevicesResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[13] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListDevicesResponse.ProtoReflect.Descriptor instead. +func (*ListDevicesResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_master_proto_rawDescGZIP(), []int{13} +} + +func (x *ListDevicesResponse) GetLocalDevice() []*device_attributes_go_proto.DeviceAttributes { + if x != nil { + return x.LocalDevice + } + return nil +} + +func (x *ListDevicesResponse) GetRemoteDevice() []*device_attributes_go_proto.DeviceAttributes { + if x != nil { + return x.RemoteDevice + } + return nil +} + +type MakeCallableRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // REQUIRED: session_handle must be returned by a CreateSession call + // to the same master service. + SessionHandle string `protobuf:"bytes,1,opt,name=session_handle,json=sessionHandle,proto3" json:"session_handle,omitempty"` + // Options that define the behavior of the created callable. + Options *CallableOptions `protobuf:"bytes,2,opt,name=options,proto3" json:"options,omitempty"` + // Unique identifier for this request. Every MakeCallableRequest must + // have a unique request_id, and retried MakeCallableRequest must have + // the same request_id. If request_id is zero, retry detection is disabled. + RequestId int64 `protobuf:"varint,3,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MakeCallableRequest) Reset() { + *x = MakeCallableRequest{} + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MakeCallableRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MakeCallableRequest) ProtoMessage() {} + +func (x *MakeCallableRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[14] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MakeCallableRequest.ProtoReflect.Descriptor instead. +func (*MakeCallableRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_master_proto_rawDescGZIP(), []int{14} +} + +func (x *MakeCallableRequest) GetSessionHandle() string { + if x != nil { + return x.SessionHandle + } + return "" +} + +func (x *MakeCallableRequest) GetOptions() *CallableOptions { + if x != nil { + return x.Options + } + return nil +} + +func (x *MakeCallableRequest) GetRequestId() int64 { + if x != nil { + return x.RequestId + } + return 0 +} + +type MakeCallableResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // A handle to the created callable. + Handle int64 `protobuf:"varint,1,opt,name=handle,proto3" json:"handle,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MakeCallableResponse) Reset() { + *x = MakeCallableResponse{} + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MakeCallableResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MakeCallableResponse) ProtoMessage() {} + +func (x *MakeCallableResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[15] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MakeCallableResponse.ProtoReflect.Descriptor instead. +func (*MakeCallableResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_master_proto_rawDescGZIP(), []int{15} +} + +func (x *MakeCallableResponse) GetHandle() int64 { + if x != nil { + return x.Handle + } + return 0 +} + +type RunCallableRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // REQUIRED: session_handle must be returned by a CreateSession call + // to the same master service. + SessionHandle string `protobuf:"bytes,1,opt,name=session_handle,json=sessionHandle,proto3" json:"session_handle,omitempty"` + // REQUIRED: handle must be returned by a MakeCallable call to the same + // master service. + Handle int64 `protobuf:"varint,2,opt,name=handle,proto3" json:"handle,omitempty"` + // Values of the tensors passed as arguments to the callable, in the order + // defined in the CallableOptions.feed field passed to MakeCallable. + Feed []*tensor_go_proto.TensorProto `protobuf:"bytes,3,rep,name=feed,proto3" json:"feed,omitempty"` + // Unique identifier for this request. Every RunCallableRequest must + // have a unique request_id, and retried RunCallableRequest must have + // the same request_id. If request_id is zero, retry detection is disabled. + RequestId int64 `protobuf:"varint,4,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RunCallableRequest) Reset() { + *x = RunCallableRequest{} + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RunCallableRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RunCallableRequest) ProtoMessage() {} + +func (x *RunCallableRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[16] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RunCallableRequest.ProtoReflect.Descriptor instead. +func (*RunCallableRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_master_proto_rawDescGZIP(), []int{16} +} + +func (x *RunCallableRequest) GetSessionHandle() string { + if x != nil { + return x.SessionHandle + } + return "" +} + +func (x *RunCallableRequest) GetHandle() int64 { + if x != nil { + return x.Handle + } + return 0 +} + +func (x *RunCallableRequest) GetFeed() []*tensor_go_proto.TensorProto { + if x != nil { + return x.Feed + } + return nil +} + +func (x *RunCallableRequest) GetRequestId() int64 { + if x != nil { + return x.RequestId + } + return 0 +} + +type RunCallableResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Values of the tensors returned by the callable, in the order defined in the + // CallableOptions.fetch field passed to MakeCallable. + Fetch []*tensor_go_proto.TensorProto `protobuf:"bytes,1,rep,name=fetch,proto3" json:"fetch,omitempty"` + // Returned metadata if requested in the options. + Metadata *RunMetadata `protobuf:"bytes,2,opt,name=metadata,proto3" json:"metadata,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RunCallableResponse) Reset() { + *x = RunCallableResponse{} + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RunCallableResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RunCallableResponse) ProtoMessage() {} + +func (x *RunCallableResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[17] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RunCallableResponse.ProtoReflect.Descriptor instead. +func (*RunCallableResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_master_proto_rawDescGZIP(), []int{17} +} + +func (x *RunCallableResponse) GetFetch() []*tensor_go_proto.TensorProto { + if x != nil { + return x.Fetch + } + return nil +} + +func (x *RunCallableResponse) GetMetadata() *RunMetadata { + if x != nil { + return x.Metadata + } + return nil +} + +type ReleaseCallableRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // REQUIRED: session_handle must be returned by a CreateSession call + // to the same master service. + SessionHandle string `protobuf:"bytes,1,opt,name=session_handle,json=sessionHandle,proto3" json:"session_handle,omitempty"` + // REQUIRED: handle must be returned by a MakeCallable call to the same + // master service. + Handle int64 `protobuf:"varint,2,opt,name=handle,proto3" json:"handle,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ReleaseCallableRequest) Reset() { + *x = ReleaseCallableRequest{} + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ReleaseCallableRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReleaseCallableRequest) ProtoMessage() {} + +func (x *ReleaseCallableRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[18] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReleaseCallableRequest.ProtoReflect.Descriptor instead. +func (*ReleaseCallableRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_master_proto_rawDescGZIP(), []int{18} +} + +func (x *ReleaseCallableRequest) GetSessionHandle() string { + if x != nil { + return x.SessionHandle + } + return "" +} + +func (x *ReleaseCallableRequest) GetHandle() int64 { + if x != nil { + return x.Handle + } + return 0 +} + +type ReleaseCallableResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ReleaseCallableResponse) Reset() { + *x = ReleaseCallableResponse{} + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ReleaseCallableResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReleaseCallableResponse) ProtoMessage() {} + +func (x *ReleaseCallableResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_master_proto_msgTypes[19] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReleaseCallableResponse.ProtoReflect.Descriptor instead. +func (*ReleaseCallableResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_master_proto_rawDescGZIP(), []int{19} +} + +var File_tensorflow_core_protobuf_master_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_master_proto_rawDesc = "" + + "\n" + + "%tensorflow/core/protobuf/master.proto\x12\n" + + "tensorflow\x1a1tensorflow/core/framework/device_attributes.proto\x1a%tensorflow/core/framework/graph.proto\x1a&tensorflow/core/framework/tensor.proto\x1a%tensorflow/core/protobuf/config.proto\x1a*tensorflow/core/protobuf/error_codes.proto\x1a+tensorflow/core/protobuf/named_tensor.proto\"\x92\x01\n" + + "\x14CreateSessionRequest\x121\n" + + "\tgraph_def\x18\x01 \x01(\v2\x14.tensorflow.GraphDefR\bgraphDef\x12/\n" + + "\x06config\x18\x02 \x01(\v2\x17.tensorflow.ConfigProtoR\x06config\x12\x16\n" + + "\x06target\x18\x03 \x01(\tR\x06target\"c\n" + + "\x15CreateSessionResponse\x12%\n" + + "\x0esession_handle\x18\x01 \x01(\tR\rsessionHandle\x12#\n" + + "\rgraph_version\x18\x02 \x01(\x03R\fgraphVersion\"\xa4\x01\n" + + "\x14ExtendSessionRequest\x12%\n" + + "\x0esession_handle\x18\x01 \x01(\tR\rsessionHandle\x121\n" + + "\tgraph_def\x18\x02 \x01(\v2\x14.tensorflow.GraphDefR\bgraphDef\x122\n" + + "\x15current_graph_version\x18\x03 \x01(\x03R\x13currentGraphVersion\"C\n" + + "\x15ExtendSessionResponse\x12*\n" + + "\x11new_graph_version\x18\x04 \x01(\x03R\x0fnewGraphVersion\"\xd8\x02\n" + + "\x0eRunStepRequest\x12%\n" + + "\x0esession_handle\x18\x01 \x01(\tR\rsessionHandle\x120\n" + + "\x04feed\x18\x02 \x03(\v2\x1c.tensorflow.NamedTensorProtoR\x04feed\x12\x14\n" + + "\x05fetch\x18\x03 \x03(\tR\x05fetch\x12\x16\n" + + "\x06target\x18\x04 \x03(\tR\x06target\x120\n" + + "\aoptions\x18\x05 \x01(\v2\x16.tensorflow.RunOptionsR\aoptions\x12,\n" + + "\x12partial_run_handle\x18\x06 \x01(\tR\x10partialRunHandle\x12@\n" + + "\x1dstore_errors_in_response_body\x18\a \x01(\bR\x19storeErrorsInResponseBody\x12\x1d\n" + + "\n" + + "request_id\x18\b \x01(\x03R\trequestId\"\xe7\x01\n" + + "\x0fRunStepResponse\x124\n" + + "\x06tensor\x18\x01 \x03(\v2\x1c.tensorflow.NamedTensorProtoR\x06tensor\x123\n" + + "\bmetadata\x18\x02 \x01(\v2\x17.tensorflow.RunMetadataR\bmetadata\x127\n" + + "\vstatus_code\x18\x03 \x01(\x0e2\x16.tensorflow.error.CodeR\n" + + "statusCode\x120\n" + + "\x14status_error_message\x18\x04 \x01(\tR\x12statusErrorMessage\"\xa0\x01\n" + + "\x16PartialRunSetupRequest\x12%\n" + + "\x0esession_handle\x18\x01 \x01(\tR\rsessionHandle\x12\x12\n" + + "\x04feed\x18\x02 \x03(\tR\x04feed\x12\x14\n" + + "\x05fetch\x18\x03 \x03(\tR\x05fetch\x12\x16\n" + + "\x06target\x18\x04 \x03(\tR\x06target\x12\x1d\n" + + "\n" + + "request_id\x18\x05 \x01(\x03R\trequestId\"G\n" + + "\x17PartialRunSetupResponse\x12,\n" + + "\x12partial_run_handle\x18\x01 \x01(\tR\x10partialRunHandle\"<\n" + + "\x13CloseSessionRequest\x12%\n" + + "\x0esession_handle\x18\x01 \x01(\tR\rsessionHandle\"\x16\n" + + "\x14CloseSessionResponse\"S\n" + + "\fResetRequest\x12\x1c\n" + + "\tcontainer\x18\x01 \x03(\tR\tcontainer\x12%\n" + + "\x0edevice_filters\x18\x02 \x03(\tR\rdeviceFilters\"\x0f\n" + + "\rResetResponse\";\n" + + "\x12ListDevicesRequest\x12%\n" + + "\x0esession_handle\x18\x01 \x01(\tR\rsessionHandle\"\x99\x01\n" + + "\x13ListDevicesResponse\x12?\n" + + "\flocal_device\x18\x01 \x03(\v2\x1c.tensorflow.DeviceAttributesR\vlocalDevice\x12A\n" + + "\rremote_device\x18\x02 \x03(\v2\x1c.tensorflow.DeviceAttributesR\fremoteDevice\"\x92\x01\n" + + "\x13MakeCallableRequest\x12%\n" + + "\x0esession_handle\x18\x01 \x01(\tR\rsessionHandle\x125\n" + + "\aoptions\x18\x02 \x01(\v2\x1b.tensorflow.CallableOptionsR\aoptions\x12\x1d\n" + + "\n" + + "request_id\x18\x03 \x01(\x03R\trequestId\".\n" + + "\x14MakeCallableResponse\x12\x16\n" + + "\x06handle\x18\x01 \x01(\x03R\x06handle\"\x9f\x01\n" + + "\x12RunCallableRequest\x12%\n" + + "\x0esession_handle\x18\x01 \x01(\tR\rsessionHandle\x12\x16\n" + + "\x06handle\x18\x02 \x01(\x03R\x06handle\x12+\n" + + "\x04feed\x18\x03 \x03(\v2\x17.tensorflow.TensorProtoR\x04feed\x12\x1d\n" + + "\n" + + "request_id\x18\x04 \x01(\x03R\trequestId\"y\n" + + "\x13RunCallableResponse\x12-\n" + + "\x05fetch\x18\x01 \x03(\v2\x17.tensorflow.TensorProtoR\x05fetch\x123\n" + + "\bmetadata\x18\x02 \x01(\v2\x17.tensorflow.RunMetadataR\bmetadata\"W\n" + + "\x16ReleaseCallableRequest\x12%\n" + + "\x0esession_handle\x18\x01 \x01(\tR\rsessionHandle\x12\x16\n" + + "\x06handle\x18\x02 \x01(\x03R\x06handle\"\x19\n" + + "\x17ReleaseCallableResponseB\x92\x01\n" + + "\x1aorg.tensorflow.distruntimeB\x18DistributedRuntimeProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_master_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_master_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_master_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_master_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_master_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_master_proto_rawDesc), len(file_tensorflow_core_protobuf_master_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_master_proto_rawDescData +} + +var file_tensorflow_core_protobuf_master_proto_msgTypes = make([]protoimpl.MessageInfo, 20) +var file_tensorflow_core_protobuf_master_proto_goTypes = []any{ + (*CreateSessionRequest)(nil), // 0: tensorflow.CreateSessionRequest + (*CreateSessionResponse)(nil), // 1: tensorflow.CreateSessionResponse + (*ExtendSessionRequest)(nil), // 2: tensorflow.ExtendSessionRequest + (*ExtendSessionResponse)(nil), // 3: tensorflow.ExtendSessionResponse + (*RunStepRequest)(nil), // 4: tensorflow.RunStepRequest + (*RunStepResponse)(nil), // 5: tensorflow.RunStepResponse + (*PartialRunSetupRequest)(nil), // 6: tensorflow.PartialRunSetupRequest + (*PartialRunSetupResponse)(nil), // 7: tensorflow.PartialRunSetupResponse + (*CloseSessionRequest)(nil), // 8: tensorflow.CloseSessionRequest + (*CloseSessionResponse)(nil), // 9: tensorflow.CloseSessionResponse + (*ResetRequest)(nil), // 10: tensorflow.ResetRequest + (*ResetResponse)(nil), // 11: tensorflow.ResetResponse + (*ListDevicesRequest)(nil), // 12: tensorflow.ListDevicesRequest + (*ListDevicesResponse)(nil), // 13: tensorflow.ListDevicesResponse + (*MakeCallableRequest)(nil), // 14: tensorflow.MakeCallableRequest + (*MakeCallableResponse)(nil), // 15: tensorflow.MakeCallableResponse + (*RunCallableRequest)(nil), // 16: tensorflow.RunCallableRequest + (*RunCallableResponse)(nil), // 17: tensorflow.RunCallableResponse + (*ReleaseCallableRequest)(nil), // 18: tensorflow.ReleaseCallableRequest + (*ReleaseCallableResponse)(nil), // 19: tensorflow.ReleaseCallableResponse + (*graph_go_proto.GraphDef)(nil), // 20: tensorflow.GraphDef + (*ConfigProto)(nil), // 21: tensorflow.ConfigProto + (*NamedTensorProto)(nil), // 22: tensorflow.NamedTensorProto + (*RunOptions)(nil), // 23: tensorflow.RunOptions + (*RunMetadata)(nil), // 24: tensorflow.RunMetadata + (Code)(0), // 25: tensorflow.error.Code + (*device_attributes_go_proto.DeviceAttributes)(nil), // 26: tensorflow.DeviceAttributes + (*CallableOptions)(nil), // 27: tensorflow.CallableOptions + (*tensor_go_proto.TensorProto)(nil), // 28: tensorflow.TensorProto +} +var file_tensorflow_core_protobuf_master_proto_depIdxs = []int32{ + 20, // 0: tensorflow.CreateSessionRequest.graph_def:type_name -> tensorflow.GraphDef + 21, // 1: tensorflow.CreateSessionRequest.config:type_name -> tensorflow.ConfigProto + 20, // 2: tensorflow.ExtendSessionRequest.graph_def:type_name -> tensorflow.GraphDef + 22, // 3: tensorflow.RunStepRequest.feed:type_name -> tensorflow.NamedTensorProto + 23, // 4: tensorflow.RunStepRequest.options:type_name -> tensorflow.RunOptions + 22, // 5: tensorflow.RunStepResponse.tensor:type_name -> tensorflow.NamedTensorProto + 24, // 6: tensorflow.RunStepResponse.metadata:type_name -> tensorflow.RunMetadata + 25, // 7: tensorflow.RunStepResponse.status_code:type_name -> tensorflow.error.Code + 26, // 8: tensorflow.ListDevicesResponse.local_device:type_name -> tensorflow.DeviceAttributes + 26, // 9: tensorflow.ListDevicesResponse.remote_device:type_name -> tensorflow.DeviceAttributes + 27, // 10: tensorflow.MakeCallableRequest.options:type_name -> tensorflow.CallableOptions + 28, // 11: tensorflow.RunCallableRequest.feed:type_name -> tensorflow.TensorProto + 28, // 12: tensorflow.RunCallableResponse.fetch:type_name -> tensorflow.TensorProto + 24, // 13: tensorflow.RunCallableResponse.metadata:type_name -> tensorflow.RunMetadata + 14, // [14:14] is the sub-list for method output_type + 14, // [14:14] is the sub-list for method input_type + 14, // [14:14] is the sub-list for extension type_name + 14, // [14:14] is the sub-list for extension extendee + 0, // [0:14] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_master_proto_init() } +func file_tensorflow_core_protobuf_master_proto_init() { + if File_tensorflow_core_protobuf_master_proto != nil { + return + } + file_tensorflow_core_protobuf_config_proto_init() + file_tensorflow_core_protobuf_error_codes_proto_init() + file_tensorflow_core_protobuf_named_tensor_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_master_proto_rawDesc), len(file_tensorflow_core_protobuf_master_proto_rawDesc)), + NumEnums: 0, + NumMessages: 20, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_master_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_master_proto_depIdxs, + MessageInfos: file_tensorflow_core_protobuf_master_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_master_proto = out.File + file_tensorflow_core_protobuf_master_proto_goTypes = nil + file_tensorflow_core_protobuf_master_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/master_service.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/master_service.pb.go new file mode 100644 index 0000000..57d778d --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/master_service.pb.go @@ -0,0 +1,128 @@ +// Copyright 2016 The TensorFlow Authors. All Rights Reserved. +// +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +//============================================================================== + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/master_service.proto + +package for_core_protos_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +var File_tensorflow_core_protobuf_master_service_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_master_service_proto_rawDesc = "" + + "\n" + + "-tensorflow/core/protobuf/master_service.proto\x12\x0ftensorflow.grpc\x1a%tensorflow/core/protobuf/master.proto2\xbb\x06\n" + + "\rMasterService\x12T\n" + + "\rCreateSession\x12 .tensorflow.CreateSessionRequest\x1a!.tensorflow.CreateSessionResponse\x12T\n" + + "\rExtendSession\x12 .tensorflow.ExtendSessionRequest\x1a!.tensorflow.ExtendSessionResponse\x12Z\n" + + "\x0fPartialRunSetup\x12\".tensorflow.PartialRunSetupRequest\x1a#.tensorflow.PartialRunSetupResponse\x12B\n" + + "\aRunStep\x12\x1a.tensorflow.RunStepRequest\x1a\x1b.tensorflow.RunStepResponse\x12Q\n" + + "\fCloseSession\x12\x1f.tensorflow.CloseSessionRequest\x1a .tensorflow.CloseSessionResponse\x12N\n" + + "\vListDevices\x12\x1e.tensorflow.ListDevicesRequest\x1a\x1f.tensorflow.ListDevicesResponse\x12<\n" + + "\x05Reset\x12\x18.tensorflow.ResetRequest\x1a\x19.tensorflow.ResetResponse\x12Q\n" + + "\fMakeCallable\x12\x1f.tensorflow.MakeCallableRequest\x1a .tensorflow.MakeCallableResponse\x12N\n" + + "\vRunCallable\x12\x1e.tensorflow.RunCallableRequest\x1a\x1f.tensorflow.RunCallableResponse\x12Z\n" + + "\x0fReleaseCallable\x12\".tensorflow.ReleaseCallableRequest\x1a#.tensorflow.ReleaseCallableResponseB\x8a\x01\n" + + "\x1aorg.tensorflow.distruntimeB\x13MasterServiceProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_protob\x06proto3" + +var file_tensorflow_core_protobuf_master_service_proto_goTypes = []any{ + (*CreateSessionRequest)(nil), // 0: tensorflow.CreateSessionRequest + (*ExtendSessionRequest)(nil), // 1: tensorflow.ExtendSessionRequest + (*PartialRunSetupRequest)(nil), // 2: tensorflow.PartialRunSetupRequest + (*RunStepRequest)(nil), // 3: tensorflow.RunStepRequest + (*CloseSessionRequest)(nil), // 4: tensorflow.CloseSessionRequest + (*ListDevicesRequest)(nil), // 5: tensorflow.ListDevicesRequest + (*ResetRequest)(nil), // 6: tensorflow.ResetRequest + (*MakeCallableRequest)(nil), // 7: tensorflow.MakeCallableRequest + (*RunCallableRequest)(nil), // 8: tensorflow.RunCallableRequest + (*ReleaseCallableRequest)(nil), // 9: tensorflow.ReleaseCallableRequest + (*CreateSessionResponse)(nil), // 10: tensorflow.CreateSessionResponse + (*ExtendSessionResponse)(nil), // 11: tensorflow.ExtendSessionResponse + (*PartialRunSetupResponse)(nil), // 12: tensorflow.PartialRunSetupResponse + (*RunStepResponse)(nil), // 13: tensorflow.RunStepResponse + (*CloseSessionResponse)(nil), // 14: tensorflow.CloseSessionResponse + (*ListDevicesResponse)(nil), // 15: tensorflow.ListDevicesResponse + (*ResetResponse)(nil), // 16: tensorflow.ResetResponse + (*MakeCallableResponse)(nil), // 17: tensorflow.MakeCallableResponse + (*RunCallableResponse)(nil), // 18: tensorflow.RunCallableResponse + (*ReleaseCallableResponse)(nil), // 19: tensorflow.ReleaseCallableResponse +} +var file_tensorflow_core_protobuf_master_service_proto_depIdxs = []int32{ + 0, // 0: tensorflow.grpc.MasterService.CreateSession:input_type -> tensorflow.CreateSessionRequest + 1, // 1: tensorflow.grpc.MasterService.ExtendSession:input_type -> tensorflow.ExtendSessionRequest + 2, // 2: tensorflow.grpc.MasterService.PartialRunSetup:input_type -> tensorflow.PartialRunSetupRequest + 3, // 3: tensorflow.grpc.MasterService.RunStep:input_type -> tensorflow.RunStepRequest + 4, // 4: tensorflow.grpc.MasterService.CloseSession:input_type -> tensorflow.CloseSessionRequest + 5, // 5: tensorflow.grpc.MasterService.ListDevices:input_type -> tensorflow.ListDevicesRequest + 6, // 6: tensorflow.grpc.MasterService.Reset:input_type -> tensorflow.ResetRequest + 7, // 7: tensorflow.grpc.MasterService.MakeCallable:input_type -> tensorflow.MakeCallableRequest + 8, // 8: tensorflow.grpc.MasterService.RunCallable:input_type -> tensorflow.RunCallableRequest + 9, // 9: tensorflow.grpc.MasterService.ReleaseCallable:input_type -> tensorflow.ReleaseCallableRequest + 10, // 10: tensorflow.grpc.MasterService.CreateSession:output_type -> tensorflow.CreateSessionResponse + 11, // 11: tensorflow.grpc.MasterService.ExtendSession:output_type -> tensorflow.ExtendSessionResponse + 12, // 12: tensorflow.grpc.MasterService.PartialRunSetup:output_type -> tensorflow.PartialRunSetupResponse + 13, // 13: tensorflow.grpc.MasterService.RunStep:output_type -> tensorflow.RunStepResponse + 14, // 14: tensorflow.grpc.MasterService.CloseSession:output_type -> tensorflow.CloseSessionResponse + 15, // 15: tensorflow.grpc.MasterService.ListDevices:output_type -> tensorflow.ListDevicesResponse + 16, // 16: tensorflow.grpc.MasterService.Reset:output_type -> tensorflow.ResetResponse + 17, // 17: tensorflow.grpc.MasterService.MakeCallable:output_type -> tensorflow.MakeCallableResponse + 18, // 18: tensorflow.grpc.MasterService.RunCallable:output_type -> tensorflow.RunCallableResponse + 19, // 19: tensorflow.grpc.MasterService.ReleaseCallable:output_type -> tensorflow.ReleaseCallableResponse + 10, // [10:20] is the sub-list for method output_type + 0, // [0:10] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_master_service_proto_init() } +func file_tensorflow_core_protobuf_master_service_proto_init() { + if File_tensorflow_core_protobuf_master_service_proto != nil { + return + } + file_tensorflow_core_protobuf_master_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_master_service_proto_rawDesc), len(file_tensorflow_core_protobuf_master_service_proto_rawDesc)), + NumEnums: 0, + NumMessages: 0, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_tensorflow_core_protobuf_master_service_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_master_service_proto_depIdxs, + }.Build() + File_tensorflow_core_protobuf_master_service_proto = out.File + file_tensorflow_core_protobuf_master_service_proto_goTypes = nil + file_tensorflow_core_protobuf_master_service_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/meta_graph.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/meta_graph.pb.go new file mode 100644 index 0000000..86ba2b7 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/meta_graph.pb.go @@ -0,0 +1,1343 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/meta_graph.proto + +package for_core_protos_go_proto + +import ( + graph_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/graph_go_proto" + op_def_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/op_def_go_proto" + tensor_shape_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_shape_go_proto" + types_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/types_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + anypb "google.golang.org/protobuf/types/known/anypb" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// 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 +// process boundary. It can be used for long term storage of graphs, +// cross-language execution of graphs, etc. +// +// MetaInfoDef +// GraphDef +// SaverDef +// CollectionDef +// TensorInfo +// SignatureDef +type MetaGraphDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + MetaInfoDef *MetaGraphDef_MetaInfoDef `protobuf:"bytes,1,opt,name=meta_info_def,json=metaInfoDef,proto3" json:"meta_info_def,omitempty"` + // GraphDef. + GraphDef *graph_go_proto.GraphDef `protobuf:"bytes,2,opt,name=graph_def,json=graphDef,proto3" json:"graph_def,omitempty"` + // SaverDef. + SaverDef *SaverDef `protobuf:"bytes,3,opt,name=saver_def,json=saverDef,proto3" json:"saver_def,omitempty"` + // collection_def: Map from collection name to collections. + // See CollectionDef section for details. + CollectionDef map[string]*CollectionDef `protobuf:"bytes,4,rep,name=collection_def,json=collectionDef,proto3" json:"collection_def,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // signature_def: Map from user supplied key for a signature to a single + // SignatureDef. + SignatureDef map[string]*SignatureDef `protobuf:"bytes,5,rep,name=signature_def,json=signatureDef,proto3" json:"signature_def,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // Asset file def to be used with the defined graph. + AssetFileDef []*AssetFileDef `protobuf:"bytes,6,rep,name=asset_file_def,json=assetFileDef,proto3" json:"asset_file_def,omitempty"` + // Extra information about the structure of functions and stateful objects. + ObjectGraphDef *SavedObjectGraph `protobuf:"bytes,7,opt,name=object_graph_def,json=objectGraphDef,proto3" json:"object_graph_def,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MetaGraphDef) Reset() { + *x = MetaGraphDef{} + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MetaGraphDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MetaGraphDef) ProtoMessage() {} + +func (x *MetaGraphDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MetaGraphDef.ProtoReflect.Descriptor instead. +func (*MetaGraphDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_meta_graph_proto_rawDescGZIP(), []int{0} +} + +func (x *MetaGraphDef) GetMetaInfoDef() *MetaGraphDef_MetaInfoDef { + if x != nil { + return x.MetaInfoDef + } + return nil +} + +func (x *MetaGraphDef) GetGraphDef() *graph_go_proto.GraphDef { + if x != nil { + return x.GraphDef + } + return nil +} + +func (x *MetaGraphDef) GetSaverDef() *SaverDef { + if x != nil { + return x.SaverDef + } + return nil +} + +func (x *MetaGraphDef) GetCollectionDef() map[string]*CollectionDef { + if x != nil { + return x.CollectionDef + } + return nil +} + +func (x *MetaGraphDef) GetSignatureDef() map[string]*SignatureDef { + if x != nil { + return x.SignatureDef + } + return nil +} + +func (x *MetaGraphDef) GetAssetFileDef() []*AssetFileDef { + if x != nil { + return x.AssetFileDef + } + return nil +} + +func (x *MetaGraphDef) GetObjectGraphDef() *SavedObjectGraph { + if x != nil { + return x.ObjectGraphDef + } + return nil +} + +// CollectionDef should cover most collections. +// To add a user-defined collection, do one of the following: +// 1. For simple data types, such as string, int, float: +// tf.add_to_collection("your_collection_name", your_simple_value) +// strings will be stored as bytes_list. +// +// 2. For Protobuf types, there are three ways to add them: +// +// 1. tf.add_to_collection("your_collection_name", +// your_proto.SerializeToString()) +// +// collection_def { +// key: "user_defined_bytes_collection" +// value { +// bytes_list { +// value: "queue_name: \"test_queue\"\n" +// } +// } +// } +// +// or +// +// 2. tf.add_to_collection("your_collection_name", str(your_proto)) +// +// collection_def { +// key: "user_defined_string_collection" +// value { +// bytes_list { +// value: "\n\ntest_queue" +// } +// } +// } +// +// or +// +// 3. any_buf = any_pb2.Any() +// tf.add_to_collection("your_collection_name", +// any_buf.Pack(your_proto)) +// +// collection_def { +// key: "user_defined_any_collection" +// value { +// any_list { +// value { +// type_url: "type.googleapis.com/tensorflow.QueueRunnerDef" +// value: "\n\ntest_queue" +// } +// } +// } +// } +// +// 3. For Python objects, implement to_proto() and from_proto(), and register +// them in the following manner: +// ops.register_proto_function("your_collection_name", +// proto_type, +// to_proto=YourPythonObject.to_proto, +// from_proto=YourPythonObject.from_proto) +// These functions will be invoked to serialize and de-serialize the +// collection. For example, +// ops.register_proto_function(ops.GraphKeys.GLOBAL_VARIABLES, +// proto_type=variable_pb2.VariableDef, +// to_proto=Variable.to_proto, +// from_proto=Variable.from_proto) +type CollectionDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Kind: + // + // *CollectionDef_NodeList_ + // *CollectionDef_BytesList_ + // *CollectionDef_Int64List_ + // *CollectionDef_FloatList_ + // *CollectionDef_AnyList_ + Kind isCollectionDef_Kind `protobuf_oneof:"kind"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CollectionDef) Reset() { + *x = CollectionDef{} + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CollectionDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CollectionDef) ProtoMessage() {} + +func (x *CollectionDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CollectionDef.ProtoReflect.Descriptor instead. +func (*CollectionDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_meta_graph_proto_rawDescGZIP(), []int{1} +} + +func (x *CollectionDef) GetKind() isCollectionDef_Kind { + if x != nil { + return x.Kind + } + return nil +} + +func (x *CollectionDef) GetNodeList() *CollectionDef_NodeList { + if x != nil { + if x, ok := x.Kind.(*CollectionDef_NodeList_); ok { + return x.NodeList + } + } + return nil +} + +func (x *CollectionDef) GetBytesList() *CollectionDef_BytesList { + if x != nil { + if x, ok := x.Kind.(*CollectionDef_BytesList_); ok { + return x.BytesList + } + } + return nil +} + +func (x *CollectionDef) GetInt64List() *CollectionDef_Int64List { + if x != nil { + if x, ok := x.Kind.(*CollectionDef_Int64List_); ok { + return x.Int64List + } + } + return nil +} + +func (x *CollectionDef) GetFloatList() *CollectionDef_FloatList { + if x != nil { + if x, ok := x.Kind.(*CollectionDef_FloatList_); ok { + return x.FloatList + } + } + return nil +} + +func (x *CollectionDef) GetAnyList() *CollectionDef_AnyList { + if x != nil { + if x, ok := x.Kind.(*CollectionDef_AnyList_); ok { + return x.AnyList + } + } + return nil +} + +type isCollectionDef_Kind interface { + isCollectionDef_Kind() +} + +type CollectionDef_NodeList_ struct { + NodeList *CollectionDef_NodeList `protobuf:"bytes,1,opt,name=node_list,json=nodeList,proto3,oneof"` +} + +type CollectionDef_BytesList_ struct { + BytesList *CollectionDef_BytesList `protobuf:"bytes,2,opt,name=bytes_list,json=bytesList,proto3,oneof"` +} + +type CollectionDef_Int64List_ struct { + Int64List *CollectionDef_Int64List `protobuf:"bytes,3,opt,name=int64_list,json=int64List,proto3,oneof"` +} + +type CollectionDef_FloatList_ struct { + FloatList *CollectionDef_FloatList `protobuf:"bytes,4,opt,name=float_list,json=floatList,proto3,oneof"` +} + +type CollectionDef_AnyList_ struct { + AnyList *CollectionDef_AnyList `protobuf:"bytes,5,opt,name=any_list,json=anyList,proto3,oneof"` +} + +func (*CollectionDef_NodeList_) isCollectionDef_Kind() {} + +func (*CollectionDef_BytesList_) isCollectionDef_Kind() {} + +func (*CollectionDef_Int64List_) isCollectionDef_Kind() {} + +func (*CollectionDef_FloatList_) isCollectionDef_Kind() {} + +func (*CollectionDef_AnyList_) isCollectionDef_Kind() {} + +// Information about a Tensor necessary for feeding or retrieval. +type TensorInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Encoding: + // + // *TensorInfo_Name + // *TensorInfo_CooSparse_ + // *TensorInfo_CompositeTensor_ + Encoding isTensorInfo_Encoding `protobuf_oneof:"encoding"` + Dtype types_go_proto.DataType `protobuf:"varint,2,opt,name=dtype,proto3,enum=tensorflow.DataType" json:"dtype,omitempty"` + // The static shape should be recorded here, to the extent that it can + // be known in advance. In the case of a SparseTensor, this field describes + // the logical shape of the represented tensor (aka dense_shape). + TensorShape *tensor_shape_go_proto.TensorShapeProto `protobuf:"bytes,3,opt,name=tensor_shape,json=tensorShape,proto3" json:"tensor_shape,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TensorInfo) Reset() { + *x = TensorInfo{} + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TensorInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TensorInfo) ProtoMessage() {} + +func (x *TensorInfo) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TensorInfo.ProtoReflect.Descriptor instead. +func (*TensorInfo) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_meta_graph_proto_rawDescGZIP(), []int{2} +} + +func (x *TensorInfo) GetEncoding() isTensorInfo_Encoding { + if x != nil { + return x.Encoding + } + return nil +} + +func (x *TensorInfo) GetName() string { + if x != nil { + if x, ok := x.Encoding.(*TensorInfo_Name); ok { + return x.Name + } + } + return "" +} + +func (x *TensorInfo) GetCooSparse() *TensorInfo_CooSparse { + if x != nil { + if x, ok := x.Encoding.(*TensorInfo_CooSparse_); ok { + return x.CooSparse + } + } + return nil +} + +func (x *TensorInfo) GetCompositeTensor() *TensorInfo_CompositeTensor { + if x != nil { + if x, ok := x.Encoding.(*TensorInfo_CompositeTensor_); ok { + return x.CompositeTensor + } + } + return nil +} + +func (x *TensorInfo) GetDtype() types_go_proto.DataType { + if x != nil { + return x.Dtype + } + return types_go_proto.DataType(0) +} + +func (x *TensorInfo) GetTensorShape() *tensor_shape_go_proto.TensorShapeProto { + if x != nil { + return x.TensorShape + } + return nil +} + +type isTensorInfo_Encoding interface { + isTensorInfo_Encoding() +} + +type TensorInfo_Name struct { + // For dense `Tensor`s, the name of the tensor in the graph. + Name string `protobuf:"bytes,1,opt,name=name,proto3,oneof"` +} + +type TensorInfo_CooSparse_ struct { + // There are many possible encodings of sparse matrices + // (https://en.wikipedia.org/wiki/Sparse_matrix). Currently, TensorFlow + // uses only the COO encoding. This is supported and documented in the + // SparseTensor Python class. + CooSparse *TensorInfo_CooSparse `protobuf:"bytes,4,opt,name=coo_sparse,json=cooSparse,proto3,oneof"` +} + +type TensorInfo_CompositeTensor_ struct { + // Generic encoding for CompositeTensors. + CompositeTensor *TensorInfo_CompositeTensor `protobuf:"bytes,5,opt,name=composite_tensor,json=compositeTensor,proto3,oneof"` +} + +func (*TensorInfo_Name) isTensorInfo_Encoding() {} + +func (*TensorInfo_CooSparse_) isTensorInfo_Encoding() {} + +func (*TensorInfo_CompositeTensor_) isTensorInfo_Encoding() {} + +// SignatureDef defines the signature of a computation supported by a TensorFlow +// graph. +// +// For example, a model with two loss computations, sharing a single input, +// might have the following signature_def map. +// +// Note that across the two SignatureDefs "loss_A" and "loss_B", the input key, +// output key, and method_name are identical, and will be used by system(s) that +// implement or rely upon this particular loss method. The output tensor names +// differ, demonstrating how different outputs can exist for the same method. +// +// signature_def { +// key: "loss_A" +// value { +// inputs { +// key: "input" +// value { +// name: "input:0" +// dtype: DT_STRING +// tensor_shape: ... +// } +// } +// outputs { +// key: "loss_output" +// value { +// name: "loss_output_A:0" +// dtype: DT_FLOAT +// tensor_shape: ... +// } +// } +// } +// ... +// method_name: "some/package/compute_loss" +// } +// +// signature_def { +// key: "loss_B" +// value { +// inputs { +// key: "input" +// value { +// name: "input:0" +// dtype: DT_STRING +// tensor_shape: ... +// } +// } +// outputs { +// key: "loss_output" +// value { +// name: "loss_output_B:0" +// dtype: DT_FLOAT +// tensor_shape: ... +// } +// } +// } +// ... +// method_name: "some/package/compute_loss" +// } +type SignatureDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Named input parameters. + Inputs map[string]*TensorInfo `protobuf:"bytes,1,rep,name=inputs,proto3" json:"inputs,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // Named output parameters. + Outputs map[string]*TensorInfo `protobuf:"bytes,2,rep,name=outputs,proto3" json:"outputs,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // Extensible method_name information enabling third-party users to mark a + // SignatureDef as supporting a particular method. This enables producers and + // consumers of SignatureDefs, e.g. a model definition library and a serving + // library to have a clear hand-off regarding the semantics of a computation. + // + // Note that multiple SignatureDefs in a single MetaGraphDef may have the same + // method_name. This is commonly used to support multi-headed computation, + // where a single graph computation may return multiple results. + MethodName string `protobuf:"bytes,3,opt,name=method_name,json=methodName,proto3" json:"method_name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SignatureDef) Reset() { + *x = SignatureDef{} + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SignatureDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SignatureDef) ProtoMessage() {} + +func (x *SignatureDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SignatureDef.ProtoReflect.Descriptor instead. +func (*SignatureDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_meta_graph_proto_rawDescGZIP(), []int{3} +} + +func (x *SignatureDef) GetInputs() map[string]*TensorInfo { + if x != nil { + return x.Inputs + } + return nil +} + +func (x *SignatureDef) GetOutputs() map[string]*TensorInfo { + if x != nil { + return x.Outputs + } + return nil +} + +func (x *SignatureDef) GetMethodName() string { + if x != nil { + return x.MethodName + } + return "" +} + +// An asset file def for a single file or a set of sharded files with the same +// name. +type AssetFileDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The tensor to bind the asset filename to. + TensorInfo *TensorInfo `protobuf:"bytes,1,opt,name=tensor_info,json=tensorInfo,proto3" json:"tensor_info,omitempty"` + // The filename within an assets directory. Note: does not include the path + // prefix, i.e. directories. For an asset at /tmp/path/vocab.txt, the filename + // would be "vocab.txt". + Filename string `protobuf:"bytes,2,opt,name=filename,proto3" json:"filename,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AssetFileDef) Reset() { + *x = AssetFileDef{} + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AssetFileDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AssetFileDef) ProtoMessage() {} + +func (x *AssetFileDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AssetFileDef.ProtoReflect.Descriptor instead. +func (*AssetFileDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_meta_graph_proto_rawDescGZIP(), []int{4} +} + +func (x *AssetFileDef) GetTensorInfo() *TensorInfo { + if x != nil { + return x.TensorInfo + } + return nil +} + +func (x *AssetFileDef) GetFilename() string { + if x != nil { + return x.Filename + } + return "" +} + +// Meta information regarding the graph to be exported. To be used by users +// of this protocol buffer to encode information regarding their meta graph. +type MetaGraphDef_MetaInfoDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // User specified Version string. Can be the name of the model and revision, + // steps this model has been trained to, etc. + MetaGraphVersion string `protobuf:"bytes,1,opt,name=meta_graph_version,json=metaGraphVersion,proto3" json:"meta_graph_version,omitempty"` + // A copy of the OpDefs used by the producer of this graph_def. + // Descriptions and Ops not used in graph_def are stripped out. + StrippedOpList *op_def_go_proto.OpList `protobuf:"bytes,2,opt,name=stripped_op_list,json=strippedOpList,proto3" json:"stripped_op_list,omitempty"` + // A serialized protobuf. Can be the time this meta graph is created, or + // modified, or name of the model. + AnyInfo *anypb.Any `protobuf:"bytes,3,opt,name=any_info,json=anyInfo,proto3" json:"any_info,omitempty"` + // User supplied tag(s) on the meta_graph and included graph_def. + // + // MetaGraphDefs should be tagged with their capabilities or use-cases. + // Examples: "train", "serve", "gpu", "tpu", etc. + // These tags enable loaders to access the MetaGraph(s) appropriate for a + // specific use-case or runtime environment. + Tags []string `protobuf:"bytes,4,rep,name=tags,proto3" json:"tags,omitempty"` + // The __version__ string of the tensorflow build used to write this graph. + // This will be populated by the framework, which will overwrite any user + // supplied value. + TensorflowVersion string `protobuf:"bytes,5,opt,name=tensorflow_version,json=tensorflowVersion,proto3" json:"tensorflow_version,omitempty"` + // The __git_version__ string of the tensorflow build used to write this + // graph. This will be populated by the framework, which will overwrite any + // user supplied value. + TensorflowGitVersion string `protobuf:"bytes,6,opt,name=tensorflow_git_version,json=tensorflowGitVersion,proto3" json:"tensorflow_git_version,omitempty"` + // A flag to denote whether default-valued attrs have been stripped from + // the nodes in this graph_def. + StrippedDefaultAttrs bool `protobuf:"varint,7,opt,name=stripped_default_attrs,json=strippedDefaultAttrs,proto3" json:"stripped_default_attrs,omitempty"` + // FunctionDef name to aliases mapping. + FunctionAliases map[string]string `protobuf:"bytes,8,rep,name=function_aliases,json=functionAliases,proto3" json:"function_aliases,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MetaGraphDef_MetaInfoDef) Reset() { + *x = MetaGraphDef_MetaInfoDef{} + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MetaGraphDef_MetaInfoDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MetaGraphDef_MetaInfoDef) ProtoMessage() {} + +func (x *MetaGraphDef_MetaInfoDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MetaGraphDef_MetaInfoDef.ProtoReflect.Descriptor instead. +func (*MetaGraphDef_MetaInfoDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_meta_graph_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *MetaGraphDef_MetaInfoDef) GetMetaGraphVersion() string { + if x != nil { + return x.MetaGraphVersion + } + return "" +} + +func (x *MetaGraphDef_MetaInfoDef) GetStrippedOpList() *op_def_go_proto.OpList { + if x != nil { + return x.StrippedOpList + } + return nil +} + +func (x *MetaGraphDef_MetaInfoDef) GetAnyInfo() *anypb.Any { + if x != nil { + return x.AnyInfo + } + return nil +} + +func (x *MetaGraphDef_MetaInfoDef) GetTags() []string { + if x != nil { + return x.Tags + } + return nil +} + +func (x *MetaGraphDef_MetaInfoDef) GetTensorflowVersion() string { + if x != nil { + return x.TensorflowVersion + } + return "" +} + +func (x *MetaGraphDef_MetaInfoDef) GetTensorflowGitVersion() string { + if x != nil { + return x.TensorflowGitVersion + } + return "" +} + +func (x *MetaGraphDef_MetaInfoDef) GetStrippedDefaultAttrs() bool { + if x != nil { + return x.StrippedDefaultAttrs + } + return false +} + +func (x *MetaGraphDef_MetaInfoDef) GetFunctionAliases() map[string]string { + if x != nil { + return x.FunctionAliases + } + return nil +} + +// NodeList is used for collecting nodes in graph. For example +// +// collection_def { +// key: "summaries" +// value { +// node_list { +// value: "input_producer/ScalarSummary:0" +// value: "shuffle_batch/ScalarSummary:0" +// value: "ImageSummary:0" +// } +// } +type CollectionDef_NodeList struct { + state protoimpl.MessageState `protogen:"open.v1"` + Value []string `protobuf:"bytes,1,rep,name=value,proto3" json:"value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CollectionDef_NodeList) Reset() { + *x = CollectionDef_NodeList{} + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CollectionDef_NodeList) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CollectionDef_NodeList) ProtoMessage() {} + +func (x *CollectionDef_NodeList) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CollectionDef_NodeList.ProtoReflect.Descriptor instead. +func (*CollectionDef_NodeList) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_meta_graph_proto_rawDescGZIP(), []int{1, 0} +} + +func (x *CollectionDef_NodeList) GetValue() []string { + if x != nil { + return x.Value + } + return nil +} + +// BytesList is used for collecting strings and serialized protobufs. For +// example: +// +// collection_def { +// key: "trainable_variables" +// value { +// bytes_list { +// value: "\n\017conv1/weights:0\022\024conv1/weights/Assign +// \032\024conv1/weights/read:0" +// value: "\n\016conv1/biases:0\022\023conv1/biases/Assign\032 +// \023conv1/biases/read:0" +// } +// } +// } +type CollectionDef_BytesList struct { + state protoimpl.MessageState `protogen:"open.v1"` + Value [][]byte `protobuf:"bytes,1,rep,name=value,proto3" json:"value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CollectionDef_BytesList) Reset() { + *x = CollectionDef_BytesList{} + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CollectionDef_BytesList) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CollectionDef_BytesList) ProtoMessage() {} + +func (x *CollectionDef_BytesList) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CollectionDef_BytesList.ProtoReflect.Descriptor instead. +func (*CollectionDef_BytesList) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_meta_graph_proto_rawDescGZIP(), []int{1, 1} +} + +func (x *CollectionDef_BytesList) GetValue() [][]byte { + if x != nil { + return x.Value + } + return nil +} + +// Int64List is used for collecting int, int64 and long values. +type CollectionDef_Int64List struct { + state protoimpl.MessageState `protogen:"open.v1"` + Value []int64 `protobuf:"varint,1,rep,packed,name=value,proto3" json:"value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CollectionDef_Int64List) Reset() { + *x = CollectionDef_Int64List{} + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CollectionDef_Int64List) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CollectionDef_Int64List) ProtoMessage() {} + +func (x *CollectionDef_Int64List) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CollectionDef_Int64List.ProtoReflect.Descriptor instead. +func (*CollectionDef_Int64List) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_meta_graph_proto_rawDescGZIP(), []int{1, 2} +} + +func (x *CollectionDef_Int64List) GetValue() []int64 { + if x != nil { + return x.Value + } + return nil +} + +// FloatList is used for collecting float values. +type CollectionDef_FloatList struct { + state protoimpl.MessageState `protogen:"open.v1"` + Value []float32 `protobuf:"fixed32,1,rep,packed,name=value,proto3" json:"value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CollectionDef_FloatList) Reset() { + *x = CollectionDef_FloatList{} + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CollectionDef_FloatList) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CollectionDef_FloatList) ProtoMessage() {} + +func (x *CollectionDef_FloatList) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CollectionDef_FloatList.ProtoReflect.Descriptor instead. +func (*CollectionDef_FloatList) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_meta_graph_proto_rawDescGZIP(), []int{1, 3} +} + +func (x *CollectionDef_FloatList) GetValue() []float32 { + if x != nil { + return x.Value + } + return nil +} + +// AnyList is used for collecting Any protos. +type CollectionDef_AnyList struct { + state protoimpl.MessageState `protogen:"open.v1"` + Value []*anypb.Any `protobuf:"bytes,1,rep,name=value,proto3" json:"value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CollectionDef_AnyList) Reset() { + *x = CollectionDef_AnyList{} + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CollectionDef_AnyList) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CollectionDef_AnyList) ProtoMessage() {} + +func (x *CollectionDef_AnyList) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[13] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CollectionDef_AnyList.ProtoReflect.Descriptor instead. +func (*CollectionDef_AnyList) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_meta_graph_proto_rawDescGZIP(), []int{1, 4} +} + +func (x *CollectionDef_AnyList) GetValue() []*anypb.Any { + if x != nil { + return x.Value + } + return nil +} + +// For sparse tensors, The COO encoding stores a triple of values, indices, +// and shape. +type TensorInfo_CooSparse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The shape of the values Tensor is [?]. Its dtype must be the dtype of + // the SparseTensor as a whole, given in the enclosing TensorInfo. + ValuesTensorName string `protobuf:"bytes,1,opt,name=values_tensor_name,json=valuesTensorName,proto3" json:"values_tensor_name,omitempty"` + // The indices Tensor must have dtype int64 and shape [?, ?]. + IndicesTensorName string `protobuf:"bytes,2,opt,name=indices_tensor_name,json=indicesTensorName,proto3" json:"indices_tensor_name,omitempty"` + // The dynamic logical shape represented by the SparseTensor is recorded in + // the Tensor referenced here. It must have dtype int64 and shape [?]. + DenseShapeTensorName string `protobuf:"bytes,3,opt,name=dense_shape_tensor_name,json=denseShapeTensorName,proto3" json:"dense_shape_tensor_name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TensorInfo_CooSparse) Reset() { + *x = TensorInfo_CooSparse{} + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TensorInfo_CooSparse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TensorInfo_CooSparse) ProtoMessage() {} + +func (x *TensorInfo_CooSparse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[14] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TensorInfo_CooSparse.ProtoReflect.Descriptor instead. +func (*TensorInfo_CooSparse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_meta_graph_proto_rawDescGZIP(), []int{2, 0} +} + +func (x *TensorInfo_CooSparse) GetValuesTensorName() string { + if x != nil { + return x.ValuesTensorName + } + return "" +} + +func (x *TensorInfo_CooSparse) GetIndicesTensorName() string { + if x != nil { + return x.IndicesTensorName + } + return "" +} + +func (x *TensorInfo_CooSparse) GetDenseShapeTensorName() string { + if x != nil { + return x.DenseShapeTensorName + } + return "" +} + +// Generic encoding for composite tensors. +type TensorInfo_CompositeTensor struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The serialized TypeSpec for the composite tensor. + TypeSpec *TypeSpecProto `protobuf:"bytes,1,opt,name=type_spec,json=typeSpec,proto3" json:"type_spec,omitempty"` + // A TensorInfo for each flattened component tensor. + Components []*TensorInfo `protobuf:"bytes,2,rep,name=components,proto3" json:"components,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TensorInfo_CompositeTensor) Reset() { + *x = TensorInfo_CompositeTensor{} + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TensorInfo_CompositeTensor) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TensorInfo_CompositeTensor) ProtoMessage() {} + +func (x *TensorInfo_CompositeTensor) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[15] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TensorInfo_CompositeTensor.ProtoReflect.Descriptor instead. +func (*TensorInfo_CompositeTensor) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_meta_graph_proto_rawDescGZIP(), []int{2, 1} +} + +func (x *TensorInfo_CompositeTensor) GetTypeSpec() *TypeSpecProto { + if x != nil { + return x.TypeSpec + } + return nil +} + +func (x *TensorInfo_CompositeTensor) GetComponents() []*TensorInfo { + if x != nil { + return x.Components + } + return nil +} + +var File_tensorflow_core_protobuf_meta_graph_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_meta_graph_proto_rawDesc = "" + + "\n" + + ")tensorflow/core/protobuf/meta_graph.proto\x12\n" + + "tensorflow\x1a\x19google/protobuf/any.proto\x1a%tensorflow/core/framework/graph.proto\x1a&tensorflow/core/framework/op_def.proto\x1a,tensorflow/core/framework/tensor_shape.proto\x1a%tensorflow/core/framework/types.proto\x1a1tensorflow/core/protobuf/saved_object_graph.proto\x1a$tensorflow/core/protobuf/saver.proto\x1a%tensorflow/core/protobuf/struct.proto\"\xa9\t\n" + + "\fMetaGraphDef\x12H\n" + + "\rmeta_info_def\x18\x01 \x01(\v2$.tensorflow.MetaGraphDef.MetaInfoDefR\vmetaInfoDef\x121\n" + + "\tgraph_def\x18\x02 \x01(\v2\x14.tensorflow.GraphDefR\bgraphDef\x121\n" + + "\tsaver_def\x18\x03 \x01(\v2\x14.tensorflow.SaverDefR\bsaverDef\x12R\n" + + "\x0ecollection_def\x18\x04 \x03(\v2+.tensorflow.MetaGraphDef.CollectionDefEntryR\rcollectionDef\x12O\n" + + "\rsignature_def\x18\x05 \x03(\v2*.tensorflow.MetaGraphDef.SignatureDefEntryR\fsignatureDef\x12>\n" + + "\x0easset_file_def\x18\x06 \x03(\v2\x18.tensorflow.AssetFileDefR\fassetFileDef\x12F\n" + + "\x10object_graph_def\x18\a \x01(\v2\x1c.tensorflow.SavedObjectGraphR\x0eobjectGraphDef\x1a\x83\x04\n" + + "\vMetaInfoDef\x12,\n" + + "\x12meta_graph_version\x18\x01 \x01(\tR\x10metaGraphVersion\x12<\n" + + "\x10stripped_op_list\x18\x02 \x01(\v2\x12.tensorflow.OpListR\x0estrippedOpList\x12/\n" + + "\bany_info\x18\x03 \x01(\v2\x14.google.protobuf.AnyR\aanyInfo\x12\x12\n" + + "\x04tags\x18\x04 \x03(\tR\x04tags\x12-\n" + + "\x12tensorflow_version\x18\x05 \x01(\tR\x11tensorflowVersion\x124\n" + + "\x16tensorflow_git_version\x18\x06 \x01(\tR\x14tensorflowGitVersion\x124\n" + + "\x16stripped_default_attrs\x18\a \x01(\bR\x14strippedDefaultAttrs\x12d\n" + + "\x10function_aliases\x18\b \x03(\v29.tensorflow.MetaGraphDef.MetaInfoDef.FunctionAliasesEntryR\x0ffunctionAliases\x1aB\n" + + "\x14FunctionAliasesEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\x1a[\n" + + "\x12CollectionDefEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12/\n" + + "\x05value\x18\x02 \x01(\v2\x19.tensorflow.CollectionDefR\x05value:\x028\x01\x1aY\n" + + "\x11SignatureDefEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12.\n" + + "\x05value\x18\x02 \x01(\v2\x18.tensorflow.SignatureDefR\x05value:\x028\x01\"\xb6\x04\n" + + "\rCollectionDef\x12A\n" + + "\tnode_list\x18\x01 \x01(\v2\".tensorflow.CollectionDef.NodeListH\x00R\bnodeList\x12D\n" + + "\n" + + "bytes_list\x18\x02 \x01(\v2#.tensorflow.CollectionDef.BytesListH\x00R\tbytesList\x12D\n" + + "\n" + + "int64_list\x18\x03 \x01(\v2#.tensorflow.CollectionDef.Int64ListH\x00R\tint64List\x12D\n" + + "\n" + + "float_list\x18\x04 \x01(\v2#.tensorflow.CollectionDef.FloatListH\x00R\tfloatList\x12>\n" + + "\bany_list\x18\x05 \x01(\v2!.tensorflow.CollectionDef.AnyListH\x00R\aanyList\x1a \n" + + "\bNodeList\x12\x14\n" + + "\x05value\x18\x01 \x03(\tR\x05value\x1a!\n" + + "\tBytesList\x12\x14\n" + + "\x05value\x18\x01 \x03(\fR\x05value\x1a%\n" + + "\tInt64List\x12\x18\n" + + "\x05value\x18\x01 \x03(\x03B\x02\x10\x01R\x05value\x1a%\n" + + "\tFloatList\x12\x18\n" + + "\x05value\x18\x01 \x03(\x02B\x02\x10\x01R\x05value\x1a5\n" + + "\aAnyList\x12*\n" + + "\x05value\x18\x01 \x03(\v2\x14.google.protobuf.AnyR\x05valueB\x06\n" + + "\x04kind\"\xda\x04\n" + + "\n" + + "TensorInfo\x12\x14\n" + + "\x04name\x18\x01 \x01(\tH\x00R\x04name\x12A\n" + + "\n" + + "coo_sparse\x18\x04 \x01(\v2 .tensorflow.TensorInfo.CooSparseH\x00R\tcooSparse\x12S\n" + + "\x10composite_tensor\x18\x05 \x01(\v2&.tensorflow.TensorInfo.CompositeTensorH\x00R\x0fcompositeTensor\x12*\n" + + "\x05dtype\x18\x02 \x01(\x0e2\x14.tensorflow.DataTypeR\x05dtype\x12?\n" + + "\ftensor_shape\x18\x03 \x01(\v2\x1c.tensorflow.TensorShapeProtoR\vtensorShape\x1a\xa0\x01\n" + + "\tCooSparse\x12,\n" + + "\x12values_tensor_name\x18\x01 \x01(\tR\x10valuesTensorName\x12.\n" + + "\x13indices_tensor_name\x18\x02 \x01(\tR\x11indicesTensorName\x125\n" + + "\x17dense_shape_tensor_name\x18\x03 \x01(\tR\x14denseShapeTensorName\x1a\x81\x01\n" + + "\x0fCompositeTensor\x126\n" + + "\ttype_spec\x18\x01 \x01(\v2\x19.tensorflow.TypeSpecProtoR\btypeSpec\x126\n" + + "\n" + + "components\x18\x02 \x03(\v2\x16.tensorflow.TensorInfoR\n" + + "componentsB\n" + + "\n" + + "\bencoding\"\xd5\x02\n" + + "\fSignatureDef\x12<\n" + + "\x06inputs\x18\x01 \x03(\v2$.tensorflow.SignatureDef.InputsEntryR\x06inputs\x12?\n" + + "\aoutputs\x18\x02 \x03(\v2%.tensorflow.SignatureDef.OutputsEntryR\aoutputs\x12\x1f\n" + + "\vmethod_name\x18\x03 \x01(\tR\n" + + "methodName\x1aQ\n" + + "\vInputsEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12,\n" + + "\x05value\x18\x02 \x01(\v2\x16.tensorflow.TensorInfoR\x05value:\x028\x01\x1aR\n" + + "\fOutputsEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12,\n" + + "\x05value\x18\x02 \x01(\v2\x16.tensorflow.TensorInfoR\x05value:\x028\x01\"c\n" + + "\fAssetFileDef\x127\n" + + "\vtensor_info\x18\x01 \x01(\v2\x16.tensorflow.TensorInfoR\n" + + "tensorInfo\x12\x1a\n" + + "\bfilename\x18\x02 \x01(\tR\bfilenameB\x87\x01\n" + + "\x18org.tensorflow.frameworkB\x0fMetaGraphProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_meta_graph_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_meta_graph_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_meta_graph_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_meta_graph_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_meta_graph_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_meta_graph_proto_rawDesc), len(file_tensorflow_core_protobuf_meta_graph_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_meta_graph_proto_rawDescData +} + +var file_tensorflow_core_protobuf_meta_graph_proto_msgTypes = make([]protoimpl.MessageInfo, 18) +var file_tensorflow_core_protobuf_meta_graph_proto_goTypes = []any{ + (*MetaGraphDef)(nil), // 0: tensorflow.MetaGraphDef + (*CollectionDef)(nil), // 1: tensorflow.CollectionDef + (*TensorInfo)(nil), // 2: tensorflow.TensorInfo + (*SignatureDef)(nil), // 3: tensorflow.SignatureDef + (*AssetFileDef)(nil), // 4: tensorflow.AssetFileDef + (*MetaGraphDef_MetaInfoDef)(nil), // 5: tensorflow.MetaGraphDef.MetaInfoDef + nil, // 6: tensorflow.MetaGraphDef.CollectionDefEntry + nil, // 7: tensorflow.MetaGraphDef.SignatureDefEntry + nil, // 8: tensorflow.MetaGraphDef.MetaInfoDef.FunctionAliasesEntry + (*CollectionDef_NodeList)(nil), // 9: tensorflow.CollectionDef.NodeList + (*CollectionDef_BytesList)(nil), // 10: tensorflow.CollectionDef.BytesList + (*CollectionDef_Int64List)(nil), // 11: tensorflow.CollectionDef.Int64List + (*CollectionDef_FloatList)(nil), // 12: tensorflow.CollectionDef.FloatList + (*CollectionDef_AnyList)(nil), // 13: tensorflow.CollectionDef.AnyList + (*TensorInfo_CooSparse)(nil), // 14: tensorflow.TensorInfo.CooSparse + (*TensorInfo_CompositeTensor)(nil), // 15: tensorflow.TensorInfo.CompositeTensor + nil, // 16: tensorflow.SignatureDef.InputsEntry + nil, // 17: tensorflow.SignatureDef.OutputsEntry + (*graph_go_proto.GraphDef)(nil), // 18: tensorflow.GraphDef + (*SaverDef)(nil), // 19: tensorflow.SaverDef + (*SavedObjectGraph)(nil), // 20: tensorflow.SavedObjectGraph + (types_go_proto.DataType)(0), // 21: tensorflow.DataType + (*tensor_shape_go_proto.TensorShapeProto)(nil), // 22: tensorflow.TensorShapeProto + (*op_def_go_proto.OpList)(nil), // 23: tensorflow.OpList + (*anypb.Any)(nil), // 24: google.protobuf.Any + (*TypeSpecProto)(nil), // 25: tensorflow.TypeSpecProto +} +var file_tensorflow_core_protobuf_meta_graph_proto_depIdxs = []int32{ + 5, // 0: tensorflow.MetaGraphDef.meta_info_def:type_name -> tensorflow.MetaGraphDef.MetaInfoDef + 18, // 1: tensorflow.MetaGraphDef.graph_def:type_name -> tensorflow.GraphDef + 19, // 2: tensorflow.MetaGraphDef.saver_def:type_name -> tensorflow.SaverDef + 6, // 3: tensorflow.MetaGraphDef.collection_def:type_name -> tensorflow.MetaGraphDef.CollectionDefEntry + 7, // 4: tensorflow.MetaGraphDef.signature_def:type_name -> tensorflow.MetaGraphDef.SignatureDefEntry + 4, // 5: tensorflow.MetaGraphDef.asset_file_def:type_name -> tensorflow.AssetFileDef + 20, // 6: tensorflow.MetaGraphDef.object_graph_def:type_name -> tensorflow.SavedObjectGraph + 9, // 7: tensorflow.CollectionDef.node_list:type_name -> tensorflow.CollectionDef.NodeList + 10, // 8: tensorflow.CollectionDef.bytes_list:type_name -> tensorflow.CollectionDef.BytesList + 11, // 9: tensorflow.CollectionDef.int64_list:type_name -> tensorflow.CollectionDef.Int64List + 12, // 10: tensorflow.CollectionDef.float_list:type_name -> tensorflow.CollectionDef.FloatList + 13, // 11: tensorflow.CollectionDef.any_list:type_name -> tensorflow.CollectionDef.AnyList + 14, // 12: tensorflow.TensorInfo.coo_sparse:type_name -> tensorflow.TensorInfo.CooSparse + 15, // 13: tensorflow.TensorInfo.composite_tensor:type_name -> tensorflow.TensorInfo.CompositeTensor + 21, // 14: tensorflow.TensorInfo.dtype:type_name -> tensorflow.DataType + 22, // 15: tensorflow.TensorInfo.tensor_shape:type_name -> tensorflow.TensorShapeProto + 16, // 16: tensorflow.SignatureDef.inputs:type_name -> tensorflow.SignatureDef.InputsEntry + 17, // 17: tensorflow.SignatureDef.outputs:type_name -> tensorflow.SignatureDef.OutputsEntry + 2, // 18: tensorflow.AssetFileDef.tensor_info:type_name -> tensorflow.TensorInfo + 23, // 19: tensorflow.MetaGraphDef.MetaInfoDef.stripped_op_list:type_name -> tensorflow.OpList + 24, // 20: tensorflow.MetaGraphDef.MetaInfoDef.any_info:type_name -> google.protobuf.Any + 8, // 21: tensorflow.MetaGraphDef.MetaInfoDef.function_aliases:type_name -> tensorflow.MetaGraphDef.MetaInfoDef.FunctionAliasesEntry + 1, // 22: tensorflow.MetaGraphDef.CollectionDefEntry.value:type_name -> tensorflow.CollectionDef + 3, // 23: tensorflow.MetaGraphDef.SignatureDefEntry.value:type_name -> tensorflow.SignatureDef + 24, // 24: tensorflow.CollectionDef.AnyList.value:type_name -> google.protobuf.Any + 25, // 25: tensorflow.TensorInfo.CompositeTensor.type_spec:type_name -> tensorflow.TypeSpecProto + 2, // 26: tensorflow.TensorInfo.CompositeTensor.components:type_name -> tensorflow.TensorInfo + 2, // 27: tensorflow.SignatureDef.InputsEntry.value:type_name -> tensorflow.TensorInfo + 2, // 28: tensorflow.SignatureDef.OutputsEntry.value:type_name -> tensorflow.TensorInfo + 29, // [29:29] is the sub-list for method output_type + 29, // [29:29] is the sub-list for method input_type + 29, // [29:29] is the sub-list for extension type_name + 29, // [29:29] is the sub-list for extension extendee + 0, // [0:29] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_meta_graph_proto_init() } +func file_tensorflow_core_protobuf_meta_graph_proto_init() { + if File_tensorflow_core_protobuf_meta_graph_proto != nil { + return + } + file_tensorflow_core_protobuf_saved_object_graph_proto_init() + file_tensorflow_core_protobuf_saver_proto_init() + file_tensorflow_core_protobuf_struct_proto_init() + file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[1].OneofWrappers = []any{ + (*CollectionDef_NodeList_)(nil), + (*CollectionDef_BytesList_)(nil), + (*CollectionDef_Int64List_)(nil), + (*CollectionDef_FloatList_)(nil), + (*CollectionDef_AnyList_)(nil), + } + file_tensorflow_core_protobuf_meta_graph_proto_msgTypes[2].OneofWrappers = []any{ + (*TensorInfo_Name)(nil), + (*TensorInfo_CooSparse_)(nil), + (*TensorInfo_CompositeTensor_)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_meta_graph_proto_rawDesc), len(file_tensorflow_core_protobuf_meta_graph_proto_rawDesc)), + NumEnums: 0, + NumMessages: 18, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_meta_graph_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_meta_graph_proto_depIdxs, + MessageInfos: file_tensorflow_core_protobuf_meta_graph_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_meta_graph_proto = out.File + file_tensorflow_core_protobuf_meta_graph_proto_goTypes = nil + file_tensorflow_core_protobuf_meta_graph_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/named_tensor.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/named_tensor.pb.go new file mode 100644 index 0000000..6a95198 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/named_tensor.pb.go @@ -0,0 +1,144 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/named_tensor.proto + +package for_core_protos_go_proto + +import ( + tensor_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// A pair of tensor name and tensor values. +type NamedTensorProto struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Name of the tensor. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // The client can populate a TensorProto using a tensorflow::Tensor`, or + // directly using the protobuf field accessors. + // + // The client specifies whether the returned tensor values should be + // filled tensor fields (float_val, int_val, etc.) or encoded in a + // compact form in tensor.tensor_content. + Tensor *tensor_go_proto.TensorProto `protobuf:"bytes,2,opt,name=tensor,proto3" json:"tensor,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NamedTensorProto) Reset() { + *x = NamedTensorProto{} + mi := &file_tensorflow_core_protobuf_named_tensor_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NamedTensorProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NamedTensorProto) ProtoMessage() {} + +func (x *NamedTensorProto) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_named_tensor_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NamedTensorProto.ProtoReflect.Descriptor instead. +func (*NamedTensorProto) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_named_tensor_proto_rawDescGZIP(), []int{0} +} + +func (x *NamedTensorProto) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *NamedTensorProto) GetTensor() *tensor_go_proto.TensorProto { + if x != nil { + return x.Tensor + } + return nil +} + +var File_tensorflow_core_protobuf_named_tensor_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_named_tensor_proto_rawDesc = "" + + "\n" + + "+tensorflow/core/protobuf/named_tensor.proto\x12\n" + + "tensorflow\x1a&tensorflow/core/framework/tensor.proto\"W\n" + + "\x10NamedTensorProto\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12/\n" + + "\x06tensor\x18\x02 \x01(\v2\x17.tensorflow.TensorProtoR\x06tensorB\x89\x01\n" + + "\x18org.tensorflow.frameworkB\x11NamedTensorProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_named_tensor_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_named_tensor_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_named_tensor_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_named_tensor_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_named_tensor_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_named_tensor_proto_rawDesc), len(file_tensorflow_core_protobuf_named_tensor_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_named_tensor_proto_rawDescData +} + +var file_tensorflow_core_protobuf_named_tensor_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_tensorflow_core_protobuf_named_tensor_proto_goTypes = []any{ + (*NamedTensorProto)(nil), // 0: tensorflow.NamedTensorProto + (*tensor_go_proto.TensorProto)(nil), // 1: tensorflow.TensorProto +} +var file_tensorflow_core_protobuf_named_tensor_proto_depIdxs = []int32{ + 1, // 0: tensorflow.NamedTensorProto.tensor:type_name -> tensorflow.TensorProto + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_named_tensor_proto_init() } +func file_tensorflow_core_protobuf_named_tensor_proto_init() { + if File_tensorflow_core_protobuf_named_tensor_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_named_tensor_proto_rawDesc), len(file_tensorflow_core_protobuf_named_tensor_proto_rawDesc)), + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_named_tensor_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_named_tensor_proto_depIdxs, + MessageInfos: file_tensorflow_core_protobuf_named_tensor_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_named_tensor_proto = out.File + file_tensorflow_core_protobuf_named_tensor_proto_goTypes = nil + file_tensorflow_core_protobuf_named_tensor_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/queue_runner.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/queue_runner.pb.go new file mode 100644 index 0000000..2a0bef4 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/queue_runner.pb.go @@ -0,0 +1,171 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/queue_runner.proto + +package for_core_protos_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Protocol buffer representing a QueueRunner. +type QueueRunnerDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Queue name. + QueueName string `protobuf:"bytes,1,opt,name=queue_name,json=queueName,proto3" json:"queue_name,omitempty"` + // A list of enqueue operations. + EnqueueOpName []string `protobuf:"bytes,2,rep,name=enqueue_op_name,json=enqueueOpName,proto3" json:"enqueue_op_name,omitempty"` + // The operation to run to close the queue. + CloseOpName string `protobuf:"bytes,3,opt,name=close_op_name,json=closeOpName,proto3" json:"close_op_name,omitempty"` + // The operation to run to cancel the queue. + CancelOpName string `protobuf:"bytes,4,opt,name=cancel_op_name,json=cancelOpName,proto3" json:"cancel_op_name,omitempty"` + // A list of exception types considered to signal a safely closed queue + // if raised during enqueue operations. + QueueClosedExceptionTypes []Code `protobuf:"varint,5,rep,packed,name=queue_closed_exception_types,json=queueClosedExceptionTypes,proto3,enum=tensorflow.error.Code" json:"queue_closed_exception_types,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *QueueRunnerDef) Reset() { + *x = QueueRunnerDef{} + mi := &file_tensorflow_core_protobuf_queue_runner_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *QueueRunnerDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueueRunnerDef) ProtoMessage() {} + +func (x *QueueRunnerDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_queue_runner_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use QueueRunnerDef.ProtoReflect.Descriptor instead. +func (*QueueRunnerDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_queue_runner_proto_rawDescGZIP(), []int{0} +} + +func (x *QueueRunnerDef) GetQueueName() string { + if x != nil { + return x.QueueName + } + return "" +} + +func (x *QueueRunnerDef) GetEnqueueOpName() []string { + if x != nil { + return x.EnqueueOpName + } + return nil +} + +func (x *QueueRunnerDef) GetCloseOpName() string { + if x != nil { + return x.CloseOpName + } + return "" +} + +func (x *QueueRunnerDef) GetCancelOpName() string { + if x != nil { + return x.CancelOpName + } + return "" +} + +func (x *QueueRunnerDef) GetQueueClosedExceptionTypes() []Code { + if x != nil { + return x.QueueClosedExceptionTypes + } + return nil +} + +var File_tensorflow_core_protobuf_queue_runner_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_queue_runner_proto_rawDesc = "" + + "\n" + + "+tensorflow/core/protobuf/queue_runner.proto\x12\n" + + "tensorflow\x1a*tensorflow/core/protobuf/error_codes.proto\"\xfa\x01\n" + + "\x0eQueueRunnerDef\x12\x1d\n" + + "\n" + + "queue_name\x18\x01 \x01(\tR\tqueueName\x12&\n" + + "\x0fenqueue_op_name\x18\x02 \x03(\tR\renqueueOpName\x12\"\n" + + "\rclose_op_name\x18\x03 \x01(\tR\vcloseOpName\x12$\n" + + "\x0ecancel_op_name\x18\x04 \x01(\tR\fcancelOpName\x12W\n" + + "\x1cqueue_closed_exception_types\x18\x05 \x03(\x0e2\x16.tensorflow.error.CodeR\x19queueClosedExceptionTypesB\x89\x01\n" + + "\x18org.tensorflow.frameworkB\x11QueueRunnerProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_queue_runner_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_queue_runner_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_queue_runner_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_queue_runner_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_queue_runner_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_queue_runner_proto_rawDesc), len(file_tensorflow_core_protobuf_queue_runner_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_queue_runner_proto_rawDescData +} + +var file_tensorflow_core_protobuf_queue_runner_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_tensorflow_core_protobuf_queue_runner_proto_goTypes = []any{ + (*QueueRunnerDef)(nil), // 0: tensorflow.QueueRunnerDef + (Code)(0), // 1: tensorflow.error.Code +} +var file_tensorflow_core_protobuf_queue_runner_proto_depIdxs = []int32{ + 1, // 0: tensorflow.QueueRunnerDef.queue_closed_exception_types:type_name -> tensorflow.error.Code + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_queue_runner_proto_init() } +func file_tensorflow_core_protobuf_queue_runner_proto_init() { + if File_tensorflow_core_protobuf_queue_runner_proto != nil { + return + } + file_tensorflow_core_protobuf_error_codes_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_queue_runner_proto_rawDesc), len(file_tensorflow_core_protobuf_queue_runner_proto_rawDesc)), + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_queue_runner_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_queue_runner_proto_depIdxs, + MessageInfos: file_tensorflow_core_protobuf_queue_runner_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_queue_runner_proto = out.File + file_tensorflow_core_protobuf_queue_runner_proto_goTypes = nil + file_tensorflow_core_protobuf_queue_runner_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/remote_tensor_handle.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/remote_tensor_handle.pb.go new file mode 100644 index 0000000..014eca9 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/remote_tensor_handle.pb.go @@ -0,0 +1,241 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/remote_tensor_handle.proto + +package for_core_protos_go_proto + +import ( + tensor_shape_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_shape_go_proto" + types_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/types_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type ResourceDtypeAndShape struct { + state protoimpl.MessageState `protogen:"open.v1"` + Dtype types_go_proto.DataType `protobuf:"varint,1,opt,name=dtype,proto3,enum=tensorflow.DataType" json:"dtype,omitempty"` + Shape *tensor_shape_go_proto.TensorShapeProto `protobuf:"bytes,2,opt,name=shape,proto3" json:"shape,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ResourceDtypeAndShape) Reset() { + *x = ResourceDtypeAndShape{} + mi := &file_tensorflow_core_protobuf_remote_tensor_handle_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ResourceDtypeAndShape) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResourceDtypeAndShape) ProtoMessage() {} + +func (x *ResourceDtypeAndShape) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_remote_tensor_handle_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ResourceDtypeAndShape.ProtoReflect.Descriptor instead. +func (*ResourceDtypeAndShape) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_remote_tensor_handle_proto_rawDescGZIP(), []int{0} +} + +func (x *ResourceDtypeAndShape) GetDtype() types_go_proto.DataType { + if x != nil { + return x.Dtype + } + return types_go_proto.DataType(0) +} + +func (x *ResourceDtypeAndShape) GetShape() *tensor_shape_go_proto.TensorShapeProto { + if x != nil { + return x.Shape + } + return nil +} + +type RemoteTensorHandle struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The ID of the operation that produced this tensor. + OpId int64 `protobuf:"varint,1,opt,name=op_id,json=opId,proto3" json:"op_id,omitempty"` + // The index into the outputs of the operation that produced this tensor. + OutputNum int32 `protobuf:"varint,2,opt,name=output_num,json=outputNum,proto3" json:"output_num,omitempty"` + // Device where the tensor is located. Cannot be empty. + // For multi-device functions, it's the default device passed to placer. + Device string `protobuf:"bytes,3,opt,name=device,proto3" json:"device,omitempty"` + // Device of the operation producing this tensor. Can be empty if the + // operation producing this tensor is a multi-device function. + OpDevice string `protobuf:"bytes,4,opt,name=op_device,json=opDevice,proto3" json:"op_device,omitempty"` + // Tensor type. + Dtype types_go_proto.DataType `protobuf:"varint,5,opt,name=dtype,proto3,enum=tensorflow.DataType" json:"dtype,omitempty"` + // Optional data types and shapes of a remote resource variable. + ResourceDtypesAndShapes []*ResourceDtypeAndShape `protobuf:"bytes,6,rep,name=resource_dtypes_and_shapes,json=resourceDtypesAndShapes,proto3" json:"resource_dtypes_and_shapes,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RemoteTensorHandle) Reset() { + *x = RemoteTensorHandle{} + mi := &file_tensorflow_core_protobuf_remote_tensor_handle_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RemoteTensorHandle) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoteTensorHandle) ProtoMessage() {} + +func (x *RemoteTensorHandle) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_remote_tensor_handle_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RemoteTensorHandle.ProtoReflect.Descriptor instead. +func (*RemoteTensorHandle) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_remote_tensor_handle_proto_rawDescGZIP(), []int{1} +} + +func (x *RemoteTensorHandle) GetOpId() int64 { + if x != nil { + return x.OpId + } + return 0 +} + +func (x *RemoteTensorHandle) GetOutputNum() int32 { + if x != nil { + return x.OutputNum + } + return 0 +} + +func (x *RemoteTensorHandle) GetDevice() string { + if x != nil { + return x.Device + } + return "" +} + +func (x *RemoteTensorHandle) GetOpDevice() string { + if x != nil { + return x.OpDevice + } + return "" +} + +func (x *RemoteTensorHandle) GetDtype() types_go_proto.DataType { + if x != nil { + return x.Dtype + } + return types_go_proto.DataType(0) +} + +func (x *RemoteTensorHandle) GetResourceDtypesAndShapes() []*ResourceDtypeAndShape { + if x != nil { + return x.ResourceDtypesAndShapes + } + return nil +} + +var File_tensorflow_core_protobuf_remote_tensor_handle_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_remote_tensor_handle_proto_rawDesc = "" + + "\n" + + "3tensorflow/core/protobuf/remote_tensor_handle.proto\x12\x10tensorflow.eager\x1a,tensorflow/core/framework/tensor_shape.proto\x1a%tensorflow/core/framework/types.proto\"w\n" + + "\x15ResourceDtypeAndShape\x12*\n" + + "\x05dtype\x18\x01 \x01(\x0e2\x14.tensorflow.DataTypeR\x05dtype\x122\n" + + "\x05shape\x18\x02 \x01(\v2\x1c.tensorflow.TensorShapeProtoR\x05shape\"\x8f\x02\n" + + "\x12RemoteTensorHandle\x12\x13\n" + + "\x05op_id\x18\x01 \x01(\x03R\x04opId\x12\x1d\n" + + "\n" + + "output_num\x18\x02 \x01(\x05R\toutputNum\x12\x16\n" + + "\x06device\x18\x03 \x01(\tR\x06device\x12\x1b\n" + + "\top_device\x18\x04 \x01(\tR\bopDevice\x12*\n" + + "\x05dtype\x18\x05 \x01(\x0e2\x14.tensorflow.DataTypeR\x05dtype\x12d\n" + + "\x1aresource_dtypes_and_shapes\x18\x06 \x03(\v2'.tensorflow.eager.ResourceDtypeAndShapeR\x17resourceDtypesAndShapesB\x90\x01\n" + + "\x18org.tensorflow.frameworkB\x18RemoteTensorHandleProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_remote_tensor_handle_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_remote_tensor_handle_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_remote_tensor_handle_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_remote_tensor_handle_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_remote_tensor_handle_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_remote_tensor_handle_proto_rawDesc), len(file_tensorflow_core_protobuf_remote_tensor_handle_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_remote_tensor_handle_proto_rawDescData +} + +var file_tensorflow_core_protobuf_remote_tensor_handle_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_tensorflow_core_protobuf_remote_tensor_handle_proto_goTypes = []any{ + (*ResourceDtypeAndShape)(nil), // 0: tensorflow.eager.ResourceDtypeAndShape + (*RemoteTensorHandle)(nil), // 1: tensorflow.eager.RemoteTensorHandle + (types_go_proto.DataType)(0), // 2: tensorflow.DataType + (*tensor_shape_go_proto.TensorShapeProto)(nil), // 3: tensorflow.TensorShapeProto +} +var file_tensorflow_core_protobuf_remote_tensor_handle_proto_depIdxs = []int32{ + 2, // 0: tensorflow.eager.ResourceDtypeAndShape.dtype:type_name -> tensorflow.DataType + 3, // 1: tensorflow.eager.ResourceDtypeAndShape.shape:type_name -> tensorflow.TensorShapeProto + 2, // 2: tensorflow.eager.RemoteTensorHandle.dtype:type_name -> tensorflow.DataType + 0, // 3: tensorflow.eager.RemoteTensorHandle.resource_dtypes_and_shapes:type_name -> tensorflow.eager.ResourceDtypeAndShape + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_remote_tensor_handle_proto_init() } +func file_tensorflow_core_protobuf_remote_tensor_handle_proto_init() { + if File_tensorflow_core_protobuf_remote_tensor_handle_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_remote_tensor_handle_proto_rawDesc), len(file_tensorflow_core_protobuf_remote_tensor_handle_proto_rawDesc)), + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_remote_tensor_handle_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_remote_tensor_handle_proto_depIdxs, + MessageInfos: file_tensorflow_core_protobuf_remote_tensor_handle_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_remote_tensor_handle_proto = out.File + file_tensorflow_core_protobuf_remote_tensor_handle_proto_goTypes = nil + file_tensorflow_core_protobuf_remote_tensor_handle_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/replay_log.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/replay_log.pb.go new file mode 100644 index 0000000..cfcb03b --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/replay_log.pb.go @@ -0,0 +1,645 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/replay_log.proto + +package for_core_protos_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Records the creation of a new replay session. We record the device listing +// here to capture the state of the cluster. +type NewReplaySession struct { + state protoimpl.MessageState `protogen:"open.v1"` + Devices *ListDevicesResponse `protobuf:"bytes,1,opt,name=devices,proto3" json:"devices,omitempty"` + SessionHandle string `protobuf:"bytes,2,opt,name=session_handle,json=sessionHandle,proto3" json:"session_handle,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NewReplaySession) Reset() { + *x = NewReplaySession{} + mi := &file_tensorflow_core_protobuf_replay_log_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NewReplaySession) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NewReplaySession) ProtoMessage() {} + +func (x *NewReplaySession) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_replay_log_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NewReplaySession.ProtoReflect.Descriptor instead. +func (*NewReplaySession) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_replay_log_proto_rawDescGZIP(), []int{0} +} + +func (x *NewReplaySession) GetDevices() *ListDevicesResponse { + if x != nil { + return x.Devices + } + return nil +} + +func (x *NewReplaySession) GetSessionHandle() string { + if x != nil { + return x.SessionHandle + } + return "" +} + +type ReplayOp struct { + state protoimpl.MessageState `protogen:"open.v1"` + StartTimeUs float64 `protobuf:"fixed64,31,opt,name=start_time_us,json=startTimeUs,proto3" json:"start_time_us,omitempty"` + EndTimeUs float64 `protobuf:"fixed64,32,opt,name=end_time_us,json=endTimeUs,proto3" json:"end_time_us,omitempty"` + // Types that are valid to be assigned to Op: + // + // *ReplayOp_CreateSession + // *ReplayOp_ExtendSession + // *ReplayOp_PartialRunSetup + // *ReplayOp_RunStep + // *ReplayOp_CloseSession + // *ReplayOp_ListDevices + // *ReplayOp_ResetRequest + // *ReplayOp_MakeCallable + // *ReplayOp_RunCallable + // *ReplayOp_ReleaseCallable + // *ReplayOp_NewReplaySession + Op isReplayOp_Op `protobuf_oneof:"op"` + // Types that are valid to be assigned to Response: + // + // *ReplayOp_CreateSessionResponse + // *ReplayOp_ExtendSessionResponse + // *ReplayOp_PartialRunSetupResponse + // *ReplayOp_RunStepResponse + // *ReplayOp_CloseSessionResponse + // *ReplayOp_ListDevicesResponse + // *ReplayOp_ResetRequestResponse + // *ReplayOp_MakeCallableResponse + // *ReplayOp_RunCallableResponse + // *ReplayOp_ReleaseCallableResponse + Response isReplayOp_Response `protobuf_oneof:"response"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ReplayOp) Reset() { + *x = ReplayOp{} + mi := &file_tensorflow_core_protobuf_replay_log_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ReplayOp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReplayOp) ProtoMessage() {} + +func (x *ReplayOp) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_replay_log_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReplayOp.ProtoReflect.Descriptor instead. +func (*ReplayOp) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_replay_log_proto_rawDescGZIP(), []int{1} +} + +func (x *ReplayOp) GetStartTimeUs() float64 { + if x != nil { + return x.StartTimeUs + } + return 0 +} + +func (x *ReplayOp) GetEndTimeUs() float64 { + if x != nil { + return x.EndTimeUs + } + return 0 +} + +func (x *ReplayOp) GetOp() isReplayOp_Op { + if x != nil { + return x.Op + } + return nil +} + +func (x *ReplayOp) GetCreateSession() *CreateSessionRequest { + if x != nil { + if x, ok := x.Op.(*ReplayOp_CreateSession); ok { + return x.CreateSession + } + } + return nil +} + +func (x *ReplayOp) GetExtendSession() *ExtendSessionRequest { + if x != nil { + if x, ok := x.Op.(*ReplayOp_ExtendSession); ok { + return x.ExtendSession + } + } + return nil +} + +func (x *ReplayOp) GetPartialRunSetup() *PartialRunSetupRequest { + if x != nil { + if x, ok := x.Op.(*ReplayOp_PartialRunSetup); ok { + return x.PartialRunSetup + } + } + return nil +} + +func (x *ReplayOp) GetRunStep() *RunStepRequest { + if x != nil { + if x, ok := x.Op.(*ReplayOp_RunStep); ok { + return x.RunStep + } + } + return nil +} + +func (x *ReplayOp) GetCloseSession() *CloseSessionRequest { + if x != nil { + if x, ok := x.Op.(*ReplayOp_CloseSession); ok { + return x.CloseSession + } + } + return nil +} + +func (x *ReplayOp) GetListDevices() *ListDevicesRequest { + if x != nil { + if x, ok := x.Op.(*ReplayOp_ListDevices); ok { + return x.ListDevices + } + } + return nil +} + +func (x *ReplayOp) GetResetRequest() *ResetRequest { + if x != nil { + if x, ok := x.Op.(*ReplayOp_ResetRequest); ok { + return x.ResetRequest + } + } + return nil +} + +func (x *ReplayOp) GetMakeCallable() *MakeCallableRequest { + if x != nil { + if x, ok := x.Op.(*ReplayOp_MakeCallable); ok { + return x.MakeCallable + } + } + return nil +} + +func (x *ReplayOp) GetRunCallable() *RunCallableRequest { + if x != nil { + if x, ok := x.Op.(*ReplayOp_RunCallable); ok { + return x.RunCallable + } + } + return nil +} + +func (x *ReplayOp) GetReleaseCallable() *ReleaseCallableRequest { + if x != nil { + if x, ok := x.Op.(*ReplayOp_ReleaseCallable); ok { + return x.ReleaseCallable + } + } + return nil +} + +func (x *ReplayOp) GetNewReplaySession() *NewReplaySession { + if x != nil { + if x, ok := x.Op.(*ReplayOp_NewReplaySession); ok { + return x.NewReplaySession + } + } + return nil +} + +func (x *ReplayOp) GetResponse() isReplayOp_Response { + if x != nil { + return x.Response + } + return nil +} + +func (x *ReplayOp) GetCreateSessionResponse() *CreateSessionResponse { + if x != nil { + if x, ok := x.Response.(*ReplayOp_CreateSessionResponse); ok { + return x.CreateSessionResponse + } + } + return nil +} + +func (x *ReplayOp) GetExtendSessionResponse() *ExtendSessionResponse { + if x != nil { + if x, ok := x.Response.(*ReplayOp_ExtendSessionResponse); ok { + return x.ExtendSessionResponse + } + } + return nil +} + +func (x *ReplayOp) GetPartialRunSetupResponse() *PartialRunSetupResponse { + if x != nil { + if x, ok := x.Response.(*ReplayOp_PartialRunSetupResponse); ok { + return x.PartialRunSetupResponse + } + } + return nil +} + +func (x *ReplayOp) GetRunStepResponse() *RunStepResponse { + if x != nil { + if x, ok := x.Response.(*ReplayOp_RunStepResponse); ok { + return x.RunStepResponse + } + } + return nil +} + +func (x *ReplayOp) GetCloseSessionResponse() *CloseSessionResponse { + if x != nil { + if x, ok := x.Response.(*ReplayOp_CloseSessionResponse); ok { + return x.CloseSessionResponse + } + } + return nil +} + +func (x *ReplayOp) GetListDevicesResponse() *ListDevicesResponse { + if x != nil { + if x, ok := x.Response.(*ReplayOp_ListDevicesResponse); ok { + return x.ListDevicesResponse + } + } + return nil +} + +func (x *ReplayOp) GetResetRequestResponse() *ResetResponse { + if x != nil { + if x, ok := x.Response.(*ReplayOp_ResetRequestResponse); ok { + return x.ResetRequestResponse + } + } + return nil +} + +func (x *ReplayOp) GetMakeCallableResponse() *MakeCallableResponse { + if x != nil { + if x, ok := x.Response.(*ReplayOp_MakeCallableResponse); ok { + return x.MakeCallableResponse + } + } + return nil +} + +func (x *ReplayOp) GetRunCallableResponse() *RunCallableResponse { + if x != nil { + if x, ok := x.Response.(*ReplayOp_RunCallableResponse); ok { + return x.RunCallableResponse + } + } + return nil +} + +func (x *ReplayOp) GetReleaseCallableResponse() *ReleaseCallableResponse { + if x != nil { + if x, ok := x.Response.(*ReplayOp_ReleaseCallableResponse); ok { + return x.ReleaseCallableResponse + } + } + return nil +} + +type isReplayOp_Op interface { + isReplayOp_Op() +} + +type ReplayOp_CreateSession struct { + CreateSession *CreateSessionRequest `protobuf:"bytes,1,opt,name=create_session,json=createSession,proto3,oneof"` +} + +type ReplayOp_ExtendSession struct { + ExtendSession *ExtendSessionRequest `protobuf:"bytes,2,opt,name=extend_session,json=extendSession,proto3,oneof"` +} + +type ReplayOp_PartialRunSetup struct { + PartialRunSetup *PartialRunSetupRequest `protobuf:"bytes,3,opt,name=partial_run_setup,json=partialRunSetup,proto3,oneof"` +} + +type ReplayOp_RunStep struct { + RunStep *RunStepRequest `protobuf:"bytes,4,opt,name=run_step,json=runStep,proto3,oneof"` +} + +type ReplayOp_CloseSession struct { + CloseSession *CloseSessionRequest `protobuf:"bytes,5,opt,name=close_session,json=closeSession,proto3,oneof"` +} + +type ReplayOp_ListDevices struct { + ListDevices *ListDevicesRequest `protobuf:"bytes,6,opt,name=list_devices,json=listDevices,proto3,oneof"` +} + +type ReplayOp_ResetRequest struct { + ResetRequest *ResetRequest `protobuf:"bytes,7,opt,name=reset_request,json=resetRequest,proto3,oneof"` +} + +type ReplayOp_MakeCallable struct { + MakeCallable *MakeCallableRequest `protobuf:"bytes,8,opt,name=make_callable,json=makeCallable,proto3,oneof"` +} + +type ReplayOp_RunCallable struct { + RunCallable *RunCallableRequest `protobuf:"bytes,9,opt,name=run_callable,json=runCallable,proto3,oneof"` +} + +type ReplayOp_ReleaseCallable struct { + ReleaseCallable *ReleaseCallableRequest `protobuf:"bytes,10,opt,name=release_callable,json=releaseCallable,proto3,oneof"` +} + +type ReplayOp_NewReplaySession struct { + NewReplaySession *NewReplaySession `protobuf:"bytes,11,opt,name=new_replay_session,json=newReplaySession,proto3,oneof"` +} + +func (*ReplayOp_CreateSession) isReplayOp_Op() {} + +func (*ReplayOp_ExtendSession) isReplayOp_Op() {} + +func (*ReplayOp_PartialRunSetup) isReplayOp_Op() {} + +func (*ReplayOp_RunStep) isReplayOp_Op() {} + +func (*ReplayOp_CloseSession) isReplayOp_Op() {} + +func (*ReplayOp_ListDevices) isReplayOp_Op() {} + +func (*ReplayOp_ResetRequest) isReplayOp_Op() {} + +func (*ReplayOp_MakeCallable) isReplayOp_Op() {} + +func (*ReplayOp_RunCallable) isReplayOp_Op() {} + +func (*ReplayOp_ReleaseCallable) isReplayOp_Op() {} + +func (*ReplayOp_NewReplaySession) isReplayOp_Op() {} + +type isReplayOp_Response interface { + isReplayOp_Response() +} + +type ReplayOp_CreateSessionResponse struct { + CreateSessionResponse *CreateSessionResponse `protobuf:"bytes,21,opt,name=create_session_response,json=createSessionResponse,proto3,oneof"` +} + +type ReplayOp_ExtendSessionResponse struct { + ExtendSessionResponse *ExtendSessionResponse `protobuf:"bytes,22,opt,name=extend_session_response,json=extendSessionResponse,proto3,oneof"` +} + +type ReplayOp_PartialRunSetupResponse struct { + PartialRunSetupResponse *PartialRunSetupResponse `protobuf:"bytes,23,opt,name=partial_run_setup_response,json=partialRunSetupResponse,proto3,oneof"` +} + +type ReplayOp_RunStepResponse struct { + RunStepResponse *RunStepResponse `protobuf:"bytes,24,opt,name=run_step_response,json=runStepResponse,proto3,oneof"` +} + +type ReplayOp_CloseSessionResponse struct { + CloseSessionResponse *CloseSessionResponse `protobuf:"bytes,25,opt,name=close_session_response,json=closeSessionResponse,proto3,oneof"` +} + +type ReplayOp_ListDevicesResponse struct { + ListDevicesResponse *ListDevicesResponse `protobuf:"bytes,26,opt,name=list_devices_response,json=listDevicesResponse,proto3,oneof"` +} + +type ReplayOp_ResetRequestResponse struct { + ResetRequestResponse *ResetResponse `protobuf:"bytes,27,opt,name=reset_request_response,json=resetRequestResponse,proto3,oneof"` +} + +type ReplayOp_MakeCallableResponse struct { + MakeCallableResponse *MakeCallableResponse `protobuf:"bytes,28,opt,name=make_callable_response,json=makeCallableResponse,proto3,oneof"` +} + +type ReplayOp_RunCallableResponse struct { + RunCallableResponse *RunCallableResponse `protobuf:"bytes,29,opt,name=run_callable_response,json=runCallableResponse,proto3,oneof"` +} + +type ReplayOp_ReleaseCallableResponse struct { + ReleaseCallableResponse *ReleaseCallableResponse `protobuf:"bytes,30,opt,name=release_callable_response,json=releaseCallableResponse,proto3,oneof"` +} + +func (*ReplayOp_CreateSessionResponse) isReplayOp_Response() {} + +func (*ReplayOp_ExtendSessionResponse) isReplayOp_Response() {} + +func (*ReplayOp_PartialRunSetupResponse) isReplayOp_Response() {} + +func (*ReplayOp_RunStepResponse) isReplayOp_Response() {} + +func (*ReplayOp_CloseSessionResponse) isReplayOp_Response() {} + +func (*ReplayOp_ListDevicesResponse) isReplayOp_Response() {} + +func (*ReplayOp_ResetRequestResponse) isReplayOp_Response() {} + +func (*ReplayOp_MakeCallableResponse) isReplayOp_Response() {} + +func (*ReplayOp_RunCallableResponse) isReplayOp_Response() {} + +func (*ReplayOp_ReleaseCallableResponse) isReplayOp_Response() {} + +var File_tensorflow_core_protobuf_replay_log_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_replay_log_proto_rawDesc = "" + + "\n" + + ")tensorflow/core/protobuf/replay_log.proto\x12\n" + + "tensorflow\x1a%tensorflow/core/protobuf/master.proto\"t\n" + + "\x10NewReplaySession\x129\n" + + "\adevices\x18\x01 \x01(\v2\x1f.tensorflow.ListDevicesResponseR\adevices\x12%\n" + + "\x0esession_handle\x18\x02 \x01(\tR\rsessionHandle\"\xfc\r\n" + + "\bReplayOp\x12\"\n" + + "\rstart_time_us\x18\x1f \x01(\x01R\vstartTimeUs\x12\x1e\n" + + "\vend_time_us\x18 \x01(\x01R\tendTimeUs\x12I\n" + + "\x0ecreate_session\x18\x01 \x01(\v2 .tensorflow.CreateSessionRequestH\x00R\rcreateSession\x12I\n" + + "\x0eextend_session\x18\x02 \x01(\v2 .tensorflow.ExtendSessionRequestH\x00R\rextendSession\x12P\n" + + "\x11partial_run_setup\x18\x03 \x01(\v2\".tensorflow.PartialRunSetupRequestH\x00R\x0fpartialRunSetup\x127\n" + + "\brun_step\x18\x04 \x01(\v2\x1a.tensorflow.RunStepRequestH\x00R\arunStep\x12F\n" + + "\rclose_session\x18\x05 \x01(\v2\x1f.tensorflow.CloseSessionRequestH\x00R\fcloseSession\x12C\n" + + "\flist_devices\x18\x06 \x01(\v2\x1e.tensorflow.ListDevicesRequestH\x00R\vlistDevices\x12?\n" + + "\rreset_request\x18\a \x01(\v2\x18.tensorflow.ResetRequestH\x00R\fresetRequest\x12F\n" + + "\rmake_callable\x18\b \x01(\v2\x1f.tensorflow.MakeCallableRequestH\x00R\fmakeCallable\x12C\n" + + "\frun_callable\x18\t \x01(\v2\x1e.tensorflow.RunCallableRequestH\x00R\vrunCallable\x12O\n" + + "\x10release_callable\x18\n" + + " \x01(\v2\".tensorflow.ReleaseCallableRequestH\x00R\x0freleaseCallable\x12L\n" + + "\x12new_replay_session\x18\v \x01(\v2\x1c.tensorflow.NewReplaySessionH\x00R\x10newReplaySession\x12[\n" + + "\x17create_session_response\x18\x15 \x01(\v2!.tensorflow.CreateSessionResponseH\x01R\x15createSessionResponse\x12[\n" + + "\x17extend_session_response\x18\x16 \x01(\v2!.tensorflow.ExtendSessionResponseH\x01R\x15extendSessionResponse\x12b\n" + + "\x1apartial_run_setup_response\x18\x17 \x01(\v2#.tensorflow.PartialRunSetupResponseH\x01R\x17partialRunSetupResponse\x12I\n" + + "\x11run_step_response\x18\x18 \x01(\v2\x1b.tensorflow.RunStepResponseH\x01R\x0frunStepResponse\x12X\n" + + "\x16close_session_response\x18\x19 \x01(\v2 .tensorflow.CloseSessionResponseH\x01R\x14closeSessionResponse\x12U\n" + + "\x15list_devices_response\x18\x1a \x01(\v2\x1f.tensorflow.ListDevicesResponseH\x01R\x13listDevicesResponse\x12Q\n" + + "\x16reset_request_response\x18\x1b \x01(\v2\x19.tensorflow.ResetResponseH\x01R\x14resetRequestResponse\x12X\n" + + "\x16make_callable_response\x18\x1c \x01(\v2 .tensorflow.MakeCallableResponseH\x01R\x14makeCallableResponse\x12U\n" + + "\x15run_callable_response\x18\x1d \x01(\v2\x1f.tensorflow.RunCallableResponseH\x01R\x13runCallableResponse\x12a\n" + + "\x19release_callable_response\x18\x1e \x01(\v2#.tensorflow.ReleaseCallableResponseH\x01R\x17releaseCallableResponseB\x04\n" + + "\x02opB\n" + + "\n" + + "\bresponseBZZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_replay_log_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_replay_log_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_replay_log_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_replay_log_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_replay_log_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_replay_log_proto_rawDesc), len(file_tensorflow_core_protobuf_replay_log_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_replay_log_proto_rawDescData +} + +var file_tensorflow_core_protobuf_replay_log_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_tensorflow_core_protobuf_replay_log_proto_goTypes = []any{ + (*NewReplaySession)(nil), // 0: tensorflow.NewReplaySession + (*ReplayOp)(nil), // 1: tensorflow.ReplayOp + (*ListDevicesResponse)(nil), // 2: tensorflow.ListDevicesResponse + (*CreateSessionRequest)(nil), // 3: tensorflow.CreateSessionRequest + (*ExtendSessionRequest)(nil), // 4: tensorflow.ExtendSessionRequest + (*PartialRunSetupRequest)(nil), // 5: tensorflow.PartialRunSetupRequest + (*RunStepRequest)(nil), // 6: tensorflow.RunStepRequest + (*CloseSessionRequest)(nil), // 7: tensorflow.CloseSessionRequest + (*ListDevicesRequest)(nil), // 8: tensorflow.ListDevicesRequest + (*ResetRequest)(nil), // 9: tensorflow.ResetRequest + (*MakeCallableRequest)(nil), // 10: tensorflow.MakeCallableRequest + (*RunCallableRequest)(nil), // 11: tensorflow.RunCallableRequest + (*ReleaseCallableRequest)(nil), // 12: tensorflow.ReleaseCallableRequest + (*CreateSessionResponse)(nil), // 13: tensorflow.CreateSessionResponse + (*ExtendSessionResponse)(nil), // 14: tensorflow.ExtendSessionResponse + (*PartialRunSetupResponse)(nil), // 15: tensorflow.PartialRunSetupResponse + (*RunStepResponse)(nil), // 16: tensorflow.RunStepResponse + (*CloseSessionResponse)(nil), // 17: tensorflow.CloseSessionResponse + (*ResetResponse)(nil), // 18: tensorflow.ResetResponse + (*MakeCallableResponse)(nil), // 19: tensorflow.MakeCallableResponse + (*RunCallableResponse)(nil), // 20: tensorflow.RunCallableResponse + (*ReleaseCallableResponse)(nil), // 21: tensorflow.ReleaseCallableResponse +} +var file_tensorflow_core_protobuf_replay_log_proto_depIdxs = []int32{ + 2, // 0: tensorflow.NewReplaySession.devices:type_name -> tensorflow.ListDevicesResponse + 3, // 1: tensorflow.ReplayOp.create_session:type_name -> tensorflow.CreateSessionRequest + 4, // 2: tensorflow.ReplayOp.extend_session:type_name -> tensorflow.ExtendSessionRequest + 5, // 3: tensorflow.ReplayOp.partial_run_setup:type_name -> tensorflow.PartialRunSetupRequest + 6, // 4: tensorflow.ReplayOp.run_step:type_name -> tensorflow.RunStepRequest + 7, // 5: tensorflow.ReplayOp.close_session:type_name -> tensorflow.CloseSessionRequest + 8, // 6: tensorflow.ReplayOp.list_devices:type_name -> tensorflow.ListDevicesRequest + 9, // 7: tensorflow.ReplayOp.reset_request:type_name -> tensorflow.ResetRequest + 10, // 8: tensorflow.ReplayOp.make_callable:type_name -> tensorflow.MakeCallableRequest + 11, // 9: tensorflow.ReplayOp.run_callable:type_name -> tensorflow.RunCallableRequest + 12, // 10: tensorflow.ReplayOp.release_callable:type_name -> tensorflow.ReleaseCallableRequest + 0, // 11: tensorflow.ReplayOp.new_replay_session:type_name -> tensorflow.NewReplaySession + 13, // 12: tensorflow.ReplayOp.create_session_response:type_name -> tensorflow.CreateSessionResponse + 14, // 13: tensorflow.ReplayOp.extend_session_response:type_name -> tensorflow.ExtendSessionResponse + 15, // 14: tensorflow.ReplayOp.partial_run_setup_response:type_name -> tensorflow.PartialRunSetupResponse + 16, // 15: tensorflow.ReplayOp.run_step_response:type_name -> tensorflow.RunStepResponse + 17, // 16: tensorflow.ReplayOp.close_session_response:type_name -> tensorflow.CloseSessionResponse + 2, // 17: tensorflow.ReplayOp.list_devices_response:type_name -> tensorflow.ListDevicesResponse + 18, // 18: tensorflow.ReplayOp.reset_request_response:type_name -> tensorflow.ResetResponse + 19, // 19: tensorflow.ReplayOp.make_callable_response:type_name -> tensorflow.MakeCallableResponse + 20, // 20: tensorflow.ReplayOp.run_callable_response:type_name -> tensorflow.RunCallableResponse + 21, // 21: tensorflow.ReplayOp.release_callable_response:type_name -> tensorflow.ReleaseCallableResponse + 22, // [22:22] is the sub-list for method output_type + 22, // [22:22] is the sub-list for method input_type + 22, // [22:22] is the sub-list for extension type_name + 22, // [22:22] is the sub-list for extension extendee + 0, // [0:22] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_replay_log_proto_init() } +func file_tensorflow_core_protobuf_replay_log_proto_init() { + if File_tensorflow_core_protobuf_replay_log_proto != nil { + return + } + file_tensorflow_core_protobuf_master_proto_init() + file_tensorflow_core_protobuf_replay_log_proto_msgTypes[1].OneofWrappers = []any{ + (*ReplayOp_CreateSession)(nil), + (*ReplayOp_ExtendSession)(nil), + (*ReplayOp_PartialRunSetup)(nil), + (*ReplayOp_RunStep)(nil), + (*ReplayOp_CloseSession)(nil), + (*ReplayOp_ListDevices)(nil), + (*ReplayOp_ResetRequest)(nil), + (*ReplayOp_MakeCallable)(nil), + (*ReplayOp_RunCallable)(nil), + (*ReplayOp_ReleaseCallable)(nil), + (*ReplayOp_NewReplaySession)(nil), + (*ReplayOp_CreateSessionResponse)(nil), + (*ReplayOp_ExtendSessionResponse)(nil), + (*ReplayOp_PartialRunSetupResponse)(nil), + (*ReplayOp_RunStepResponse)(nil), + (*ReplayOp_CloseSessionResponse)(nil), + (*ReplayOp_ListDevicesResponse)(nil), + (*ReplayOp_ResetRequestResponse)(nil), + (*ReplayOp_MakeCallableResponse)(nil), + (*ReplayOp_RunCallableResponse)(nil), + (*ReplayOp_ReleaseCallableResponse)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_replay_log_proto_rawDesc), len(file_tensorflow_core_protobuf_replay_log_proto_rawDesc)), + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_replay_log_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_replay_log_proto_depIdxs, + MessageInfos: file_tensorflow_core_protobuf_replay_log_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_replay_log_proto = out.File + file_tensorflow_core_protobuf_replay_log_proto_goTypes = nil + file_tensorflow_core_protobuf_replay_log_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/rewriter_config.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/rewriter_config.pb.go new file mode 100644 index 0000000..e2a4f14 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/rewriter_config.pb.go @@ -0,0 +1,926 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/rewriter_config.proto + +package for_core_protos_go_proto + +import ( + attr_value_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/attr_value_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type RewriterConfig_Toggle int32 + +const ( + RewriterConfig_DEFAULT RewriterConfig_Toggle = 0 + RewriterConfig_ON RewriterConfig_Toggle = 1 + RewriterConfig_OFF RewriterConfig_Toggle = 2 + // Enable some aggressive optimizations that use assumptions that TF graphs + // may break. For example, assume the shape of a placeholder matches its + // actual feed. + RewriterConfig_AGGRESSIVE RewriterConfig_Toggle = 3 +) + +// Enum value maps for RewriterConfig_Toggle. +var ( + RewriterConfig_Toggle_name = map[int32]string{ + 0: "DEFAULT", + 1: "ON", + 2: "OFF", + 3: "AGGRESSIVE", + } + RewriterConfig_Toggle_value = map[string]int32{ + "DEFAULT": 0, + "ON": 1, + "OFF": 2, + "AGGRESSIVE": 3, + } +) + +func (x RewriterConfig_Toggle) Enum() *RewriterConfig_Toggle { + p := new(RewriterConfig_Toggle) + *p = x + return p +} + +func (x RewriterConfig_Toggle) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (RewriterConfig_Toggle) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_protobuf_rewriter_config_proto_enumTypes[0].Descriptor() +} + +func (RewriterConfig_Toggle) Type() protoreflect.EnumType { + return &file_tensorflow_core_protobuf_rewriter_config_proto_enumTypes[0] +} + +func (x RewriterConfig_Toggle) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use RewriterConfig_Toggle.Descriptor instead. +func (RewriterConfig_Toggle) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_rewriter_config_proto_rawDescGZIP(), []int{2, 0} +} + +// Enum for layout conversion between NCHW and NHWC on CPU. Default is OFF. +type RewriterConfig_CpuLayout int32 + +const ( + RewriterConfig_NO_CONVERSION_ON_CPU RewriterConfig_CpuLayout = 0 + RewriterConfig_NCHW_TO_NHWC RewriterConfig_CpuLayout = 1 + RewriterConfig_NHWC_TO_NCHW RewriterConfig_CpuLayout = 2 +) + +// Enum value maps for RewriterConfig_CpuLayout. +var ( + RewriterConfig_CpuLayout_name = map[int32]string{ + 0: "NO_CONVERSION_ON_CPU", + 1: "NCHW_TO_NHWC", + 2: "NHWC_TO_NCHW", + } + RewriterConfig_CpuLayout_value = map[string]int32{ + "NO_CONVERSION_ON_CPU": 0, + "NCHW_TO_NHWC": 1, + "NHWC_TO_NCHW": 2, + } +) + +func (x RewriterConfig_CpuLayout) Enum() *RewriterConfig_CpuLayout { + p := new(RewriterConfig_CpuLayout) + *p = x + return p +} + +func (x RewriterConfig_CpuLayout) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (RewriterConfig_CpuLayout) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_protobuf_rewriter_config_proto_enumTypes[1].Descriptor() +} + +func (RewriterConfig_CpuLayout) Type() protoreflect.EnumType { + return &file_tensorflow_core_protobuf_rewriter_config_proto_enumTypes[1] +} + +func (x RewriterConfig_CpuLayout) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use RewriterConfig_CpuLayout.Descriptor instead. +func (RewriterConfig_CpuLayout) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_rewriter_config_proto_rawDescGZIP(), []int{2, 1} +} + +// Enum controlling the number of times to run optimizers. The default is to +// run them twice. +type RewriterConfig_NumIterationsType int32 + +const ( + RewriterConfig_DEFAULT_NUM_ITERS RewriterConfig_NumIterationsType = 0 + RewriterConfig_ONE RewriterConfig_NumIterationsType = 1 + RewriterConfig_TWO RewriterConfig_NumIterationsType = 2 +) + +// Enum value maps for RewriterConfig_NumIterationsType. +var ( + RewriterConfig_NumIterationsType_name = map[int32]string{ + 0: "DEFAULT_NUM_ITERS", + 1: "ONE", + 2: "TWO", + } + RewriterConfig_NumIterationsType_value = map[string]int32{ + "DEFAULT_NUM_ITERS": 0, + "ONE": 1, + "TWO": 2, + } +) + +func (x RewriterConfig_NumIterationsType) Enum() *RewriterConfig_NumIterationsType { + p := new(RewriterConfig_NumIterationsType) + *p = x + return p +} + +func (x RewriterConfig_NumIterationsType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (RewriterConfig_NumIterationsType) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_protobuf_rewriter_config_proto_enumTypes[2].Descriptor() +} + +func (RewriterConfig_NumIterationsType) Type() protoreflect.EnumType { + return &file_tensorflow_core_protobuf_rewriter_config_proto_enumTypes[2] +} + +func (x RewriterConfig_NumIterationsType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use RewriterConfig_NumIterationsType.Descriptor instead. +func (RewriterConfig_NumIterationsType) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_rewriter_config_proto_rawDescGZIP(), []int{2, 2} +} + +type RewriterConfig_MemOptType int32 + +const ( + // The default setting (SCHEDULING and SWAPPING HEURISTICS only) + RewriterConfig_DEFAULT_MEM_OPT RewriterConfig_MemOptType = 0 + // Disabled in the meta-optimizer. + RewriterConfig_NO_MEM_OPT RewriterConfig_MemOptType = 1 + // Driven by manual op-level annotations. + RewriterConfig_MANUAL RewriterConfig_MemOptType = 2 + // Swapping heuristic will move a tensor from the GPU to the CPU and move + // it back when needed to reduce peak memory usage. + RewriterConfig_SWAPPING_HEURISTICS RewriterConfig_MemOptType = 4 + // Recomputation heuristics will recompute ops (such as Relu activation) + // during backprop instead of storing them, reducing peak memory usage. + RewriterConfig_RECOMPUTATION_HEURISTICS RewriterConfig_MemOptType = 5 + // Scheduling will split big ops such as AddN and try to enforce a schedule + // of the new computations that decreases peak memory usage. + RewriterConfig_SCHEDULING_HEURISTICS RewriterConfig_MemOptType = 6 + // Use any combination of swapping and recomputation heuristics. + RewriterConfig_HEURISTICS RewriterConfig_MemOptType = 3 +) + +// Enum value maps for RewriterConfig_MemOptType. +var ( + RewriterConfig_MemOptType_name = map[int32]string{ + 0: "DEFAULT_MEM_OPT", + 1: "NO_MEM_OPT", + 2: "MANUAL", + 4: "SWAPPING_HEURISTICS", + 5: "RECOMPUTATION_HEURISTICS", + 6: "SCHEDULING_HEURISTICS", + 3: "HEURISTICS", + } + RewriterConfig_MemOptType_value = map[string]int32{ + "DEFAULT_MEM_OPT": 0, + "NO_MEM_OPT": 1, + "MANUAL": 2, + "SWAPPING_HEURISTICS": 4, + "RECOMPUTATION_HEURISTICS": 5, + "SCHEDULING_HEURISTICS": 6, + "HEURISTICS": 3, + } +) + +func (x RewriterConfig_MemOptType) Enum() *RewriterConfig_MemOptType { + p := new(RewriterConfig_MemOptType) + *p = x + return p +} + +func (x RewriterConfig_MemOptType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (RewriterConfig_MemOptType) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_protobuf_rewriter_config_proto_enumTypes[3].Descriptor() +} + +func (RewriterConfig_MemOptType) Type() protoreflect.EnumType { + return &file_tensorflow_core_protobuf_rewriter_config_proto_enumTypes[3] +} + +func (x RewriterConfig_MemOptType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use RewriterConfig_MemOptType.Descriptor instead. +func (RewriterConfig_MemOptType) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_rewriter_config_proto_rawDescGZIP(), []int{2, 3} +} + +type AutoParallelOptions struct { + state protoimpl.MessageState `protogen:"open.v1"` + Enable bool `protobuf:"varint,1,opt,name=enable,proto3" json:"enable,omitempty"` + NumReplicas int32 `protobuf:"varint,2,opt,name=num_replicas,json=numReplicas,proto3" json:"num_replicas,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AutoParallelOptions) Reset() { + *x = AutoParallelOptions{} + mi := &file_tensorflow_core_protobuf_rewriter_config_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AutoParallelOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AutoParallelOptions) ProtoMessage() {} + +func (x *AutoParallelOptions) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_rewriter_config_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AutoParallelOptions.ProtoReflect.Descriptor instead. +func (*AutoParallelOptions) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_rewriter_config_proto_rawDescGZIP(), []int{0} +} + +func (x *AutoParallelOptions) GetEnable() bool { + if x != nil { + return x.Enable + } + return false +} + +func (x *AutoParallelOptions) GetNumReplicas() int32 { + if x != nil { + return x.NumReplicas + } + return 0 +} + +type ScopedAllocatorOptions struct { + state protoimpl.MessageState `protogen:"open.v1"` + // If present, only perform optimization for these ops. + EnableOp []string `protobuf:"bytes,1,rep,name=enable_op,json=enableOp,proto3" json:"enable_op,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ScopedAllocatorOptions) Reset() { + *x = ScopedAllocatorOptions{} + mi := &file_tensorflow_core_protobuf_rewriter_config_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ScopedAllocatorOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ScopedAllocatorOptions) ProtoMessage() {} + +func (x *ScopedAllocatorOptions) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_rewriter_config_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ScopedAllocatorOptions.ProtoReflect.Descriptor instead. +func (*ScopedAllocatorOptions) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_rewriter_config_proto_rawDescGZIP(), []int{1} +} + +func (x *ScopedAllocatorOptions) GetEnableOp() []string { + if x != nil { + return x.EnableOp + } + return nil +} + +type RewriterConfig struct { + state protoimpl.MessageState `protogen:"open.v1"` + // CPU Conversion settings between NHCW and NCHW. + CpuLayoutConversion RewriterConfig_CpuLayout `protobuf:"varint,50,opt,name=cpu_layout_conversion,json=cpuLayoutConversion,proto3,enum=tensorflow.RewriterConfig_CpuLayout" json:"cpu_layout_conversion,omitempty"` + // Optimize tensor layouts (default is ON) + // e.g. This will try to use NCHW layout on GPU which is faster. + LayoutOptimizer RewriterConfig_Toggle `protobuf:"varint,1,opt,name=layout_optimizer,json=layoutOptimizer,proto3,enum=tensorflow.RewriterConfig_Toggle" json:"layout_optimizer,omitempty"` + // Fold constants (default is ON) + // Statically infer the value of tensors when possible, and materialize the + // result using constants. + ConstantFolding RewriterConfig_Toggle `protobuf:"varint,3,opt,name=constant_folding,json=constantFolding,proto3,enum=tensorflow.RewriterConfig_Toggle" json:"constant_folding,omitempty"` + // Shape optimizations (default is ON) + // Simplify computations made on shapes. + ShapeOptimization RewriterConfig_Toggle `protobuf:"varint,13,opt,name=shape_optimization,json=shapeOptimization,proto3,enum=tensorflow.RewriterConfig_Toggle" json:"shape_optimization,omitempty"` + // Remapping (default is ON) + // Remap subgraphs onto more efficient implementations. + Remapping RewriterConfig_Toggle `protobuf:"varint,14,opt,name=remapping,proto3,enum=tensorflow.RewriterConfig_Toggle" json:"remapping,omitempty"` + // Common subgraph elimination (default is ON) + // e.g. Simplify arithmetic ops; merge ops with same value (like constants). + CommonSubgraphElimination RewriterConfig_Toggle `protobuf:"varint,24,opt,name=common_subgraph_elimination,json=commonSubgraphElimination,proto3,enum=tensorflow.RewriterConfig_Toggle" json:"common_subgraph_elimination,omitempty"` + // Arithmetic optimizations (default is ON) + // e.g. Simplify arithmetic ops; merge ops with same value (like constants). + ArithmeticOptimization RewriterConfig_Toggle `protobuf:"varint,7,opt,name=arithmetic_optimization,json=arithmeticOptimization,proto3,enum=tensorflow.RewriterConfig_Toggle" json:"arithmetic_optimization,omitempty"` + // Control dependency optimizations (default is ON). + // Remove redundant control dependencies, which may enable other optimization. + DependencyOptimization RewriterConfig_Toggle `protobuf:"varint,8,opt,name=dependency_optimization,json=dependencyOptimization,proto3,enum=tensorflow.RewriterConfig_Toggle" json:"dependency_optimization,omitempty"` + // Loop optimizations (default is ON). + LoopOptimization RewriterConfig_Toggle `protobuf:"varint,9,opt,name=loop_optimization,json=loopOptimization,proto3,enum=tensorflow.RewriterConfig_Toggle" json:"loop_optimization,omitempty"` + // Function optimizations (default is ON). + FunctionOptimization RewriterConfig_Toggle `protobuf:"varint,10,opt,name=function_optimization,json=functionOptimization,proto3,enum=tensorflow.RewriterConfig_Toggle" json:"function_optimization,omitempty"` + // Strips debug-related nodes from the graph (off by default). + DebugStripper RewriterConfig_Toggle `protobuf:"varint,11,opt,name=debug_stripper,json=debugStripper,proto3,enum=tensorflow.RewriterConfig_Toggle" json:"debug_stripper,omitempty"` + // If true, don't remove unnecessary ops from the graph + DisableModelPruning bool `protobuf:"varint,2,opt,name=disable_model_pruning,json=disableModelPruning,proto3" json:"disable_model_pruning,omitempty"` + // Try to allocate some independent Op outputs contiguously in order to + // merge or eliminate downstream Ops (off by default). + ScopedAllocatorOptimization RewriterConfig_Toggle `protobuf:"varint,15,opt,name=scoped_allocator_optimization,json=scopedAllocatorOptimization,proto3,enum=tensorflow.RewriterConfig_Toggle" json:"scoped_allocator_optimization,omitempty"` + // Force small ops onto the CPU (default is OFF). + PinToHostOptimization RewriterConfig_Toggle `protobuf:"varint,18,opt,name=pin_to_host_optimization,json=pinToHostOptimization,proto3,enum=tensorflow.RewriterConfig_Toggle" json:"pin_to_host_optimization,omitempty"` + // Enable the swap of kernel implementations based on the device placement + // (default is ON). + ImplementationSelector RewriterConfig_Toggle `protobuf:"varint,22,opt,name=implementation_selector,json=implementationSelector,proto3,enum=tensorflow.RewriterConfig_Toggle" json:"implementation_selector,omitempty"` + // Optimize data types for CUDA (default is OFF). + // This will try to use float16 on GPU which is faster. + // Note that this can change the numerical stability of the graph and may + // require the use of loss scaling to maintain model convergence. + AutoMixedPrecision RewriterConfig_Toggle `protobuf:"varint,23,opt,name=auto_mixed_precision,json=autoMixedPrecision,proto3,enum=tensorflow.RewriterConfig_Toggle" json:"auto_mixed_precision,omitempty"` + // Optimize data types for MKL (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. + AutoMixedPrecisionMkl RewriterConfig_Toggle `protobuf:"varint,25,opt,name=auto_mixed_precision_mkl,json=autoMixedPrecisionMkl,proto3,enum=tensorflow.RewriterConfig_Toggle" json:"auto_mixed_precision_mkl,omitempty"` + // Disable the entire meta optimizer (off by default). + DisableMetaOptimizer bool `protobuf:"varint,19,opt,name=disable_meta_optimizer,json=disableMetaOptimizer,proto3" json:"disable_meta_optimizer,omitempty"` + // Controls how many times we run the optimizers in meta optimizer (default + // is once). + MetaOptimizerIterations RewriterConfig_NumIterationsType `protobuf:"varint,12,opt,name=meta_optimizer_iterations,json=metaOptimizerIterations,proto3,enum=tensorflow.RewriterConfig_NumIterationsType" json:"meta_optimizer_iterations,omitempty"` + // The minimum number of nodes in a graph to optimizer. For smaller graphs, + // optimization is skipped. + // 0 means the system picks an appropriate number. + // < 0 means do not skip optimization. + MinGraphNodes int32 `protobuf:"varint,17,opt,name=min_graph_nodes,json=minGraphNodes,proto3" json:"min_graph_nodes,omitempty"` + // Disable optimizations that assume compressed tensors. Note that this flag + // is experimental and may be removed in the future. + ExperimentalDisableCompressedTensorOptimization bool `protobuf:"varint,26,opt,name=experimental_disable_compressed_tensor_optimization,json=experimentalDisableCompressedTensorOptimization,proto3" json:"experimental_disable_compressed_tensor_optimization,omitempty"` + // Configures memory optimization passes through the meta-optimizer. Has no + // effect on manually requested memory optimization passes in the optimizers + // field. + MemoryOptimization RewriterConfig_MemOptType `protobuf:"varint,4,opt,name=memory_optimization,json=memoryOptimization,proto3,enum=tensorflow.RewriterConfig_MemOptType" json:"memory_optimization,omitempty"` + // A node name scope for node names which are valid outputs of recomputations. + // Inputs to nodes that match this scope may be recomputed (subject either to + // manual annotation of those input nodes or to manual annotation and + // heuristics depending on memory_optimization), but the nodes themselves will + // not be recomputed. This matches any sub-scopes as well, meaning the scope + // can appear not just as a top-level scope. For example, if the value is + // "gradients/", the default, it will match node name "gradients/foo", + // "foo/gradients/bar", but not "foo_gradients/" + MemoryOptimizerTargetNodeNameScope string `protobuf:"bytes,6,opt,name=memory_optimizer_target_node_name_scope,json=memoryOptimizerTargetNodeNameScope,proto3" json:"memory_optimizer_target_node_name_scope,omitempty"` + // Maximum number of milliseconds to spend optimizing a single graph before + // timing out. If equal to 0 the system picks a default (currently 5 minutes). + // If less than 0 the optimizer will never time out. + MetaOptimizerTimeoutMs int64 `protobuf:"varint,20,opt,name=meta_optimizer_timeout_ms,json=metaOptimizerTimeoutMs,proto3" json:"meta_optimizer_timeout_ms,omitempty"` + // Configures AutoParallel optimization passes either through the + // meta-optimizer or when manually specified through the optimizers field. + AutoParallel *AutoParallelOptions `protobuf:"bytes,5,opt,name=auto_parallel,json=autoParallel,proto3" json:"auto_parallel,omitempty"` + // If true, any optimization pass failing will cause the MetaOptimizer to + // stop with an error. By default - or when set to false, failing passes are + // skipped silently. + FailOnOptimizerErrors bool `protobuf:"varint,21,opt,name=fail_on_optimizer_errors,json=failOnOptimizerErrors,proto3" json:"fail_on_optimizer_errors,omitempty"` + ScopedAllocatorOpts *ScopedAllocatorOptions `protobuf:"bytes,16,opt,name=scoped_allocator_opts,json=scopedAllocatorOpts,proto3" json:"scoped_allocator_opts,omitempty"` + // If non-empty, will use this as an alternative way to specify a list of + // optimizations to turn on and the order of the optimizations (replacing the + // meta-optimizer). + // + // Of the RewriterConfig options, only the AutoParallel configuration options + // (the auto_parallel field) apply to manually requested optimization passes + // ("autoparallel"). Memory optimization passes ("memory") invoked here are + // not configurable (in contrast to memory optimization passes through the + // meta-optimizer) and act only on manual op annotations. + // + // Custom optimizers (see custom_optimizers) that are not part of this + // schedule will be run after - in the order that they were specified. + Optimizers []string `protobuf:"bytes,100,rep,name=optimizers,proto3" json:"optimizers,omitempty"` + // list of CustomGraphOptimizers to apply. + CustomOptimizers []*RewriterConfig_CustomGraphOptimizer `protobuf:"bytes,200,rep,name=custom_optimizers,json=customOptimizers,proto3" json:"custom_optimizers,omitempty"` + // VerifierConfig specifying the verifiers to be run after every optimizer. + InterOptimizerVerifierConfig *VerifierConfig `protobuf:"bytes,300,opt,name=inter_optimizer_verifier_config,json=interOptimizerVerifierConfig,proto3" json:"inter_optimizer_verifier_config,omitempty"` + // VerifierConfig specifying the verifiers to be run at the end, after all + // optimizers have run. + PostOptimizationVerifierConfig *VerifierConfig `protobuf:"bytes,301,opt,name=post_optimization_verifier_config,json=postOptimizationVerifierConfig,proto3" json:"post_optimization_verifier_config,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RewriterConfig) Reset() { + *x = RewriterConfig{} + mi := &file_tensorflow_core_protobuf_rewriter_config_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RewriterConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RewriterConfig) ProtoMessage() {} + +func (x *RewriterConfig) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_rewriter_config_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RewriterConfig.ProtoReflect.Descriptor instead. +func (*RewriterConfig) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_rewriter_config_proto_rawDescGZIP(), []int{2} +} + +func (x *RewriterConfig) GetCpuLayoutConversion() RewriterConfig_CpuLayout { + if x != nil { + return x.CpuLayoutConversion + } + return RewriterConfig_NO_CONVERSION_ON_CPU +} + +func (x *RewriterConfig) GetLayoutOptimizer() RewriterConfig_Toggle { + if x != nil { + return x.LayoutOptimizer + } + return RewriterConfig_DEFAULT +} + +func (x *RewriterConfig) GetConstantFolding() RewriterConfig_Toggle { + if x != nil { + return x.ConstantFolding + } + return RewriterConfig_DEFAULT +} + +func (x *RewriterConfig) GetShapeOptimization() RewriterConfig_Toggle { + if x != nil { + return x.ShapeOptimization + } + return RewriterConfig_DEFAULT +} + +func (x *RewriterConfig) GetRemapping() RewriterConfig_Toggle { + if x != nil { + return x.Remapping + } + return RewriterConfig_DEFAULT +} + +func (x *RewriterConfig) GetCommonSubgraphElimination() RewriterConfig_Toggle { + if x != nil { + return x.CommonSubgraphElimination + } + return RewriterConfig_DEFAULT +} + +func (x *RewriterConfig) GetArithmeticOptimization() RewriterConfig_Toggle { + if x != nil { + return x.ArithmeticOptimization + } + return RewriterConfig_DEFAULT +} + +func (x *RewriterConfig) GetDependencyOptimization() RewriterConfig_Toggle { + if x != nil { + return x.DependencyOptimization + } + return RewriterConfig_DEFAULT +} + +func (x *RewriterConfig) GetLoopOptimization() RewriterConfig_Toggle { + if x != nil { + return x.LoopOptimization + } + return RewriterConfig_DEFAULT +} + +func (x *RewriterConfig) GetFunctionOptimization() RewriterConfig_Toggle { + if x != nil { + return x.FunctionOptimization + } + return RewriterConfig_DEFAULT +} + +func (x *RewriterConfig) GetDebugStripper() RewriterConfig_Toggle { + if x != nil { + return x.DebugStripper + } + return RewriterConfig_DEFAULT +} + +func (x *RewriterConfig) GetDisableModelPruning() bool { + if x != nil { + return x.DisableModelPruning + } + return false +} + +func (x *RewriterConfig) GetScopedAllocatorOptimization() RewriterConfig_Toggle { + if x != nil { + return x.ScopedAllocatorOptimization + } + return RewriterConfig_DEFAULT +} + +func (x *RewriterConfig) GetPinToHostOptimization() RewriterConfig_Toggle { + if x != nil { + return x.PinToHostOptimization + } + return RewriterConfig_DEFAULT +} + +func (x *RewriterConfig) GetImplementationSelector() RewriterConfig_Toggle { + if x != nil { + return x.ImplementationSelector + } + return RewriterConfig_DEFAULT +} + +func (x *RewriterConfig) GetAutoMixedPrecision() RewriterConfig_Toggle { + if x != nil { + return x.AutoMixedPrecision + } + return RewriterConfig_DEFAULT +} + +func (x *RewriterConfig) GetAutoMixedPrecisionMkl() RewriterConfig_Toggle { + if x != nil { + return x.AutoMixedPrecisionMkl + } + return RewriterConfig_DEFAULT +} + +func (x *RewriterConfig) GetDisableMetaOptimizer() bool { + if x != nil { + return x.DisableMetaOptimizer + } + return false +} + +func (x *RewriterConfig) GetMetaOptimizerIterations() RewriterConfig_NumIterationsType { + if x != nil { + return x.MetaOptimizerIterations + } + return RewriterConfig_DEFAULT_NUM_ITERS +} + +func (x *RewriterConfig) GetMinGraphNodes() int32 { + if x != nil { + return x.MinGraphNodes + } + return 0 +} + +func (x *RewriterConfig) GetExperimentalDisableCompressedTensorOptimization() bool { + if x != nil { + return x.ExperimentalDisableCompressedTensorOptimization + } + return false +} + +func (x *RewriterConfig) GetMemoryOptimization() RewriterConfig_MemOptType { + if x != nil { + return x.MemoryOptimization + } + return RewriterConfig_DEFAULT_MEM_OPT +} + +func (x *RewriterConfig) GetMemoryOptimizerTargetNodeNameScope() string { + if x != nil { + return x.MemoryOptimizerTargetNodeNameScope + } + return "" +} + +func (x *RewriterConfig) GetMetaOptimizerTimeoutMs() int64 { + if x != nil { + return x.MetaOptimizerTimeoutMs + } + return 0 +} + +func (x *RewriterConfig) GetAutoParallel() *AutoParallelOptions { + if x != nil { + return x.AutoParallel + } + return nil +} + +func (x *RewriterConfig) GetFailOnOptimizerErrors() bool { + if x != nil { + return x.FailOnOptimizerErrors + } + return false +} + +func (x *RewriterConfig) GetScopedAllocatorOpts() *ScopedAllocatorOptions { + if x != nil { + return x.ScopedAllocatorOpts + } + return nil +} + +func (x *RewriterConfig) GetOptimizers() []string { + if x != nil { + return x.Optimizers + } + return nil +} + +func (x *RewriterConfig) GetCustomOptimizers() []*RewriterConfig_CustomGraphOptimizer { + if x != nil { + return x.CustomOptimizers + } + return nil +} + +func (x *RewriterConfig) GetInterOptimizerVerifierConfig() *VerifierConfig { + if x != nil { + return x.InterOptimizerVerifierConfig + } + return nil +} + +func (x *RewriterConfig) GetPostOptimizationVerifierConfig() *VerifierConfig { + if x != nil { + return x.PostOptimizationVerifierConfig + } + return nil +} + +// Message to describe custom graph optimizer and its parameters +type RewriterConfig_CustomGraphOptimizer struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + ParameterMap map[string]*attr_value_go_proto.AttrValue `protobuf:"bytes,2,rep,name=parameter_map,json=parameterMap,proto3" json:"parameter_map,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RewriterConfig_CustomGraphOptimizer) Reset() { + *x = RewriterConfig_CustomGraphOptimizer{} + mi := &file_tensorflow_core_protobuf_rewriter_config_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RewriterConfig_CustomGraphOptimizer) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RewriterConfig_CustomGraphOptimizer) ProtoMessage() {} + +func (x *RewriterConfig_CustomGraphOptimizer) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_rewriter_config_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RewriterConfig_CustomGraphOptimizer.ProtoReflect.Descriptor instead. +func (*RewriterConfig_CustomGraphOptimizer) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_rewriter_config_proto_rawDescGZIP(), []int{2, 0} +} + +func (x *RewriterConfig_CustomGraphOptimizer) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *RewriterConfig_CustomGraphOptimizer) GetParameterMap() map[string]*attr_value_go_proto.AttrValue { + if x != nil { + return x.ParameterMap + } + return nil +} + +var File_tensorflow_core_protobuf_rewriter_config_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_rewriter_config_proto_rawDesc = "" + + "\n" + + ".tensorflow/core/protobuf/rewriter_config.proto\x12\n" + + "tensorflow\x1a*tensorflow/core/framework/attr_value.proto\x1a.tensorflow/core/protobuf/verifier_config.proto\"P\n" + + "\x13AutoParallelOptions\x12\x16\n" + + "\x06enable\x18\x01 \x01(\bR\x06enable\x12!\n" + + "\fnum_replicas\x18\x02 \x01(\x05R\vnumReplicas\"5\n" + + "\x16ScopedAllocatorOptions\x12\x1b\n" + + "\tenable_op\x18\x01 \x03(\tR\benableOp\"\xba\x18\n" + + "\x0eRewriterConfig\x12X\n" + + "\x15cpu_layout_conversion\x182 \x01(\x0e2$.tensorflow.RewriterConfig.CpuLayoutR\x13cpuLayoutConversion\x12L\n" + + "\x10layout_optimizer\x18\x01 \x01(\x0e2!.tensorflow.RewriterConfig.ToggleR\x0flayoutOptimizer\x12L\n" + + "\x10constant_folding\x18\x03 \x01(\x0e2!.tensorflow.RewriterConfig.ToggleR\x0fconstantFolding\x12P\n" + + "\x12shape_optimization\x18\r \x01(\x0e2!.tensorflow.RewriterConfig.ToggleR\x11shapeOptimization\x12?\n" + + "\tremapping\x18\x0e \x01(\x0e2!.tensorflow.RewriterConfig.ToggleR\tremapping\x12a\n" + + "\x1bcommon_subgraph_elimination\x18\x18 \x01(\x0e2!.tensorflow.RewriterConfig.ToggleR\x19commonSubgraphElimination\x12Z\n" + + "\x17arithmetic_optimization\x18\a \x01(\x0e2!.tensorflow.RewriterConfig.ToggleR\x16arithmeticOptimization\x12Z\n" + + "\x17dependency_optimization\x18\b \x01(\x0e2!.tensorflow.RewriterConfig.ToggleR\x16dependencyOptimization\x12N\n" + + "\x11loop_optimization\x18\t \x01(\x0e2!.tensorflow.RewriterConfig.ToggleR\x10loopOptimization\x12V\n" + + "\x15function_optimization\x18\n" + + " \x01(\x0e2!.tensorflow.RewriterConfig.ToggleR\x14functionOptimization\x12H\n" + + "\x0edebug_stripper\x18\v \x01(\x0e2!.tensorflow.RewriterConfig.ToggleR\rdebugStripper\x122\n" + + "\x15disable_model_pruning\x18\x02 \x01(\bR\x13disableModelPruning\x12e\n" + + "\x1dscoped_allocator_optimization\x18\x0f \x01(\x0e2!.tensorflow.RewriterConfig.ToggleR\x1bscopedAllocatorOptimization\x12Z\n" + + "\x18pin_to_host_optimization\x18\x12 \x01(\x0e2!.tensorflow.RewriterConfig.ToggleR\x15pinToHostOptimization\x12Z\n" + + "\x17implementation_selector\x18\x16 \x01(\x0e2!.tensorflow.RewriterConfig.ToggleR\x16implementationSelector\x12S\n" + + "\x14auto_mixed_precision\x18\x17 \x01(\x0e2!.tensorflow.RewriterConfig.ToggleR\x12autoMixedPrecision\x12Z\n" + + "\x18auto_mixed_precision_mkl\x18\x19 \x01(\x0e2!.tensorflow.RewriterConfig.ToggleR\x15autoMixedPrecisionMkl\x124\n" + + "\x16disable_meta_optimizer\x18\x13 \x01(\bR\x14disableMetaOptimizer\x12h\n" + + "\x19meta_optimizer_iterations\x18\f \x01(\x0e2,.tensorflow.RewriterConfig.NumIterationsTypeR\x17metaOptimizerIterations\x12&\n" + + "\x0fmin_graph_nodes\x18\x11 \x01(\x05R\rminGraphNodes\x12l\n" + + "3experimental_disable_compressed_tensor_optimization\x18\x1a \x01(\bR/experimentalDisableCompressedTensorOptimization\x12V\n" + + "\x13memory_optimization\x18\x04 \x01(\x0e2%.tensorflow.RewriterConfig.MemOptTypeR\x12memoryOptimization\x12S\n" + + "'memory_optimizer_target_node_name_scope\x18\x06 \x01(\tR\"memoryOptimizerTargetNodeNameScope\x129\n" + + "\x19meta_optimizer_timeout_ms\x18\x14 \x01(\x03R\x16metaOptimizerTimeoutMs\x12D\n" + + "\rauto_parallel\x18\x05 \x01(\v2\x1f.tensorflow.AutoParallelOptionsR\fautoParallel\x127\n" + + "\x18fail_on_optimizer_errors\x18\x15 \x01(\bR\x15failOnOptimizerErrors\x12V\n" + + "\x15scoped_allocator_opts\x18\x10 \x01(\v2\".tensorflow.ScopedAllocatorOptionsR\x13scopedAllocatorOpts\x12\x1e\n" + + "\n" + + "optimizers\x18d \x03(\tR\n" + + "optimizers\x12]\n" + + "\x11custom_optimizers\x18\xc8\x01 \x03(\v2/.tensorflow.RewriterConfig.CustomGraphOptimizerR\x10customOptimizers\x12b\n" + + "\x1finter_optimizer_verifier_config\x18\xac\x02 \x01(\v2\x1a.tensorflow.VerifierConfigR\x1cinterOptimizerVerifierConfig\x12f\n" + + "!post_optimization_verifier_config\x18\xad\x02 \x01(\v2\x1a.tensorflow.VerifierConfigR\x1epostOptimizationVerifierConfig\x1a\xea\x01\n" + + "\x14CustomGraphOptimizer\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12f\n" + + "\rparameter_map\x18\x02 \x03(\v2A.tensorflow.RewriterConfig.CustomGraphOptimizer.ParameterMapEntryR\fparameterMap\x1aV\n" + + "\x11ParameterMapEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12+\n" + + "\x05value\x18\x02 \x01(\v2\x15.tensorflow.AttrValueR\x05value:\x028\x01\"6\n" + + "\x06Toggle\x12\v\n" + + "\aDEFAULT\x10\x00\x12\x06\n" + + "\x02ON\x10\x01\x12\a\n" + + "\x03OFF\x10\x02\x12\x0e\n" + + "\n" + + "AGGRESSIVE\x10\x03\"I\n" + + "\tCpuLayout\x12\x18\n" + + "\x14NO_CONVERSION_ON_CPU\x10\x00\x12\x10\n" + + "\fNCHW_TO_NHWC\x10\x01\x12\x10\n" + + "\fNHWC_TO_NCHW\x10\x02\"<\n" + + "\x11NumIterationsType\x12\x15\n" + + "\x11DEFAULT_NUM_ITERS\x10\x00\x12\a\n" + + "\x03ONE\x10\x01\x12\a\n" + + "\x03TWO\x10\x02\"\x9f\x01\n" + + "\n" + + "MemOptType\x12\x13\n" + + "\x0fDEFAULT_MEM_OPT\x10\x00\x12\x0e\n" + + "\n" + + "NO_MEM_OPT\x10\x01\x12\n" + + "\n" + + "\x06MANUAL\x10\x02\x12\x17\n" + + "\x13SWAPPING_HEURISTICS\x10\x04\x12\x1c\n" + + "\x18RECOMPUTATION_HEURISTICS\x10\x05\x12\x19\n" + + "\x15SCHEDULING_HEURISTICS\x10\x06\x12\x0e\n" + + "\n" + + "HEURISTICS\x10\x03B\x8c\x01\n" + + "\x18org.tensorflow.frameworkB\x14RewriterConfigProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_rewriter_config_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_rewriter_config_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_rewriter_config_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_rewriter_config_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_rewriter_config_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_rewriter_config_proto_rawDesc), len(file_tensorflow_core_protobuf_rewriter_config_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_rewriter_config_proto_rawDescData +} + +var file_tensorflow_core_protobuf_rewriter_config_proto_enumTypes = make([]protoimpl.EnumInfo, 4) +var file_tensorflow_core_protobuf_rewriter_config_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_tensorflow_core_protobuf_rewriter_config_proto_goTypes = []any{ + (RewriterConfig_Toggle)(0), // 0: tensorflow.RewriterConfig.Toggle + (RewriterConfig_CpuLayout)(0), // 1: tensorflow.RewriterConfig.CpuLayout + (RewriterConfig_NumIterationsType)(0), // 2: tensorflow.RewriterConfig.NumIterationsType + (RewriterConfig_MemOptType)(0), // 3: tensorflow.RewriterConfig.MemOptType + (*AutoParallelOptions)(nil), // 4: tensorflow.AutoParallelOptions + (*ScopedAllocatorOptions)(nil), // 5: tensorflow.ScopedAllocatorOptions + (*RewriterConfig)(nil), // 6: tensorflow.RewriterConfig + (*RewriterConfig_CustomGraphOptimizer)(nil), // 7: tensorflow.RewriterConfig.CustomGraphOptimizer + nil, // 8: tensorflow.RewriterConfig.CustomGraphOptimizer.ParameterMapEntry + (*VerifierConfig)(nil), // 9: tensorflow.VerifierConfig + (*attr_value_go_proto.AttrValue)(nil), // 10: tensorflow.AttrValue +} +var file_tensorflow_core_protobuf_rewriter_config_proto_depIdxs = []int32{ + 1, // 0: tensorflow.RewriterConfig.cpu_layout_conversion:type_name -> tensorflow.RewriterConfig.CpuLayout + 0, // 1: tensorflow.RewriterConfig.layout_optimizer:type_name -> tensorflow.RewriterConfig.Toggle + 0, // 2: tensorflow.RewriterConfig.constant_folding:type_name -> tensorflow.RewriterConfig.Toggle + 0, // 3: tensorflow.RewriterConfig.shape_optimization:type_name -> tensorflow.RewriterConfig.Toggle + 0, // 4: tensorflow.RewriterConfig.remapping:type_name -> tensorflow.RewriterConfig.Toggle + 0, // 5: tensorflow.RewriterConfig.common_subgraph_elimination:type_name -> tensorflow.RewriterConfig.Toggle + 0, // 6: tensorflow.RewriterConfig.arithmetic_optimization:type_name -> tensorflow.RewriterConfig.Toggle + 0, // 7: tensorflow.RewriterConfig.dependency_optimization:type_name -> tensorflow.RewriterConfig.Toggle + 0, // 8: tensorflow.RewriterConfig.loop_optimization:type_name -> tensorflow.RewriterConfig.Toggle + 0, // 9: tensorflow.RewriterConfig.function_optimization:type_name -> tensorflow.RewriterConfig.Toggle + 0, // 10: tensorflow.RewriterConfig.debug_stripper:type_name -> tensorflow.RewriterConfig.Toggle + 0, // 11: tensorflow.RewriterConfig.scoped_allocator_optimization:type_name -> tensorflow.RewriterConfig.Toggle + 0, // 12: tensorflow.RewriterConfig.pin_to_host_optimization:type_name -> tensorflow.RewriterConfig.Toggle + 0, // 13: tensorflow.RewriterConfig.implementation_selector:type_name -> tensorflow.RewriterConfig.Toggle + 0, // 14: tensorflow.RewriterConfig.auto_mixed_precision:type_name -> tensorflow.RewriterConfig.Toggle + 0, // 15: tensorflow.RewriterConfig.auto_mixed_precision_mkl:type_name -> tensorflow.RewriterConfig.Toggle + 2, // 16: tensorflow.RewriterConfig.meta_optimizer_iterations:type_name -> tensorflow.RewriterConfig.NumIterationsType + 3, // 17: tensorflow.RewriterConfig.memory_optimization:type_name -> tensorflow.RewriterConfig.MemOptType + 4, // 18: tensorflow.RewriterConfig.auto_parallel:type_name -> tensorflow.AutoParallelOptions + 5, // 19: tensorflow.RewriterConfig.scoped_allocator_opts:type_name -> tensorflow.ScopedAllocatorOptions + 7, // 20: tensorflow.RewriterConfig.custom_optimizers:type_name -> tensorflow.RewriterConfig.CustomGraphOptimizer + 9, // 21: tensorflow.RewriterConfig.inter_optimizer_verifier_config:type_name -> tensorflow.VerifierConfig + 9, // 22: tensorflow.RewriterConfig.post_optimization_verifier_config:type_name -> tensorflow.VerifierConfig + 8, // 23: tensorflow.RewriterConfig.CustomGraphOptimizer.parameter_map:type_name -> tensorflow.RewriterConfig.CustomGraphOptimizer.ParameterMapEntry + 10, // 24: tensorflow.RewriterConfig.CustomGraphOptimizer.ParameterMapEntry.value:type_name -> tensorflow.AttrValue + 25, // [25:25] is the sub-list for method output_type + 25, // [25:25] is the sub-list for method input_type + 25, // [25:25] is the sub-list for extension type_name + 25, // [25:25] is the sub-list for extension extendee + 0, // [0:25] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_rewriter_config_proto_init() } +func file_tensorflow_core_protobuf_rewriter_config_proto_init() { + if File_tensorflow_core_protobuf_rewriter_config_proto != nil { + return + } + file_tensorflow_core_protobuf_verifier_config_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_rewriter_config_proto_rawDesc), len(file_tensorflow_core_protobuf_rewriter_config_proto_rawDesc)), + NumEnums: 4, + NumMessages: 5, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_rewriter_config_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_rewriter_config_proto_depIdxs, + EnumInfos: file_tensorflow_core_protobuf_rewriter_config_proto_enumTypes, + MessageInfos: file_tensorflow_core_protobuf_rewriter_config_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_rewriter_config_proto = out.File + file_tensorflow_core_protobuf_rewriter_config_proto_goTypes = nil + file_tensorflow_core_protobuf_rewriter_config_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/saved_model.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/saved_model.pb.go new file mode 100644 index 0000000..3383361 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/saved_model.pb.go @@ -0,0 +1,144 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/saved_model.proto + +package for_core_protos_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// SavedModel is the high level serialization format for TensorFlow Models. +// See [todo: doc links, similar to session_bundle] for more information. +type SavedModel struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The schema version of the SavedModel instance. Used for versioning when + // making future changes to the specification/implementation. Initial value + // at release will be 1. + SavedModelSchemaVersion int64 `protobuf:"varint,1,opt,name=saved_model_schema_version,json=savedModelSchemaVersion,proto3" json:"saved_model_schema_version,omitempty"` + // One or more MetaGraphs. + MetaGraphs []*MetaGraphDef `protobuf:"bytes,2,rep,name=meta_graphs,json=metaGraphs,proto3" json:"meta_graphs,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SavedModel) Reset() { + *x = SavedModel{} + mi := &file_tensorflow_core_protobuf_saved_model_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SavedModel) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SavedModel) ProtoMessage() {} + +func (x *SavedModel) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_saved_model_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SavedModel.ProtoReflect.Descriptor instead. +func (*SavedModel) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_saved_model_proto_rawDescGZIP(), []int{0} +} + +func (x *SavedModel) GetSavedModelSchemaVersion() int64 { + if x != nil { + return x.SavedModelSchemaVersion + } + return 0 +} + +func (x *SavedModel) GetMetaGraphs() []*MetaGraphDef { + if x != nil { + return x.MetaGraphs + } + return nil +} + +var File_tensorflow_core_protobuf_saved_model_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_saved_model_proto_rawDesc = "" + + "\n" + + "*tensorflow/core/protobuf/saved_model.proto\x12\n" + + "tensorflow\x1a)tensorflow/core/protobuf/meta_graph.proto\"\x84\x01\n" + + "\n" + + "SavedModel\x12;\n" + + "\x1asaved_model_schema_version\x18\x01 \x01(\x03R\x17savedModelSchemaVersion\x129\n" + + "\vmeta_graphs\x18\x02 \x03(\v2\x18.tensorflow.MetaGraphDefR\n" + + "metaGraphsB\x88\x01\n" + + "\x18org.tensorflow.frameworkB\x10SavedModelProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_saved_model_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_saved_model_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_saved_model_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_saved_model_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_saved_model_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_saved_model_proto_rawDesc), len(file_tensorflow_core_protobuf_saved_model_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_saved_model_proto_rawDescData +} + +var file_tensorflow_core_protobuf_saved_model_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_tensorflow_core_protobuf_saved_model_proto_goTypes = []any{ + (*SavedModel)(nil), // 0: tensorflow.SavedModel + (*MetaGraphDef)(nil), // 1: tensorflow.MetaGraphDef +} +var file_tensorflow_core_protobuf_saved_model_proto_depIdxs = []int32{ + 1, // 0: tensorflow.SavedModel.meta_graphs:type_name -> tensorflow.MetaGraphDef + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_saved_model_proto_init() } +func file_tensorflow_core_protobuf_saved_model_proto_init() { + if File_tensorflow_core_protobuf_saved_model_proto != nil { + return + } + file_tensorflow_core_protobuf_meta_graph_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_saved_model_proto_rawDesc), len(file_tensorflow_core_protobuf_saved_model_proto_rawDesc)), + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_saved_model_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_saved_model_proto_depIdxs, + MessageInfos: file_tensorflow_core_protobuf_saved_model_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_saved_model_proto = out.File + file_tensorflow_core_protobuf_saved_model_proto_goTypes = nil + file_tensorflow_core_protobuf_saved_model_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/saved_object_graph.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/saved_object_graph.pb.go new file mode 100644 index 0000000..5364e52 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/saved_object_graph.pb.go @@ -0,0 +1,1175 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/saved_object_graph.proto + +package for_core_protos_go_proto + +import ( + tensor_shape_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_shape_go_proto" + types_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/types_go_proto" + variable_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/variable_go_proto" + versions_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/versions_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Whether the function should be compiled by XLA. +// +// The public interface to `tf.function` uses an optional boolean to +// represent three distinct states for this field. Unfortunately, proto3 +// removes the ability to explicitly check for the presence or absence of a +// field, so we instead map to an enum. +// +// See `tf.function` for details. +type FunctionSpec_ExperimentalCompile int32 + +const ( + FunctionSpec_DEFAULT FunctionSpec_ExperimentalCompile = 0 + FunctionSpec_ON FunctionSpec_ExperimentalCompile = 1 + FunctionSpec_OFF FunctionSpec_ExperimentalCompile = 2 +) + +// Enum value maps for FunctionSpec_ExperimentalCompile. +var ( + FunctionSpec_ExperimentalCompile_name = map[int32]string{ + 0: "DEFAULT", + 1: "ON", + 2: "OFF", + } + FunctionSpec_ExperimentalCompile_value = map[string]int32{ + "DEFAULT": 0, + "ON": 1, + "OFF": 2, + } +) + +func (x FunctionSpec_ExperimentalCompile) Enum() *FunctionSpec_ExperimentalCompile { + p := new(FunctionSpec_ExperimentalCompile) + *p = x + return p +} + +func (x FunctionSpec_ExperimentalCompile) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (FunctionSpec_ExperimentalCompile) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_protobuf_saved_object_graph_proto_enumTypes[0].Descriptor() +} + +func (FunctionSpec_ExperimentalCompile) Type() protoreflect.EnumType { + return &file_tensorflow_core_protobuf_saved_object_graph_proto_enumTypes[0] +} + +func (x FunctionSpec_ExperimentalCompile) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use FunctionSpec_ExperimentalCompile.Descriptor instead. +func (FunctionSpec_ExperimentalCompile) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_saved_object_graph_proto_rawDescGZIP(), []int{9, 0} +} + +type SavedObjectGraph struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Flattened list of objects in the object graph. + // + // The position of the object in this list indicates its id. + // Nodes[0] is considered the root node. + Nodes []*SavedObject `protobuf:"bytes,1,rep,name=nodes,proto3" json:"nodes,omitempty"` + // Information about captures and output structures in concrete functions. + // Referenced from SavedBareConcreteFunction and SavedFunction. + ConcreteFunctions map[string]*SavedConcreteFunction `protobuf:"bytes,2,rep,name=concrete_functions,json=concreteFunctions,proto3" json:"concrete_functions,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SavedObjectGraph) Reset() { + *x = SavedObjectGraph{} + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SavedObjectGraph) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SavedObjectGraph) ProtoMessage() {} + +func (x *SavedObjectGraph) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SavedObjectGraph.ProtoReflect.Descriptor instead. +func (*SavedObjectGraph) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_saved_object_graph_proto_rawDescGZIP(), []int{0} +} + +func (x *SavedObjectGraph) GetNodes() []*SavedObject { + if x != nil { + return x.Nodes + } + return nil +} + +func (x *SavedObjectGraph) GetConcreteFunctions() map[string]*SavedConcreteFunction { + if x != nil { + return x.ConcreteFunctions + } + return nil +} + +type SavedObject struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Objects which this object depends on: named edges in the dependency + // graph. + // + // Note: currently only valid if kind == "user_object". + Children []*TrackableObjectGraph_TrackableObject_ObjectReference `protobuf:"bytes,1,rep,name=children,proto3" json:"children,omitempty"` + // Slot variables owned by this object. This describes the three-way + // (optimizer, variable, slot variable) relationship; none of the three + // depend on the others directly. + // + // Note: currently only valid if kind == "user_object". + SlotVariables []*TrackableObjectGraph_TrackableObject_SlotVariableReference `protobuf:"bytes,3,rep,name=slot_variables,json=slotVariables,proto3" json:"slot_variables,omitempty"` + // Types that are valid to be assigned to Kind: + // + // *SavedObject_UserObject + // *SavedObject_Asset + // *SavedObject_Function + // *SavedObject_Variable + // *SavedObject_BareConcreteFunction + // *SavedObject_Constant + // *SavedObject_Resource + Kind isSavedObject_Kind `protobuf_oneof:"kind"` + SaveableObjects map[string]*SaveableObject `protobuf:"bytes,11,rep,name=saveable_objects,json=saveableObjects,proto3" json:"saveable_objects,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SavedObject) Reset() { + *x = SavedObject{} + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SavedObject) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SavedObject) ProtoMessage() {} + +func (x *SavedObject) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SavedObject.ProtoReflect.Descriptor instead. +func (*SavedObject) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_saved_object_graph_proto_rawDescGZIP(), []int{1} +} + +func (x *SavedObject) GetChildren() []*TrackableObjectGraph_TrackableObject_ObjectReference { + if x != nil { + return x.Children + } + return nil +} + +func (x *SavedObject) GetSlotVariables() []*TrackableObjectGraph_TrackableObject_SlotVariableReference { + if x != nil { + return x.SlotVariables + } + return nil +} + +func (x *SavedObject) GetKind() isSavedObject_Kind { + if x != nil { + return x.Kind + } + return nil +} + +func (x *SavedObject) GetUserObject() *SavedUserObject { + if x != nil { + if x, ok := x.Kind.(*SavedObject_UserObject); ok { + return x.UserObject + } + } + return nil +} + +func (x *SavedObject) GetAsset() *SavedAsset { + if x != nil { + if x, ok := x.Kind.(*SavedObject_Asset); ok { + return x.Asset + } + } + return nil +} + +func (x *SavedObject) GetFunction() *SavedFunction { + if x != nil { + if x, ok := x.Kind.(*SavedObject_Function); ok { + return x.Function + } + } + return nil +} + +func (x *SavedObject) GetVariable() *SavedVariable { + if x != nil { + if x, ok := x.Kind.(*SavedObject_Variable); ok { + return x.Variable + } + } + return nil +} + +func (x *SavedObject) GetBareConcreteFunction() *SavedBareConcreteFunction { + if x != nil { + if x, ok := x.Kind.(*SavedObject_BareConcreteFunction); ok { + return x.BareConcreteFunction + } + } + return nil +} + +func (x *SavedObject) GetConstant() *SavedConstant { + if x != nil { + if x, ok := x.Kind.(*SavedObject_Constant); ok { + return x.Constant + } + } + return nil +} + +func (x *SavedObject) GetResource() *SavedResource { + if x != nil { + if x, ok := x.Kind.(*SavedObject_Resource); ok { + return x.Resource + } + } + return nil +} + +func (x *SavedObject) GetSaveableObjects() map[string]*SaveableObject { + if x != nil { + return x.SaveableObjects + } + return nil +} + +type isSavedObject_Kind interface { + isSavedObject_Kind() +} + +type SavedObject_UserObject struct { + UserObject *SavedUserObject `protobuf:"bytes,4,opt,name=user_object,json=userObject,proto3,oneof"` +} + +type SavedObject_Asset struct { + Asset *SavedAsset `protobuf:"bytes,5,opt,name=asset,proto3,oneof"` +} + +type SavedObject_Function struct { + Function *SavedFunction `protobuf:"bytes,6,opt,name=function,proto3,oneof"` +} + +type SavedObject_Variable struct { + Variable *SavedVariable `protobuf:"bytes,7,opt,name=variable,proto3,oneof"` +} + +type SavedObject_BareConcreteFunction struct { + BareConcreteFunction *SavedBareConcreteFunction `protobuf:"bytes,8,opt,name=bare_concrete_function,json=bareConcreteFunction,proto3,oneof"` +} + +type SavedObject_Constant struct { + Constant *SavedConstant `protobuf:"bytes,9,opt,name=constant,proto3,oneof"` +} + +type SavedObject_Resource struct { + Resource *SavedResource `protobuf:"bytes,10,opt,name=resource,proto3,oneof"` +} + +func (*SavedObject_UserObject) isSavedObject_Kind() {} + +func (*SavedObject_Asset) isSavedObject_Kind() {} + +func (*SavedObject_Function) isSavedObject_Kind() {} + +func (*SavedObject_Variable) isSavedObject_Kind() {} + +func (*SavedObject_BareConcreteFunction) isSavedObject_Kind() {} + +func (*SavedObject_Constant) isSavedObject_Kind() {} + +func (*SavedObject_Resource) isSavedObject_Kind() {} + +// A SavedUserObject is an object (in the object-oriented language of the +// TensorFlow program) of some user- or framework-defined class other than +// those handled specifically by the other kinds of SavedObjects. +// +// This object cannot be evaluated as a tensor, and therefore cannot be bound +// to an input of a function. +type SavedUserObject struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Corresponds to a registration of the type to use in the loading program. + Identifier string `protobuf:"bytes,1,opt,name=identifier,proto3" json:"identifier,omitempty"` + // Version information from the producer of this SavedUserObject. + Version *versions_go_proto.VersionDef `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` + // Initialization-related metadata. + Metadata string `protobuf:"bytes,3,opt,name=metadata,proto3" json:"metadata,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SavedUserObject) Reset() { + *x = SavedUserObject{} + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SavedUserObject) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SavedUserObject) ProtoMessage() {} + +func (x *SavedUserObject) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SavedUserObject.ProtoReflect.Descriptor instead. +func (*SavedUserObject) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_saved_object_graph_proto_rawDescGZIP(), []int{2} +} + +func (x *SavedUserObject) GetIdentifier() string { + if x != nil { + return x.Identifier + } + return "" +} + +func (x *SavedUserObject) GetVersion() *versions_go_proto.VersionDef { + if x != nil { + return x.Version + } + return nil +} + +func (x *SavedUserObject) GetMetadata() string { + if x != nil { + return x.Metadata + } + return "" +} + +// A SavedAsset points to an asset in the MetaGraph. +// +// When bound to a function this object evaluates to a tensor with the absolute +// filename. Users should not depend on a particular part of the filename to +// remain stable (e.g. basename could be changed). +type SavedAsset struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Index into `MetaGraphDef.asset_file_def[]` that describes the Asset. + // + // Only the field `AssetFileDef.filename` is used. Other fields, such as + // `AssetFileDef.tensor_info`, MUST be ignored. + AssetFileDefIndex int32 `protobuf:"varint,1,opt,name=asset_file_def_index,json=assetFileDefIndex,proto3" json:"asset_file_def_index,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SavedAsset) Reset() { + *x = SavedAsset{} + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SavedAsset) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SavedAsset) ProtoMessage() {} + +func (x *SavedAsset) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SavedAsset.ProtoReflect.Descriptor instead. +func (*SavedAsset) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_saved_object_graph_proto_rawDescGZIP(), []int{3} +} + +func (x *SavedAsset) GetAssetFileDefIndex() int32 { + if x != nil { + return x.AssetFileDefIndex + } + return 0 +} + +// A function with multiple signatures, possibly with non-Tensor arguments. +type SavedFunction struct { + state protoimpl.MessageState `protogen:"open.v1"` + ConcreteFunctions []string `protobuf:"bytes,1,rep,name=concrete_functions,json=concreteFunctions,proto3" json:"concrete_functions,omitempty"` + FunctionSpec *FunctionSpec `protobuf:"bytes,2,opt,name=function_spec,json=functionSpec,proto3" json:"function_spec,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SavedFunction) Reset() { + *x = SavedFunction{} + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SavedFunction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SavedFunction) ProtoMessage() {} + +func (x *SavedFunction) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SavedFunction.ProtoReflect.Descriptor instead. +func (*SavedFunction) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_saved_object_graph_proto_rawDescGZIP(), []int{4} +} + +func (x *SavedFunction) GetConcreteFunctions() []string { + if x != nil { + return x.ConcreteFunctions + } + return nil +} + +func (x *SavedFunction) GetFunctionSpec() *FunctionSpec { + if x != nil { + return x.FunctionSpec + } + return nil +} + +// Stores low-level information about a concrete function. Referenced in either +// a SavedFunction or a SavedBareConcreteFunction. +type SavedConcreteFunction struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Bound inputs to the function. The SavedObjects identified by the node ids + // given here are appended as extra inputs to the caller-supplied inputs. + // The only types of SavedObjects valid here are SavedVariable, SavedResource + // and SavedAsset. + BoundInputs []int32 `protobuf:"varint,2,rep,packed,name=bound_inputs,json=boundInputs,proto3" json:"bound_inputs,omitempty"` + // Input in canonicalized form that was received to create this concrete + // function. + CanonicalizedInputSignature *StructuredValue `protobuf:"bytes,3,opt,name=canonicalized_input_signature,json=canonicalizedInputSignature,proto3" json:"canonicalized_input_signature,omitempty"` + // Output that was the return value of this function after replacing all + // Tensors with TensorSpecs. This can be an arbitrary nested function and will + // be used to reconstruct the full structure from pure tensors. + OutputSignature *StructuredValue `protobuf:"bytes,4,opt,name=output_signature,json=outputSignature,proto3" json:"output_signature,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SavedConcreteFunction) Reset() { + *x = SavedConcreteFunction{} + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SavedConcreteFunction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SavedConcreteFunction) ProtoMessage() {} + +func (x *SavedConcreteFunction) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SavedConcreteFunction.ProtoReflect.Descriptor instead. +func (*SavedConcreteFunction) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_saved_object_graph_proto_rawDescGZIP(), []int{5} +} + +func (x *SavedConcreteFunction) GetBoundInputs() []int32 { + if x != nil { + return x.BoundInputs + } + return nil +} + +func (x *SavedConcreteFunction) GetCanonicalizedInputSignature() *StructuredValue { + if x != nil { + return x.CanonicalizedInputSignature + } + return nil +} + +func (x *SavedConcreteFunction) GetOutputSignature() *StructuredValue { + if x != nil { + return x.OutputSignature + } + return nil +} + +type SavedBareConcreteFunction struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Identifies a SavedConcreteFunction. + ConcreteFunctionName string `protobuf:"bytes,1,opt,name=concrete_function_name,json=concreteFunctionName,proto3" json:"concrete_function_name,omitempty"` + // A sequence of unique strings, one per Tensor argument. + ArgumentKeywords []string `protobuf:"bytes,2,rep,name=argument_keywords,json=argumentKeywords,proto3" json:"argument_keywords,omitempty"` + // The prefix of `argument_keywords` which may be identified by position. + AllowedPositionalArguments int64 `protobuf:"varint,3,opt,name=allowed_positional_arguments,json=allowedPositionalArguments,proto3" json:"allowed_positional_arguments,omitempty"` + // The spec of the function that this ConcreteFunction is traced from. This + // allows the ConcreteFunction to be called with nest structure inputs. This + // field may not be populated. If this field is absent, the concrete function + // can only be called with flat inputs. + // TODO(b/169361281): support calling saved ConcreteFunction with structured + // inputs in C++ SavedModel API. + FunctionSpec *FunctionSpec `protobuf:"bytes,4,opt,name=function_spec,json=functionSpec,proto3" json:"function_spec,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SavedBareConcreteFunction) Reset() { + *x = SavedBareConcreteFunction{} + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SavedBareConcreteFunction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SavedBareConcreteFunction) ProtoMessage() {} + +func (x *SavedBareConcreteFunction) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SavedBareConcreteFunction.ProtoReflect.Descriptor instead. +func (*SavedBareConcreteFunction) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_saved_object_graph_proto_rawDescGZIP(), []int{6} +} + +func (x *SavedBareConcreteFunction) GetConcreteFunctionName() string { + if x != nil { + return x.ConcreteFunctionName + } + return "" +} + +func (x *SavedBareConcreteFunction) GetArgumentKeywords() []string { + if x != nil { + return x.ArgumentKeywords + } + return nil +} + +func (x *SavedBareConcreteFunction) GetAllowedPositionalArguments() int64 { + if x != nil { + return x.AllowedPositionalArguments + } + return 0 +} + +func (x *SavedBareConcreteFunction) GetFunctionSpec() *FunctionSpec { + if x != nil { + return x.FunctionSpec + } + return nil +} + +type SavedConstant struct { + state protoimpl.MessageState `protogen:"open.v1"` + // An Operation name for a ConstantOp in this SavedObjectGraph's MetaGraph. + Operation string `protobuf:"bytes,1,opt,name=operation,proto3" json:"operation,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SavedConstant) Reset() { + *x = SavedConstant{} + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SavedConstant) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SavedConstant) ProtoMessage() {} + +func (x *SavedConstant) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SavedConstant.ProtoReflect.Descriptor instead. +func (*SavedConstant) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_saved_object_graph_proto_rawDescGZIP(), []int{7} +} + +func (x *SavedConstant) GetOperation() string { + if x != nil { + return x.Operation + } + return "" +} + +// Represents a Variable that is initialized by loading the contents from the +// checkpoint. +type SavedVariable struct { + state protoimpl.MessageState `protogen:"open.v1"` + Dtype types_go_proto.DataType `protobuf:"varint,1,opt,name=dtype,proto3,enum=tensorflow.DataType" json:"dtype,omitempty"` + Shape *tensor_shape_go_proto.TensorShapeProto `protobuf:"bytes,2,opt,name=shape,proto3" json:"shape,omitempty"` + Trainable bool `protobuf:"varint,3,opt,name=trainable,proto3" json:"trainable,omitempty"` + Synchronization variable_go_proto.VariableSynchronization `protobuf:"varint,4,opt,name=synchronization,proto3,enum=tensorflow.VariableSynchronization" json:"synchronization,omitempty"` + Aggregation variable_go_proto.VariableAggregation `protobuf:"varint,5,opt,name=aggregation,proto3,enum=tensorflow.VariableAggregation" json:"aggregation,omitempty"` + Name string `protobuf:"bytes,6,opt,name=name,proto3" json:"name,omitempty"` + Device string `protobuf:"bytes,7,opt,name=device,proto3" json:"device,omitempty"` + // List of component variables for a distributed variable. + // + // When this field is non-empty, the SavedVariable will be assumed + // to be a distributed variable defined by the components listed here. + // + // This is only supported by experimental loaders at the moment. + ExperimentalDistributedVariableComponents []*SavedVariable `protobuf:"bytes,8,rep,name=experimental_distributed_variable_components,json=experimentalDistributedVariableComponents,proto3" json:"experimental_distributed_variable_components,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SavedVariable) Reset() { + *x = SavedVariable{} + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SavedVariable) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SavedVariable) ProtoMessage() {} + +func (x *SavedVariable) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SavedVariable.ProtoReflect.Descriptor instead. +func (*SavedVariable) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_saved_object_graph_proto_rawDescGZIP(), []int{8} +} + +func (x *SavedVariable) GetDtype() types_go_proto.DataType { + if x != nil { + return x.Dtype + } + return types_go_proto.DataType(0) +} + +func (x *SavedVariable) GetShape() *tensor_shape_go_proto.TensorShapeProto { + if x != nil { + return x.Shape + } + return nil +} + +func (x *SavedVariable) GetTrainable() bool { + if x != nil { + return x.Trainable + } + return false +} + +func (x *SavedVariable) GetSynchronization() variable_go_proto.VariableSynchronization { + if x != nil { + return x.Synchronization + } + return variable_go_proto.VariableSynchronization(0) +} + +func (x *SavedVariable) GetAggregation() variable_go_proto.VariableAggregation { + if x != nil { + return x.Aggregation + } + return variable_go_proto.VariableAggregation(0) +} + +func (x *SavedVariable) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *SavedVariable) GetDevice() string { + if x != nil { + return x.Device + } + return "" +} + +func (x *SavedVariable) GetExperimentalDistributedVariableComponents() []*SavedVariable { + if x != nil { + return x.ExperimentalDistributedVariableComponents + } + return nil +} + +// Represents `FunctionSpec` used in `Function`. This represents a +// function that has been wrapped as a TensorFlow `Function`. +type FunctionSpec struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Full arg spec from inspect.getfullargspec(). + Fullargspec *StructuredValue `protobuf:"bytes,1,opt,name=fullargspec,proto3" json:"fullargspec,omitempty"` + // Whether this represents a class method. + IsMethod bool `protobuf:"varint,2,opt,name=is_method,json=isMethod,proto3" json:"is_method,omitempty"` + // The input signature, if specified. + InputSignature *StructuredValue `protobuf:"bytes,5,opt,name=input_signature,json=inputSignature,proto3" json:"input_signature,omitempty"` + ExperimentalCompile FunctionSpec_ExperimentalCompile `protobuf:"varint,6,opt,name=experimental_compile,json=experimentalCompile,proto3,enum=tensorflow.FunctionSpec_ExperimentalCompile" json:"experimental_compile,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *FunctionSpec) Reset() { + *x = FunctionSpec{} + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *FunctionSpec) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FunctionSpec) ProtoMessage() {} + +func (x *FunctionSpec) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FunctionSpec.ProtoReflect.Descriptor instead. +func (*FunctionSpec) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_saved_object_graph_proto_rawDescGZIP(), []int{9} +} + +func (x *FunctionSpec) GetFullargspec() *StructuredValue { + if x != nil { + return x.Fullargspec + } + return nil +} + +func (x *FunctionSpec) GetIsMethod() bool { + if x != nil { + return x.IsMethod + } + return false +} + +func (x *FunctionSpec) GetInputSignature() *StructuredValue { + if x != nil { + return x.InputSignature + } + return nil +} + +func (x *FunctionSpec) GetExperimentalCompile() FunctionSpec_ExperimentalCompile { + if x != nil { + return x.ExperimentalCompile + } + return FunctionSpec_DEFAULT +} + +// A SavedResource represents a TF object that holds state during its lifetime. +// An object of this type can have a reference to a: +// create_resource() and an initialize() function. +type SavedResource struct { + state protoimpl.MessageState `protogen:"open.v1"` + // A device specification indicating a required placement for the resource + // creation function, e.g. "CPU". An empty string allows the user to select a + // device. + Device string `protobuf:"bytes,1,opt,name=device,proto3" json:"device,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SavedResource) Reset() { + *x = SavedResource{} + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SavedResource) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SavedResource) ProtoMessage() {} + +func (x *SavedResource) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SavedResource.ProtoReflect.Descriptor instead. +func (*SavedResource) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_saved_object_graph_proto_rawDescGZIP(), []int{10} +} + +func (x *SavedResource) GetDevice() string { + if x != nil { + return x.Device + } + return "" +} + +type SaveableObject struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Node ids of concrete functions for saving and loading from a checkpoint. + SaveFunction int32 `protobuf:"varint,2,opt,name=save_function,json=saveFunction,proto3" json:"save_function,omitempty"` + RestoreFunction int32 `protobuf:"varint,3,opt,name=restore_function,json=restoreFunction,proto3" json:"restore_function,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SaveableObject) Reset() { + *x = SaveableObject{} + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SaveableObject) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SaveableObject) ProtoMessage() {} + +func (x *SaveableObject) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SaveableObject.ProtoReflect.Descriptor instead. +func (*SaveableObject) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_saved_object_graph_proto_rawDescGZIP(), []int{11} +} + +func (x *SaveableObject) GetSaveFunction() int32 { + if x != nil { + return x.SaveFunction + } + return 0 +} + +func (x *SaveableObject) GetRestoreFunction() int32 { + if x != nil { + return x.RestoreFunction + } + return 0 +} + +var File_tensorflow_core_protobuf_saved_object_graph_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_saved_object_graph_proto_rawDesc = "" + + "\n" + + "1tensorflow/core/protobuf/saved_object_graph.proto\x12\n" + + "tensorflow\x1a,tensorflow/core/framework/tensor_shape.proto\x1a%tensorflow/core/framework/types.proto\x1a(tensorflow/core/framework/variable.proto\x1a(tensorflow/core/framework/versions.proto\x1a%tensorflow/core/protobuf/struct.proto\x1a5tensorflow/core/protobuf/trackable_object_graph.proto\"\x8e\x02\n" + + "\x10SavedObjectGraph\x12-\n" + + "\x05nodes\x18\x01 \x03(\v2\x17.tensorflow.SavedObjectR\x05nodes\x12b\n" + + "\x12concrete_functions\x18\x02 \x03(\v23.tensorflow.SavedObjectGraph.ConcreteFunctionsEntryR\x11concreteFunctions\x1ag\n" + + "\x16ConcreteFunctionsEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x127\n" + + "\x05value\x18\x02 \x01(\v2!.tensorflow.SavedConcreteFunctionR\x05value:\x028\x01\"\xe0\x06\n" + + "\vSavedObject\x12\\\n" + + "\bchildren\x18\x01 \x03(\v2@.tensorflow.TrackableObjectGraph.TrackableObject.ObjectReferenceR\bchildren\x12m\n" + + "\x0eslot_variables\x18\x03 \x03(\v2F.tensorflow.TrackableObjectGraph.TrackableObject.SlotVariableReferenceR\rslotVariables\x12>\n" + + "\vuser_object\x18\x04 \x01(\v2\x1b.tensorflow.SavedUserObjectH\x00R\n" + + "userObject\x12.\n" + + "\x05asset\x18\x05 \x01(\v2\x16.tensorflow.SavedAssetH\x00R\x05asset\x127\n" + + "\bfunction\x18\x06 \x01(\v2\x19.tensorflow.SavedFunctionH\x00R\bfunction\x127\n" + + "\bvariable\x18\a \x01(\v2\x19.tensorflow.SavedVariableH\x00R\bvariable\x12]\n" + + "\x16bare_concrete_function\x18\b \x01(\v2%.tensorflow.SavedBareConcreteFunctionH\x00R\x14bareConcreteFunction\x127\n" + + "\bconstant\x18\t \x01(\v2\x19.tensorflow.SavedConstantH\x00R\bconstant\x127\n" + + "\bresource\x18\n" + + " \x01(\v2\x19.tensorflow.SavedResourceH\x00R\bresource\x12W\n" + + "\x10saveable_objects\x18\v \x03(\v2,.tensorflow.SavedObject.SaveableObjectsEntryR\x0fsaveableObjects\x1a^\n" + + "\x14SaveableObjectsEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x120\n" + + "\x05value\x18\x02 \x01(\v2\x1a.tensorflow.SaveableObjectR\x05value:\x028\x01B\x06\n" + + "\x04kindJ\x04\b\x02\x10\x03R\n" + + "attributes\"\x7f\n" + + "\x0fSavedUserObject\x12\x1e\n" + + "\n" + + "identifier\x18\x01 \x01(\tR\n" + + "identifier\x120\n" + + "\aversion\x18\x02 \x01(\v2\x16.tensorflow.VersionDefR\aversion\x12\x1a\n" + + "\bmetadata\x18\x03 \x01(\tR\bmetadata\"=\n" + + "\n" + + "SavedAsset\x12/\n" + + "\x14asset_file_def_index\x18\x01 \x01(\x05R\x11assetFileDefIndex\"}\n" + + "\rSavedFunction\x12-\n" + + "\x12concrete_functions\x18\x01 \x03(\tR\x11concreteFunctions\x12=\n" + + "\rfunction_spec\x18\x02 \x01(\v2\x18.tensorflow.FunctionSpecR\ffunctionSpec\"\xe3\x01\n" + + "\x15SavedConcreteFunction\x12!\n" + + "\fbound_inputs\x18\x02 \x03(\x05R\vboundInputs\x12_\n" + + "\x1dcanonicalized_input_signature\x18\x03 \x01(\v2\x1b.tensorflow.StructuredValueR\x1bcanonicalizedInputSignature\x12F\n" + + "\x10output_signature\x18\x04 \x01(\v2\x1b.tensorflow.StructuredValueR\x0foutputSignature\"\xff\x01\n" + + "\x19SavedBareConcreteFunction\x124\n" + + "\x16concrete_function_name\x18\x01 \x01(\tR\x14concreteFunctionName\x12+\n" + + "\x11argument_keywords\x18\x02 \x03(\tR\x10argumentKeywords\x12@\n" + + "\x1callowed_positional_arguments\x18\x03 \x01(\x03R\x1aallowedPositionalArguments\x12=\n" + + "\rfunction_spec\x18\x04 \x01(\v2\x18.tensorflow.FunctionSpecR\ffunctionSpec\"-\n" + + "\rSavedConstant\x12\x1c\n" + + "\toperation\x18\x01 \x01(\tR\toperation\"\xc7\x03\n" + + "\rSavedVariable\x12*\n" + + "\x05dtype\x18\x01 \x01(\x0e2\x14.tensorflow.DataTypeR\x05dtype\x122\n" + + "\x05shape\x18\x02 \x01(\v2\x1c.tensorflow.TensorShapeProtoR\x05shape\x12\x1c\n" + + "\ttrainable\x18\x03 \x01(\bR\ttrainable\x12M\n" + + "\x0fsynchronization\x18\x04 \x01(\x0e2#.tensorflow.VariableSynchronizationR\x0fsynchronization\x12A\n" + + "\vaggregation\x18\x05 \x01(\x0e2\x1f.tensorflow.VariableAggregationR\vaggregation\x12\x12\n" + + "\x04name\x18\x06 \x01(\tR\x04name\x12\x16\n" + + "\x06device\x18\a \x01(\tR\x06device\x12z\n" + + ",experimental_distributed_variable_components\x18\b \x03(\v2\x19.tensorflow.SavedVariableR)experimentalDistributedVariableComponents\"\xd2\x02\n" + + "\fFunctionSpec\x12=\n" + + "\vfullargspec\x18\x01 \x01(\v2\x1b.tensorflow.StructuredValueR\vfullargspec\x12\x1b\n" + + "\tis_method\x18\x02 \x01(\bR\bisMethod\x12D\n" + + "\x0finput_signature\x18\x05 \x01(\v2\x1b.tensorflow.StructuredValueR\x0einputSignature\x12_\n" + + "\x14experimental_compile\x18\x06 \x01(\x0e2,.tensorflow.FunctionSpec.ExperimentalCompileR\x13experimentalCompile\"3\n" + + "\x13ExperimentalCompile\x12\v\n" + + "\aDEFAULT\x10\x00\x12\x06\n" + + "\x02ON\x10\x01\x12\a\n" + + "\x03OFF\x10\x02J\x04\b\x03\x10\x04J\x04\b\x04\x10\x05\"'\n" + + "\rSavedResource\x12\x16\n" + + "\x06device\x18\x01 \x01(\tR\x06device\"`\n" + + "\x0eSaveableObject\x12#\n" + + "\rsave_function\x18\x02 \x01(\x05R\fsaveFunction\x12)\n" + + "\x10restore_function\x18\x03 \x01(\x05R\x0frestoreFunctionBZZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_saved_object_graph_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_saved_object_graph_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_saved_object_graph_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_saved_object_graph_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_saved_object_graph_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_saved_object_graph_proto_rawDesc), len(file_tensorflow_core_protobuf_saved_object_graph_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_saved_object_graph_proto_rawDescData +} + +var file_tensorflow_core_protobuf_saved_object_graph_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes = make([]protoimpl.MessageInfo, 14) +var file_tensorflow_core_protobuf_saved_object_graph_proto_goTypes = []any{ + (FunctionSpec_ExperimentalCompile)(0), // 0: tensorflow.FunctionSpec.ExperimentalCompile + (*SavedObjectGraph)(nil), // 1: tensorflow.SavedObjectGraph + (*SavedObject)(nil), // 2: tensorflow.SavedObject + (*SavedUserObject)(nil), // 3: tensorflow.SavedUserObject + (*SavedAsset)(nil), // 4: tensorflow.SavedAsset + (*SavedFunction)(nil), // 5: tensorflow.SavedFunction + (*SavedConcreteFunction)(nil), // 6: tensorflow.SavedConcreteFunction + (*SavedBareConcreteFunction)(nil), // 7: tensorflow.SavedBareConcreteFunction + (*SavedConstant)(nil), // 8: tensorflow.SavedConstant + (*SavedVariable)(nil), // 9: tensorflow.SavedVariable + (*FunctionSpec)(nil), // 10: tensorflow.FunctionSpec + (*SavedResource)(nil), // 11: tensorflow.SavedResource + (*SaveableObject)(nil), // 12: tensorflow.SaveableObject + nil, // 13: tensorflow.SavedObjectGraph.ConcreteFunctionsEntry + nil, // 14: tensorflow.SavedObject.SaveableObjectsEntry + (*TrackableObjectGraph_TrackableObject_ObjectReference)(nil), // 15: tensorflow.TrackableObjectGraph.TrackableObject.ObjectReference + (*TrackableObjectGraph_TrackableObject_SlotVariableReference)(nil), // 16: tensorflow.TrackableObjectGraph.TrackableObject.SlotVariableReference + (*versions_go_proto.VersionDef)(nil), // 17: tensorflow.VersionDef + (*StructuredValue)(nil), // 18: tensorflow.StructuredValue + (types_go_proto.DataType)(0), // 19: tensorflow.DataType + (*tensor_shape_go_proto.TensorShapeProto)(nil), // 20: tensorflow.TensorShapeProto + (variable_go_proto.VariableSynchronization)(0), // 21: tensorflow.VariableSynchronization + (variable_go_proto.VariableAggregation)(0), // 22: tensorflow.VariableAggregation +} +var file_tensorflow_core_protobuf_saved_object_graph_proto_depIdxs = []int32{ + 2, // 0: tensorflow.SavedObjectGraph.nodes:type_name -> tensorflow.SavedObject + 13, // 1: tensorflow.SavedObjectGraph.concrete_functions:type_name -> tensorflow.SavedObjectGraph.ConcreteFunctionsEntry + 15, // 2: tensorflow.SavedObject.children:type_name -> tensorflow.TrackableObjectGraph.TrackableObject.ObjectReference + 16, // 3: tensorflow.SavedObject.slot_variables:type_name -> tensorflow.TrackableObjectGraph.TrackableObject.SlotVariableReference + 3, // 4: tensorflow.SavedObject.user_object:type_name -> tensorflow.SavedUserObject + 4, // 5: tensorflow.SavedObject.asset:type_name -> tensorflow.SavedAsset + 5, // 6: tensorflow.SavedObject.function:type_name -> tensorflow.SavedFunction + 9, // 7: tensorflow.SavedObject.variable:type_name -> tensorflow.SavedVariable + 7, // 8: tensorflow.SavedObject.bare_concrete_function:type_name -> tensorflow.SavedBareConcreteFunction + 8, // 9: tensorflow.SavedObject.constant:type_name -> tensorflow.SavedConstant + 11, // 10: tensorflow.SavedObject.resource:type_name -> tensorflow.SavedResource + 14, // 11: tensorflow.SavedObject.saveable_objects:type_name -> tensorflow.SavedObject.SaveableObjectsEntry + 17, // 12: tensorflow.SavedUserObject.version:type_name -> tensorflow.VersionDef + 10, // 13: tensorflow.SavedFunction.function_spec:type_name -> tensorflow.FunctionSpec + 18, // 14: tensorflow.SavedConcreteFunction.canonicalized_input_signature:type_name -> tensorflow.StructuredValue + 18, // 15: tensorflow.SavedConcreteFunction.output_signature:type_name -> tensorflow.StructuredValue + 10, // 16: tensorflow.SavedBareConcreteFunction.function_spec:type_name -> tensorflow.FunctionSpec + 19, // 17: tensorflow.SavedVariable.dtype:type_name -> tensorflow.DataType + 20, // 18: tensorflow.SavedVariable.shape:type_name -> tensorflow.TensorShapeProto + 21, // 19: tensorflow.SavedVariable.synchronization:type_name -> tensorflow.VariableSynchronization + 22, // 20: tensorflow.SavedVariable.aggregation:type_name -> tensorflow.VariableAggregation + 9, // 21: tensorflow.SavedVariable.experimental_distributed_variable_components:type_name -> tensorflow.SavedVariable + 18, // 22: tensorflow.FunctionSpec.fullargspec:type_name -> tensorflow.StructuredValue + 18, // 23: tensorflow.FunctionSpec.input_signature:type_name -> tensorflow.StructuredValue + 0, // 24: tensorflow.FunctionSpec.experimental_compile:type_name -> tensorflow.FunctionSpec.ExperimentalCompile + 6, // 25: tensorflow.SavedObjectGraph.ConcreteFunctionsEntry.value:type_name -> tensorflow.SavedConcreteFunction + 12, // 26: tensorflow.SavedObject.SaveableObjectsEntry.value:type_name -> tensorflow.SaveableObject + 27, // [27:27] is the sub-list for method output_type + 27, // [27:27] is the sub-list for method input_type + 27, // [27:27] is the sub-list for extension type_name + 27, // [27:27] is the sub-list for extension extendee + 0, // [0:27] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_saved_object_graph_proto_init() } +func file_tensorflow_core_protobuf_saved_object_graph_proto_init() { + if File_tensorflow_core_protobuf_saved_object_graph_proto != nil { + return + } + file_tensorflow_core_protobuf_struct_proto_init() + file_tensorflow_core_protobuf_trackable_object_graph_proto_init() + file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes[1].OneofWrappers = []any{ + (*SavedObject_UserObject)(nil), + (*SavedObject_Asset)(nil), + (*SavedObject_Function)(nil), + (*SavedObject_Variable)(nil), + (*SavedObject_BareConcreteFunction)(nil), + (*SavedObject_Constant)(nil), + (*SavedObject_Resource)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_saved_object_graph_proto_rawDesc), len(file_tensorflow_core_protobuf_saved_object_graph_proto_rawDesc)), + NumEnums: 1, + NumMessages: 14, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_saved_object_graph_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_saved_object_graph_proto_depIdxs, + EnumInfos: file_tensorflow_core_protobuf_saved_object_graph_proto_enumTypes, + MessageInfos: file_tensorflow_core_protobuf_saved_object_graph_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_saved_object_graph_proto = out.File + file_tensorflow_core_protobuf_saved_object_graph_proto_goTypes = nil + file_tensorflow_core_protobuf_saved_object_graph_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/saver.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/saver.pb.go new file mode 100644 index 0000000..82c6b2a --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/saver.pb.go @@ -0,0 +1,254 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/saver.proto + +package for_core_protos_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// A version number that identifies a different on-disk checkpoint format. +// Usually, each subclass of BaseSaverBuilder works with a particular +// version/format. However, it is possible that the same builder may be +// upgraded to support a newer checkpoint format in the future. +type SaverDef_CheckpointFormatVersion int32 + +const ( + // Internal legacy format. + SaverDef_LEGACY SaverDef_CheckpointFormatVersion = 0 + // Deprecated format: tf.Saver() which works with tensorflow::table::Table. + SaverDef_V1 SaverDef_CheckpointFormatVersion = 1 + // Current format: more efficient. + SaverDef_V2 SaverDef_CheckpointFormatVersion = 2 +) + +// Enum value maps for SaverDef_CheckpointFormatVersion. +var ( + SaverDef_CheckpointFormatVersion_name = map[int32]string{ + 0: "LEGACY", + 1: "V1", + 2: "V2", + } + SaverDef_CheckpointFormatVersion_value = map[string]int32{ + "LEGACY": 0, + "V1": 1, + "V2": 2, + } +) + +func (x SaverDef_CheckpointFormatVersion) Enum() *SaverDef_CheckpointFormatVersion { + p := new(SaverDef_CheckpointFormatVersion) + *p = x + return p +} + +func (x SaverDef_CheckpointFormatVersion) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (SaverDef_CheckpointFormatVersion) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_protobuf_saver_proto_enumTypes[0].Descriptor() +} + +func (SaverDef_CheckpointFormatVersion) Type() protoreflect.EnumType { + return &file_tensorflow_core_protobuf_saver_proto_enumTypes[0] +} + +func (x SaverDef_CheckpointFormatVersion) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use SaverDef_CheckpointFormatVersion.Descriptor instead. +func (SaverDef_CheckpointFormatVersion) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_saver_proto_rawDescGZIP(), []int{0, 0} +} + +// Protocol buffer representing the configuration of a Saver. +type SaverDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The name of the tensor in which to specify the filename when saving or + // restoring a model checkpoint. + FilenameTensorName string `protobuf:"bytes,1,opt,name=filename_tensor_name,json=filenameTensorName,proto3" json:"filename_tensor_name,omitempty"` + // The operation to run when saving a model checkpoint. + SaveTensorName string `protobuf:"bytes,2,opt,name=save_tensor_name,json=saveTensorName,proto3" json:"save_tensor_name,omitempty"` + // The operation to run when restoring a model checkpoint. + RestoreOpName string `protobuf:"bytes,3,opt,name=restore_op_name,json=restoreOpName,proto3" json:"restore_op_name,omitempty"` + // Maximum number of checkpoints to keep. If 0, no checkpoints are deleted. + MaxToKeep int32 `protobuf:"varint,4,opt,name=max_to_keep,json=maxToKeep,proto3" json:"max_to_keep,omitempty"` + // Shard the save files, one per device that has Variable nodes. + Sharded bool `protobuf:"varint,5,opt,name=sharded,proto3" json:"sharded,omitempty"` + // How often to keep an additional checkpoint. If not specified, only the last + // "max_to_keep" checkpoints are kept; if specified, in addition to keeping + // the last "max_to_keep" checkpoints, an additional checkpoint will be kept + // for every n hours of training. + KeepCheckpointEveryNHours float32 `protobuf:"fixed32,6,opt,name=keep_checkpoint_every_n_hours,json=keepCheckpointEveryNHours,proto3" json:"keep_checkpoint_every_n_hours,omitempty"` + Version SaverDef_CheckpointFormatVersion `protobuf:"varint,7,opt,name=version,proto3,enum=tensorflow.SaverDef_CheckpointFormatVersion" json:"version,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SaverDef) Reset() { + *x = SaverDef{} + mi := &file_tensorflow_core_protobuf_saver_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SaverDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SaverDef) ProtoMessage() {} + +func (x *SaverDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_saver_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SaverDef.ProtoReflect.Descriptor instead. +func (*SaverDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_saver_proto_rawDescGZIP(), []int{0} +} + +func (x *SaverDef) GetFilenameTensorName() string { + if x != nil { + return x.FilenameTensorName + } + return "" +} + +func (x *SaverDef) GetSaveTensorName() string { + if x != nil { + return x.SaveTensorName + } + return "" +} + +func (x *SaverDef) GetRestoreOpName() string { + if x != nil { + return x.RestoreOpName + } + return "" +} + +func (x *SaverDef) GetMaxToKeep() int32 { + if x != nil { + return x.MaxToKeep + } + return 0 +} + +func (x *SaverDef) GetSharded() bool { + if x != nil { + return x.Sharded + } + return false +} + +func (x *SaverDef) GetKeepCheckpointEveryNHours() float32 { + if x != nil { + return x.KeepCheckpointEveryNHours + } + return 0 +} + +func (x *SaverDef) GetVersion() SaverDef_CheckpointFormatVersion { + if x != nil { + return x.Version + } + return SaverDef_LEGACY +} + +var File_tensorflow_core_protobuf_saver_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_saver_proto_rawDesc = "" + + "\n" + + "$tensorflow/core/protobuf/saver.proto\x12\n" + + "tensorflow\"\x89\x03\n" + + "\bSaverDef\x120\n" + + "\x14filename_tensor_name\x18\x01 \x01(\tR\x12filenameTensorName\x12(\n" + + "\x10save_tensor_name\x18\x02 \x01(\tR\x0esaveTensorName\x12&\n" + + "\x0frestore_op_name\x18\x03 \x01(\tR\rrestoreOpName\x12\x1e\n" + + "\vmax_to_keep\x18\x04 \x01(\x05R\tmaxToKeep\x12\x18\n" + + "\asharded\x18\x05 \x01(\bR\asharded\x12@\n" + + "\x1dkeep_checkpoint_every_n_hours\x18\x06 \x01(\x02R\x19keepCheckpointEveryNHours\x12F\n" + + "\aversion\x18\a \x01(\x0e2,.tensorflow.SaverDef.CheckpointFormatVersionR\aversion\"5\n" + + "\x17CheckpointFormatVersion\x12\n" + + "\n" + + "\x06LEGACY\x10\x00\x12\x06\n" + + "\x02V1\x10\x01\x12\x06\n" + + "\x02V2\x10\x02B~\n" + + "\x13org.tensorflow.utilB\vSaverProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_saver_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_saver_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_saver_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_saver_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_saver_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_saver_proto_rawDesc), len(file_tensorflow_core_protobuf_saver_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_saver_proto_rawDescData +} + +var file_tensorflow_core_protobuf_saver_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_tensorflow_core_protobuf_saver_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_tensorflow_core_protobuf_saver_proto_goTypes = []any{ + (SaverDef_CheckpointFormatVersion)(0), // 0: tensorflow.SaverDef.CheckpointFormatVersion + (*SaverDef)(nil), // 1: tensorflow.SaverDef +} +var file_tensorflow_core_protobuf_saver_proto_depIdxs = []int32{ + 0, // 0: tensorflow.SaverDef.version:type_name -> tensorflow.SaverDef.CheckpointFormatVersion + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_saver_proto_init() } +func file_tensorflow_core_protobuf_saver_proto_init() { + if File_tensorflow_core_protobuf_saver_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_saver_proto_rawDesc), len(file_tensorflow_core_protobuf_saver_proto_rawDesc)), + NumEnums: 1, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_saver_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_saver_proto_depIdxs, + EnumInfos: file_tensorflow_core_protobuf_saver_proto_enumTypes, + MessageInfos: file_tensorflow_core_protobuf_saver_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_saver_proto = out.File + file_tensorflow_core_protobuf_saver_proto_goTypes = nil + file_tensorflow_core_protobuf_saver_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/struct.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/struct.pb.go new file mode 100644 index 0000000..c823e05 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/struct.pb.go @@ -0,0 +1,1083 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/struct.proto + +package for_core_protos_go_proto + +import ( + tensor_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_go_proto" + tensor_shape_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_shape_go_proto" + types_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/types_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type TypeSpecProto_TypeSpecClass int32 + +const ( + TypeSpecProto_UNKNOWN TypeSpecProto_TypeSpecClass = 0 + TypeSpecProto_SPARSE_TENSOR_SPEC TypeSpecProto_TypeSpecClass = 1 // tf.SparseTensorSpec + TypeSpecProto_INDEXED_SLICES_SPEC TypeSpecProto_TypeSpecClass = 2 // tf.IndexedSlicesSpec + TypeSpecProto_RAGGED_TENSOR_SPEC TypeSpecProto_TypeSpecClass = 3 // tf.RaggedTensorSpec + TypeSpecProto_TENSOR_ARRAY_SPEC TypeSpecProto_TypeSpecClass = 4 // tf.TensorArraySpec + TypeSpecProto_DATA_DATASET_SPEC TypeSpecProto_TypeSpecClass = 5 // tf.data.DatasetSpec + TypeSpecProto_DATA_ITERATOR_SPEC TypeSpecProto_TypeSpecClass = 6 // IteratorSpec from data/ops/iterator_ops.py + TypeSpecProto_OPTIONAL_SPEC TypeSpecProto_TypeSpecClass = 7 // tf.OptionalSpec + TypeSpecProto_PER_REPLICA_SPEC TypeSpecProto_TypeSpecClass = 8 // PerReplicaSpec from distribute/values.py + TypeSpecProto_VARIABLE_SPEC TypeSpecProto_TypeSpecClass = 9 // tf.VariableSpec + TypeSpecProto_ROW_PARTITION_SPEC TypeSpecProto_TypeSpecClass = 10 // RowPartitionSpec from ragged/row_partition.py + TypeSpecProto_NDARRAY_SPEC TypeSpecProto_TypeSpecClass = 11 // TF Numpy NDarray spec +) + +// Enum value maps for TypeSpecProto_TypeSpecClass. +var ( + TypeSpecProto_TypeSpecClass_name = map[int32]string{ + 0: "UNKNOWN", + 1: "SPARSE_TENSOR_SPEC", + 2: "INDEXED_SLICES_SPEC", + 3: "RAGGED_TENSOR_SPEC", + 4: "TENSOR_ARRAY_SPEC", + 5: "DATA_DATASET_SPEC", + 6: "DATA_ITERATOR_SPEC", + 7: "OPTIONAL_SPEC", + 8: "PER_REPLICA_SPEC", + 9: "VARIABLE_SPEC", + 10: "ROW_PARTITION_SPEC", + 11: "NDARRAY_SPEC", + } + TypeSpecProto_TypeSpecClass_value = map[string]int32{ + "UNKNOWN": 0, + "SPARSE_TENSOR_SPEC": 1, + "INDEXED_SLICES_SPEC": 2, + "RAGGED_TENSOR_SPEC": 3, + "TENSOR_ARRAY_SPEC": 4, + "DATA_DATASET_SPEC": 5, + "DATA_ITERATOR_SPEC": 6, + "OPTIONAL_SPEC": 7, + "PER_REPLICA_SPEC": 8, + "VARIABLE_SPEC": 9, + "ROW_PARTITION_SPEC": 10, + "NDARRAY_SPEC": 11, + } +) + +func (x TypeSpecProto_TypeSpecClass) Enum() *TypeSpecProto_TypeSpecClass { + p := new(TypeSpecProto_TypeSpecClass) + *p = x + return p +} + +func (x TypeSpecProto_TypeSpecClass) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (TypeSpecProto_TypeSpecClass) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_protobuf_struct_proto_enumTypes[0].Descriptor() +} + +func (TypeSpecProto_TypeSpecClass) Type() protoreflect.EnumType { + return &file_tensorflow_core_protobuf_struct_proto_enumTypes[0] +} + +func (x TypeSpecProto_TypeSpecClass) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use TypeSpecProto_TypeSpecClass.Descriptor instead. +func (TypeSpecProto_TypeSpecClass) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_struct_proto_rawDescGZIP(), []int{9, 0} +} + +// `StructuredValue` represents a dynamically typed value representing various +// data structures that are inspired by Python data structures typically used in +// TensorFlow functions as inputs and outputs. +// +// For example when saving a Layer there may be a `training` argument. If the +// user passes a boolean True/False, that switches between two concrete +// TensorFlow functions. In order to switch between them in the same way after +// loading the SavedModel, we need to represent "True" and "False". +// +// A more advanced example might be a function which takes a list of +// dictionaries mapping from strings to Tensors. In order to map from +// user-specified arguments `[{"a": tf.constant(1.)}, {"q": tf.constant(3.)}]` +// after load to the right saved TensorFlow function, we need to represent the +// nested structure and the strings, recording that we have a trace for anything +// matching `[{"a": tf.TensorSpec(None, tf.float32)}, {"q": tf.TensorSpec([], +// tf.float64)}]` as an example. +// +// Likewise functions may return nested structures of Tensors, for example +// returning a dictionary mapping from strings to Tensors. In order for the +// loaded function to return the same structure we need to serialize it. +// +// This is an ergonomic aid for working with loaded SavedModels, not a promise +// to serialize all possible function signatures. For example we do not expect +// to pickle generic Python objects, and ideally we'd stay language-agnostic. +type StructuredValue struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The kind of value. + // + // Types that are valid to be assigned to Kind: + // + // *StructuredValue_NoneValue + // *StructuredValue_Float64Value + // *StructuredValue_Int64Value + // *StructuredValue_StringValue + // *StructuredValue_BoolValue + // *StructuredValue_TensorShapeValue + // *StructuredValue_TensorDtypeValue + // *StructuredValue_TensorSpecValue + // *StructuredValue_TypeSpecValue + // *StructuredValue_BoundedTensorSpecValue + // *StructuredValue_ListValue + // *StructuredValue_TupleValue + // *StructuredValue_DictValue + // *StructuredValue_NamedTupleValue + Kind isStructuredValue_Kind `protobuf_oneof:"kind"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *StructuredValue) Reset() { + *x = StructuredValue{} + mi := &file_tensorflow_core_protobuf_struct_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *StructuredValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StructuredValue) ProtoMessage() {} + +func (x *StructuredValue) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_struct_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StructuredValue.ProtoReflect.Descriptor instead. +func (*StructuredValue) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_struct_proto_rawDescGZIP(), []int{0} +} + +func (x *StructuredValue) GetKind() isStructuredValue_Kind { + if x != nil { + return x.Kind + } + return nil +} + +func (x *StructuredValue) GetNoneValue() *NoneValue { + if x != nil { + if x, ok := x.Kind.(*StructuredValue_NoneValue); ok { + return x.NoneValue + } + } + return nil +} + +func (x *StructuredValue) GetFloat64Value() float64 { + if x != nil { + if x, ok := x.Kind.(*StructuredValue_Float64Value); ok { + return x.Float64Value + } + } + return 0 +} + +func (x *StructuredValue) GetInt64Value() int64 { + if x != nil { + if x, ok := x.Kind.(*StructuredValue_Int64Value); ok { + return x.Int64Value + } + } + return 0 +} + +func (x *StructuredValue) GetStringValue() string { + if x != nil { + if x, ok := x.Kind.(*StructuredValue_StringValue); ok { + return x.StringValue + } + } + return "" +} + +func (x *StructuredValue) GetBoolValue() bool { + if x != nil { + if x, ok := x.Kind.(*StructuredValue_BoolValue); ok { + return x.BoolValue + } + } + return false +} + +func (x *StructuredValue) GetTensorShapeValue() *tensor_shape_go_proto.TensorShapeProto { + if x != nil { + if x, ok := x.Kind.(*StructuredValue_TensorShapeValue); ok { + return x.TensorShapeValue + } + } + return nil +} + +func (x *StructuredValue) GetTensorDtypeValue() types_go_proto.DataType { + if x != nil { + if x, ok := x.Kind.(*StructuredValue_TensorDtypeValue); ok { + return x.TensorDtypeValue + } + } + return types_go_proto.DataType(0) +} + +func (x *StructuredValue) GetTensorSpecValue() *TensorSpecProto { + if x != nil { + if x, ok := x.Kind.(*StructuredValue_TensorSpecValue); ok { + return x.TensorSpecValue + } + } + return nil +} + +func (x *StructuredValue) GetTypeSpecValue() *TypeSpecProto { + if x != nil { + if x, ok := x.Kind.(*StructuredValue_TypeSpecValue); ok { + return x.TypeSpecValue + } + } + return nil +} + +func (x *StructuredValue) GetBoundedTensorSpecValue() *BoundedTensorSpecProto { + if x != nil { + if x, ok := x.Kind.(*StructuredValue_BoundedTensorSpecValue); ok { + return x.BoundedTensorSpecValue + } + } + return nil +} + +func (x *StructuredValue) GetListValue() *ListValue { + if x != nil { + if x, ok := x.Kind.(*StructuredValue_ListValue); ok { + return x.ListValue + } + } + return nil +} + +func (x *StructuredValue) GetTupleValue() *TupleValue { + if x != nil { + if x, ok := x.Kind.(*StructuredValue_TupleValue); ok { + return x.TupleValue + } + } + return nil +} + +func (x *StructuredValue) GetDictValue() *DictValue { + if x != nil { + if x, ok := x.Kind.(*StructuredValue_DictValue); ok { + return x.DictValue + } + } + return nil +} + +func (x *StructuredValue) GetNamedTupleValue() *NamedTupleValue { + if x != nil { + if x, ok := x.Kind.(*StructuredValue_NamedTupleValue); ok { + return x.NamedTupleValue + } + } + return nil +} + +type isStructuredValue_Kind interface { + isStructuredValue_Kind() +} + +type StructuredValue_NoneValue struct { + // Represents None. + NoneValue *NoneValue `protobuf:"bytes,1,opt,name=none_value,json=noneValue,proto3,oneof"` +} + +type StructuredValue_Float64Value struct { + // Represents a double-precision floating-point value (a Python `float`). + Float64Value float64 `protobuf:"fixed64,11,opt,name=float64_value,json=float64Value,proto3,oneof"` +} + +type StructuredValue_Int64Value struct { + // Represents a signed integer value, limited to 64 bits. + // Larger values from Python's arbitrary-precision integers are unsupported. + Int64Value int64 `protobuf:"zigzag64,12,opt,name=int64_value,json=int64Value,proto3,oneof"` +} + +type StructuredValue_StringValue struct { + // Represents a string of Unicode characters stored in a Python `str`. + // In Python 3, this is exactly what type `str` is. + // In Python 2, this is the UTF-8 encoding of the characters. + // For strings with ASCII characters only (as often used in TensorFlow code) + // there is effectively no difference between the language versions. + // The obsolescent `unicode` type of Python 2 is not supported here. + StringValue string `protobuf:"bytes,13,opt,name=string_value,json=stringValue,proto3,oneof"` +} + +type StructuredValue_BoolValue struct { + // Represents a boolean value. + BoolValue bool `protobuf:"varint,14,opt,name=bool_value,json=boolValue,proto3,oneof"` +} + +type StructuredValue_TensorShapeValue struct { + // Represents a TensorShape. + TensorShapeValue *tensor_shape_go_proto.TensorShapeProto `protobuf:"bytes,31,opt,name=tensor_shape_value,json=tensorShapeValue,proto3,oneof"` +} + +type StructuredValue_TensorDtypeValue struct { + // Represents an enum value for dtype. + TensorDtypeValue types_go_proto.DataType `protobuf:"varint,32,opt,name=tensor_dtype_value,json=tensorDtypeValue,proto3,enum=tensorflow.DataType,oneof"` +} + +type StructuredValue_TensorSpecValue struct { + // Represents a value for tf.TensorSpec. + TensorSpecValue *TensorSpecProto `protobuf:"bytes,33,opt,name=tensor_spec_value,json=tensorSpecValue,proto3,oneof"` +} + +type StructuredValue_TypeSpecValue struct { + // Represents a value for tf.TypeSpec. + TypeSpecValue *TypeSpecProto `protobuf:"bytes,34,opt,name=type_spec_value,json=typeSpecValue,proto3,oneof"` +} + +type StructuredValue_BoundedTensorSpecValue struct { + // Represents a value for tf.BoundedTensorSpec. + BoundedTensorSpecValue *BoundedTensorSpecProto `protobuf:"bytes,35,opt,name=bounded_tensor_spec_value,json=boundedTensorSpecValue,proto3,oneof"` +} + +type StructuredValue_ListValue struct { + // Represents a list of `Value`. + ListValue *ListValue `protobuf:"bytes,51,opt,name=list_value,json=listValue,proto3,oneof"` +} + +type StructuredValue_TupleValue struct { + // Represents a tuple of `Value`. + TupleValue *TupleValue `protobuf:"bytes,52,opt,name=tuple_value,json=tupleValue,proto3,oneof"` +} + +type StructuredValue_DictValue struct { + // Represents a dict `Value`. + DictValue *DictValue `protobuf:"bytes,53,opt,name=dict_value,json=dictValue,proto3,oneof"` +} + +type StructuredValue_NamedTupleValue struct { + // Represents Python's namedtuple. + NamedTupleValue *NamedTupleValue `protobuf:"bytes,54,opt,name=named_tuple_value,json=namedTupleValue,proto3,oneof"` +} + +func (*StructuredValue_NoneValue) isStructuredValue_Kind() {} + +func (*StructuredValue_Float64Value) isStructuredValue_Kind() {} + +func (*StructuredValue_Int64Value) isStructuredValue_Kind() {} + +func (*StructuredValue_StringValue) isStructuredValue_Kind() {} + +func (*StructuredValue_BoolValue) isStructuredValue_Kind() {} + +func (*StructuredValue_TensorShapeValue) isStructuredValue_Kind() {} + +func (*StructuredValue_TensorDtypeValue) isStructuredValue_Kind() {} + +func (*StructuredValue_TensorSpecValue) isStructuredValue_Kind() {} + +func (*StructuredValue_TypeSpecValue) isStructuredValue_Kind() {} + +func (*StructuredValue_BoundedTensorSpecValue) isStructuredValue_Kind() {} + +func (*StructuredValue_ListValue) isStructuredValue_Kind() {} + +func (*StructuredValue_TupleValue) isStructuredValue_Kind() {} + +func (*StructuredValue_DictValue) isStructuredValue_Kind() {} + +func (*StructuredValue_NamedTupleValue) isStructuredValue_Kind() {} + +// Represents None. +type NoneValue struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NoneValue) Reset() { + *x = NoneValue{} + mi := &file_tensorflow_core_protobuf_struct_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NoneValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NoneValue) ProtoMessage() {} + +func (x *NoneValue) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_struct_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NoneValue.ProtoReflect.Descriptor instead. +func (*NoneValue) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_struct_proto_rawDescGZIP(), []int{1} +} + +// Represents a Python list. +type ListValue struct { + state protoimpl.MessageState `protogen:"open.v1"` + Values []*StructuredValue `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListValue) Reset() { + *x = ListValue{} + mi := &file_tensorflow_core_protobuf_struct_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListValue) ProtoMessage() {} + +func (x *ListValue) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_struct_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListValue.ProtoReflect.Descriptor instead. +func (*ListValue) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_struct_proto_rawDescGZIP(), []int{2} +} + +func (x *ListValue) GetValues() []*StructuredValue { + if x != nil { + return x.Values + } + return nil +} + +// Represents a Python tuple. +type TupleValue struct { + state protoimpl.MessageState `protogen:"open.v1"` + Values []*StructuredValue `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TupleValue) Reset() { + *x = TupleValue{} + mi := &file_tensorflow_core_protobuf_struct_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TupleValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TupleValue) ProtoMessage() {} + +func (x *TupleValue) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_struct_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TupleValue.ProtoReflect.Descriptor instead. +func (*TupleValue) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_struct_proto_rawDescGZIP(), []int{3} +} + +func (x *TupleValue) GetValues() []*StructuredValue { + if x != nil { + return x.Values + } + return nil +} + +// Represents a Python dict keyed by `str`. +// The comment on Unicode from Value.string_value applies analogously. +type DictValue struct { + state protoimpl.MessageState `protogen:"open.v1"` + Fields map[string]*StructuredValue `protobuf:"bytes,1,rep,name=fields,proto3" json:"fields,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DictValue) Reset() { + *x = DictValue{} + mi := &file_tensorflow_core_protobuf_struct_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DictValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DictValue) ProtoMessage() {} + +func (x *DictValue) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_struct_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DictValue.ProtoReflect.Descriptor instead. +func (*DictValue) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_struct_proto_rawDescGZIP(), []int{4} +} + +func (x *DictValue) GetFields() map[string]*StructuredValue { + if x != nil { + return x.Fields + } + return nil +} + +// Represents a (key, value) pair. +type PairValue struct { + state protoimpl.MessageState `protogen:"open.v1"` + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Value *StructuredValue `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PairValue) Reset() { + *x = PairValue{} + mi := &file_tensorflow_core_protobuf_struct_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PairValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PairValue) ProtoMessage() {} + +func (x *PairValue) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_struct_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PairValue.ProtoReflect.Descriptor instead. +func (*PairValue) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_struct_proto_rawDescGZIP(), []int{5} +} + +func (x *PairValue) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *PairValue) GetValue() *StructuredValue { + if x != nil { + return x.Value + } + return nil +} + +// Represents Python's namedtuple. +type NamedTupleValue struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Values []*PairValue `protobuf:"bytes,2,rep,name=values,proto3" json:"values,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NamedTupleValue) Reset() { + *x = NamedTupleValue{} + mi := &file_tensorflow_core_protobuf_struct_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NamedTupleValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NamedTupleValue) ProtoMessage() {} + +func (x *NamedTupleValue) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_struct_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NamedTupleValue.ProtoReflect.Descriptor instead. +func (*NamedTupleValue) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_struct_proto_rawDescGZIP(), []int{6} +} + +func (x *NamedTupleValue) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *NamedTupleValue) GetValues() []*PairValue { + if x != nil { + return x.Values + } + return nil +} + +// A protobuf to represent tf.TensorSpec. +type TensorSpecProto struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Shape *tensor_shape_go_proto.TensorShapeProto `protobuf:"bytes,2,opt,name=shape,proto3" json:"shape,omitempty"` + Dtype types_go_proto.DataType `protobuf:"varint,3,opt,name=dtype,proto3,enum=tensorflow.DataType" json:"dtype,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TensorSpecProto) Reset() { + *x = TensorSpecProto{} + mi := &file_tensorflow_core_protobuf_struct_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TensorSpecProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TensorSpecProto) ProtoMessage() {} + +func (x *TensorSpecProto) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_struct_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TensorSpecProto.ProtoReflect.Descriptor instead. +func (*TensorSpecProto) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_struct_proto_rawDescGZIP(), []int{7} +} + +func (x *TensorSpecProto) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *TensorSpecProto) GetShape() *tensor_shape_go_proto.TensorShapeProto { + if x != nil { + return x.Shape + } + return nil +} + +func (x *TensorSpecProto) GetDtype() types_go_proto.DataType { + if x != nil { + return x.Dtype + } + return types_go_proto.DataType(0) +} + +// A protobuf to represent tf.BoundedTensorSpec. +type BoundedTensorSpecProto struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Shape *tensor_shape_go_proto.TensorShapeProto `protobuf:"bytes,2,opt,name=shape,proto3" json:"shape,omitempty"` + Dtype types_go_proto.DataType `protobuf:"varint,3,opt,name=dtype,proto3,enum=tensorflow.DataType" json:"dtype,omitempty"` + Minimum *tensor_go_proto.TensorProto `protobuf:"bytes,4,opt,name=minimum,proto3" json:"minimum,omitempty"` + Maximum *tensor_go_proto.TensorProto `protobuf:"bytes,5,opt,name=maximum,proto3" json:"maximum,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BoundedTensorSpecProto) Reset() { + *x = BoundedTensorSpecProto{} + mi := &file_tensorflow_core_protobuf_struct_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BoundedTensorSpecProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BoundedTensorSpecProto) ProtoMessage() {} + +func (x *BoundedTensorSpecProto) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_struct_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BoundedTensorSpecProto.ProtoReflect.Descriptor instead. +func (*BoundedTensorSpecProto) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_struct_proto_rawDescGZIP(), []int{8} +} + +func (x *BoundedTensorSpecProto) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *BoundedTensorSpecProto) GetShape() *tensor_shape_go_proto.TensorShapeProto { + if x != nil { + return x.Shape + } + return nil +} + +func (x *BoundedTensorSpecProto) GetDtype() types_go_proto.DataType { + if x != nil { + return x.Dtype + } + return types_go_proto.DataType(0) +} + +func (x *BoundedTensorSpecProto) GetMinimum() *tensor_go_proto.TensorProto { + if x != nil { + return x.Minimum + } + return nil +} + +func (x *BoundedTensorSpecProto) GetMaximum() *tensor_go_proto.TensorProto { + if x != nil { + return x.Maximum + } + return nil +} + +// Represents a tf.TypeSpec +type TypeSpecProto struct { + state protoimpl.MessageState `protogen:"open.v1"` + TypeSpecClass TypeSpecProto_TypeSpecClass `protobuf:"varint,1,opt,name=type_spec_class,json=typeSpecClass,proto3,enum=tensorflow.TypeSpecProto_TypeSpecClass" json:"type_spec_class,omitempty"` + // The value returned by TypeSpec._serialize(). + TypeState *StructuredValue `protobuf:"bytes,2,opt,name=type_state,json=typeState,proto3" json:"type_state,omitempty"` + // This is currently redundant with the type_spec_class enum, and is only + // used for error reporting. In particular, if you use an older binary to + // load a newer model, and the model uses a TypeSpecClass that the older + // binary doesn't support, then this lets us display a useful error message. + TypeSpecClassName string `protobuf:"bytes,3,opt,name=type_spec_class_name,json=typeSpecClassName,proto3" json:"type_spec_class_name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TypeSpecProto) Reset() { + *x = TypeSpecProto{} + mi := &file_tensorflow_core_protobuf_struct_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TypeSpecProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TypeSpecProto) ProtoMessage() {} + +func (x *TypeSpecProto) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_struct_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TypeSpecProto.ProtoReflect.Descriptor instead. +func (*TypeSpecProto) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_struct_proto_rawDescGZIP(), []int{9} +} + +func (x *TypeSpecProto) GetTypeSpecClass() TypeSpecProto_TypeSpecClass { + if x != nil { + return x.TypeSpecClass + } + return TypeSpecProto_UNKNOWN +} + +func (x *TypeSpecProto) GetTypeState() *StructuredValue { + if x != nil { + return x.TypeState + } + return nil +} + +func (x *TypeSpecProto) GetTypeSpecClassName() string { + if x != nil { + return x.TypeSpecClassName + } + return "" +} + +var File_tensorflow_core_protobuf_struct_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_struct_proto_rawDesc = "" + + "\n" + + "%tensorflow/core/protobuf/struct.proto\x12\n" + + "tensorflow\x1a&tensorflow/core/framework/tensor.proto\x1a,tensorflow/core/framework/tensor_shape.proto\x1a%tensorflow/core/framework/types.proto\"\xdc\x06\n" + + "\x0fStructuredValue\x126\n" + + "\n" + + "none_value\x18\x01 \x01(\v2\x15.tensorflow.NoneValueH\x00R\tnoneValue\x12%\n" + + "\rfloat64_value\x18\v \x01(\x01H\x00R\ffloat64Value\x12!\n" + + "\vint64_value\x18\f \x01(\x12H\x00R\n" + + "int64Value\x12#\n" + + "\fstring_value\x18\r \x01(\tH\x00R\vstringValue\x12\x1f\n" + + "\n" + + "bool_value\x18\x0e \x01(\bH\x00R\tboolValue\x12L\n" + + "\x12tensor_shape_value\x18\x1f \x01(\v2\x1c.tensorflow.TensorShapeProtoH\x00R\x10tensorShapeValue\x12D\n" + + "\x12tensor_dtype_value\x18 \x01(\x0e2\x14.tensorflow.DataTypeH\x00R\x10tensorDtypeValue\x12I\n" + + "\x11tensor_spec_value\x18! \x01(\v2\x1b.tensorflow.TensorSpecProtoH\x00R\x0ftensorSpecValue\x12C\n" + + "\x0ftype_spec_value\x18\" \x01(\v2\x19.tensorflow.TypeSpecProtoH\x00R\rtypeSpecValue\x12_\n" + + "\x19bounded_tensor_spec_value\x18# \x01(\v2\".tensorflow.BoundedTensorSpecProtoH\x00R\x16boundedTensorSpecValue\x126\n" + + "\n" + + "list_value\x183 \x01(\v2\x15.tensorflow.ListValueH\x00R\tlistValue\x129\n" + + "\vtuple_value\x184 \x01(\v2\x16.tensorflow.TupleValueH\x00R\n" + + "tupleValue\x126\n" + + "\n" + + "dict_value\x185 \x01(\v2\x15.tensorflow.DictValueH\x00R\tdictValue\x12I\n" + + "\x11named_tuple_value\x186 \x01(\v2\x1b.tensorflow.NamedTupleValueH\x00R\x0fnamedTupleValueB\x06\n" + + "\x04kind\"\v\n" + + "\tNoneValue\"@\n" + + "\tListValue\x123\n" + + "\x06values\x18\x01 \x03(\v2\x1b.tensorflow.StructuredValueR\x06values\"A\n" + + "\n" + + "TupleValue\x123\n" + + "\x06values\x18\x01 \x03(\v2\x1b.tensorflow.StructuredValueR\x06values\"\x9e\x01\n" + + "\tDictValue\x129\n" + + "\x06fields\x18\x01 \x03(\v2!.tensorflow.DictValue.FieldsEntryR\x06fields\x1aV\n" + + "\vFieldsEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x121\n" + + "\x05value\x18\x02 \x01(\v2\x1b.tensorflow.StructuredValueR\x05value:\x028\x01\"P\n" + + "\tPairValue\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x121\n" + + "\x05value\x18\x02 \x01(\v2\x1b.tensorflow.StructuredValueR\x05value\"T\n" + + "\x0fNamedTupleValue\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12-\n" + + "\x06values\x18\x02 \x03(\v2\x15.tensorflow.PairValueR\x06values\"\x85\x01\n" + + "\x0fTensorSpecProto\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x122\n" + + "\x05shape\x18\x02 \x01(\v2\x1c.tensorflow.TensorShapeProtoR\x05shape\x12*\n" + + "\x05dtype\x18\x03 \x01(\x0e2\x14.tensorflow.DataTypeR\x05dtype\"\xf2\x01\n" + + "\x16BoundedTensorSpecProto\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x122\n" + + "\x05shape\x18\x02 \x01(\v2\x1c.tensorflow.TensorShapeProtoR\x05shape\x12*\n" + + "\x05dtype\x18\x03 \x01(\x0e2\x14.tensorflow.DataTypeR\x05dtype\x121\n" + + "\aminimum\x18\x04 \x01(\v2\x17.tensorflow.TensorProtoR\aminimum\x121\n" + + "\amaximum\x18\x05 \x01(\v2\x17.tensorflow.TensorProtoR\amaximum\"\xe1\x03\n" + + "\rTypeSpecProto\x12O\n" + + "\x0ftype_spec_class\x18\x01 \x01(\x0e2'.tensorflow.TypeSpecProto.TypeSpecClassR\rtypeSpecClass\x12:\n" + + "\n" + + "type_state\x18\x02 \x01(\v2\x1b.tensorflow.StructuredValueR\ttypeState\x12/\n" + + "\x14type_spec_class_name\x18\x03 \x01(\tR\x11typeSpecClassName\"\x91\x02\n" + + "\rTypeSpecClass\x12\v\n" + + "\aUNKNOWN\x10\x00\x12\x16\n" + + "\x12SPARSE_TENSOR_SPEC\x10\x01\x12\x17\n" + + "\x13INDEXED_SLICES_SPEC\x10\x02\x12\x16\n" + + "\x12RAGGED_TENSOR_SPEC\x10\x03\x12\x15\n" + + "\x11TENSOR_ARRAY_SPEC\x10\x04\x12\x15\n" + + "\x11DATA_DATASET_SPEC\x10\x05\x12\x16\n" + + "\x12DATA_ITERATOR_SPEC\x10\x06\x12\x11\n" + + "\rOPTIONAL_SPEC\x10\a\x12\x14\n" + + "\x10PER_REPLICA_SPEC\x10\b\x12\x11\n" + + "\rVARIABLE_SPEC\x10\t\x12\x16\n" + + "\x12ROW_PARTITION_SPEC\x10\n" + + "\x12\x10\n" + + "\fNDARRAY_SPEC\x10\vBWZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_protob\x06proto3" + +var ( + file_tensorflow_core_protobuf_struct_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_struct_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_struct_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_struct_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_struct_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_struct_proto_rawDesc), len(file_tensorflow_core_protobuf_struct_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_struct_proto_rawDescData +} + +var file_tensorflow_core_protobuf_struct_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_tensorflow_core_protobuf_struct_proto_msgTypes = make([]protoimpl.MessageInfo, 11) +var file_tensorflow_core_protobuf_struct_proto_goTypes = []any{ + (TypeSpecProto_TypeSpecClass)(0), // 0: tensorflow.TypeSpecProto.TypeSpecClass + (*StructuredValue)(nil), // 1: tensorflow.StructuredValue + (*NoneValue)(nil), // 2: tensorflow.NoneValue + (*ListValue)(nil), // 3: tensorflow.ListValue + (*TupleValue)(nil), // 4: tensorflow.TupleValue + (*DictValue)(nil), // 5: tensorflow.DictValue + (*PairValue)(nil), // 6: tensorflow.PairValue + (*NamedTupleValue)(nil), // 7: tensorflow.NamedTupleValue + (*TensorSpecProto)(nil), // 8: tensorflow.TensorSpecProto + (*BoundedTensorSpecProto)(nil), // 9: tensorflow.BoundedTensorSpecProto + (*TypeSpecProto)(nil), // 10: tensorflow.TypeSpecProto + nil, // 11: tensorflow.DictValue.FieldsEntry + (*tensor_shape_go_proto.TensorShapeProto)(nil), // 12: tensorflow.TensorShapeProto + (types_go_proto.DataType)(0), // 13: tensorflow.DataType + (*tensor_go_proto.TensorProto)(nil), // 14: tensorflow.TensorProto +} +var file_tensorflow_core_protobuf_struct_proto_depIdxs = []int32{ + 2, // 0: tensorflow.StructuredValue.none_value:type_name -> tensorflow.NoneValue + 12, // 1: tensorflow.StructuredValue.tensor_shape_value:type_name -> tensorflow.TensorShapeProto + 13, // 2: tensorflow.StructuredValue.tensor_dtype_value:type_name -> tensorflow.DataType + 8, // 3: tensorflow.StructuredValue.tensor_spec_value:type_name -> tensorflow.TensorSpecProto + 10, // 4: tensorflow.StructuredValue.type_spec_value:type_name -> tensorflow.TypeSpecProto + 9, // 5: tensorflow.StructuredValue.bounded_tensor_spec_value:type_name -> tensorflow.BoundedTensorSpecProto + 3, // 6: tensorflow.StructuredValue.list_value:type_name -> tensorflow.ListValue + 4, // 7: tensorflow.StructuredValue.tuple_value:type_name -> tensorflow.TupleValue + 5, // 8: tensorflow.StructuredValue.dict_value:type_name -> tensorflow.DictValue + 7, // 9: tensorflow.StructuredValue.named_tuple_value:type_name -> tensorflow.NamedTupleValue + 1, // 10: tensorflow.ListValue.values:type_name -> tensorflow.StructuredValue + 1, // 11: tensorflow.TupleValue.values:type_name -> tensorflow.StructuredValue + 11, // 12: tensorflow.DictValue.fields:type_name -> tensorflow.DictValue.FieldsEntry + 1, // 13: tensorflow.PairValue.value:type_name -> tensorflow.StructuredValue + 6, // 14: tensorflow.NamedTupleValue.values:type_name -> tensorflow.PairValue + 12, // 15: tensorflow.TensorSpecProto.shape:type_name -> tensorflow.TensorShapeProto + 13, // 16: tensorflow.TensorSpecProto.dtype:type_name -> tensorflow.DataType + 12, // 17: tensorflow.BoundedTensorSpecProto.shape:type_name -> tensorflow.TensorShapeProto + 13, // 18: tensorflow.BoundedTensorSpecProto.dtype:type_name -> tensorflow.DataType + 14, // 19: tensorflow.BoundedTensorSpecProto.minimum:type_name -> tensorflow.TensorProto + 14, // 20: tensorflow.BoundedTensorSpecProto.maximum:type_name -> tensorflow.TensorProto + 0, // 21: tensorflow.TypeSpecProto.type_spec_class:type_name -> tensorflow.TypeSpecProto.TypeSpecClass + 1, // 22: tensorflow.TypeSpecProto.type_state:type_name -> tensorflow.StructuredValue + 1, // 23: tensorflow.DictValue.FieldsEntry.value:type_name -> tensorflow.StructuredValue + 24, // [24:24] is the sub-list for method output_type + 24, // [24:24] is the sub-list for method input_type + 24, // [24:24] is the sub-list for extension type_name + 24, // [24:24] is the sub-list for extension extendee + 0, // [0:24] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_struct_proto_init() } +func file_tensorflow_core_protobuf_struct_proto_init() { + if File_tensorflow_core_protobuf_struct_proto != nil { + return + } + file_tensorflow_core_protobuf_struct_proto_msgTypes[0].OneofWrappers = []any{ + (*StructuredValue_NoneValue)(nil), + (*StructuredValue_Float64Value)(nil), + (*StructuredValue_Int64Value)(nil), + (*StructuredValue_StringValue)(nil), + (*StructuredValue_BoolValue)(nil), + (*StructuredValue_TensorShapeValue)(nil), + (*StructuredValue_TensorDtypeValue)(nil), + (*StructuredValue_TensorSpecValue)(nil), + (*StructuredValue_TypeSpecValue)(nil), + (*StructuredValue_BoundedTensorSpecValue)(nil), + (*StructuredValue_ListValue)(nil), + (*StructuredValue_TupleValue)(nil), + (*StructuredValue_DictValue)(nil), + (*StructuredValue_NamedTupleValue)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_struct_proto_rawDesc), len(file_tensorflow_core_protobuf_struct_proto_rawDesc)), + NumEnums: 1, + NumMessages: 11, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_struct_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_struct_proto_depIdxs, + EnumInfos: file_tensorflow_core_protobuf_struct_proto_enumTypes, + MessageInfos: file_tensorflow_core_protobuf_struct_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_struct_proto = out.File + file_tensorflow_core_protobuf_struct_proto_goTypes = nil + file_tensorflow_core_protobuf_struct_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/tensor_bundle.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/tensor_bundle.pb.go new file mode 100644 index 0000000..3fac279 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/tensor_bundle.pb.go @@ -0,0 +1,340 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/tensor_bundle.proto + +package for_core_protos_go_proto + +import ( + tensor_shape_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_shape_go_proto" + tensor_slice_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_slice_go_proto" + types_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/types_go_proto" + versions_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/versions_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// An enum indicating the endianness of the platform that produced this +// bundle. A bundle can only be read by a platform with matching endianness. +// Defaults to LITTLE, as most modern platforms are little-endian. +// +// Affects the binary tensor data bytes only, not the metadata in protobufs. +type BundleHeaderProto_Endianness int32 + +const ( + BundleHeaderProto_LITTLE BundleHeaderProto_Endianness = 0 + BundleHeaderProto_BIG BundleHeaderProto_Endianness = 1 +) + +// Enum value maps for BundleHeaderProto_Endianness. +var ( + BundleHeaderProto_Endianness_name = map[int32]string{ + 0: "LITTLE", + 1: "BIG", + } + BundleHeaderProto_Endianness_value = map[string]int32{ + "LITTLE": 0, + "BIG": 1, + } +) + +func (x BundleHeaderProto_Endianness) Enum() *BundleHeaderProto_Endianness { + p := new(BundleHeaderProto_Endianness) + *p = x + return p +} + +func (x BundleHeaderProto_Endianness) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (BundleHeaderProto_Endianness) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_protobuf_tensor_bundle_proto_enumTypes[0].Descriptor() +} + +func (BundleHeaderProto_Endianness) Type() protoreflect.EnumType { + return &file_tensorflow_core_protobuf_tensor_bundle_proto_enumTypes[0] +} + +func (x BundleHeaderProto_Endianness) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use BundleHeaderProto_Endianness.Descriptor instead. +func (BundleHeaderProto_Endianness) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_tensor_bundle_proto_rawDescGZIP(), []int{0, 0} +} + +// Special header that is associated with a bundle. +// +// TODO(zongheng,zhifengc): maybe in the future, we can add information about +// which binary produced this checkpoint, timestamp, etc. Sometime, these can be +// valuable debugging information. And if needed, these can be used as defensive +// information ensuring reader (binary version) of the checkpoint and the writer +// (binary version) must match within certain range, etc. +type BundleHeaderProto struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Number of data files in the bundle. + NumShards int32 `protobuf:"varint,1,opt,name=num_shards,json=numShards,proto3" json:"num_shards,omitempty"` + Endianness BundleHeaderProto_Endianness `protobuf:"varint,2,opt,name=endianness,proto3,enum=tensorflow.BundleHeaderProto_Endianness" json:"endianness,omitempty"` + // Versioning of the tensor bundle format. + Version *versions_go_proto.VersionDef `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BundleHeaderProto) Reset() { + *x = BundleHeaderProto{} + mi := &file_tensorflow_core_protobuf_tensor_bundle_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BundleHeaderProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BundleHeaderProto) ProtoMessage() {} + +func (x *BundleHeaderProto) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_tensor_bundle_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BundleHeaderProto.ProtoReflect.Descriptor instead. +func (*BundleHeaderProto) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_tensor_bundle_proto_rawDescGZIP(), []int{0} +} + +func (x *BundleHeaderProto) GetNumShards() int32 { + if x != nil { + return x.NumShards + } + return 0 +} + +func (x *BundleHeaderProto) GetEndianness() BundleHeaderProto_Endianness { + if x != nil { + return x.Endianness + } + return BundleHeaderProto_LITTLE +} + +func (x *BundleHeaderProto) GetVersion() *versions_go_proto.VersionDef { + if x != nil { + return x.Version + } + return nil +} + +// Describes the metadata related to a checkpointed tensor. +type BundleEntryProto struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The tensor dtype and shape. + Dtype types_go_proto.DataType `protobuf:"varint,1,opt,name=dtype,proto3,enum=tensorflow.DataType" json:"dtype,omitempty"` + Shape *tensor_shape_go_proto.TensorShapeProto `protobuf:"bytes,2,opt,name=shape,proto3" json:"shape,omitempty"` + // The binary content of the tensor lies in: + // + // File "shard_id": bytes [offset, offset + size). + ShardId int32 `protobuf:"varint,3,opt,name=shard_id,json=shardId,proto3" json:"shard_id,omitempty"` + Offset int64 `protobuf:"varint,4,opt,name=offset,proto3" json:"offset,omitempty"` + Size int64 `protobuf:"varint,5,opt,name=size,proto3" json:"size,omitempty"` + // The CRC32C checksum of the tensor bytes. + Crc32C uint32 `protobuf:"fixed32,6,opt,name=crc32c,proto3" json:"crc32c,omitempty"` + // Iff present, this entry represents a partitioned tensor. The previous + // fields are interpreted as follows: + // + // "dtype", "shape": describe the full tensor. + // "shard_id", "offset", "size", "crc32c": all IGNORED. + // These information for each slice can be looked up in their own + // BundleEntryProto, keyed by each "slice_name". + Slices []*tensor_slice_go_proto.TensorSliceProto `protobuf:"bytes,7,rep,name=slices,proto3" json:"slices,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BundleEntryProto) Reset() { + *x = BundleEntryProto{} + mi := &file_tensorflow_core_protobuf_tensor_bundle_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BundleEntryProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BundleEntryProto) ProtoMessage() {} + +func (x *BundleEntryProto) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_tensor_bundle_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BundleEntryProto.ProtoReflect.Descriptor instead. +func (*BundleEntryProto) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_tensor_bundle_proto_rawDescGZIP(), []int{1} +} + +func (x *BundleEntryProto) GetDtype() types_go_proto.DataType { + if x != nil { + return x.Dtype + } + return types_go_proto.DataType(0) +} + +func (x *BundleEntryProto) GetShape() *tensor_shape_go_proto.TensorShapeProto { + if x != nil { + return x.Shape + } + return nil +} + +func (x *BundleEntryProto) GetShardId() int32 { + if x != nil { + return x.ShardId + } + return 0 +} + +func (x *BundleEntryProto) GetOffset() int64 { + if x != nil { + return x.Offset + } + return 0 +} + +func (x *BundleEntryProto) GetSize() int64 { + if x != nil { + return x.Size + } + return 0 +} + +func (x *BundleEntryProto) GetCrc32C() uint32 { + if x != nil { + return x.Crc32C + } + return 0 +} + +func (x *BundleEntryProto) GetSlices() []*tensor_slice_go_proto.TensorSliceProto { + if x != nil { + return x.Slices + } + return nil +} + +var File_tensorflow_core_protobuf_tensor_bundle_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_tensor_bundle_proto_rawDesc = "" + + "\n" + + ",tensorflow/core/protobuf/tensor_bundle.proto\x12\n" + + "tensorflow\x1a,tensorflow/core/framework/tensor_shape.proto\x1a,tensorflow/core/framework/tensor_slice.proto\x1a%tensorflow/core/framework/types.proto\x1a(tensorflow/core/framework/versions.proto\"\xd1\x01\n" + + "\x11BundleHeaderProto\x12\x1d\n" + + "\n" + + "num_shards\x18\x01 \x01(\x05R\tnumShards\x12H\n" + + "\n" + + "endianness\x18\x02 \x01(\x0e2(.tensorflow.BundleHeaderProto.EndiannessR\n" + + "endianness\x120\n" + + "\aversion\x18\x03 \x01(\v2\x16.tensorflow.VersionDefR\aversion\"!\n" + + "\n" + + "Endianness\x12\n" + + "\n" + + "\x06LITTLE\x10\x00\x12\a\n" + + "\x03BIG\x10\x01\"\x87\x02\n" + + "\x10BundleEntryProto\x12*\n" + + "\x05dtype\x18\x01 \x01(\x0e2\x14.tensorflow.DataTypeR\x05dtype\x122\n" + + "\x05shape\x18\x02 \x01(\v2\x1c.tensorflow.TensorShapeProtoR\x05shape\x12\x19\n" + + "\bshard_id\x18\x03 \x01(\x05R\ashardId\x12\x16\n" + + "\x06offset\x18\x04 \x01(\x03R\x06offset\x12\x12\n" + + "\x04size\x18\x05 \x01(\x03R\x04size\x12\x16\n" + + "\x06crc32c\x18\x06 \x01(\aR\x06crc32c\x124\n" + + "\x06slices\x18\a \x03(\v2\x1c.tensorflow.TensorSliceProtoR\x06slicesB\x85\x01\n" + + "\x13org.tensorflow.utilB\x12TensorBundleProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_tensor_bundle_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_tensor_bundle_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_tensor_bundle_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_tensor_bundle_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_tensor_bundle_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_tensor_bundle_proto_rawDesc), len(file_tensorflow_core_protobuf_tensor_bundle_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_tensor_bundle_proto_rawDescData +} + +var file_tensorflow_core_protobuf_tensor_bundle_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_tensorflow_core_protobuf_tensor_bundle_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_tensorflow_core_protobuf_tensor_bundle_proto_goTypes = []any{ + (BundleHeaderProto_Endianness)(0), // 0: tensorflow.BundleHeaderProto.Endianness + (*BundleHeaderProto)(nil), // 1: tensorflow.BundleHeaderProto + (*BundleEntryProto)(nil), // 2: tensorflow.BundleEntryProto + (*versions_go_proto.VersionDef)(nil), // 3: tensorflow.VersionDef + (types_go_proto.DataType)(0), // 4: tensorflow.DataType + (*tensor_shape_go_proto.TensorShapeProto)(nil), // 5: tensorflow.TensorShapeProto + (*tensor_slice_go_proto.TensorSliceProto)(nil), // 6: tensorflow.TensorSliceProto +} +var file_tensorflow_core_protobuf_tensor_bundle_proto_depIdxs = []int32{ + 0, // 0: tensorflow.BundleHeaderProto.endianness:type_name -> tensorflow.BundleHeaderProto.Endianness + 3, // 1: tensorflow.BundleHeaderProto.version:type_name -> tensorflow.VersionDef + 4, // 2: tensorflow.BundleEntryProto.dtype:type_name -> tensorflow.DataType + 5, // 3: tensorflow.BundleEntryProto.shape:type_name -> tensorflow.TensorShapeProto + 6, // 4: tensorflow.BundleEntryProto.slices:type_name -> tensorflow.TensorSliceProto + 5, // [5:5] is the sub-list for method output_type + 5, // [5:5] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_tensor_bundle_proto_init() } +func file_tensorflow_core_protobuf_tensor_bundle_proto_init() { + if File_tensorflow_core_protobuf_tensor_bundle_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_tensor_bundle_proto_rawDesc), len(file_tensorflow_core_protobuf_tensor_bundle_proto_rawDesc)), + NumEnums: 1, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_tensor_bundle_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_tensor_bundle_proto_depIdxs, + EnumInfos: file_tensorflow_core_protobuf_tensor_bundle_proto_enumTypes, + MessageInfos: file_tensorflow_core_protobuf_tensor_bundle_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_tensor_bundle_proto = out.File + file_tensorflow_core_protobuf_tensor_bundle_proto_goTypes = nil + file_tensorflow_core_protobuf_tensor_bundle_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/tensorflow_server.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/tensorflow_server.pb.go new file mode 100644 index 0000000..f7b1fe3 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/tensorflow_server.pb.go @@ -0,0 +1,220 @@ +// Copyright 2016 The TensorFlow Authors. All Rights Reserved. +// +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +//============================================================================== + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/tensorflow_server.proto + +package for_core_protos_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Defines the configuration of a single TensorFlow server. +type ServerDef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The cluster of which this server is a member. + Cluster *ClusterDef `protobuf:"bytes,1,opt,name=cluster,proto3" json:"cluster,omitempty"` + // The name of the job of which this server is a member. + // + // NOTE(mrry): The `cluster` field must contain a `JobDef` with a `name` field + // that matches this name. + JobName string `protobuf:"bytes,2,opt,name=job_name,json=jobName,proto3" json:"job_name,omitempty"` + // The task index of this server in its job. + // + // NOTE: The `cluster` field must contain a `JobDef` with a matching `name` + // and a mapping in its `tasks` field for this index. + TaskIndex int32 `protobuf:"varint,3,opt,name=task_index,json=taskIndex,proto3" json:"task_index,omitempty"` + // The default configuration for sessions that run on this server. + DefaultSessionConfig *ConfigProto `protobuf:"bytes,4,opt,name=default_session_config,json=defaultSessionConfig,proto3" json:"default_session_config,omitempty"` + // The protocol to be used by this server. + // + // Acceptable values include: "grpc", "grpc+verbs". + Protocol string `protobuf:"bytes,5,opt,name=protocol,proto3" json:"protocol,omitempty"` + // The server port. If not set, then we identify the port from the job_name. + Port int32 `protobuf:"varint,6,opt,name=port,proto3" json:"port,omitempty"` + // Device filters for remote tasks in the cluster. + // NOTE: This is an experimental feature and only effective in TensorFlow 2.x. + ClusterDeviceFilters *ClusterDeviceFilters `protobuf:"bytes,7,opt,name=cluster_device_filters,json=clusterDeviceFilters,proto3" json:"cluster_device_filters,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ServerDef) Reset() { + *x = ServerDef{} + mi := &file_tensorflow_core_protobuf_tensorflow_server_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ServerDef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ServerDef) ProtoMessage() {} + +func (x *ServerDef) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_tensorflow_server_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ServerDef.ProtoReflect.Descriptor instead. +func (*ServerDef) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_tensorflow_server_proto_rawDescGZIP(), []int{0} +} + +func (x *ServerDef) GetCluster() *ClusterDef { + if x != nil { + return x.Cluster + } + return nil +} + +func (x *ServerDef) GetJobName() string { + if x != nil { + return x.JobName + } + return "" +} + +func (x *ServerDef) GetTaskIndex() int32 { + if x != nil { + return x.TaskIndex + } + return 0 +} + +func (x *ServerDef) GetDefaultSessionConfig() *ConfigProto { + if x != nil { + return x.DefaultSessionConfig + } + return nil +} + +func (x *ServerDef) GetProtocol() string { + if x != nil { + return x.Protocol + } + return "" +} + +func (x *ServerDef) GetPort() int32 { + if x != nil { + return x.Port + } + return 0 +} + +func (x *ServerDef) GetClusterDeviceFilters() *ClusterDeviceFilters { + if x != nil { + return x.ClusterDeviceFilters + } + return nil +} + +var File_tensorflow_core_protobuf_tensorflow_server_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_tensorflow_server_proto_rawDesc = "" + + "\n" + + "0tensorflow/core/protobuf/tensorflow_server.proto\x12\n" + + "tensorflow\x1a&tensorflow/core/protobuf/cluster.proto\x1a%tensorflow/core/protobuf/config.proto\x1a-tensorflow/core/protobuf/device_filters.proto\"\xce\x02\n" + + "\tServerDef\x120\n" + + "\acluster\x18\x01 \x01(\v2\x16.tensorflow.ClusterDefR\acluster\x12\x19\n" + + "\bjob_name\x18\x02 \x01(\tR\ajobName\x12\x1d\n" + + "\n" + + "task_index\x18\x03 \x01(\x05R\ttaskIndex\x12M\n" + + "\x16default_session_config\x18\x04 \x01(\v2\x17.tensorflow.ConfigProtoR\x14defaultSessionConfig\x12\x1a\n" + + "\bprotocol\x18\x05 \x01(\tR\bprotocol\x12\x12\n" + + "\x04port\x18\x06 \x01(\x05R\x04port\x12V\n" + + "\x16cluster_device_filters\x18\a \x01(\v2 .tensorflow.ClusterDeviceFiltersR\x14clusterDeviceFiltersB\x86\x01\n" + + "\x1aorg.tensorflow.distruntimeB\fServerProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_tensorflow_server_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_tensorflow_server_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_tensorflow_server_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_tensorflow_server_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_tensorflow_server_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_tensorflow_server_proto_rawDesc), len(file_tensorflow_core_protobuf_tensorflow_server_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_tensorflow_server_proto_rawDescData +} + +var file_tensorflow_core_protobuf_tensorflow_server_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_tensorflow_core_protobuf_tensorflow_server_proto_goTypes = []any{ + (*ServerDef)(nil), // 0: tensorflow.ServerDef + (*ClusterDef)(nil), // 1: tensorflow.ClusterDef + (*ConfigProto)(nil), // 2: tensorflow.ConfigProto + (*ClusterDeviceFilters)(nil), // 3: tensorflow.ClusterDeviceFilters +} +var file_tensorflow_core_protobuf_tensorflow_server_proto_depIdxs = []int32{ + 1, // 0: tensorflow.ServerDef.cluster:type_name -> tensorflow.ClusterDef + 2, // 1: tensorflow.ServerDef.default_session_config:type_name -> tensorflow.ConfigProto + 3, // 2: tensorflow.ServerDef.cluster_device_filters:type_name -> tensorflow.ClusterDeviceFilters + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_tensorflow_server_proto_init() } +func file_tensorflow_core_protobuf_tensorflow_server_proto_init() { + if File_tensorflow_core_protobuf_tensorflow_server_proto != nil { + return + } + file_tensorflow_core_protobuf_cluster_proto_init() + file_tensorflow_core_protobuf_config_proto_init() + file_tensorflow_core_protobuf_device_filters_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_tensorflow_server_proto_rawDesc), len(file_tensorflow_core_protobuf_tensorflow_server_proto_rawDesc)), + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_tensorflow_server_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_tensorflow_server_proto_depIdxs, + MessageInfos: file_tensorflow_core_protobuf_tensorflow_server_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_tensorflow_server_proto = out.File + file_tensorflow_core_protobuf_tensorflow_server_proto_goTypes = nil + file_tensorflow_core_protobuf_tensorflow_server_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/trackable_object_graph.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/trackable_object_graph.pb.go new file mode 100644 index 0000000..dfeba54 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/trackable_object_graph.pb.go @@ -0,0 +1,412 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/trackable_object_graph.proto + +package for_core_protos_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type TrackableObjectGraph struct { + state protoimpl.MessageState `protogen:"open.v1"` + Nodes []*TrackableObjectGraph_TrackableObject `protobuf:"bytes,1,rep,name=nodes,proto3" json:"nodes,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TrackableObjectGraph) Reset() { + *x = TrackableObjectGraph{} + mi := &file_tensorflow_core_protobuf_trackable_object_graph_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TrackableObjectGraph) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TrackableObjectGraph) ProtoMessage() {} + +func (x *TrackableObjectGraph) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_trackable_object_graph_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TrackableObjectGraph.ProtoReflect.Descriptor instead. +func (*TrackableObjectGraph) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_trackable_object_graph_proto_rawDescGZIP(), []int{0} +} + +func (x *TrackableObjectGraph) GetNodes() []*TrackableObjectGraph_TrackableObject { + if x != nil { + return x.Nodes + } + return nil +} + +type TrackableObjectGraph_TrackableObject struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Objects which this object depends on. + Children []*TrackableObjectGraph_TrackableObject_ObjectReference `protobuf:"bytes,1,rep,name=children,proto3" json:"children,omitempty"` + // Serialized data specific to this object. + Attributes []*TrackableObjectGraph_TrackableObject_SerializedTensor `protobuf:"bytes,2,rep,name=attributes,proto3" json:"attributes,omitempty"` + // Slot variables owned by this object. + SlotVariables []*TrackableObjectGraph_TrackableObject_SlotVariableReference `protobuf:"bytes,3,rep,name=slot_variables,json=slotVariables,proto3" json:"slot_variables,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TrackableObjectGraph_TrackableObject) Reset() { + *x = TrackableObjectGraph_TrackableObject{} + mi := &file_tensorflow_core_protobuf_trackable_object_graph_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TrackableObjectGraph_TrackableObject) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TrackableObjectGraph_TrackableObject) ProtoMessage() {} + +func (x *TrackableObjectGraph_TrackableObject) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_trackable_object_graph_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TrackableObjectGraph_TrackableObject.ProtoReflect.Descriptor instead. +func (*TrackableObjectGraph_TrackableObject) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_trackable_object_graph_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *TrackableObjectGraph_TrackableObject) GetChildren() []*TrackableObjectGraph_TrackableObject_ObjectReference { + if x != nil { + return x.Children + } + return nil +} + +func (x *TrackableObjectGraph_TrackableObject) GetAttributes() []*TrackableObjectGraph_TrackableObject_SerializedTensor { + if x != nil { + return x.Attributes + } + return nil +} + +func (x *TrackableObjectGraph_TrackableObject) GetSlotVariables() []*TrackableObjectGraph_TrackableObject_SlotVariableReference { + if x != nil { + return x.SlotVariables + } + return nil +} + +type TrackableObjectGraph_TrackableObject_ObjectReference struct { + state protoimpl.MessageState `protogen:"open.v1"` + // An index into `TrackableObjectGraph.nodes`, indicating the object + // being referenced. + NodeId int32 `protobuf:"varint,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` + // A user-provided name for the edge. + LocalName string `protobuf:"bytes,2,opt,name=local_name,json=localName,proto3" json:"local_name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TrackableObjectGraph_TrackableObject_ObjectReference) Reset() { + *x = TrackableObjectGraph_TrackableObject_ObjectReference{} + mi := &file_tensorflow_core_protobuf_trackable_object_graph_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TrackableObjectGraph_TrackableObject_ObjectReference) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TrackableObjectGraph_TrackableObject_ObjectReference) ProtoMessage() {} + +func (x *TrackableObjectGraph_TrackableObject_ObjectReference) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_trackable_object_graph_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TrackableObjectGraph_TrackableObject_ObjectReference.ProtoReflect.Descriptor instead. +func (*TrackableObjectGraph_TrackableObject_ObjectReference) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_trackable_object_graph_proto_rawDescGZIP(), []int{0, 0, 0} +} + +func (x *TrackableObjectGraph_TrackableObject_ObjectReference) GetNodeId() int32 { + if x != nil { + return x.NodeId + } + return 0 +} + +func (x *TrackableObjectGraph_TrackableObject_ObjectReference) GetLocalName() string { + if x != nil { + return x.LocalName + } + return "" +} + +type TrackableObjectGraph_TrackableObject_SerializedTensor struct { + state protoimpl.MessageState `protogen:"open.v1"` + // A name for the Tensor. Simple variables have only one + // `SerializedTensor` named "VARIABLE_VALUE" by convention. This value may + // be restored on object creation as an optimization. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // The full name of the variable/tensor, if applicable. Used to allow + // name-based loading of checkpoints which were saved using an + // object-based API. Should match the checkpoint key which would have been + // assigned by tf.train.Saver. + FullName string `protobuf:"bytes,2,opt,name=full_name,json=fullName,proto3" json:"full_name,omitempty"` + // The generated name of the Tensor in the checkpoint. + CheckpointKey string `protobuf:"bytes,3,opt,name=checkpoint_key,json=checkpointKey,proto3" json:"checkpoint_key,omitempty"` + // 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. + OptionalRestore bool `protobuf:"varint,4,opt,name=optional_restore,json=optionalRestore,proto3" json:"optional_restore,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TrackableObjectGraph_TrackableObject_SerializedTensor) Reset() { + *x = TrackableObjectGraph_TrackableObject_SerializedTensor{} + mi := &file_tensorflow_core_protobuf_trackable_object_graph_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TrackableObjectGraph_TrackableObject_SerializedTensor) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TrackableObjectGraph_TrackableObject_SerializedTensor) ProtoMessage() {} + +func (x *TrackableObjectGraph_TrackableObject_SerializedTensor) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_trackable_object_graph_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TrackableObjectGraph_TrackableObject_SerializedTensor.ProtoReflect.Descriptor instead. +func (*TrackableObjectGraph_TrackableObject_SerializedTensor) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_trackable_object_graph_proto_rawDescGZIP(), []int{0, 0, 1} +} + +func (x *TrackableObjectGraph_TrackableObject_SerializedTensor) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *TrackableObjectGraph_TrackableObject_SerializedTensor) GetFullName() string { + if x != nil { + return x.FullName + } + return "" +} + +func (x *TrackableObjectGraph_TrackableObject_SerializedTensor) GetCheckpointKey() string { + if x != nil { + return x.CheckpointKey + } + return "" +} + +func (x *TrackableObjectGraph_TrackableObject_SerializedTensor) GetOptionalRestore() bool { + if x != nil { + return x.OptionalRestore + } + return false +} + +type TrackableObjectGraph_TrackableObject_SlotVariableReference struct { + state protoimpl.MessageState `protogen:"open.v1"` + // An index into `TrackableObjectGraph.nodes`, indicating the + // variable object this slot was created for. + OriginalVariableNodeId int32 `protobuf:"varint,1,opt,name=original_variable_node_id,json=originalVariableNodeId,proto3" json:"original_variable_node_id,omitempty"` + // The name of the slot (e.g. "m"/"v"). + SlotName string `protobuf:"bytes,2,opt,name=slot_name,json=slotName,proto3" json:"slot_name,omitempty"` + // An index into `TrackableObjectGraph.nodes`, indicating the + // `Object` with the value of the slot variable. + SlotVariableNodeId int32 `protobuf:"varint,3,opt,name=slot_variable_node_id,json=slotVariableNodeId,proto3" json:"slot_variable_node_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TrackableObjectGraph_TrackableObject_SlotVariableReference) Reset() { + *x = TrackableObjectGraph_TrackableObject_SlotVariableReference{} + mi := &file_tensorflow_core_protobuf_trackable_object_graph_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TrackableObjectGraph_TrackableObject_SlotVariableReference) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TrackableObjectGraph_TrackableObject_SlotVariableReference) ProtoMessage() {} + +func (x *TrackableObjectGraph_TrackableObject_SlotVariableReference) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_trackable_object_graph_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TrackableObjectGraph_TrackableObject_SlotVariableReference.ProtoReflect.Descriptor instead. +func (*TrackableObjectGraph_TrackableObject_SlotVariableReference) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_trackable_object_graph_proto_rawDescGZIP(), []int{0, 0, 2} +} + +func (x *TrackableObjectGraph_TrackableObject_SlotVariableReference) GetOriginalVariableNodeId() int32 { + if x != nil { + return x.OriginalVariableNodeId + } + return 0 +} + +func (x *TrackableObjectGraph_TrackableObject_SlotVariableReference) GetSlotName() string { + if x != nil { + return x.SlotName + } + return "" +} + +func (x *TrackableObjectGraph_TrackableObject_SlotVariableReference) GetSlotVariableNodeId() int32 { + if x != nil { + return x.SlotVariableNodeId + } + return 0 +} + +var File_tensorflow_core_protobuf_trackable_object_graph_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_trackable_object_graph_proto_rawDesc = "" + + "\n" + + "5tensorflow/core/protobuf/trackable_object_graph.proto\x12\n" + + "tensorflow\"\xaa\x06\n" + + "\x14TrackableObjectGraph\x12F\n" + + "\x05nodes\x18\x01 \x03(\v20.tensorflow.TrackableObjectGraph.TrackableObjectR\x05nodes\x1a\xc9\x05\n" + + "\x0fTrackableObject\x12\\\n" + + "\bchildren\x18\x01 \x03(\v2@.tensorflow.TrackableObjectGraph.TrackableObject.ObjectReferenceR\bchildren\x12a\n" + + "\n" + + "attributes\x18\x02 \x03(\v2A.tensorflow.TrackableObjectGraph.TrackableObject.SerializedTensorR\n" + + "attributes\x12m\n" + + "\x0eslot_variables\x18\x03 \x03(\v2F.tensorflow.TrackableObjectGraph.TrackableObject.SlotVariableReferenceR\rslotVariables\x1aI\n" + + "\x0fObjectReference\x12\x17\n" + + "\anode_id\x18\x01 \x01(\x05R\x06nodeId\x12\x1d\n" + + "\n" + + "local_name\x18\x02 \x01(\tR\tlocalName\x1a\x95\x01\n" + + "\x10SerializedTensor\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x1b\n" + + "\tfull_name\x18\x02 \x01(\tR\bfullName\x12%\n" + + "\x0echeckpoint_key\x18\x03 \x01(\tR\rcheckpointKey\x12)\n" + + "\x10optional_restore\x18\x04 \x01(\bR\x0foptionalRestore\x1a\xa2\x01\n" + + "\x15SlotVariableReference\x129\n" + + "\x19original_variable_node_id\x18\x01 \x01(\x05R\x16originalVariableNodeId\x12\x1b\n" + + "\tslot_name\x18\x02 \x01(\tR\bslotName\x121\n" + + "\x15slot_variable_node_id\x18\x03 \x01(\x05R\x12slotVariableNodeIdBZZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_trackable_object_graph_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_trackable_object_graph_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_trackable_object_graph_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_trackable_object_graph_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_trackable_object_graph_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_trackable_object_graph_proto_rawDesc), len(file_tensorflow_core_protobuf_trackable_object_graph_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_trackable_object_graph_proto_rawDescData +} + +var file_tensorflow_core_protobuf_trackable_object_graph_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_tensorflow_core_protobuf_trackable_object_graph_proto_goTypes = []any{ + (*TrackableObjectGraph)(nil), // 0: tensorflow.TrackableObjectGraph + (*TrackableObjectGraph_TrackableObject)(nil), // 1: tensorflow.TrackableObjectGraph.TrackableObject + (*TrackableObjectGraph_TrackableObject_ObjectReference)(nil), // 2: tensorflow.TrackableObjectGraph.TrackableObject.ObjectReference + (*TrackableObjectGraph_TrackableObject_SerializedTensor)(nil), // 3: tensorflow.TrackableObjectGraph.TrackableObject.SerializedTensor + (*TrackableObjectGraph_TrackableObject_SlotVariableReference)(nil), // 4: tensorflow.TrackableObjectGraph.TrackableObject.SlotVariableReference +} +var file_tensorflow_core_protobuf_trackable_object_graph_proto_depIdxs = []int32{ + 1, // 0: tensorflow.TrackableObjectGraph.nodes:type_name -> tensorflow.TrackableObjectGraph.TrackableObject + 2, // 1: tensorflow.TrackableObjectGraph.TrackableObject.children:type_name -> tensorflow.TrackableObjectGraph.TrackableObject.ObjectReference + 3, // 2: tensorflow.TrackableObjectGraph.TrackableObject.attributes:type_name -> tensorflow.TrackableObjectGraph.TrackableObject.SerializedTensor + 4, // 3: tensorflow.TrackableObjectGraph.TrackableObject.slot_variables:type_name -> tensorflow.TrackableObjectGraph.TrackableObject.SlotVariableReference + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_trackable_object_graph_proto_init() } +func file_tensorflow_core_protobuf_trackable_object_graph_proto_init() { + if File_tensorflow_core_protobuf_trackable_object_graph_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_trackable_object_graph_proto_rawDesc), len(file_tensorflow_core_protobuf_trackable_object_graph_proto_rawDesc)), + NumEnums: 0, + NumMessages: 5, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_trackable_object_graph_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_trackable_object_graph_proto_depIdxs, + MessageInfos: file_tensorflow_core_protobuf_trackable_object_graph_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_trackable_object_graph_proto = out.File + file_tensorflow_core_protobuf_trackable_object_graph_proto_goTypes = nil + file_tensorflow_core_protobuf_trackable_object_graph_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/transport_options.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/transport_options.pb.go new file mode 100644 index 0000000..fda7bcf --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/transport_options.pb.go @@ -0,0 +1,124 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/transport_options.proto + +package for_core_protos_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Extra data needed on a non-RDMA RecvBufResponse. +type RecvBufRespExtra struct { + state protoimpl.MessageState `protogen:"open.v1"` + TensorContent [][]byte `protobuf:"bytes,1,rep,name=tensor_content,json=tensorContent,proto3" json:"tensor_content,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RecvBufRespExtra) Reset() { + *x = RecvBufRespExtra{} + mi := &file_tensorflow_core_protobuf_transport_options_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RecvBufRespExtra) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RecvBufRespExtra) ProtoMessage() {} + +func (x *RecvBufRespExtra) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_transport_options_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RecvBufRespExtra.ProtoReflect.Descriptor instead. +func (*RecvBufRespExtra) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_transport_options_proto_rawDescGZIP(), []int{0} +} + +func (x *RecvBufRespExtra) GetTensorContent() [][]byte { + if x != nil { + return x.TensorContent + } + return nil +} + +var File_tensorflow_core_protobuf_transport_options_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_transport_options_proto_rawDesc = "" + + "\n" + + "0tensorflow/core/protobuf/transport_options.proto\x12\n" + + "tensorflow\"9\n" + + "\x10RecvBufRespExtra\x12%\n" + + "\x0etensor_content\x18\x01 \x03(\fR\rtensorContentBWZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_protob\x06proto3" + +var ( + file_tensorflow_core_protobuf_transport_options_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_transport_options_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_transport_options_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_transport_options_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_transport_options_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_transport_options_proto_rawDesc), len(file_tensorflow_core_protobuf_transport_options_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_transport_options_proto_rawDescData +} + +var file_tensorflow_core_protobuf_transport_options_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_tensorflow_core_protobuf_transport_options_proto_goTypes = []any{ + (*RecvBufRespExtra)(nil), // 0: tensorflow.RecvBufRespExtra +} +var file_tensorflow_core_protobuf_transport_options_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_transport_options_proto_init() } +func file_tensorflow_core_protobuf_transport_options_proto_init() { + if File_tensorflow_core_protobuf_transport_options_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_transport_options_proto_rawDesc), len(file_tensorflow_core_protobuf_transport_options_proto_rawDesc)), + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_transport_options_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_transport_options_proto_depIdxs, + MessageInfos: file_tensorflow_core_protobuf_transport_options_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_transport_options_proto = out.File + file_tensorflow_core_protobuf_transport_options_proto_goTypes = nil + file_tensorflow_core_protobuf_transport_options_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/verifier_config.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/verifier_config.pb.go new file mode 100644 index 0000000..8a64647 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/verifier_config.pb.go @@ -0,0 +1,194 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/verifier_config.proto + +package for_core_protos_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type VerifierConfig_Toggle int32 + +const ( + VerifierConfig_DEFAULT VerifierConfig_Toggle = 0 + VerifierConfig_ON VerifierConfig_Toggle = 1 + VerifierConfig_OFF VerifierConfig_Toggle = 2 +) + +// Enum value maps for VerifierConfig_Toggle. +var ( + VerifierConfig_Toggle_name = map[int32]string{ + 0: "DEFAULT", + 1: "ON", + 2: "OFF", + } + VerifierConfig_Toggle_value = map[string]int32{ + "DEFAULT": 0, + "ON": 1, + "OFF": 2, + } +) + +func (x VerifierConfig_Toggle) Enum() *VerifierConfig_Toggle { + p := new(VerifierConfig_Toggle) + *p = x + return p +} + +func (x VerifierConfig_Toggle) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (VerifierConfig_Toggle) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_core_protobuf_verifier_config_proto_enumTypes[0].Descriptor() +} + +func (VerifierConfig_Toggle) Type() protoreflect.EnumType { + return &file_tensorflow_core_protobuf_verifier_config_proto_enumTypes[0] +} + +func (x VerifierConfig_Toggle) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use VerifierConfig_Toggle.Descriptor instead. +func (VerifierConfig_Toggle) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_verifier_config_proto_rawDescGZIP(), []int{0, 0} +} + +// The config for graph verifiers. +type VerifierConfig struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Deadline for completion of all verification i.e. all the Toggle ON + // verifiers must complete execution within this time. + VerificationTimeoutInMs int64 `protobuf:"varint,1,opt,name=verification_timeout_in_ms,json=verificationTimeoutInMs,proto3" json:"verification_timeout_in_ms,omitempty"` + // Perform structural validation on a tensorflow graph. Default is OFF. + StructureVerifier VerifierConfig_Toggle `protobuf:"varint,2,opt,name=structure_verifier,json=structureVerifier,proto3,enum=tensorflow.VerifierConfig_Toggle" json:"structure_verifier,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *VerifierConfig) Reset() { + *x = VerifierConfig{} + mi := &file_tensorflow_core_protobuf_verifier_config_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *VerifierConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VerifierConfig) ProtoMessage() {} + +func (x *VerifierConfig) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_verifier_config_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use VerifierConfig.ProtoReflect.Descriptor instead. +func (*VerifierConfig) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_verifier_config_proto_rawDescGZIP(), []int{0} +} + +func (x *VerifierConfig) GetVerificationTimeoutInMs() int64 { + if x != nil { + return x.VerificationTimeoutInMs + } + return 0 +} + +func (x *VerifierConfig) GetStructureVerifier() VerifierConfig_Toggle { + if x != nil { + return x.StructureVerifier + } + return VerifierConfig_DEFAULT +} + +var File_tensorflow_core_protobuf_verifier_config_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_verifier_config_proto_rawDesc = "" + + "\n" + + ".tensorflow/core/protobuf/verifier_config.proto\x12\n" + + "tensorflow\"\xc7\x01\n" + + "\x0eVerifierConfig\x12;\n" + + "\x1averification_timeout_in_ms\x18\x01 \x01(\x03R\x17verificationTimeoutInMs\x12P\n" + + "\x12structure_verifier\x18\x02 \x01(\x0e2!.tensorflow.VerifierConfig.ToggleR\x11structureVerifier\"&\n" + + "\x06Toggle\x12\v\n" + + "\aDEFAULT\x10\x00\x12\x06\n" + + "\x02ON\x10\x01\x12\a\n" + + "\x03OFF\x10\x02B\x8c\x01\n" + + "\x18org.tensorflow.frameworkB\x14VerifierConfigProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_verifier_config_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_verifier_config_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_verifier_config_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_verifier_config_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_verifier_config_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_verifier_config_proto_rawDesc), len(file_tensorflow_core_protobuf_verifier_config_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_verifier_config_proto_rawDescData +} + +var file_tensorflow_core_protobuf_verifier_config_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_tensorflow_core_protobuf_verifier_config_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_tensorflow_core_protobuf_verifier_config_proto_goTypes = []any{ + (VerifierConfig_Toggle)(0), // 0: tensorflow.VerifierConfig.Toggle + (*VerifierConfig)(nil), // 1: tensorflow.VerifierConfig +} +var file_tensorflow_core_protobuf_verifier_config_proto_depIdxs = []int32{ + 0, // 0: tensorflow.VerifierConfig.structure_verifier:type_name -> tensorflow.VerifierConfig.Toggle + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_verifier_config_proto_init() } +func file_tensorflow_core_protobuf_verifier_config_proto_init() { + if File_tensorflow_core_protobuf_verifier_config_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_verifier_config_proto_rawDesc), len(file_tensorflow_core_protobuf_verifier_config_proto_rawDesc)), + NumEnums: 1, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_verifier_config_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_verifier_config_proto_depIdxs, + EnumInfos: file_tensorflow_core_protobuf_verifier_config_proto_enumTypes, + MessageInfos: file_tensorflow_core_protobuf_verifier_config_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_verifier_config_proto = out.File + file_tensorflow_core_protobuf_verifier_config_proto_goTypes = nil + file_tensorflow_core_protobuf_verifier_config_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/worker.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/worker.pb.go new file mode 100644 index 0000000..67b79d2 --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/worker.pb.go @@ -0,0 +1,2752 @@ +// Copyright 2016 The TensorFlow Authors. All Rights Reserved. +// +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +//============================================================================== + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/worker.proto + +package for_core_protos_go_proto + +import ( + cost_graph_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/cost_graph_go_proto" + device_attributes_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/device_attributes_go_proto" + graph_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/graph_go_proto" + step_stats_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/step_stats_go_proto" + tensor_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_go_proto" + tensor_shape_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_shape_go_proto" + types_go_proto "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/types_go_proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + anypb "google.golang.org/protobuf/types/known/anypb" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type GetStatusRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetStatusRequest) Reset() { + *x = GetStatusRequest{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetStatusRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetStatusRequest) ProtoMessage() {} + +func (x *GetStatusRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetStatusRequest.ProtoReflect.Descriptor instead. +func (*GetStatusRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{0} +} + +type GetStatusResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + DeviceAttributes []*device_attributes_go_proto.DeviceAttributes `protobuf:"bytes,1,rep,name=device_attributes,json=deviceAttributes,proto3" json:"device_attributes,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetStatusResponse) Reset() { + *x = GetStatusResponse{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetStatusResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetStatusResponse) ProtoMessage() {} + +func (x *GetStatusResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetStatusResponse.ProtoReflect.Descriptor instead. +func (*GetStatusResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{1} +} + +func (x *GetStatusResponse) GetDeviceAttributes() []*device_attributes_go_proto.DeviceAttributes { + if x != nil { + return x.DeviceAttributes + } + return nil +} + +type CreateWorkerSessionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Sessions are identified by a given handle. + SessionHandle string `protobuf:"bytes,1,opt,name=session_handle,json=sessionHandle,proto3" json:"session_handle,omitempty"` + // Defines the configuration of a TensorFlow worker. + ServerDef *ServerDef `protobuf:"bytes,2,opt,name=server_def,json=serverDef,proto3" json:"server_def,omitempty"` + // If true, any resources such as Variables used in the session will not be + // shared with other sessions. + IsolateSessionState bool `protobuf:"varint,3,opt,name=isolate_session_state,json=isolateSessionState,proto3" json:"isolate_session_state,omitempty"` + // The device attributes of all the devices in the cluster. + ClusterDeviceAttributes []*device_attributes_go_proto.DeviceAttributes `protobuf:"bytes,4,rep,name=cluster_device_attributes,json=clusterDeviceAttributes,proto3" json:"cluster_device_attributes,omitempty"` + // The master task name from which the request is sent. + MasterTask string `protobuf:"bytes,5,opt,name=master_task,json=masterTask,proto3" json:"master_task,omitempty"` + // The incarnation ID of the master task local CPU device. + // If the target worker already has a WorkerSession created previously with + // the same master task name but a different incarnation, it usually indicates + // that the previous master failed before deleting the WorkerSession on the + // worker. To prevent memory leaks, the worker should garbage collect the old + // WorkerSessions. + MasterIncarnation int64 `protobuf:"varint,6,opt,name=master_incarnation,json=masterIncarnation,proto3" json:"master_incarnation,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateWorkerSessionRequest) Reset() { + *x = CreateWorkerSessionRequest{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateWorkerSessionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateWorkerSessionRequest) ProtoMessage() {} + +func (x *CreateWorkerSessionRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateWorkerSessionRequest.ProtoReflect.Descriptor instead. +func (*CreateWorkerSessionRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{2} +} + +func (x *CreateWorkerSessionRequest) GetSessionHandle() string { + if x != nil { + return x.SessionHandle + } + return "" +} + +func (x *CreateWorkerSessionRequest) GetServerDef() *ServerDef { + if x != nil { + return x.ServerDef + } + return nil +} + +func (x *CreateWorkerSessionRequest) GetIsolateSessionState() bool { + if x != nil { + return x.IsolateSessionState + } + return false +} + +func (x *CreateWorkerSessionRequest) GetClusterDeviceAttributes() []*device_attributes_go_proto.DeviceAttributes { + if x != nil { + return x.ClusterDeviceAttributes + } + return nil +} + +func (x *CreateWorkerSessionRequest) GetMasterTask() string { + if x != nil { + return x.MasterTask + } + return "" +} + +func (x *CreateWorkerSessionRequest) GetMasterIncarnation() int64 { + if x != nil { + return x.MasterIncarnation + } + return 0 +} + +type CreateWorkerSessionResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateWorkerSessionResponse) Reset() { + *x = CreateWorkerSessionResponse{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateWorkerSessionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateWorkerSessionResponse) ProtoMessage() {} + +func (x *CreateWorkerSessionResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateWorkerSessionResponse.ProtoReflect.Descriptor instead. +func (*CreateWorkerSessionResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{3} +} + +type DeleteWorkerSessionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Sessions are identified by a given handle. + SessionHandle string `protobuf:"bytes,1,opt,name=session_handle,json=sessionHandle,proto3" json:"session_handle,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteWorkerSessionRequest) Reset() { + *x = DeleteWorkerSessionRequest{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteWorkerSessionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteWorkerSessionRequest) ProtoMessage() {} + +func (x *DeleteWorkerSessionRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteWorkerSessionRequest.ProtoReflect.Descriptor instead. +func (*DeleteWorkerSessionRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{4} +} + +func (x *DeleteWorkerSessionRequest) GetSessionHandle() string { + if x != nil { + return x.SessionHandle + } + return "" +} + +type DeleteWorkerSessionResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteWorkerSessionResponse) Reset() { + *x = DeleteWorkerSessionResponse{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteWorkerSessionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteWorkerSessionResponse) ProtoMessage() {} + +func (x *DeleteWorkerSessionResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteWorkerSessionResponse.ProtoReflect.Descriptor instead. +func (*DeleteWorkerSessionResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{5} +} + +type RegisterGraphRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Subgraphs are scoped within one session. + SessionHandle string `protobuf:"bytes,1,opt,name=session_handle,json=sessionHandle,proto3" json:"session_handle,omitempty"` + // Set to true if `CreateWorkerSession` was called for `session_handle`. + CreateWorkerSessionCalled bool `protobuf:"varint,6,opt,name=create_worker_session_called,json=createWorkerSessionCalled,proto3" json:"create_worker_session_called,omitempty"` + // "graph_def" has the subgraph of nodes for this worker, with each node + // having its device_name filled in. + GraphDef *graph_go_proto.GraphDef `protobuf:"bytes,2,opt,name=graph_def,json=graphDef,proto3" json:"graph_def,omitempty"` + // True iff the graph (before partitioning) contains control flow nodes. + // + // As of 01/11/2015, this is no longer set by clients. + // + // Deprecated: Marked as deprecated in tensorflow/core/protobuf/worker.proto. + HasControlFlow bool `protobuf:"varint,3,opt,name=has_control_flow,json=hasControlFlow,proto3" json:"has_control_flow,omitempty"` + // Configuration options for the session in which this graph was created. + GraphOptions *GraphOptions `protobuf:"bytes,4,opt,name=graph_options,json=graphOptions,proto3" json:"graph_options,omitempty"` + // Field(s) used by TensorFlow Debugger (tfdbg). + DebugOptions *DebugOptions `protobuf:"bytes,5,opt,name=debug_options,json=debugOptions,proto3" json:"debug_options,omitempty"` + // If graph_def contains any collective ops this must be a positive + // integer used to coordinate execution with other graphs. All + // graphs in a distributed execution with the same + // collective_graph_key will coordinate to use the same step_id + // concurrently so that BufRendezvous entries will make the correct + // values accessible. + CollectiveGraphKey int64 `protobuf:"varint,7,opt,name=collective_graph_key,json=collectiveGraphKey,proto3" json:"collective_graph_key,omitempty"` + // ConfigProto from the session in which this graph was created. + // Contains additional parameters beyond graph_options, including + // the name of the requested executor. + ConfigProto *ConfigProto `protobuf:"bytes,8,opt,name=config_proto,json=configProto,proto3" json:"config_proto,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RegisterGraphRequest) Reset() { + *x = RegisterGraphRequest{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RegisterGraphRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RegisterGraphRequest) ProtoMessage() {} + +func (x *RegisterGraphRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RegisterGraphRequest.ProtoReflect.Descriptor instead. +func (*RegisterGraphRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{6} +} + +func (x *RegisterGraphRequest) GetSessionHandle() string { + if x != nil { + return x.SessionHandle + } + return "" +} + +func (x *RegisterGraphRequest) GetCreateWorkerSessionCalled() bool { + if x != nil { + return x.CreateWorkerSessionCalled + } + return false +} + +func (x *RegisterGraphRequest) GetGraphDef() *graph_go_proto.GraphDef { + if x != nil { + return x.GraphDef + } + return nil +} + +// Deprecated: Marked as deprecated in tensorflow/core/protobuf/worker.proto. +func (x *RegisterGraphRequest) GetHasControlFlow() bool { + if x != nil { + return x.HasControlFlow + } + return false +} + +func (x *RegisterGraphRequest) GetGraphOptions() *GraphOptions { + if x != nil { + return x.GraphOptions + } + return nil +} + +func (x *RegisterGraphRequest) GetDebugOptions() *DebugOptions { + if x != nil { + return x.DebugOptions + } + return nil +} + +func (x *RegisterGraphRequest) GetCollectiveGraphKey() int64 { + if x != nil { + return x.CollectiveGraphKey + } + return 0 +} + +func (x *RegisterGraphRequest) GetConfigProto() *ConfigProto { + if x != nil { + return x.ConfigProto + } + return nil +} + +type RegisterGraphResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // If the registration succeeds, returns an opaque graph_handle to + // the master. The master calls RunGraph with graph_handle to + // compute different steps. + GraphHandle string `protobuf:"bytes,1,opt,name=graph_handle,json=graphHandle,proto3" json:"graph_handle,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RegisterGraphResponse) Reset() { + *x = RegisterGraphResponse{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RegisterGraphResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RegisterGraphResponse) ProtoMessage() {} + +func (x *RegisterGraphResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RegisterGraphResponse.ProtoReflect.Descriptor instead. +func (*RegisterGraphResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{7} +} + +func (x *RegisterGraphResponse) GetGraphHandle() string { + if x != nil { + return x.GraphHandle + } + return "" +} + +type DeregisterGraphRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The session_handle used when registering the graph. If session_handle is + // empty, a single global namespace is used. + SessionHandle string `protobuf:"bytes,2,opt,name=session_handle,json=sessionHandle,proto3" json:"session_handle,omitempty"` + // Set to true if `CreateWorkerSession` was called for `session_handle`. + CreateWorkerSessionCalled bool `protobuf:"varint,3,opt,name=create_worker_session_called,json=createWorkerSessionCalled,proto3" json:"create_worker_session_called,omitempty"` + // REQUIRED: graph_handle must be returned by a RegisterGraph call + // to the same WorkerService. + GraphHandle string `protobuf:"bytes,1,opt,name=graph_handle,json=graphHandle,proto3" json:"graph_handle,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeregisterGraphRequest) Reset() { + *x = DeregisterGraphRequest{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeregisterGraphRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeregisterGraphRequest) ProtoMessage() {} + +func (x *DeregisterGraphRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeregisterGraphRequest.ProtoReflect.Descriptor instead. +func (*DeregisterGraphRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{8} +} + +func (x *DeregisterGraphRequest) GetSessionHandle() string { + if x != nil { + return x.SessionHandle + } + return "" +} + +func (x *DeregisterGraphRequest) GetCreateWorkerSessionCalled() bool { + if x != nil { + return x.CreateWorkerSessionCalled + } + return false +} + +func (x *DeregisterGraphRequest) GetGraphHandle() string { + if x != nil { + return x.GraphHandle + } + return "" +} + +type DeregisterGraphResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeregisterGraphResponse) Reset() { + *x = DeregisterGraphResponse{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeregisterGraphResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeregisterGraphResponse) ProtoMessage() {} + +func (x *DeregisterGraphResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeregisterGraphResponse.ProtoReflect.Descriptor instead. +func (*DeregisterGraphResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{9} +} + +type CleanupAllRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // A list of container names. + // + // If 'container' is not empty, releases resources in the given + // containers in all devices. + // + // If 'container' is empty, releases resources in the default + // container in all devices. + Container []string `protobuf:"bytes,1,rep,name=container,proto3" json:"container,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CleanupAllRequest) Reset() { + *x = CleanupAllRequest{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CleanupAllRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CleanupAllRequest) ProtoMessage() {} + +func (x *CleanupAllRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CleanupAllRequest.ProtoReflect.Descriptor instead. +func (*CleanupAllRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{10} +} + +func (x *CleanupAllRequest) GetContainer() []string { + if x != nil { + return x.Container + } + return nil +} + +type CleanupAllResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CleanupAllResponse) Reset() { + *x = CleanupAllResponse{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CleanupAllResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CleanupAllResponse) ProtoMessage() {} + +func (x *CleanupAllResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CleanupAllResponse.ProtoReflect.Descriptor instead. +func (*CleanupAllResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{11} +} + +// Options specific to the execution of a single step. +type ExecutorOpts struct { + state protoimpl.MessageState `protogen:"open.v1"` + RecordCosts bool `protobuf:"varint,1,opt,name=record_costs,json=recordCosts,proto3" json:"record_costs,omitempty"` + RecordTimeline bool `protobuf:"varint,3,opt,name=record_timeline,json=recordTimeline,proto3" json:"record_timeline,omitempty"` + RecordPartitionGraphs bool `protobuf:"varint,4,opt,name=record_partition_graphs,json=recordPartitionGraphs,proto3" json:"record_partition_graphs,omitempty"` + ReportTensorAllocationsUponOom bool `protobuf:"varint,5,opt,name=report_tensor_allocations_upon_oom,json=reportTensorAllocationsUponOom,proto3" json:"report_tensor_allocations_upon_oom,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ExecutorOpts) Reset() { + *x = ExecutorOpts{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ExecutorOpts) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExecutorOpts) ProtoMessage() {} + +func (x *ExecutorOpts) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ExecutorOpts.ProtoReflect.Descriptor instead. +func (*ExecutorOpts) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{12} +} + +func (x *ExecutorOpts) GetRecordCosts() bool { + if x != nil { + return x.RecordCosts + } + return false +} + +func (x *ExecutorOpts) GetRecordTimeline() bool { + if x != nil { + return x.RecordTimeline + } + return false +} + +func (x *ExecutorOpts) GetRecordPartitionGraphs() bool { + if x != nil { + return x.RecordPartitionGraphs + } + return false +} + +func (x *ExecutorOpts) GetReportTensorAllocationsUponOom() bool { + if x != nil { + return x.ReportTensorAllocationsUponOom + } + return false +} + +type RunGraphRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // session_handle is the master-generated unique id for this session. + // If session_handle is non-empty, it must be the same as used when + // registering the graph. If it is empty, a single global namespace is used to + // search for the graph_handle. + SessionHandle string `protobuf:"bytes,8,opt,name=session_handle,json=sessionHandle,proto3" json:"session_handle,omitempty"` + // Set to true if `CreateWorkerSession` was called for `session_handle`. + CreateWorkerSessionCalled bool `protobuf:"varint,10,opt,name=create_worker_session_called,json=createWorkerSessionCalled,proto3" json:"create_worker_session_called,omitempty"` + // REQUIRED: graph_handle must be returned by a RegisterGraph call + // to the same WorkerService. + GraphHandle string `protobuf:"bytes,1,opt,name=graph_handle,json=graphHandle,proto3" json:"graph_handle,omitempty"` + // A unique ID to distinguish different runs of the same graph. + // + // The master generates a global unique `step_id` to distinguish + // different runs of the graph computation. Subgraphs communicate + // (e.g., send/recv ops) with each other using `step_id` to + // distinguish tensors generated by different runs. + StepId int64 `protobuf:"varint,2,opt,name=step_id,json=stepId,proto3" json:"step_id,omitempty"` + // Options for this step. + ExecOpts *ExecutorOpts `protobuf:"bytes,5,opt,name=exec_opts,json=execOpts,proto3" json:"exec_opts,omitempty"` + // Runs the graph. + // + // Sends the tensors in "send" into the graph before the run and + // fetches the keys into `RunGraphResponse.recv` after the run. + Send []*NamedTensorProto `protobuf:"bytes,3,rep,name=send,proto3" json:"send,omitempty"` + RecvKey []string `protobuf:"bytes,4,rep,name=recv_key,json=recvKey,proto3" json:"recv_key,omitempty"` + // True if the RunGraphRequest is a partial run request. + IsPartial bool `protobuf:"varint,6,opt,name=is_partial,json=isPartial,proto3" json:"is_partial,omitempty"` + // True if this is the last partial run request in a sequence of requests. + IsLastPartialRun bool `protobuf:"varint,7,opt,name=is_last_partial_run,json=isLastPartialRun,proto3" json:"is_last_partial_run,omitempty"` + // If true then some errors, e.g., execution errors that have long + // error messages, may return an OK RunGraphResponse with the actual + // error saved in the status_code/status_error_message fields of the + // response body. This is a workaround since the RPC subsystem may + // truncate long metadata messages. + StoreErrorsInResponseBody bool `protobuf:"varint,9,opt,name=store_errors_in_response_body,json=storeErrorsInResponseBody,proto3" json:"store_errors_in_response_body,omitempty"` + // Unique identifier for this request. Every RunGraphRequest must have a + // unique request_id, and retried RunGraphRequests must have the same + // request_id. If request_id is zero, retry detection is disabled. + // + // Retried RunGraphRequests are problematic because they may issue a + // RecvTensor that will have no corresponding sender and will wait forever. + // Workers use request_ids to reject retried RunGraph requests instead of + // waiting forever. + RequestId int64 `protobuf:"varint,11,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RunGraphRequest) Reset() { + *x = RunGraphRequest{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RunGraphRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RunGraphRequest) ProtoMessage() {} + +func (x *RunGraphRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[13] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RunGraphRequest.ProtoReflect.Descriptor instead. +func (*RunGraphRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{13} +} + +func (x *RunGraphRequest) GetSessionHandle() string { + if x != nil { + return x.SessionHandle + } + return "" +} + +func (x *RunGraphRequest) GetCreateWorkerSessionCalled() bool { + if x != nil { + return x.CreateWorkerSessionCalled + } + return false +} + +func (x *RunGraphRequest) GetGraphHandle() string { + if x != nil { + return x.GraphHandle + } + return "" +} + +func (x *RunGraphRequest) GetStepId() int64 { + if x != nil { + return x.StepId + } + return 0 +} + +func (x *RunGraphRequest) GetExecOpts() *ExecutorOpts { + if x != nil { + return x.ExecOpts + } + return nil +} + +func (x *RunGraphRequest) GetSend() []*NamedTensorProto { + if x != nil { + return x.Send + } + return nil +} + +func (x *RunGraphRequest) GetRecvKey() []string { + if x != nil { + return x.RecvKey + } + return nil +} + +func (x *RunGraphRequest) GetIsPartial() bool { + if x != nil { + return x.IsPartial + } + return false +} + +func (x *RunGraphRequest) GetIsLastPartialRun() bool { + if x != nil { + return x.IsLastPartialRun + } + return false +} + +func (x *RunGraphRequest) GetStoreErrorsInResponseBody() bool { + if x != nil { + return x.StoreErrorsInResponseBody + } + return false +} + +func (x *RunGraphRequest) GetRequestId() int64 { + if x != nil { + return x.RequestId + } + return 0 +} + +type RunGraphResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // A list of tensors corresponding to those requested by + // `RunGraphRequest.recv_key`. + Recv []*NamedTensorProto `protobuf:"bytes,1,rep,name=recv,proto3" json:"recv,omitempty"` + // If the request asked for execution stats, the cost graph, or the partition + // graphs, these are returned here. + // TODO(suharshs): Package these in a RunMetadata instead. + StepStats *step_stats_go_proto.StepStats `protobuf:"bytes,2,opt,name=step_stats,json=stepStats,proto3" json:"step_stats,omitempty"` + CostGraph *cost_graph_go_proto.CostGraphDef `protobuf:"bytes,3,opt,name=cost_graph,json=costGraph,proto3" json:"cost_graph,omitempty"` + PartitionGraph []*graph_go_proto.GraphDef `protobuf:"bytes,4,rep,name=partition_graph,json=partitionGraph,proto3" json:"partition_graph,omitempty"` + // If store_errors_in_response_body is true in the request, then + // optionally the server may return an OK status for the RPC and + // fill the true status into the fields below, to allow for messages + // that are too long to fit in metadata. + StatusCode Code `protobuf:"varint,5,opt,name=status_code,json=statusCode,proto3,enum=tensorflow.error.Code" json:"status_code,omitempty"` + StatusErrorMessage string `protobuf:"bytes,6,opt,name=status_error_message,json=statusErrorMessage,proto3" json:"status_error_message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RunGraphResponse) Reset() { + *x = RunGraphResponse{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RunGraphResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RunGraphResponse) ProtoMessage() {} + +func (x *RunGraphResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[14] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RunGraphResponse.ProtoReflect.Descriptor instead. +func (*RunGraphResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{14} +} + +func (x *RunGraphResponse) GetRecv() []*NamedTensorProto { + if x != nil { + return x.Recv + } + return nil +} + +func (x *RunGraphResponse) GetStepStats() *step_stats_go_proto.StepStats { + if x != nil { + return x.StepStats + } + return nil +} + +func (x *RunGraphResponse) GetCostGraph() *cost_graph_go_proto.CostGraphDef { + if x != nil { + return x.CostGraph + } + return nil +} + +func (x *RunGraphResponse) GetPartitionGraph() []*graph_go_proto.GraphDef { + if x != nil { + return x.PartitionGraph + } + return nil +} + +func (x *RunGraphResponse) GetStatusCode() Code { + if x != nil { + return x.StatusCode + } + return Code_OK +} + +func (x *RunGraphResponse) GetStatusErrorMessage() string { + if x != nil { + return x.StatusErrorMessage + } + return "" +} + +type CleanupGraphRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + StepId int64 `protobuf:"varint,1,opt,name=step_id,json=stepId,proto3" json:"step_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CleanupGraphRequest) Reset() { + *x = CleanupGraphRequest{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CleanupGraphRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CleanupGraphRequest) ProtoMessage() {} + +func (x *CleanupGraphRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[15] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CleanupGraphRequest.ProtoReflect.Descriptor instead. +func (*CleanupGraphRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{15} +} + +func (x *CleanupGraphRequest) GetStepId() int64 { + if x != nil { + return x.StepId + } + return 0 +} + +type CleanupGraphResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CleanupGraphResponse) Reset() { + *x = CleanupGraphResponse{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CleanupGraphResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CleanupGraphResponse) ProtoMessage() {} + +func (x *CleanupGraphResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[16] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CleanupGraphResponse.ProtoReflect.Descriptor instead. +func (*CleanupGraphResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{16} +} + +type RecvTensorRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The step in which the tensor will be produced. + // + // REQUIRED: This must eventually correspond to the `step_id` passed + // into a RunGraph call on the same WorkerService. + StepId int64 `protobuf:"varint,1,opt,name=step_id,json=stepId,proto3" json:"step_id,omitempty"` + // A key identifying the channel to receive tensors from. A RecvTensor request + // retrieves one tensor from the channel, but multiple tensors can be sent and + // received over the same channel with multiple RecvTensor requests. See + // rendezvous.h for details. + RendezvousKey string `protobuf:"bytes,2,opt,name=rendezvous_key,json=rendezvousKey,proto3" json:"rendezvous_key,omitempty"` + // If true, use an out-of-band DMA mechanism to transfer the + // received tensor. + DmaOk bool `protobuf:"varint,3,opt,name=dma_ok,json=dmaOk,proto3" json:"dma_ok,omitempty"` + // Optional information on client-side device locality. + ClientLocality *device_attributes_go_proto.DeviceLocality `protobuf:"bytes,4,opt,name=client_locality,json=clientLocality,proto3" json:"client_locality,omitempty"` + // Optional information on server-side device locality. + ServerLocality *device_attributes_go_proto.DeviceLocality `protobuf:"bytes,5,opt,name=server_locality,json=serverLocality,proto3" json:"server_locality,omitempty"` + // Optional information needed by the RPC subsystem. + TransportOptions *anypb.Any `protobuf:"bytes,6,opt,name=transport_options,json=transportOptions,proto3" json:"transport_options,omitempty"` + // Unique identifier for this request. Every RecvTensorRequest must have a + // unique request_id, and retried RecvTensorRequests must have the same + // request_id. If request_id is zero, retry detection and response cache + // are disabled. + // + // Retried RecvTensorRequests are problematic because a RecvTensor with no + // corresponding sender will wait forever, and the tensor may have been + // delivered to a previous retry. Workers use request_ids to reject retried + // RecvTensor requests instead of waiting forever. + RequestId int64 `protobuf:"varint,7,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RecvTensorRequest) Reset() { + *x = RecvTensorRequest{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RecvTensorRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RecvTensorRequest) ProtoMessage() {} + +func (x *RecvTensorRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[17] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RecvTensorRequest.ProtoReflect.Descriptor instead. +func (*RecvTensorRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{17} +} + +func (x *RecvTensorRequest) GetStepId() int64 { + if x != nil { + return x.StepId + } + return 0 +} + +func (x *RecvTensorRequest) GetRendezvousKey() string { + if x != nil { + return x.RendezvousKey + } + return "" +} + +func (x *RecvTensorRequest) GetDmaOk() bool { + if x != nil { + return x.DmaOk + } + return false +} + +func (x *RecvTensorRequest) GetClientLocality() *device_attributes_go_proto.DeviceLocality { + if x != nil { + return x.ClientLocality + } + return nil +} + +func (x *RecvTensorRequest) GetServerLocality() *device_attributes_go_proto.DeviceLocality { + if x != nil { + return x.ServerLocality + } + return nil +} + +func (x *RecvTensorRequest) GetTransportOptions() *anypb.Any { + if x != nil { + return x.TransportOptions + } + return nil +} + +func (x *RecvTensorRequest) GetRequestId() int64 { + if x != nil { + return x.RequestId + } + return 0 +} + +type RecvTensorResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The tensor as a proto. + Tensor *tensor_go_proto.TensorProto `protobuf:"bytes,1,opt,name=tensor,proto3" json:"tensor,omitempty"` + // If true, this tensor was the output of a dead node, and the + // content is invalid. + IsDead bool `protobuf:"varint,2,opt,name=is_dead,json=isDead,proto3" json:"is_dead,omitempty"` + // The time at which tensor was available and started to be returned. + SendStartMicros int64 `protobuf:"varint,3,opt,name=send_start_micros,json=sendStartMicros,proto3" json:"send_start_micros,omitempty"` + // Optional additional information about how to receive the tensor, + // e.g. in the event that `RecvTensorRequest.dma_ok` was true. + TransportOptions *anypb.Any `protobuf:"bytes,4,opt,name=transport_options,json=transportOptions,proto3" json:"transport_options,omitempty"` + // Whether the receiver should send a MarkRecvFinishedRequest to the sender + // to ack the message. + RequireAck bool `protobuf:"varint,5,opt,name=require_ack,json=requireAck,proto3" json:"require_ack,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RecvTensorResponse) Reset() { + *x = RecvTensorResponse{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RecvTensorResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RecvTensorResponse) ProtoMessage() {} + +func (x *RecvTensorResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[18] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RecvTensorResponse.ProtoReflect.Descriptor instead. +func (*RecvTensorResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{18} +} + +func (x *RecvTensorResponse) GetTensor() *tensor_go_proto.TensorProto { + if x != nil { + return x.Tensor + } + return nil +} + +func (x *RecvTensorResponse) GetIsDead() bool { + if x != nil { + return x.IsDead + } + return false +} + +func (x *RecvTensorResponse) GetSendStartMicros() int64 { + if x != nil { + return x.SendStartMicros + } + return 0 +} + +func (x *RecvTensorResponse) GetTransportOptions() *anypb.Any { + if x != nil { + return x.TransportOptions + } + return nil +} + +func (x *RecvTensorResponse) GetRequireAck() bool { + if x != nil { + return x.RequireAck + } + return false +} + +// Message for managing the response cache maintained on the sender side. +// Currently only used by the gRPC worker service. +type MarkRecvFinishedRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + RequestId int64 `protobuf:"varint,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MarkRecvFinishedRequest) Reset() { + *x = MarkRecvFinishedRequest{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MarkRecvFinishedRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MarkRecvFinishedRequest) ProtoMessage() {} + +func (x *MarkRecvFinishedRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[19] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MarkRecvFinishedRequest.ProtoReflect.Descriptor instead. +func (*MarkRecvFinishedRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{19} +} + +func (x *MarkRecvFinishedRequest) GetRequestId() int64 { + if x != nil { + return x.RequestId + } + return 0 +} + +type MarkRecvFinishedResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MarkRecvFinishedResponse) Reset() { + *x = MarkRecvFinishedResponse{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MarkRecvFinishedResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MarkRecvFinishedResponse) ProtoMessage() {} + +func (x *MarkRecvFinishedResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[20] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MarkRecvFinishedResponse.ProtoReflect.Descriptor instead. +func (*MarkRecvFinishedResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{20} +} + +// Out-of-band request to begin or end logging, or +// to retrieve logs for particular steps. +type LoggingRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // If true, RPC logging will be enabled. + EnableRpcLogging bool `protobuf:"varint,1,opt,name=enable_rpc_logging,json=enableRpcLogging,proto3" json:"enable_rpc_logging,omitempty"` + // If true, RPC logging will be disabled. + DisableRpcLogging bool `protobuf:"varint,4,opt,name=disable_rpc_logging,json=disableRpcLogging,proto3" json:"disable_rpc_logging,omitempty"` + // If true, discard any saved logging data (for all steps). + Clear bool `protobuf:"varint,2,opt,name=clear,proto3" json:"clear,omitempty"` + // When set, requests all saved log data pertaining to the step. + // Any log data retrieved is eliminated from the store and cannot be + // retrieved again. + FetchStepId []int64 `protobuf:"varint,3,rep,packed,name=fetch_step_id,json=fetchStepId,proto3" json:"fetch_step_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LoggingRequest) Reset() { + *x = LoggingRequest{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LoggingRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LoggingRequest) ProtoMessage() {} + +func (x *LoggingRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[21] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LoggingRequest.ProtoReflect.Descriptor instead. +func (*LoggingRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{21} +} + +func (x *LoggingRequest) GetEnableRpcLogging() bool { + if x != nil { + return x.EnableRpcLogging + } + return false +} + +func (x *LoggingRequest) GetDisableRpcLogging() bool { + if x != nil { + return x.DisableRpcLogging + } + return false +} + +func (x *LoggingRequest) GetClear() bool { + if x != nil { + return x.Clear + } + return false +} + +func (x *LoggingRequest) GetFetchStepId() []int64 { + if x != nil { + return x.FetchStepId + } + return nil +} + +type LabeledStepStats struct { + state protoimpl.MessageState `protogen:"open.v1"` + StepId int64 `protobuf:"varint,1,opt,name=step_id,json=stepId,proto3" json:"step_id,omitempty"` + StepStats *step_stats_go_proto.StepStats `protobuf:"bytes,2,opt,name=step_stats,json=stepStats,proto3" json:"step_stats,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LabeledStepStats) Reset() { + *x = LabeledStepStats{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LabeledStepStats) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LabeledStepStats) ProtoMessage() {} + +func (x *LabeledStepStats) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[22] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LabeledStepStats.ProtoReflect.Descriptor instead. +func (*LabeledStepStats) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{22} +} + +func (x *LabeledStepStats) GetStepId() int64 { + if x != nil { + return x.StepId + } + return 0 +} + +func (x *LabeledStepStats) GetStepStats() *step_stats_go_proto.StepStats { + if x != nil { + return x.StepStats + } + return nil +} + +type LoggingResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Step []*LabeledStepStats `protobuf:"bytes,1,rep,name=step,proto3" json:"step,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LoggingResponse) Reset() { + *x = LoggingResponse{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LoggingResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LoggingResponse) ProtoMessage() {} + +func (x *LoggingResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[23] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LoggingResponse.ProtoReflect.Descriptor instead. +func (*LoggingResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{23} +} + +func (x *LoggingResponse) GetStep() []*LabeledStepStats { + if x != nil { + return x.Step + } + return nil +} + +type TraceOpts struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Length of the trace to be taken, in seconds. + Duration float64 `protobuf:"fixed64,1,opt,name=duration,proto3" json:"duration,omitempty"` + // If true, capture step profile locally in each worker. Currently + // unimplemented. + UseStepProfiler bool `protobuf:"varint,2,opt,name=use_step_profiler,json=useStepProfiler,proto3" json:"use_step_profiler,omitempty"` + // If true, capture kernel events from each worker. + UseKernelProfiler bool `protobuf:"varint,3,opt,name=use_kernel_profiler,json=useKernelProfiler,proto3" json:"use_kernel_profiler,omitempty"` + // If true, capture extended profiling events from TensorFlow process. + UseExtendedProfiler bool `protobuf:"varint,4,opt,name=use_extended_profiler,json=useExtendedProfiler,proto3" json:"use_extended_profiler,omitempty"` + // If true, capture GPU profiling events locally on each + // machine. Currently unimplemented. + UseGpuProfiler bool `protobuf:"varint,5,opt,name=use_gpu_profiler,json=useGpuProfiler,proto3" json:"use_gpu_profiler,omitempty"` + // If true, collect sampled profile events. Currently unimplemented. + UseSampleProfiler bool `protobuf:"varint,6,opt,name=use_sample_profiler,json=useSampleProfiler,proto3" json:"use_sample_profiler,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TraceOpts) Reset() { + *x = TraceOpts{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TraceOpts) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TraceOpts) ProtoMessage() {} + +func (x *TraceOpts) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[24] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TraceOpts.ProtoReflect.Descriptor instead. +func (*TraceOpts) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{24} +} + +func (x *TraceOpts) GetDuration() float64 { + if x != nil { + return x.Duration + } + return 0 +} + +func (x *TraceOpts) GetUseStepProfiler() bool { + if x != nil { + return x.UseStepProfiler + } + return false +} + +func (x *TraceOpts) GetUseKernelProfiler() bool { + if x != nil { + return x.UseKernelProfiler + } + return false +} + +func (x *TraceOpts) GetUseExtendedProfiler() bool { + if x != nil { + return x.UseExtendedProfiler + } + return false +} + +func (x *TraceOpts) GetUseGpuProfiler() bool { + if x != nil { + return x.UseGpuProfiler + } + return false +} + +func (x *TraceOpts) GetUseSampleProfiler() bool { + if x != nil { + return x.UseSampleProfiler + } + return false +} + +// Out-of-band request to configure distributed tracing. +type TracingRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Options *TraceOpts `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TracingRequest) Reset() { + *x = TracingRequest{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TracingRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TracingRequest) ProtoMessage() {} + +func (x *TracingRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[25] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TracingRequest.ProtoReflect.Descriptor instead. +func (*TracingRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{25} +} + +func (x *TracingRequest) GetOptions() *TraceOpts { + if x != nil { + return x.Options + } + return nil +} + +type TracingResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TracingResponse) Reset() { + *x = TracingResponse{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TracingResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TracingResponse) ProtoMessage() {} + +func (x *TracingResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[26] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TracingResponse.ProtoReflect.Descriptor instead. +func (*TracingResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{26} +} + +type RecvBufRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Used at server side to find the correct BufRendezvous. + StepId int64 `protobuf:"varint,1,opt,name=step_id,json=stepId,proto3" json:"step_id,omitempty"` + // Arbitrary string identifying a BufRendezvous entry. + BufRendezvousKey string `protobuf:"bytes,2,opt,name=buf_rendezvous_key,json=bufRendezvousKey,proto3" json:"buf_rendezvous_key,omitempty"` + // Size of value expected, must agree with BufRendezvous entry. + NumBytes int64 `protobuf:"varint,3,opt,name=num_bytes,json=numBytes,proto3" json:"num_bytes,omitempty"` + // When RDMA is in use, address of destination field on client. + BufPtr uint64 `protobuf:"fixed64,4,opt,name=buf_ptr,json=bufPtr,proto3" json:"buf_ptr,omitempty"` + // Optional information on client-side device locality. + ClientLocality *device_attributes_go_proto.DeviceLocality `protobuf:"bytes,5,opt,name=client_locality,json=clientLocality,proto3" json:"client_locality,omitempty"` + // Optional information on server-side device locality. + ServerLocality *device_attributes_go_proto.DeviceLocality `protobuf:"bytes,6,opt,name=server_locality,json=serverLocality,proto3" json:"server_locality,omitempty"` + // Optional, implementation-specific data. + TransportOptions *anypb.Any `protobuf:"bytes,7,opt,name=transport_options,json=transportOptions,proto3" json:"transport_options,omitempty"` + // For annotating timeline and device incarnation check. + SrcDevice string `protobuf:"bytes,8,opt,name=src_device,json=srcDevice,proto3" json:"src_device,omitempty"` + // Optional, for annotating the timeline. + DstDevice string `protobuf:"bytes,9,opt,name=dst_device,json=dstDevice,proto3" json:"dst_device,omitempty"` + // Depending on the RPC system in use, it may be necessary to set this + // id to detect resends of RPCs where the server is not aware that + // the prior RPC failed. + RequestId int64 `protobuf:"varint,10,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + // Incarnation number of the source device, used to detect worker failures. + SrcIncarnation uint64 `protobuf:"varint,11,opt,name=src_incarnation,json=srcIncarnation,proto3" json:"src_incarnation,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RecvBufRequest) Reset() { + *x = RecvBufRequest{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RecvBufRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RecvBufRequest) ProtoMessage() {} + +func (x *RecvBufRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[27] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RecvBufRequest.ProtoReflect.Descriptor instead. +func (*RecvBufRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{27} +} + +func (x *RecvBufRequest) GetStepId() int64 { + if x != nil { + return x.StepId + } + return 0 +} + +func (x *RecvBufRequest) GetBufRendezvousKey() string { + if x != nil { + return x.BufRendezvousKey + } + return "" +} + +func (x *RecvBufRequest) GetNumBytes() int64 { + if x != nil { + return x.NumBytes + } + return 0 +} + +func (x *RecvBufRequest) GetBufPtr() uint64 { + if x != nil { + return x.BufPtr + } + return 0 +} + +func (x *RecvBufRequest) GetClientLocality() *device_attributes_go_proto.DeviceLocality { + if x != nil { + return x.ClientLocality + } + return nil +} + +func (x *RecvBufRequest) GetServerLocality() *device_attributes_go_proto.DeviceLocality { + if x != nil { + return x.ServerLocality + } + return nil +} + +func (x *RecvBufRequest) GetTransportOptions() *anypb.Any { + if x != nil { + return x.TransportOptions + } + return nil +} + +func (x *RecvBufRequest) GetSrcDevice() string { + if x != nil { + return x.SrcDevice + } + return "" +} + +func (x *RecvBufRequest) GetDstDevice() string { + if x != nil { + return x.DstDevice + } + return "" +} + +func (x *RecvBufRequest) GetRequestId() int64 { + if x != nil { + return x.RequestId + } + return 0 +} + +func (x *RecvBufRequest) GetSrcIncarnation() uint64 { + if x != nil { + return x.SrcIncarnation + } + return 0 +} + +type RecvBufResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + BufPtr uint64 `protobuf:"fixed64,1,opt,name=buf_ptr,json=bufPtr,proto3" json:"buf_ptr,omitempty"` // Address of source field on server. + NumBytes int64 `protobuf:"varint,2,opt,name=num_bytes,json=numBytes,proto3" json:"num_bytes,omitempty"` // Byte length of buf_ptr field, if set. + IsDead bool `protobuf:"varint,3,opt,name=is_dead,json=isDead,proto3" json:"is_dead,omitempty"` // True if value is 'dead' like a tensor. + // Optional, implementation-specific data. + TransportOptions *anypb.Any `protobuf:"bytes,4,opt,name=transport_options,json=transportOptions,proto3" json:"transport_options,omitempty"` + // Optional, for timeline. + SendStartMicros int64 `protobuf:"varint,5,opt,name=send_start_micros,json=sendStartMicros,proto3" json:"send_start_micros,omitempty"` + // Whether the receiver should send a MarkRecvFinishedRequest to the sender + // to ack the message. + RequireAck bool `protobuf:"varint,6,opt,name=require_ack,json=requireAck,proto3" json:"require_ack,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RecvBufResponse) Reset() { + *x = RecvBufResponse{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RecvBufResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RecvBufResponse) ProtoMessage() {} + +func (x *RecvBufResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[28] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RecvBufResponse.ProtoReflect.Descriptor instead. +func (*RecvBufResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{28} +} + +func (x *RecvBufResponse) GetBufPtr() uint64 { + if x != nil { + return x.BufPtr + } + return 0 +} + +func (x *RecvBufResponse) GetNumBytes() int64 { + if x != nil { + return x.NumBytes + } + return 0 +} + +func (x *RecvBufResponse) GetIsDead() bool { + if x != nil { + return x.IsDead + } + return false +} + +func (x *RecvBufResponse) GetTransportOptions() *anypb.Any { + if x != nil { + return x.TransportOptions + } + return nil +} + +func (x *RecvBufResponse) GetSendStartMicros() int64 { + if x != nil { + return x.SendStartMicros + } + return 0 +} + +func (x *RecvBufResponse) GetRequireAck() bool { + if x != nil { + return x.RequireAck + } + return false +} + +// Supplies one or more device names as members of the group identified by +// group_key. Service will respond when all group_size devices become known. +// All devices in group must have same type. +type CompleteGroupRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + GroupKey int32 `protobuf:"varint,1,opt,name=group_key,json=groupKey,proto3" json:"group_key,omitempty"` + GroupSize int32 `protobuf:"varint,2,opt,name=group_size,json=groupSize,proto3" json:"group_size,omitempty"` + DeviceType string `protobuf:"bytes,3,opt,name=device_type,json=deviceType,proto3" json:"device_type,omitempty"` + CollectiveType int32 `protobuf:"varint,5,opt,name=collective_type,json=collectiveType,proto3" json:"collective_type,omitempty"` + DeviceAttributes *device_attributes_go_proto.DeviceAttributes `protobuf:"bytes,6,opt,name=device_attributes,json=deviceAttributes,proto3" json:"device_attributes,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CompleteGroupRequest) Reset() { + *x = CompleteGroupRequest{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CompleteGroupRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CompleteGroupRequest) ProtoMessage() {} + +func (x *CompleteGroupRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[29] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CompleteGroupRequest.ProtoReflect.Descriptor instead. +func (*CompleteGroupRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{29} +} + +func (x *CompleteGroupRequest) GetGroupKey() int32 { + if x != nil { + return x.GroupKey + } + return 0 +} + +func (x *CompleteGroupRequest) GetGroupSize() int32 { + if x != nil { + return x.GroupSize + } + return 0 +} + +func (x *CompleteGroupRequest) GetDeviceType() string { + if x != nil { + return x.DeviceType + } + return "" +} + +func (x *CompleteGroupRequest) GetCollectiveType() int32 { + if x != nil { + return x.CollectiveType + } + return 0 +} + +func (x *CompleteGroupRequest) GetDeviceAttributes() *device_attributes_go_proto.DeviceAttributes { + if x != nil { + return x.DeviceAttributes + } + return nil +} + +// Gives the complete membership of the group identified by group_key. +type CompleteGroupResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + GroupKey int32 `protobuf:"varint,1,opt,name=group_key,json=groupKey,proto3" json:"group_key,omitempty"` + GroupSize int32 `protobuf:"varint,2,opt,name=group_size,json=groupSize,proto3" json:"group_size,omitempty"` + DeviceType string `protobuf:"bytes,3,opt,name=device_type,json=deviceType,proto3" json:"device_type,omitempty"` + NumTasks int32 `protobuf:"varint,4,opt,name=num_tasks,json=numTasks,proto3" json:"num_tasks,omitempty"` // number of distinct tasks hosting the devices + CommunicatorKey []byte `protobuf:"bytes,7,opt,name=communicator_key,json=communicatorKey,proto3" json:"communicator_key,omitempty"` + DeviceAttributes []*device_attributes_go_proto.DeviceAttributes `protobuf:"bytes,8,rep,name=device_attributes,json=deviceAttributes,proto3" json:"device_attributes,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CompleteGroupResponse) Reset() { + *x = CompleteGroupResponse{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CompleteGroupResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CompleteGroupResponse) ProtoMessage() {} + +func (x *CompleteGroupResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[30] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CompleteGroupResponse.ProtoReflect.Descriptor instead. +func (*CompleteGroupResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{30} +} + +func (x *CompleteGroupResponse) GetGroupKey() int32 { + if x != nil { + return x.GroupKey + } + return 0 +} + +func (x *CompleteGroupResponse) GetGroupSize() int32 { + if x != nil { + return x.GroupSize + } + return 0 +} + +func (x *CompleteGroupResponse) GetDeviceType() string { + if x != nil { + return x.DeviceType + } + return "" +} + +func (x *CompleteGroupResponse) GetNumTasks() int32 { + if x != nil { + return x.NumTasks + } + return 0 +} + +func (x *CompleteGroupResponse) GetCommunicatorKey() []byte { + if x != nil { + return x.CommunicatorKey + } + return nil +} + +func (x *CompleteGroupResponse) GetDeviceAttributes() []*device_attributes_go_proto.DeviceAttributes { + if x != nil { + return x.DeviceAttributes + } + return nil +} + +// Supplies data about one collective op belonging to the instance identified +// by instance_key. Service will respond when all group_size ops have +// become known. Most of the data being sent is for correctness checking, +// to ensure that all ops in the instance share common attributes. +type CompleteInstanceRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Type int32 `protobuf:"varint,2,opt,name=type,proto3" json:"type,omitempty"` + DataType types_go_proto.DataType `protobuf:"varint,3,opt,name=data_type,json=dataType,proto3,enum=tensorflow.DataType" json:"data_type,omitempty"` + Shape *tensor_shape_go_proto.TensorShapeProto `protobuf:"bytes,4,opt,name=shape,proto3" json:"shape,omitempty"` + GroupKey int32 `protobuf:"varint,5,opt,name=group_key,json=groupKey,proto3" json:"group_key,omitempty"` + GroupSize int32 `protobuf:"varint,6,opt,name=group_size,json=groupSize,proto3" json:"group_size,omitempty"` + InstanceKey int32 `protobuf:"varint,7,opt,name=instance_key,json=instanceKey,proto3" json:"instance_key,omitempty"` + DeviceType string `protobuf:"bytes,8,opt,name=device_type,json=deviceType,proto3" json:"device_type,omitempty"` + SubdivOffset []int32 `protobuf:"varint,9,rep,packed,name=subdiv_offset,json=subdivOffset,proto3" json:"subdiv_offset,omitempty"` + Device string `protobuf:"bytes,10,opt,name=device,proto3" json:"device,omitempty"` + IsSource bool `protobuf:"varint,11,opt,name=is_source,json=isSource,proto3" json:"is_source,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CompleteInstanceRequest) Reset() { + *x = CompleteInstanceRequest{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CompleteInstanceRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CompleteInstanceRequest) ProtoMessage() {} + +func (x *CompleteInstanceRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[31] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CompleteInstanceRequest.ProtoReflect.Descriptor instead. +func (*CompleteInstanceRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{31} +} + +func (x *CompleteInstanceRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CompleteInstanceRequest) GetType() int32 { + if x != nil { + return x.Type + } + return 0 +} + +func (x *CompleteInstanceRequest) GetDataType() types_go_proto.DataType { + if x != nil { + return x.DataType + } + return types_go_proto.DataType(0) +} + +func (x *CompleteInstanceRequest) GetShape() *tensor_shape_go_proto.TensorShapeProto { + if x != nil { + return x.Shape + } + return nil +} + +func (x *CompleteInstanceRequest) GetGroupKey() int32 { + if x != nil { + return x.GroupKey + } + return 0 +} + +func (x *CompleteInstanceRequest) GetGroupSize() int32 { + if x != nil { + return x.GroupSize + } + return 0 +} + +func (x *CompleteInstanceRequest) GetInstanceKey() int32 { + if x != nil { + return x.InstanceKey + } + return 0 +} + +func (x *CompleteInstanceRequest) GetDeviceType() string { + if x != nil { + return x.DeviceType + } + return "" +} + +func (x *CompleteInstanceRequest) GetSubdivOffset() []int32 { + if x != nil { + return x.SubdivOffset + } + return nil +} + +func (x *CompleteInstanceRequest) GetDevice() string { + if x != nil { + return x.Device + } + return "" +} + +func (x *CompleteInstanceRequest) GetIsSource() bool { + if x != nil { + return x.IsSource + } + return false +} + +// Confirms that every op in the instance has consistently declared itself. +// Also gives the source_rank in case of broadcast. +type CompleteInstanceResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + InstanceKey int32 `protobuf:"varint,1,opt,name=instance_key,json=instanceKey,proto3" json:"instance_key,omitempty"` + SourceRank int32 `protobuf:"varint,2,opt,name=source_rank,json=sourceRank,proto3" json:"source_rank,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CompleteInstanceResponse) Reset() { + *x = CompleteInstanceResponse{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CompleteInstanceResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CompleteInstanceResponse) ProtoMessage() {} + +func (x *CompleteInstanceResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[32] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CompleteInstanceResponse.ProtoReflect.Descriptor instead. +func (*CompleteInstanceResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{32} +} + +func (x *CompleteInstanceResponse) GetInstanceKey() int32 { + if x != nil { + return x.InstanceKey + } + return 0 +} + +func (x *CompleteInstanceResponse) GetSourceRank() int32 { + if x != nil { + return x.SourceRank + } + return 0 +} + +// Request for next agreed-upon step_id for the specified graph_keys. +// This is used to enable multiple graphs containing nodes from +// a common collective instance to coordinate using the same step_ids. +type GetStepSequenceRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + GraphKey []int64 `protobuf:"varint,1,rep,packed,name=graph_key,json=graphKey,proto3" json:"graph_key,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetStepSequenceRequest) Reset() { + *x = GetStepSequenceRequest{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[33] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetStepSequenceRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetStepSequenceRequest) ProtoMessage() {} + +func (x *GetStepSequenceRequest) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[33] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetStepSequenceRequest.ProtoReflect.Descriptor instead. +func (*GetStepSequenceRequest) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{33} +} + +func (x *GetStepSequenceRequest) GetGraphKey() []int64 { + if x != nil { + return x.GraphKey + } + return nil +} + +type StepSequence struct { + state protoimpl.MessageState `protogen:"open.v1"` + GraphKey int64 `protobuf:"varint,1,opt,name=graph_key,json=graphKey,proto3" json:"graph_key,omitempty"` + NextStepId int64 `protobuf:"varint,2,opt,name=next_step_id,json=nextStepId,proto3" json:"next_step_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *StepSequence) Reset() { + *x = StepSequence{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[34] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *StepSequence) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StepSequence) ProtoMessage() {} + +func (x *StepSequence) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[34] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StepSequence.ProtoReflect.Descriptor instead. +func (*StepSequence) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{34} +} + +func (x *StepSequence) GetGraphKey() int64 { + if x != nil { + return x.GraphKey + } + return 0 +} + +func (x *StepSequence) GetNextStepId() int64 { + if x != nil { + return x.NextStepId + } + return 0 +} + +// Next valid step_ids for one or more graph_keys. +type GetStepSequenceResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + StepSequence []*StepSequence `protobuf:"bytes,1,rep,name=step_sequence,json=stepSequence,proto3" json:"step_sequence,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetStepSequenceResponse) Reset() { + *x = GetStepSequenceResponse{} + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[35] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetStepSequenceResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetStepSequenceResponse) ProtoMessage() {} + +func (x *GetStepSequenceResponse) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_core_protobuf_worker_proto_msgTypes[35] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetStepSequenceResponse.ProtoReflect.Descriptor instead. +func (*GetStepSequenceResponse) Descriptor() ([]byte, []int) { + return file_tensorflow_core_protobuf_worker_proto_rawDescGZIP(), []int{35} +} + +func (x *GetStepSequenceResponse) GetStepSequence() []*StepSequence { + if x != nil { + return x.StepSequence + } + return nil +} + +var File_tensorflow_core_protobuf_worker_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_worker_proto_rawDesc = "" + + "\n" + + "%tensorflow/core/protobuf/worker.proto\x12\n" + + "tensorflow\x1a\x19google/protobuf/any.proto\x1a*tensorflow/core/framework/cost_graph.proto\x1a1tensorflow/core/framework/device_attributes.proto\x1a%tensorflow/core/framework/graph.proto\x1a*tensorflow/core/framework/step_stats.proto\x1a&tensorflow/core/framework/tensor.proto\x1a,tensorflow/core/framework/tensor_shape.proto\x1a%tensorflow/core/framework/types.proto\x1a%tensorflow/core/protobuf/config.proto\x1a$tensorflow/core/protobuf/debug.proto\x1a*tensorflow/core/protobuf/error_codes.proto\x1a+tensorflow/core/protobuf/named_tensor.proto\x1a0tensorflow/core/protobuf/tensorflow_server.proto\"\x12\n" + + "\x10GetStatusRequest\"^\n" + + "\x11GetStatusResponse\x12I\n" + + "\x11device_attributes\x18\x01 \x03(\v2\x1c.tensorflow.DeviceAttributesR\x10deviceAttributes\"\xd7\x02\n" + + "\x1aCreateWorkerSessionRequest\x12%\n" + + "\x0esession_handle\x18\x01 \x01(\tR\rsessionHandle\x124\n" + + "\n" + + "server_def\x18\x02 \x01(\v2\x15.tensorflow.ServerDefR\tserverDef\x122\n" + + "\x15isolate_session_state\x18\x03 \x01(\bR\x13isolateSessionState\x12X\n" + + "\x19cluster_device_attributes\x18\x04 \x03(\v2\x1c.tensorflow.DeviceAttributesR\x17clusterDeviceAttributes\x12\x1f\n" + + "\vmaster_task\x18\x05 \x01(\tR\n" + + "masterTask\x12-\n" + + "\x12master_incarnation\x18\x06 \x01(\x03R\x11masterIncarnation\"\x1d\n" + + "\x1bCreateWorkerSessionResponse\"C\n" + + "\x1aDeleteWorkerSessionRequest\x12%\n" + + "\x0esession_handle\x18\x01 \x01(\tR\rsessionHandle\"\x1d\n" + + "\x1bDeleteWorkerSessionResponse\"\xcb\x03\n" + + "\x14RegisterGraphRequest\x12%\n" + + "\x0esession_handle\x18\x01 \x01(\tR\rsessionHandle\x12?\n" + + "\x1ccreate_worker_session_called\x18\x06 \x01(\bR\x19createWorkerSessionCalled\x121\n" + + "\tgraph_def\x18\x02 \x01(\v2\x14.tensorflow.GraphDefR\bgraphDef\x12,\n" + + "\x10has_control_flow\x18\x03 \x01(\bB\x02\x18\x01R\x0ehasControlFlow\x12=\n" + + "\rgraph_options\x18\x04 \x01(\v2\x18.tensorflow.GraphOptionsR\fgraphOptions\x12=\n" + + "\rdebug_options\x18\x05 \x01(\v2\x18.tensorflow.DebugOptionsR\fdebugOptions\x120\n" + + "\x14collective_graph_key\x18\a \x01(\x03R\x12collectiveGraphKey\x12:\n" + + "\fconfig_proto\x18\b \x01(\v2\x17.tensorflow.ConfigProtoR\vconfigProto\":\n" + + "\x15RegisterGraphResponse\x12!\n" + + "\fgraph_handle\x18\x01 \x01(\tR\vgraphHandle\"\xa3\x01\n" + + "\x16DeregisterGraphRequest\x12%\n" + + "\x0esession_handle\x18\x02 \x01(\tR\rsessionHandle\x12?\n" + + "\x1ccreate_worker_session_called\x18\x03 \x01(\bR\x19createWorkerSessionCalled\x12!\n" + + "\fgraph_handle\x18\x01 \x01(\tR\vgraphHandle\"\x19\n" + + "\x17DeregisterGraphResponse\"1\n" + + "\x11CleanupAllRequest\x12\x1c\n" + + "\tcontainer\x18\x01 \x03(\tR\tcontainer\"\x14\n" + + "\x12CleanupAllResponse\"\xde\x01\n" + + "\fExecutorOpts\x12!\n" + + "\frecord_costs\x18\x01 \x01(\bR\vrecordCosts\x12'\n" + + "\x0frecord_timeline\x18\x03 \x01(\bR\x0erecordTimeline\x126\n" + + "\x17record_partition_graphs\x18\x04 \x01(\bR\x15recordPartitionGraphs\x12J\n" + + "\"report_tensor_allocations_upon_oom\x18\x05 \x01(\bR\x1ereportTensorAllocationsUponOom\"\xe8\x03\n" + + "\x0fRunGraphRequest\x12%\n" + + "\x0esession_handle\x18\b \x01(\tR\rsessionHandle\x12?\n" + + "\x1ccreate_worker_session_called\x18\n" + + " \x01(\bR\x19createWorkerSessionCalled\x12!\n" + + "\fgraph_handle\x18\x01 \x01(\tR\vgraphHandle\x12\x17\n" + + "\astep_id\x18\x02 \x01(\x03R\x06stepId\x125\n" + + "\texec_opts\x18\x05 \x01(\v2\x18.tensorflow.ExecutorOptsR\bexecOpts\x120\n" + + "\x04send\x18\x03 \x03(\v2\x1c.tensorflow.NamedTensorProtoR\x04send\x12\x19\n" + + "\brecv_key\x18\x04 \x03(\tR\arecvKey\x12\x1d\n" + + "\n" + + "is_partial\x18\x06 \x01(\bR\tisPartial\x12-\n" + + "\x13is_last_partial_run\x18\a \x01(\bR\x10isLastPartialRun\x12@\n" + + "\x1dstore_errors_in_response_body\x18\t \x01(\bR\x19storeErrorsInResponseBody\x12\x1d\n" + + "\n" + + "request_id\x18\v \x01(\x03R\trequestId\"\xdd\x02\n" + + "\x10RunGraphResponse\x120\n" + + "\x04recv\x18\x01 \x03(\v2\x1c.tensorflow.NamedTensorProtoR\x04recv\x124\n" + + "\n" + + "step_stats\x18\x02 \x01(\v2\x15.tensorflow.StepStatsR\tstepStats\x127\n" + + "\n" + + "cost_graph\x18\x03 \x01(\v2\x18.tensorflow.CostGraphDefR\tcostGraph\x12=\n" + + "\x0fpartition_graph\x18\x04 \x03(\v2\x14.tensorflow.GraphDefR\x0epartitionGraph\x127\n" + + "\vstatus_code\x18\x05 \x01(\x0e2\x16.tensorflow.error.CodeR\n" + + "statusCode\x120\n" + + "\x14status_error_message\x18\x06 \x01(\tR\x12statusErrorMessage\".\n" + + "\x13CleanupGraphRequest\x12\x17\n" + + "\astep_id\x18\x01 \x01(\x03R\x06stepId\"\x16\n" + + "\x14CleanupGraphResponse\"\xd6\x02\n" + + "\x11RecvTensorRequest\x12\x17\n" + + "\astep_id\x18\x01 \x01(\x03R\x06stepId\x12%\n" + + "\x0erendezvous_key\x18\x02 \x01(\tR\rrendezvousKey\x12\x15\n" + + "\x06dma_ok\x18\x03 \x01(\bR\x05dmaOk\x12C\n" + + "\x0fclient_locality\x18\x04 \x01(\v2\x1a.tensorflow.DeviceLocalityR\x0eclientLocality\x12C\n" + + "\x0fserver_locality\x18\x05 \x01(\v2\x1a.tensorflow.DeviceLocalityR\x0eserverLocality\x12A\n" + + "\x11transport_options\x18\x06 \x01(\v2\x14.google.protobuf.AnyR\x10transportOptions\x12\x1d\n" + + "\n" + + "request_id\x18\a \x01(\x03R\trequestId\"\xee\x01\n" + + "\x12RecvTensorResponse\x12/\n" + + "\x06tensor\x18\x01 \x01(\v2\x17.tensorflow.TensorProtoR\x06tensor\x12\x17\n" + + "\ais_dead\x18\x02 \x01(\bR\x06isDead\x12*\n" + + "\x11send_start_micros\x18\x03 \x01(\x03R\x0fsendStartMicros\x12A\n" + + "\x11transport_options\x18\x04 \x01(\v2\x14.google.protobuf.AnyR\x10transportOptions\x12\x1f\n" + + "\vrequire_ack\x18\x05 \x01(\bR\n" + + "requireAck\"8\n" + + "\x17MarkRecvFinishedRequest\x12\x1d\n" + + "\n" + + "request_id\x18\x01 \x01(\x03R\trequestId\"\x1a\n" + + "\x18MarkRecvFinishedResponse\"\xa8\x01\n" + + "\x0eLoggingRequest\x12,\n" + + "\x12enable_rpc_logging\x18\x01 \x01(\bR\x10enableRpcLogging\x12.\n" + + "\x13disable_rpc_logging\x18\x04 \x01(\bR\x11disableRpcLogging\x12\x14\n" + + "\x05clear\x18\x02 \x01(\bR\x05clear\x12\"\n" + + "\rfetch_step_id\x18\x03 \x03(\x03R\vfetchStepId\"a\n" + + "\x10LabeledStepStats\x12\x17\n" + + "\astep_id\x18\x01 \x01(\x03R\x06stepId\x124\n" + + "\n" + + "step_stats\x18\x02 \x01(\v2\x15.tensorflow.StepStatsR\tstepStats\"C\n" + + "\x0fLoggingResponse\x120\n" + + "\x04step\x18\x01 \x03(\v2\x1c.tensorflow.LabeledStepStatsR\x04step\"\x91\x02\n" + + "\tTraceOpts\x12\x1a\n" + + "\bduration\x18\x01 \x01(\x01R\bduration\x12*\n" + + "\x11use_step_profiler\x18\x02 \x01(\bR\x0fuseStepProfiler\x12.\n" + + "\x13use_kernel_profiler\x18\x03 \x01(\bR\x11useKernelProfiler\x122\n" + + "\x15use_extended_profiler\x18\x04 \x01(\bR\x13useExtendedProfiler\x12(\n" + + "\x10use_gpu_profiler\x18\x05 \x01(\bR\x0euseGpuProfiler\x12.\n" + + "\x13use_sample_profiler\x18\x06 \x01(\bR\x11useSampleProfiler\"A\n" + + "\x0eTracingRequest\x12/\n" + + "\aoptions\x18\x01 \x01(\v2\x15.tensorflow.TraceOptsR\aoptions\"\x11\n" + + "\x0fTracingResponse\"\xe0\x03\n" + + "\x0eRecvBufRequest\x12\x17\n" + + "\astep_id\x18\x01 \x01(\x03R\x06stepId\x12,\n" + + "\x12buf_rendezvous_key\x18\x02 \x01(\tR\x10bufRendezvousKey\x12\x1b\n" + + "\tnum_bytes\x18\x03 \x01(\x03R\bnumBytes\x12\x17\n" + + "\abuf_ptr\x18\x04 \x01(\x06R\x06bufPtr\x12C\n" + + "\x0fclient_locality\x18\x05 \x01(\v2\x1a.tensorflow.DeviceLocalityR\x0eclientLocality\x12C\n" + + "\x0fserver_locality\x18\x06 \x01(\v2\x1a.tensorflow.DeviceLocalityR\x0eserverLocality\x12A\n" + + "\x11transport_options\x18\a \x01(\v2\x14.google.protobuf.AnyR\x10transportOptions\x12\x1d\n" + + "\n" + + "src_device\x18\b \x01(\tR\tsrcDevice\x12\x1d\n" + + "\n" + + "dst_device\x18\t \x01(\tR\tdstDevice\x12\x1d\n" + + "\n" + + "request_id\x18\n" + + " \x01(\x03R\trequestId\x12'\n" + + "\x0fsrc_incarnation\x18\v \x01(\x04R\x0esrcIncarnation\"\xf0\x01\n" + + "\x0fRecvBufResponse\x12\x17\n" + + "\abuf_ptr\x18\x01 \x01(\x06R\x06bufPtr\x12\x1b\n" + + "\tnum_bytes\x18\x02 \x01(\x03R\bnumBytes\x12\x17\n" + + "\ais_dead\x18\x03 \x01(\bR\x06isDead\x12A\n" + + "\x11transport_options\x18\x04 \x01(\v2\x14.google.protobuf.AnyR\x10transportOptions\x12*\n" + + "\x11send_start_micros\x18\x05 \x01(\x03R\x0fsendStartMicros\x12\x1f\n" + + "\vrequire_ack\x18\x06 \x01(\bR\n" + + "requireAck\"\xed\x01\n" + + "\x14CompleteGroupRequest\x12\x1b\n" + + "\tgroup_key\x18\x01 \x01(\x05R\bgroupKey\x12\x1d\n" + + "\n" + + "group_size\x18\x02 \x01(\x05R\tgroupSize\x12\x1f\n" + + "\vdevice_type\x18\x03 \x01(\tR\n" + + "deviceType\x12'\n" + + "\x0fcollective_type\x18\x05 \x01(\x05R\x0ecollectiveType\x12I\n" + + "\x11device_attributes\x18\x06 \x01(\v2\x1c.tensorflow.DeviceAttributesR\x10deviceAttributesJ\x04\b\x04\x10\x05\"\x93\x02\n" + + "\x15CompleteGroupResponse\x12\x1b\n" + + "\tgroup_key\x18\x01 \x01(\x05R\bgroupKey\x12\x1d\n" + + "\n" + + "group_size\x18\x02 \x01(\x05R\tgroupSize\x12\x1f\n" + + "\vdevice_type\x18\x03 \x01(\tR\n" + + "deviceType\x12\x1b\n" + + "\tnum_tasks\x18\x04 \x01(\x05R\bnumTasks\x12)\n" + + "\x10communicator_key\x18\a \x01(\fR\x0fcommunicatorKey\x12I\n" + + "\x11device_attributes\x18\b \x03(\v2\x1c.tensorflow.DeviceAttributesR\x10deviceAttributesJ\x04\b\x05\x10\x06J\x04\b\x06\x10\a\"\x82\x03\n" + + "\x17CompleteInstanceRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x12\n" + + "\x04type\x18\x02 \x01(\x05R\x04type\x121\n" + + "\tdata_type\x18\x03 \x01(\x0e2\x14.tensorflow.DataTypeR\bdataType\x122\n" + + "\x05shape\x18\x04 \x01(\v2\x1c.tensorflow.TensorShapeProtoR\x05shape\x12\x1b\n" + + "\tgroup_key\x18\x05 \x01(\x05R\bgroupKey\x12\x1d\n" + + "\n" + + "group_size\x18\x06 \x01(\x05R\tgroupSize\x12!\n" + + "\finstance_key\x18\a \x01(\x05R\vinstanceKey\x12\x1f\n" + + "\vdevice_type\x18\b \x01(\tR\n" + + "deviceType\x12#\n" + + "\rsubdiv_offset\x18\t \x03(\x05R\fsubdivOffset\x12\x16\n" + + "\x06device\x18\n" + + " \x01(\tR\x06device\x12\x1b\n" + + "\tis_source\x18\v \x01(\bR\bisSource\"d\n" + + "\x18CompleteInstanceResponse\x12!\n" + + "\finstance_key\x18\x01 \x01(\x05R\vinstanceKey\x12\x1f\n" + + "\vsource_rank\x18\x02 \x01(\x05R\n" + + "sourceRankJ\x04\b\x03\x10\x04\"5\n" + + "\x16GetStepSequenceRequest\x12\x1b\n" + + "\tgraph_key\x18\x01 \x03(\x03R\bgraphKey\"M\n" + + "\fStepSequence\x12\x1b\n" + + "\tgraph_key\x18\x01 \x01(\x03R\bgraphKey\x12 \n" + + "\fnext_step_id\x18\x02 \x01(\x03R\n" + + "nextStepId\"X\n" + + "\x17GetStepSequenceResponse\x12=\n" + + "\rstep_sequence\x18\x01 \x03(\v2\x18.tensorflow.StepSequenceR\fstepSequenceB\x86\x01\n" + + "\x1aorg.tensorflow.distruntimeB\fWorkerProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto\xf8\x01\x01b\x06proto3" + +var ( + file_tensorflow_core_protobuf_worker_proto_rawDescOnce sync.Once + file_tensorflow_core_protobuf_worker_proto_rawDescData []byte +) + +func file_tensorflow_core_protobuf_worker_proto_rawDescGZIP() []byte { + file_tensorflow_core_protobuf_worker_proto_rawDescOnce.Do(func() { + file_tensorflow_core_protobuf_worker_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_worker_proto_rawDesc), len(file_tensorflow_core_protobuf_worker_proto_rawDesc))) + }) + return file_tensorflow_core_protobuf_worker_proto_rawDescData +} + +var file_tensorflow_core_protobuf_worker_proto_msgTypes = make([]protoimpl.MessageInfo, 36) +var file_tensorflow_core_protobuf_worker_proto_goTypes = []any{ + (*GetStatusRequest)(nil), // 0: tensorflow.GetStatusRequest + (*GetStatusResponse)(nil), // 1: tensorflow.GetStatusResponse + (*CreateWorkerSessionRequest)(nil), // 2: tensorflow.CreateWorkerSessionRequest + (*CreateWorkerSessionResponse)(nil), // 3: tensorflow.CreateWorkerSessionResponse + (*DeleteWorkerSessionRequest)(nil), // 4: tensorflow.DeleteWorkerSessionRequest + (*DeleteWorkerSessionResponse)(nil), // 5: tensorflow.DeleteWorkerSessionResponse + (*RegisterGraphRequest)(nil), // 6: tensorflow.RegisterGraphRequest + (*RegisterGraphResponse)(nil), // 7: tensorflow.RegisterGraphResponse + (*DeregisterGraphRequest)(nil), // 8: tensorflow.DeregisterGraphRequest + (*DeregisterGraphResponse)(nil), // 9: tensorflow.DeregisterGraphResponse + (*CleanupAllRequest)(nil), // 10: tensorflow.CleanupAllRequest + (*CleanupAllResponse)(nil), // 11: tensorflow.CleanupAllResponse + (*ExecutorOpts)(nil), // 12: tensorflow.ExecutorOpts + (*RunGraphRequest)(nil), // 13: tensorflow.RunGraphRequest + (*RunGraphResponse)(nil), // 14: tensorflow.RunGraphResponse + (*CleanupGraphRequest)(nil), // 15: tensorflow.CleanupGraphRequest + (*CleanupGraphResponse)(nil), // 16: tensorflow.CleanupGraphResponse + (*RecvTensorRequest)(nil), // 17: tensorflow.RecvTensorRequest + (*RecvTensorResponse)(nil), // 18: tensorflow.RecvTensorResponse + (*MarkRecvFinishedRequest)(nil), // 19: tensorflow.MarkRecvFinishedRequest + (*MarkRecvFinishedResponse)(nil), // 20: tensorflow.MarkRecvFinishedResponse + (*LoggingRequest)(nil), // 21: tensorflow.LoggingRequest + (*LabeledStepStats)(nil), // 22: tensorflow.LabeledStepStats + (*LoggingResponse)(nil), // 23: tensorflow.LoggingResponse + (*TraceOpts)(nil), // 24: tensorflow.TraceOpts + (*TracingRequest)(nil), // 25: tensorflow.TracingRequest + (*TracingResponse)(nil), // 26: tensorflow.TracingResponse + (*RecvBufRequest)(nil), // 27: tensorflow.RecvBufRequest + (*RecvBufResponse)(nil), // 28: tensorflow.RecvBufResponse + (*CompleteGroupRequest)(nil), // 29: tensorflow.CompleteGroupRequest + (*CompleteGroupResponse)(nil), // 30: tensorflow.CompleteGroupResponse + (*CompleteInstanceRequest)(nil), // 31: tensorflow.CompleteInstanceRequest + (*CompleteInstanceResponse)(nil), // 32: tensorflow.CompleteInstanceResponse + (*GetStepSequenceRequest)(nil), // 33: tensorflow.GetStepSequenceRequest + (*StepSequence)(nil), // 34: tensorflow.StepSequence + (*GetStepSequenceResponse)(nil), // 35: tensorflow.GetStepSequenceResponse + (*device_attributes_go_proto.DeviceAttributes)(nil), // 36: tensorflow.DeviceAttributes + (*ServerDef)(nil), // 37: tensorflow.ServerDef + (*graph_go_proto.GraphDef)(nil), // 38: tensorflow.GraphDef + (*GraphOptions)(nil), // 39: tensorflow.GraphOptions + (*DebugOptions)(nil), // 40: tensorflow.DebugOptions + (*ConfigProto)(nil), // 41: tensorflow.ConfigProto + (*NamedTensorProto)(nil), // 42: tensorflow.NamedTensorProto + (*step_stats_go_proto.StepStats)(nil), // 43: tensorflow.StepStats + (*cost_graph_go_proto.CostGraphDef)(nil), // 44: tensorflow.CostGraphDef + (Code)(0), // 45: tensorflow.error.Code + (*device_attributes_go_proto.DeviceLocality)(nil), // 46: tensorflow.DeviceLocality + (*anypb.Any)(nil), // 47: google.protobuf.Any + (*tensor_go_proto.TensorProto)(nil), // 48: tensorflow.TensorProto + (types_go_proto.DataType)(0), // 49: tensorflow.DataType + (*tensor_shape_go_proto.TensorShapeProto)(nil), // 50: tensorflow.TensorShapeProto +} +var file_tensorflow_core_protobuf_worker_proto_depIdxs = []int32{ + 36, // 0: tensorflow.GetStatusResponse.device_attributes:type_name -> tensorflow.DeviceAttributes + 37, // 1: tensorflow.CreateWorkerSessionRequest.server_def:type_name -> tensorflow.ServerDef + 36, // 2: tensorflow.CreateWorkerSessionRequest.cluster_device_attributes:type_name -> tensorflow.DeviceAttributes + 38, // 3: tensorflow.RegisterGraphRequest.graph_def:type_name -> tensorflow.GraphDef + 39, // 4: tensorflow.RegisterGraphRequest.graph_options:type_name -> tensorflow.GraphOptions + 40, // 5: tensorflow.RegisterGraphRequest.debug_options:type_name -> tensorflow.DebugOptions + 41, // 6: tensorflow.RegisterGraphRequest.config_proto:type_name -> tensorflow.ConfigProto + 12, // 7: tensorflow.RunGraphRequest.exec_opts:type_name -> tensorflow.ExecutorOpts + 42, // 8: tensorflow.RunGraphRequest.send:type_name -> tensorflow.NamedTensorProto + 42, // 9: tensorflow.RunGraphResponse.recv:type_name -> tensorflow.NamedTensorProto + 43, // 10: tensorflow.RunGraphResponse.step_stats:type_name -> tensorflow.StepStats + 44, // 11: tensorflow.RunGraphResponse.cost_graph:type_name -> tensorflow.CostGraphDef + 38, // 12: tensorflow.RunGraphResponse.partition_graph:type_name -> tensorflow.GraphDef + 45, // 13: tensorflow.RunGraphResponse.status_code:type_name -> tensorflow.error.Code + 46, // 14: tensorflow.RecvTensorRequest.client_locality:type_name -> tensorflow.DeviceLocality + 46, // 15: tensorflow.RecvTensorRequest.server_locality:type_name -> tensorflow.DeviceLocality + 47, // 16: tensorflow.RecvTensorRequest.transport_options:type_name -> google.protobuf.Any + 48, // 17: tensorflow.RecvTensorResponse.tensor:type_name -> tensorflow.TensorProto + 47, // 18: tensorflow.RecvTensorResponse.transport_options:type_name -> google.protobuf.Any + 43, // 19: tensorflow.LabeledStepStats.step_stats:type_name -> tensorflow.StepStats + 22, // 20: tensorflow.LoggingResponse.step:type_name -> tensorflow.LabeledStepStats + 24, // 21: tensorflow.TracingRequest.options:type_name -> tensorflow.TraceOpts + 46, // 22: tensorflow.RecvBufRequest.client_locality:type_name -> tensorflow.DeviceLocality + 46, // 23: tensorflow.RecvBufRequest.server_locality:type_name -> tensorflow.DeviceLocality + 47, // 24: tensorflow.RecvBufRequest.transport_options:type_name -> google.protobuf.Any + 47, // 25: tensorflow.RecvBufResponse.transport_options:type_name -> google.protobuf.Any + 36, // 26: tensorflow.CompleteGroupRequest.device_attributes:type_name -> tensorflow.DeviceAttributes + 36, // 27: tensorflow.CompleteGroupResponse.device_attributes:type_name -> tensorflow.DeviceAttributes + 49, // 28: tensorflow.CompleteInstanceRequest.data_type:type_name -> tensorflow.DataType + 50, // 29: tensorflow.CompleteInstanceRequest.shape:type_name -> tensorflow.TensorShapeProto + 34, // 30: tensorflow.GetStepSequenceResponse.step_sequence:type_name -> tensorflow.StepSequence + 31, // [31:31] is the sub-list for method output_type + 31, // [31:31] is the sub-list for method input_type + 31, // [31:31] is the sub-list for extension type_name + 31, // [31:31] is the sub-list for extension extendee + 0, // [0:31] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_worker_proto_init() } +func file_tensorflow_core_protobuf_worker_proto_init() { + if File_tensorflow_core_protobuf_worker_proto != nil { + return + } + file_tensorflow_core_protobuf_config_proto_init() + file_tensorflow_core_protobuf_debug_proto_init() + file_tensorflow_core_protobuf_error_codes_proto_init() + file_tensorflow_core_protobuf_named_tensor_proto_init() + file_tensorflow_core_protobuf_tensorflow_server_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_worker_proto_rawDesc), len(file_tensorflow_core_protobuf_worker_proto_rawDesc)), + NumEnums: 0, + NumMessages: 36, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_core_protobuf_worker_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_worker_proto_depIdxs, + MessageInfos: file_tensorflow_core_protobuf_worker_proto_msgTypes, + }.Build() + File_tensorflow_core_protobuf_worker_proto = out.File + file_tensorflow_core_protobuf_worker_proto_goTypes = nil + file_tensorflow_core_protobuf_worker_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/worker_service.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/worker_service.pb.go new file mode 100644 index 0000000..d1f0e6c --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto/worker_service.pb.go @@ -0,0 +1,155 @@ +// Copyright 2016 The TensorFlow Authors. All Rights Reserved. +// +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +//============================================================================== + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/core/protobuf/worker_service.proto + +package for_core_protos_go_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +var File_tensorflow_core_protobuf_worker_service_proto protoreflect.FileDescriptor + +const file_tensorflow_core_protobuf_worker_service_proto_rawDesc = "" + + "\n" + + "-tensorflow/core/protobuf/worker_service.proto\x12\x0ftensorflow.grpc\x1a%tensorflow/core/protobuf/worker.proto2\xf0\t\n" + + "\rWorkerService\x12H\n" + + "\tGetStatus\x12\x1c.tensorflow.GetStatusRequest\x1a\x1d.tensorflow.GetStatusResponse\x12f\n" + + "\x13CreateWorkerSession\x12&.tensorflow.CreateWorkerSessionRequest\x1a'.tensorflow.CreateWorkerSessionResponse\x12f\n" + + "\x13DeleteWorkerSession\x12&.tensorflow.DeleteWorkerSessionRequest\x1a'.tensorflow.DeleteWorkerSessionResponse\x12T\n" + + "\rRegisterGraph\x12 .tensorflow.RegisterGraphRequest\x1a!.tensorflow.RegisterGraphResponse\x12Z\n" + + "\x0fDeregisterGraph\x12\".tensorflow.DeregisterGraphRequest\x1a#.tensorflow.DeregisterGraphResponse\x12E\n" + + "\bRunGraph\x12\x1b.tensorflow.RunGraphRequest\x1a\x1c.tensorflow.RunGraphResponse\x12Q\n" + + "\fCleanupGraph\x12\x1f.tensorflow.CleanupGraphRequest\x1a .tensorflow.CleanupGraphResponse\x12K\n" + + "\n" + + "CleanupAll\x12\x1d.tensorflow.CleanupAllRequest\x1a\x1e.tensorflow.CleanupAllResponse\x12M\n" + + "\n" + + "RecvTensor\x12\x1d.tensorflow.RecvTensorRequest\x1a\x1e.tensorflow.RecvTensorResponse\"\x00\x12B\n" + + "\aLogging\x12\x1a.tensorflow.LoggingRequest\x1a\x1b.tensorflow.LoggingResponse\x12B\n" + + "\aTracing\x12\x1a.tensorflow.TracingRequest\x1a\x1b.tensorflow.TracingResponse\x12D\n" + + "\aRecvBuf\x12\x1a.tensorflow.RecvBufRequest\x1a\x1b.tensorflow.RecvBufResponse\"\x00\x12Z\n" + + "\x0fGetStepSequence\x12\".tensorflow.GetStepSequenceRequest\x1a#.tensorflow.GetStepSequenceResponse\x12T\n" + + "\rCompleteGroup\x12 .tensorflow.CompleteGroupRequest\x1a!.tensorflow.CompleteGroupResponse\x12]\n" + + "\x10CompleteInstance\x12#.tensorflow.CompleteInstanceRequest\x1a$.tensorflow.CompleteInstanceResponseB\x8a\x01\n" + + "\x1aorg.tensorflow.distruntimeB\x13WorkerServiceProtosP\x01ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_protob\x06proto3" + +var file_tensorflow_core_protobuf_worker_service_proto_goTypes = []any{ + (*GetStatusRequest)(nil), // 0: tensorflow.GetStatusRequest + (*CreateWorkerSessionRequest)(nil), // 1: tensorflow.CreateWorkerSessionRequest + (*DeleteWorkerSessionRequest)(nil), // 2: tensorflow.DeleteWorkerSessionRequest + (*RegisterGraphRequest)(nil), // 3: tensorflow.RegisterGraphRequest + (*DeregisterGraphRequest)(nil), // 4: tensorflow.DeregisterGraphRequest + (*RunGraphRequest)(nil), // 5: tensorflow.RunGraphRequest + (*CleanupGraphRequest)(nil), // 6: tensorflow.CleanupGraphRequest + (*CleanupAllRequest)(nil), // 7: tensorflow.CleanupAllRequest + (*RecvTensorRequest)(nil), // 8: tensorflow.RecvTensorRequest + (*LoggingRequest)(nil), // 9: tensorflow.LoggingRequest + (*TracingRequest)(nil), // 10: tensorflow.TracingRequest + (*RecvBufRequest)(nil), // 11: tensorflow.RecvBufRequest + (*GetStepSequenceRequest)(nil), // 12: tensorflow.GetStepSequenceRequest + (*CompleteGroupRequest)(nil), // 13: tensorflow.CompleteGroupRequest + (*CompleteInstanceRequest)(nil), // 14: tensorflow.CompleteInstanceRequest + (*GetStatusResponse)(nil), // 15: tensorflow.GetStatusResponse + (*CreateWorkerSessionResponse)(nil), // 16: tensorflow.CreateWorkerSessionResponse + (*DeleteWorkerSessionResponse)(nil), // 17: tensorflow.DeleteWorkerSessionResponse + (*RegisterGraphResponse)(nil), // 18: tensorflow.RegisterGraphResponse + (*DeregisterGraphResponse)(nil), // 19: tensorflow.DeregisterGraphResponse + (*RunGraphResponse)(nil), // 20: tensorflow.RunGraphResponse + (*CleanupGraphResponse)(nil), // 21: tensorflow.CleanupGraphResponse + (*CleanupAllResponse)(nil), // 22: tensorflow.CleanupAllResponse + (*RecvTensorResponse)(nil), // 23: tensorflow.RecvTensorResponse + (*LoggingResponse)(nil), // 24: tensorflow.LoggingResponse + (*TracingResponse)(nil), // 25: tensorflow.TracingResponse + (*RecvBufResponse)(nil), // 26: tensorflow.RecvBufResponse + (*GetStepSequenceResponse)(nil), // 27: tensorflow.GetStepSequenceResponse + (*CompleteGroupResponse)(nil), // 28: tensorflow.CompleteGroupResponse + (*CompleteInstanceResponse)(nil), // 29: tensorflow.CompleteInstanceResponse +} +var file_tensorflow_core_protobuf_worker_service_proto_depIdxs = []int32{ + 0, // 0: tensorflow.grpc.WorkerService.GetStatus:input_type -> tensorflow.GetStatusRequest + 1, // 1: tensorflow.grpc.WorkerService.CreateWorkerSession:input_type -> tensorflow.CreateWorkerSessionRequest + 2, // 2: tensorflow.grpc.WorkerService.DeleteWorkerSession:input_type -> tensorflow.DeleteWorkerSessionRequest + 3, // 3: tensorflow.grpc.WorkerService.RegisterGraph:input_type -> tensorflow.RegisterGraphRequest + 4, // 4: tensorflow.grpc.WorkerService.DeregisterGraph:input_type -> tensorflow.DeregisterGraphRequest + 5, // 5: tensorflow.grpc.WorkerService.RunGraph:input_type -> tensorflow.RunGraphRequest + 6, // 6: tensorflow.grpc.WorkerService.CleanupGraph:input_type -> tensorflow.CleanupGraphRequest + 7, // 7: tensorflow.grpc.WorkerService.CleanupAll:input_type -> tensorflow.CleanupAllRequest + 8, // 8: tensorflow.grpc.WorkerService.RecvTensor:input_type -> tensorflow.RecvTensorRequest + 9, // 9: tensorflow.grpc.WorkerService.Logging:input_type -> tensorflow.LoggingRequest + 10, // 10: tensorflow.grpc.WorkerService.Tracing:input_type -> tensorflow.TracingRequest + 11, // 11: tensorflow.grpc.WorkerService.RecvBuf:input_type -> tensorflow.RecvBufRequest + 12, // 12: tensorflow.grpc.WorkerService.GetStepSequence:input_type -> tensorflow.GetStepSequenceRequest + 13, // 13: tensorflow.grpc.WorkerService.CompleteGroup:input_type -> tensorflow.CompleteGroupRequest + 14, // 14: tensorflow.grpc.WorkerService.CompleteInstance:input_type -> tensorflow.CompleteInstanceRequest + 15, // 15: tensorflow.grpc.WorkerService.GetStatus:output_type -> tensorflow.GetStatusResponse + 16, // 16: tensorflow.grpc.WorkerService.CreateWorkerSession:output_type -> tensorflow.CreateWorkerSessionResponse + 17, // 17: tensorflow.grpc.WorkerService.DeleteWorkerSession:output_type -> tensorflow.DeleteWorkerSessionResponse + 18, // 18: tensorflow.grpc.WorkerService.RegisterGraph:output_type -> tensorflow.RegisterGraphResponse + 19, // 19: tensorflow.grpc.WorkerService.DeregisterGraph:output_type -> tensorflow.DeregisterGraphResponse + 20, // 20: tensorflow.grpc.WorkerService.RunGraph:output_type -> tensorflow.RunGraphResponse + 21, // 21: tensorflow.grpc.WorkerService.CleanupGraph:output_type -> tensorflow.CleanupGraphResponse + 22, // 22: tensorflow.grpc.WorkerService.CleanupAll:output_type -> tensorflow.CleanupAllResponse + 23, // 23: tensorflow.grpc.WorkerService.RecvTensor:output_type -> tensorflow.RecvTensorResponse + 24, // 24: tensorflow.grpc.WorkerService.Logging:output_type -> tensorflow.LoggingResponse + 25, // 25: tensorflow.grpc.WorkerService.Tracing:output_type -> tensorflow.TracingResponse + 26, // 26: tensorflow.grpc.WorkerService.RecvBuf:output_type -> tensorflow.RecvBufResponse + 27, // 27: tensorflow.grpc.WorkerService.GetStepSequence:output_type -> tensorflow.GetStepSequenceResponse + 28, // 28: tensorflow.grpc.WorkerService.CompleteGroup:output_type -> tensorflow.CompleteGroupResponse + 29, // 29: tensorflow.grpc.WorkerService.CompleteInstance:output_type -> tensorflow.CompleteInstanceResponse + 15, // [15:30] is the sub-list for method output_type + 0, // [0:15] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_tensorflow_core_protobuf_worker_service_proto_init() } +func file_tensorflow_core_protobuf_worker_service_proto_init() { + if File_tensorflow_core_protobuf_worker_service_proto != nil { + return + } + file_tensorflow_core_protobuf_worker_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_core_protobuf_worker_service_proto_rawDesc), len(file_tensorflow_core_protobuf_worker_service_proto_rawDesc)), + NumEnums: 0, + NumMessages: 0, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_tensorflow_core_protobuf_worker_service_proto_goTypes, + DependencyIndexes: file_tensorflow_core_protobuf_worker_service_proto_depIdxs, + }.Build() + File_tensorflow_core_protobuf_worker_service_proto = out.File + file_tensorflow_core_protobuf_worker_service_proto_goTypes = nil + file_tensorflow_core_protobuf_worker_service_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/stream_executor/dnn.pb.go b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/stream_executor/dnn.pb.go new file mode 100644 index 0000000..57465ff --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/stream_executor/dnn.pb.go @@ -0,0 +1,820 @@ +// LINT: LEGACY_NAMES + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: tensorflow/stream_executor/dnn.proto + +package stream_executor + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Specifies the data type used by an operation. +type DataType int32 + +const ( + DataType_kFloat DataType = 0 + DataType_kDouble DataType = 1 + DataType_kHalf DataType = 2 + DataType_kInt8 DataType = 3 + DataType_kInt32 DataType = 4 + DataType_kComplexFloat DataType = 5 + DataType_kComplexDouble DataType = 6 +) + +// Enum value maps for DataType. +var ( + DataType_name = map[int32]string{ + 0: "kFloat", + 1: "kDouble", + 2: "kHalf", + 3: "kInt8", + 4: "kInt32", + 5: "kComplexFloat", + 6: "kComplexDouble", + } + DataType_value = map[string]int32{ + "kFloat": 0, + "kDouble": 1, + "kHalf": 2, + "kInt8": 3, + "kInt32": 4, + "kComplexFloat": 5, + "kComplexDouble": 6, + } +) + +func (x DataType) Enum() *DataType { + p := new(DataType) + *p = x + return p +} + +func (x DataType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (DataType) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_stream_executor_dnn_proto_enumTypes[0].Descriptor() +} + +func (DataType) Type() protoreflect.EnumType { + return &file_tensorflow_stream_executor_dnn_proto_enumTypes[0] +} + +func (x DataType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use DataType.Descriptor instead. +func (DataType) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_stream_executor_dnn_proto_rawDescGZIP(), []int{0} +} + +// Describes how a convolution input or output layer's data is formatted. +type DataLayout int32 + +const ( + // Naming convention: + // Y <-> row or height + // X <-> column or width + // Batch <-> batch, or N + // Depth <-> feature, or channel + // TODO(timshen): turn them into cuDNN names, e.g. kNCHW. + DataLayout_kYXDepthBatch DataLayout = 0 + DataLayout_kYXBatchDepth DataLayout = 1 + DataLayout_kBatchYXDepth DataLayout = 2 // cuDNN's NHWC layout + DataLayout_kBatchDepthYX DataLayout = 3 // cuDNN's NCHW layout + DataLayout_kBatchDepthYX4 DataLayout = 4 // cuDNN's NCHW_VECT_C layout +) + +// Enum value maps for DataLayout. +var ( + DataLayout_name = map[int32]string{ + 0: "kYXDepthBatch", + 1: "kYXBatchDepth", + 2: "kBatchYXDepth", + 3: "kBatchDepthYX", + 4: "kBatchDepthYX4", + } + DataLayout_value = map[string]int32{ + "kYXDepthBatch": 0, + "kYXBatchDepth": 1, + "kBatchYXDepth": 2, + "kBatchDepthYX": 3, + "kBatchDepthYX4": 4, + } +) + +func (x DataLayout) Enum() *DataLayout { + p := new(DataLayout) + *p = x + return p +} + +func (x DataLayout) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (DataLayout) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_stream_executor_dnn_proto_enumTypes[1].Descriptor() +} + +func (DataLayout) Type() protoreflect.EnumType { + return &file_tensorflow_stream_executor_dnn_proto_enumTypes[1] +} + +func (x DataLayout) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use DataLayout.Descriptor instead. +func (DataLayout) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_stream_executor_dnn_proto_rawDescGZIP(), []int{1} +} + +// Describes how a convolution filter is laid out in the memory. +type FilterLayout int32 + +const ( + // Naming convention: + // Y <-> row or height + // X <-> column or width + // Output <-> output feature, or N + // Input <-> input feature, or N + // TODO(timshen): turn them into cuDNN names, e.g. kNCHW. + FilterLayout_kOutputInputYX FilterLayout = 0 // cuDNN's NCHW layout + FilterLayout_kOutputYXInput FilterLayout = 1 // cuDNN's NHWC layout + FilterLayout_kOutputInputYX4 FilterLayout = 2 // cuDNN's NCHW_VECT_C layout + FilterLayout_kInputYXOutput FilterLayout = 3 + FilterLayout_kYXInputOutput FilterLayout = 4 +) + +// Enum value maps for FilterLayout. +var ( + FilterLayout_name = map[int32]string{ + 0: "kOutputInputYX", + 1: "kOutputYXInput", + 2: "kOutputInputYX4", + 3: "kInputYXOutput", + 4: "kYXInputOutput", + } + FilterLayout_value = map[string]int32{ + "kOutputInputYX": 0, + "kOutputYXInput": 1, + "kOutputInputYX4": 2, + "kInputYXOutput": 3, + "kYXInputOutput": 4, + } +) + +func (x FilterLayout) Enum() *FilterLayout { + p := new(FilterLayout) + *p = x + return p +} + +func (x FilterLayout) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (FilterLayout) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_stream_executor_dnn_proto_enumTypes[2].Descriptor() +} + +func (FilterLayout) Type() protoreflect.EnumType { + return &file_tensorflow_stream_executor_dnn_proto_enumTypes[2] +} + +func (x FilterLayout) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use FilterLayout.Descriptor instead. +func (FilterLayout) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_stream_executor_dnn_proto_rawDescGZIP(), []int{2} +} + +// Describes a kind of non-linearity (threshold-like mathematical function). +type ActivationMode int32 + +const ( + ActivationMode_kNone ActivationMode = 0 + ActivationMode_kSigmoid ActivationMode = 1 + // Rectified linear activation: f(x) = x < 0 ? 0 : x + ActivationMode_kRelu ActivationMode = 2 + // Rectified linear activation; where upper maximum is 6.0. + ActivationMode_kRelu6 ActivationMode = 3 + // Rectified linear activation; where upper maximum specified by + // BatchDescriptor::value_max(). + ActivationMode_kReluX ActivationMode = 4 + ActivationMode_kTanh ActivationMode = 5 + // Like ReluX; but passes all values in the range [-X,X]. + ActivationMode_kBandPass ActivationMode = 6 +) + +// Enum value maps for ActivationMode. +var ( + ActivationMode_name = map[int32]string{ + 0: "kNone", + 1: "kSigmoid", + 2: "kRelu", + 3: "kRelu6", + 4: "kReluX", + 5: "kTanh", + 6: "kBandPass", + } + ActivationMode_value = map[string]int32{ + "kNone": 0, + "kSigmoid": 1, + "kRelu": 2, + "kRelu6": 3, + "kReluX": 4, + "kTanh": 5, + "kBandPass": 6, + } +) + +func (x ActivationMode) Enum() *ActivationMode { + p := new(ActivationMode) + *p = x + return p +} + +func (x ActivationMode) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ActivationMode) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_stream_executor_dnn_proto_enumTypes[3].Descriptor() +} + +func (ActivationMode) Type() protoreflect.EnumType { + return &file_tensorflow_stream_executor_dnn_proto_enumTypes[3] +} + +func (x ActivationMode) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ActivationMode.Descriptor instead. +func (ActivationMode) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_stream_executor_dnn_proto_rawDescGZIP(), []int{3} +} + +// Describe the math definition for the conv op. The popular behavior is +// actually called cross-correlation in math, despite the operation is often +// referred as convolution. See cuDNN cudnnConvolutionMode_t. +type ConvolutionMode int32 + +const ( + ConvolutionMode_CROSS_CORRELATION ConvolutionMode = 0 + ConvolutionMode_CONVOLUTION ConvolutionMode = 1 +) + +// Enum value maps for ConvolutionMode. +var ( + ConvolutionMode_name = map[int32]string{ + 0: "CROSS_CORRELATION", + 1: "CONVOLUTION", + } + ConvolutionMode_value = map[string]int32{ + "CROSS_CORRELATION": 0, + "CONVOLUTION": 1, + } +) + +func (x ConvolutionMode) Enum() *ConvolutionMode { + p := new(ConvolutionMode) + *p = x + return p +} + +func (x ConvolutionMode) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ConvolutionMode) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_stream_executor_dnn_proto_enumTypes[4].Descriptor() +} + +func (ConvolutionMode) Type() protoreflect.EnumType { + return &file_tensorflow_stream_executor_dnn_proto_enumTypes[4] +} + +func (x ConvolutionMode) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ConvolutionMode.Descriptor instead. +func (ConvolutionMode) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_stream_executor_dnn_proto_rawDescGZIP(), []int{4} +} + +type ConvolutionKind int32 + +const ( + ConvolutionKind_INVALID ConvolutionKind = 0 + ConvolutionKind_FORWARD ConvolutionKind = 1 + ConvolutionKind_BACKWARD_FILTER ConvolutionKind = 2 + ConvolutionKind_BACKWARD_DATA ConvolutionKind = 3 + ConvolutionKind_FORWARD_BIAS_ACTIVATION ConvolutionKind = 4 +) + +// Enum value maps for ConvolutionKind. +var ( + ConvolutionKind_name = map[int32]string{ + 0: "INVALID", + 1: "FORWARD", + 2: "BACKWARD_FILTER", + 3: "BACKWARD_DATA", + 4: "FORWARD_BIAS_ACTIVATION", + } + ConvolutionKind_value = map[string]int32{ + "INVALID": 0, + "FORWARD": 1, + "BACKWARD_FILTER": 2, + "BACKWARD_DATA": 3, + "FORWARD_BIAS_ACTIVATION": 4, + } +) + +func (x ConvolutionKind) Enum() *ConvolutionKind { + p := new(ConvolutionKind) + *p = x + return p +} + +func (x ConvolutionKind) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ConvolutionKind) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_stream_executor_dnn_proto_enumTypes[5].Descriptor() +} + +func (ConvolutionKind) Type() protoreflect.EnumType { + return &file_tensorflow_stream_executor_dnn_proto_enumTypes[5] +} + +func (x ConvolutionKind) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ConvolutionKind.Descriptor instead. +func (ConvolutionKind) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_stream_executor_dnn_proto_rawDescGZIP(), []int{5} +} + +type AlgorithmProto_MathType int32 + +const ( + AlgorithmProto_DEFAULT_MATH AlgorithmProto_MathType = 0 + // The GPU may operate 4x4 matrix FMA. + // See cuDNN's documentation for CUDNN_TENSOR_OP_MATH. + AlgorithmProto_TENSOR_OP_MATH AlgorithmProto_MathType = 1 +) + +// Enum value maps for AlgorithmProto_MathType. +var ( + AlgorithmProto_MathType_name = map[int32]string{ + 0: "DEFAULT_MATH", + 1: "TENSOR_OP_MATH", + } + AlgorithmProto_MathType_value = map[string]int32{ + "DEFAULT_MATH": 0, + "TENSOR_OP_MATH": 1, + } +) + +func (x AlgorithmProto_MathType) Enum() *AlgorithmProto_MathType { + p := new(AlgorithmProto_MathType) + *p = x + return p +} + +func (x AlgorithmProto_MathType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (AlgorithmProto_MathType) Descriptor() protoreflect.EnumDescriptor { + return file_tensorflow_stream_executor_dnn_proto_enumTypes[6].Descriptor() +} + +func (AlgorithmProto_MathType) Type() protoreflect.EnumType { + return &file_tensorflow_stream_executor_dnn_proto_enumTypes[6] +} + +func (x AlgorithmProto_MathType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use AlgorithmProto_MathType.Descriptor instead. +func (AlgorithmProto_MathType) EnumDescriptor() ([]byte, []int) { + return file_tensorflow_stream_executor_dnn_proto_rawDescGZIP(), []int{1, 0} +} + +// Generic tensor representation. +type TensorDescriptorProto struct { + state protoimpl.MessageState `protogen:"open.v1"` + Dimensions []int64 `protobuf:"varint,1,rep,packed,name=dimensions,proto3" json:"dimensions,omitempty"` + DataType DataType `protobuf:"varint,2,opt,name=data_type,json=dataType,proto3,enum=stream_executor.dnn.DataType" json:"data_type,omitempty"` + // Types that are valid to be assigned to LayoutOneof: + // + // *TensorDescriptorProto_DataLayout + // *TensorDescriptorProto_FilterLayout + LayoutOneof isTensorDescriptorProto_LayoutOneof `protobuf_oneof:"layout_oneof"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TensorDescriptorProto) Reset() { + *x = TensorDescriptorProto{} + mi := &file_tensorflow_stream_executor_dnn_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TensorDescriptorProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TensorDescriptorProto) ProtoMessage() {} + +func (x *TensorDescriptorProto) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_stream_executor_dnn_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TensorDescriptorProto.ProtoReflect.Descriptor instead. +func (*TensorDescriptorProto) Descriptor() ([]byte, []int) { + return file_tensorflow_stream_executor_dnn_proto_rawDescGZIP(), []int{0} +} + +func (x *TensorDescriptorProto) GetDimensions() []int64 { + if x != nil { + return x.Dimensions + } + return nil +} + +func (x *TensorDescriptorProto) GetDataType() DataType { + if x != nil { + return x.DataType + } + return DataType_kFloat +} + +func (x *TensorDescriptorProto) GetLayoutOneof() isTensorDescriptorProto_LayoutOneof { + if x != nil { + return x.LayoutOneof + } + return nil +} + +func (x *TensorDescriptorProto) GetDataLayout() DataLayout { + if x != nil { + if x, ok := x.LayoutOneof.(*TensorDescriptorProto_DataLayout); ok { + return x.DataLayout + } + } + return DataLayout_kYXDepthBatch +} + +func (x *TensorDescriptorProto) GetFilterLayout() FilterLayout { + if x != nil { + if x, ok := x.LayoutOneof.(*TensorDescriptorProto_FilterLayout); ok { + return x.FilterLayout + } + } + return FilterLayout_kOutputInputYX +} + +type isTensorDescriptorProto_LayoutOneof interface { + isTensorDescriptorProto_LayoutOneof() +} + +type TensorDescriptorProto_DataLayout struct { + DataLayout DataLayout `protobuf:"varint,3,opt,name=data_layout,json=dataLayout,proto3,enum=stream_executor.dnn.DataLayout,oneof"` +} + +type TensorDescriptorProto_FilterLayout struct { + FilterLayout FilterLayout `protobuf:"varint,4,opt,name=filter_layout,json=filterLayout,proto3,enum=stream_executor.dnn.FilterLayout,oneof"` +} + +func (*TensorDescriptorProto_DataLayout) isTensorDescriptorProto_LayoutOneof() {} + +func (*TensorDescriptorProto_FilterLayout) isTensorDescriptorProto_LayoutOneof() {} + +// Generic algorithm representation. +type AlgorithmProto struct { + state protoimpl.MessageState `protogen:"open.v1"` + AlgoId int64 `protobuf:"varint,1,opt,name=algo_id,json=algoId,proto3" json:"algo_id,omitempty"` + MathType AlgorithmProto_MathType `protobuf:"varint,2,opt,name=math_type,json=mathType,proto3,enum=stream_executor.dnn.AlgorithmProto_MathType" json:"math_type,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AlgorithmProto) Reset() { + *x = AlgorithmProto{} + mi := &file_tensorflow_stream_executor_dnn_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AlgorithmProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AlgorithmProto) ProtoMessage() {} + +func (x *AlgorithmProto) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_stream_executor_dnn_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AlgorithmProto.ProtoReflect.Descriptor instead. +func (*AlgorithmProto) Descriptor() ([]byte, []int) { + return file_tensorflow_stream_executor_dnn_proto_rawDescGZIP(), []int{1} +} + +func (x *AlgorithmProto) GetAlgoId() int64 { + if x != nil { + return x.AlgoId + } + return 0 +} + +func (x *AlgorithmProto) GetMathType() AlgorithmProto_MathType { + if x != nil { + return x.MathType + } + return AlgorithmProto_DEFAULT_MATH +} + +// Convolution-specific parameters. +type ConvolutionDescriptorProto struct { + state protoimpl.MessageState `protogen:"open.v1"` + Paddings []int64 `protobuf:"varint,1,rep,packed,name=paddings,proto3" json:"paddings,omitempty"` + Strides []int64 `protobuf:"varint,2,rep,packed,name=strides,proto3" json:"strides,omitempty"` + Dilations []int64 `protobuf:"varint,3,rep,packed,name=dilations,proto3" json:"dilations,omitempty"` + // The "accumulator" type. For example, use F32 as an accumulator for F16 + // convolutions. + // See cuDNN's cudnnConvolutionMode_t. + ComputeMode DataType `protobuf:"varint,4,opt,name=compute_mode,json=computeMode,proto3,enum=stream_executor.dnn.DataType" json:"compute_mode,omitempty"` + // See cuDNN's group count. + GroupCount int32 `protobuf:"varint,5,opt,name=group_count,json=groupCount,proto3" json:"group_count,omitempty"` + ConvolutionMode ConvolutionMode `protobuf:"varint,6,opt,name=convolution_mode,json=convolutionMode,proto3,enum=stream_executor.dnn.ConvolutionMode" json:"convolution_mode,omitempty"` + // Tensorflow node name, same as in NodeDef, for debugging purposes. + Name string `protobuf:"bytes,7,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ConvolutionDescriptorProto) Reset() { + *x = ConvolutionDescriptorProto{} + mi := &file_tensorflow_stream_executor_dnn_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ConvolutionDescriptorProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConvolutionDescriptorProto) ProtoMessage() {} + +func (x *ConvolutionDescriptorProto) ProtoReflect() protoreflect.Message { + mi := &file_tensorflow_stream_executor_dnn_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConvolutionDescriptorProto.ProtoReflect.Descriptor instead. +func (*ConvolutionDescriptorProto) Descriptor() ([]byte, []int) { + return file_tensorflow_stream_executor_dnn_proto_rawDescGZIP(), []int{2} +} + +func (x *ConvolutionDescriptorProto) GetPaddings() []int64 { + if x != nil { + return x.Paddings + } + return nil +} + +func (x *ConvolutionDescriptorProto) GetStrides() []int64 { + if x != nil { + return x.Strides + } + return nil +} + +func (x *ConvolutionDescriptorProto) GetDilations() []int64 { + if x != nil { + return x.Dilations + } + return nil +} + +func (x *ConvolutionDescriptorProto) GetComputeMode() DataType { + if x != nil { + return x.ComputeMode + } + return DataType_kFloat +} + +func (x *ConvolutionDescriptorProto) GetGroupCount() int32 { + if x != nil { + return x.GroupCount + } + return 0 +} + +func (x *ConvolutionDescriptorProto) GetConvolutionMode() ConvolutionMode { + if x != nil { + return x.ConvolutionMode + } + return ConvolutionMode_CROSS_CORRELATION +} + +func (x *ConvolutionDescriptorProto) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +var File_tensorflow_stream_executor_dnn_proto protoreflect.FileDescriptor + +const file_tensorflow_stream_executor_dnn_proto_rawDesc = "" + + "\n" + + "$tensorflow/stream_executor/dnn.proto\x12\x13stream_executor.dnn\"\x91\x02\n" + + "\x15TensorDescriptorProto\x12\x1e\n" + + "\n" + + "dimensions\x18\x01 \x03(\x03R\n" + + "dimensions\x12:\n" + + "\tdata_type\x18\x02 \x01(\x0e2\x1d.stream_executor.dnn.DataTypeR\bdataType\x12B\n" + + "\vdata_layout\x18\x03 \x01(\x0e2\x1f.stream_executor.dnn.DataLayoutH\x00R\n" + + "dataLayout\x12H\n" + + "\rfilter_layout\x18\x04 \x01(\x0e2!.stream_executor.dnn.FilterLayoutH\x00R\ffilterLayoutB\x0e\n" + + "\flayout_oneof\"\xa6\x01\n" + + "\x0eAlgorithmProto\x12\x17\n" + + "\aalgo_id\x18\x01 \x01(\x03R\x06algoId\x12I\n" + + "\tmath_type\x18\x02 \x01(\x0e2,.stream_executor.dnn.AlgorithmProto.MathTypeR\bmathType\"0\n" + + "\bMathType\x12\x10\n" + + "\fDEFAULT_MATH\x10\x00\x12\x12\n" + + "\x0eTENSOR_OP_MATH\x10\x01\"\xb8\x02\n" + + "\x1aConvolutionDescriptorProto\x12\x1a\n" + + "\bpaddings\x18\x01 \x03(\x03R\bpaddings\x12\x18\n" + + "\astrides\x18\x02 \x03(\x03R\astrides\x12\x1c\n" + + "\tdilations\x18\x03 \x03(\x03R\tdilations\x12@\n" + + "\fcompute_mode\x18\x04 \x01(\x0e2\x1d.stream_executor.dnn.DataTypeR\vcomputeMode\x12\x1f\n" + + "\vgroup_count\x18\x05 \x01(\x05R\n" + + "groupCount\x12O\n" + + "\x10convolution_mode\x18\x06 \x01(\x0e2$.stream_executor.dnn.ConvolutionModeR\x0fconvolutionMode\x12\x12\n" + + "\x04name\x18\a \x01(\tR\x04name*l\n" + + "\bDataType\x12\n" + + "\n" + + "\x06kFloat\x10\x00\x12\v\n" + + "\akDouble\x10\x01\x12\t\n" + + "\x05kHalf\x10\x02\x12\t\n" + + "\x05kInt8\x10\x03\x12\n" + + "\n" + + "\x06kInt32\x10\x04\x12\x11\n" + + "\rkComplexFloat\x10\x05\x12\x12\n" + + "\x0ekComplexDouble\x10\x06*l\n" + + "\n" + + "DataLayout\x12\x11\n" + + "\rkYXDepthBatch\x10\x00\x12\x11\n" + + "\rkYXBatchDepth\x10\x01\x12\x11\n" + + "\rkBatchYXDepth\x10\x02\x12\x11\n" + + "\rkBatchDepthYX\x10\x03\x12\x12\n" + + "\x0ekBatchDepthYX4\x10\x04*s\n" + + "\fFilterLayout\x12\x12\n" + + "\x0ekOutputInputYX\x10\x00\x12\x12\n" + + "\x0ekOutputYXInput\x10\x01\x12\x13\n" + + "\x0fkOutputInputYX4\x10\x02\x12\x12\n" + + "\x0ekInputYXOutput\x10\x03\x12\x12\n" + + "\x0ekYXInputOutput\x10\x04*f\n" + + "\x0eActivationMode\x12\t\n" + + "\x05kNone\x10\x00\x12\f\n" + + "\bkSigmoid\x10\x01\x12\t\n" + + "\x05kRelu\x10\x02\x12\n" + + "\n" + + "\x06kRelu6\x10\x03\x12\n" + + "\n" + + "\x06kReluX\x10\x04\x12\t\n" + + "\x05kTanh\x10\x05\x12\r\n" + + "\tkBandPass\x10\x06*9\n" + + "\x0fConvolutionMode\x12\x15\n" + + "\x11CROSS_CORRELATION\x10\x00\x12\x0f\n" + + "\vCONVOLUTION\x10\x01*p\n" + + "\x0fConvolutionKind\x12\v\n" + + "\aINVALID\x10\x00\x12\v\n" + + "\aFORWARD\x10\x01\x12\x13\n" + + "\x0fBACKWARD_FILTER\x10\x02\x12\x11\n" + + "\rBACKWARD_DATA\x10\x03\x12\x1b\n" + + "\x17FORWARD_BIAS_ACTIVATION\x10\x04B@Z>github.com/tensorflow/tensorflow/tensorflow/go/stream_executorb\x06proto3" + +var ( + file_tensorflow_stream_executor_dnn_proto_rawDescOnce sync.Once + file_tensorflow_stream_executor_dnn_proto_rawDescData []byte +) + +func file_tensorflow_stream_executor_dnn_proto_rawDescGZIP() []byte { + file_tensorflow_stream_executor_dnn_proto_rawDescOnce.Do(func() { + file_tensorflow_stream_executor_dnn_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tensorflow_stream_executor_dnn_proto_rawDesc), len(file_tensorflow_stream_executor_dnn_proto_rawDesc))) + }) + return file_tensorflow_stream_executor_dnn_proto_rawDescData +} + +var file_tensorflow_stream_executor_dnn_proto_enumTypes = make([]protoimpl.EnumInfo, 7) +var file_tensorflow_stream_executor_dnn_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_tensorflow_stream_executor_dnn_proto_goTypes = []any{ + (DataType)(0), // 0: stream_executor.dnn.DataType + (DataLayout)(0), // 1: stream_executor.dnn.DataLayout + (FilterLayout)(0), // 2: stream_executor.dnn.FilterLayout + (ActivationMode)(0), // 3: stream_executor.dnn.ActivationMode + (ConvolutionMode)(0), // 4: stream_executor.dnn.ConvolutionMode + (ConvolutionKind)(0), // 5: stream_executor.dnn.ConvolutionKind + (AlgorithmProto_MathType)(0), // 6: stream_executor.dnn.AlgorithmProto.MathType + (*TensorDescriptorProto)(nil), // 7: stream_executor.dnn.TensorDescriptorProto + (*AlgorithmProto)(nil), // 8: stream_executor.dnn.AlgorithmProto + (*ConvolutionDescriptorProto)(nil), // 9: stream_executor.dnn.ConvolutionDescriptorProto +} +var file_tensorflow_stream_executor_dnn_proto_depIdxs = []int32{ + 0, // 0: stream_executor.dnn.TensorDescriptorProto.data_type:type_name -> stream_executor.dnn.DataType + 1, // 1: stream_executor.dnn.TensorDescriptorProto.data_layout:type_name -> stream_executor.dnn.DataLayout + 2, // 2: stream_executor.dnn.TensorDescriptorProto.filter_layout:type_name -> stream_executor.dnn.FilterLayout + 6, // 3: stream_executor.dnn.AlgorithmProto.math_type:type_name -> stream_executor.dnn.AlgorithmProto.MathType + 0, // 4: stream_executor.dnn.ConvolutionDescriptorProto.compute_mode:type_name -> stream_executor.dnn.DataType + 4, // 5: stream_executor.dnn.ConvolutionDescriptorProto.convolution_mode:type_name -> stream_executor.dnn.ConvolutionMode + 6, // [6:6] is the sub-list for method output_type + 6, // [6:6] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_tensorflow_stream_executor_dnn_proto_init() } +func file_tensorflow_stream_executor_dnn_proto_init() { + if File_tensorflow_stream_executor_dnn_proto != nil { + return + } + file_tensorflow_stream_executor_dnn_proto_msgTypes[0].OneofWrappers = []any{ + (*TensorDescriptorProto_DataLayout)(nil), + (*TensorDescriptorProto_FilterLayout)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_tensorflow_stream_executor_dnn_proto_rawDesc), len(file_tensorflow_stream_executor_dnn_proto_rawDesc)), + NumEnums: 7, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_tensorflow_stream_executor_dnn_proto_goTypes, + DependencyIndexes: file_tensorflow_stream_executor_dnn_proto_depIdxs, + EnumInfos: file_tensorflow_stream_executor_dnn_proto_enumTypes, + MessageInfos: file_tensorflow_stream_executor_dnn_proto_msgTypes, + }.Build() + File_tensorflow_stream_executor_dnn_proto = out.File + file_tensorflow_stream_executor_dnn_proto_goTypes = nil + file_tensorflow_stream_executor_dnn_proto_depIdxs = nil +} diff --git a/third_party/go-tensorflow/tensorflow/go/version.go b/third_party/go-tensorflow/tensorflow/go/version.go new file mode 100644 index 0000000..7de909d --- /dev/null +++ b/third_party/go-tensorflow/tensorflow/go/version.go @@ -0,0 +1,25 @@ +/* +Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package tensorflow + +// #include +// #include "tensorflow/c/c_api.h" +import "C" + +// Version returns a string describing the version of the underlying TensorFlow +// runtime. +func Version() string { return C.GoString(C.TF_Version()) } From 3ba5708bb2367babacca84fc5a5f4ae7b6da3f1a Mon Sep 17 00:00:00 2001 From: David Choi Date: Tue, 18 Nov 2025 11:43:26 -0800 Subject: [PATCH 31/38] Fix bug with Triton POLL mode, update e2e config --- example/e2e/regression/app.yaml | 2 +- .../cases/009_float_cache/test.yaml | 19 +++-------- example/server/etc/config.yaml | 8 ++--- service/triton/http.go | 34 ++++++++++++------- service/triton/triton.go | 9 ++--- 5 files changed, 34 insertions(+), 38 deletions(-) diff --git a/example/e2e/regression/app.yaml b/example/e2e/regression/app.yaml index 3c284ed..50d0e23 100644 --- a/example/e2e/regression/app.yaml +++ b/example/e2e/regression/app.yaml @@ -18,7 +18,7 @@ pipeline: directory: /tmp/e2e checkError: true immuneToHangups: true - command: ./mly-endly -c=/tmp/e2e/config.yaml + command: ./mly-endly -c=/tmp/e2e/config.yaml 2>&1 >/tmp/e2e/mly-endly.log env: DEBUG: 'true' LD_LIBRARY_PATH: /usr/local/lib diff --git a/example/e2e/regression/cases/009_float_cache/test.yaml b/example/e2e/regression/cases/009_float_cache/test.yaml index de2797a..1dccece 100644 --- a/example/e2e/regression/cases/009_float_cache/test.yaml +++ b/example/e2e/regression/cases/009_float_cache/test.yaml @@ -15,30 +15,21 @@ pipeline: assert: action: validator:assert - init: - actual: $AsJSON($test.Cmd[0].Stdout) - actual: $actual + actual: $AsJSON($test.Cmd[0].Stdout) expect: $LoadJSON('${parentPath}/expect.json') assertCache: action: validator:assert - init: - actual: $AsJSON($test.Cmd[1].Stdout) - expect: $LoadJSON('${parentPath}/expect-cache.json') - actual: $actual - expect: $expect + actual: $AsJSON($test.Cmd[1].Stdout) + expect: $LoadJSON('${parentPath}/expect-cache.json') assertNoCache: action: validator:assert - init: - actual: $AsJSON($test.Cmd[2].Stdout) - actual: $actual + actual: $AsJSON($test.Cmd[2].Stdout) expect: $LoadJSON('${parentPath}/expect-no-cache.json') assertNoDict: action: validator:assert - init: - actual: $AsJSON($test.Cmd[4].Stdout) - actual: $actual + actual: $AsJSON($test.Cmd[4].Stdout) expect: $LoadJSON('${parentPath}/expect-no-dict.json') diff --git a/example/server/etc/config.yaml b/example/server/etc/config.yaml index 85081a5..7467fbf 100644 --- a/example/server/etc/config.yaml +++ b/example/server/etc/config.yaml @@ -3,10 +3,10 @@ Endpoint: models: - id: sli_triton - url: http://localhost:8001 + url: http://localhost:8000 platform: triton triton: - modelName: sli + modelName: sli_2 timeout: 5 useDict: true debug: false @@ -17,15 +17,11 @@ models: - aux inputs: - name: sa - index: 0 - name: sl - index: 1 - name: aux - index: 2 auxiliary: true outputs: - name: expand - index: 0 dataType: int - id: sli diff --git a/service/triton/http.go b/service/triton/http.go index dd8dff6..4195a81 100644 --- a/service/triton/http.go +++ b/service/triton/http.go @@ -6,6 +6,7 @@ import ( "encoding/json" "fmt" "io" + "log" "net/http" "reflect" "time" @@ -16,12 +17,17 @@ import ( // Deprecated: use GRPCClient instead type HTTPClient struct { httpClient *http.Client + serverURL string - serverURL string + debug bool } -func (c *HTTPClient) statusRequest(ctx context.Context, method, url string) (*http.Response, error) { - httpReq, err := http.NewRequestWithContext(ctx, method, url, nil) +func (c *HTTPClient) sendRequestCheckStatus(ctx context.Context, method, path string) (*http.Response, error) { + if c.debug { + log.Printf("Sending request %s %s\n", method, path) + } + + httpReq, err := http.NewRequestWithContext(ctx, method, c.serverURL+path, nil) if err != nil { return nil, fmt.Errorf("failed to create HTTP request: %w", err) } @@ -34,15 +40,15 @@ func (c *HTTPClient) statusRequest(ctx context.Context, method, url string) (*ht defer resp.Body.Close() if resp.StatusCode != http.StatusOK { - return resp, fmt.Errorf("triton server http status code: %d for %s %s", resp.StatusCode, method, url) + return resp, fmt.Errorf("triton server http status code: %d for %s %s", resp.StatusCode, method, path) } return resp, nil } func (c *HTTPClient) ServerReady(ctx context.Context) error { - url := c.serverURL + "/v2/health/ready" - _, err := c.statusRequest(ctx, "GET", url) + path := "/v2/health/ready" + _, err := c.sendRequestCheckStatus(ctx, "GET", path) return err } @@ -61,15 +67,15 @@ func (c *HTTPClient) ModelInfer(ctx context.Context, modelName string, inputs [] } func (c *HTTPClient) ModelReady(ctx context.Context, modelName string) (bool, error) { - url := c.serverURL + "/v2/models/" + modelName + "/ready" - resp, err := c.statusRequest(ctx, "GET", url) + path := "/v2/models/" + modelName + "/ready" + resp, err := c.sendRequestCheckStatus(ctx, "GET", path) if err != nil { return false, err } if resp.StatusCode == http.StatusBadRequest { // TODO "Model version not ready" - return false, nil + return false, fmt.Errorf("triton server returned status %d", resp.StatusCode) } else if resp.StatusCode != http.StatusOK { body, _ := io.ReadAll(resp.Body) return false, fmt.Errorf("triton server returned status %d: %s", resp.StatusCode, string(body)) @@ -79,14 +85,14 @@ func (c *HTTPClient) ModelReady(ctx context.Context, modelName string) (bool, er } func (c *HTTPClient) ModelLoad(ctx context.Context, modelName string) error { - url := c.serverURL + "/v2/repository/models/" + modelName + "/load" - _, err := c.statusRequest(ctx, "POST", url) + path := "/v2/repository/models/" + modelName + "/load" + _, err := c.sendRequestCheckStatus(ctx, "POST", path) return err } func (c *HTTPClient) ModelUnload(ctx context.Context, modelName string) error { - url := c.serverURL + "/v2/repository/models/" + modelName + "/unload" - _, err := c.statusRequest(ctx, "POST", url) + path := "/v2/repository/models/" + modelName + "/unload" + _, err := c.sendRequestCheckStatus(ctx, "POST", path) return err } @@ -223,6 +229,8 @@ func (c *HTTPClient) handleRequestWithRetry(ctx context.Context, httpReq *http.R if err == nil { break + } else if resp == nil { + // do nothing } else if resp.StatusCode >= 500 { // try again on 5xx resp.Body.Close() diff --git a/service/triton/triton.go b/service/triton/triton.go index 162cf40..a4c8347 100644 --- a/service/triton/triton.go +++ b/service/triton/triton.go @@ -45,6 +45,7 @@ func NewTritonEvaluator(config *config.Model, tritonClients map[string]TritonCli Timeout: timeout, }, serverURL: config.URL, + debug: config.Debug, } } else { client = tritonClients[config.Triton.ServerID] @@ -201,14 +202,14 @@ func (t *TritonEvaluator) ReloadIfNeeded(ctx context.Context) error { return fmt.Errorf("failed to check Triton model %s health: %w", t.modelName, err) } - if !t.repositoryExplicit { - return fmt.Errorf("model %s not ready and Triton is not in EXPLICIT Model Control Mode", t.modelName) - } - if ready { return nil } + if !t.repositoryExplicit { + return fmt.Errorf("model %s not ready and Triton is not in EXPLICIT Model Control Mode: %w", t.modelName, err) + } + err = t.client.ModelLoad(ctx, t.modelName) if err != nil { return fmt.Errorf("failed to load Triton model %s: %w", t.modelName, err) From 7adb32f8b66b9a7e9a080a23dc66f1396e5ba8da Mon Sep 17 00:00:00 2001 From: David Choi Date: Tue, 18 Nov 2025 11:53:47 -0800 Subject: [PATCH 32/38] e2e Triton Repository now matches example server configuration. --- example/e2e/data/router.yaml | 3 ++ .../1/model.savedmodel/saved_model.pb | Bin .../variables/variables.data-00000-of-00001 | Bin .../variables/variables.index | Bin .../{sli => sli_1}/config.pbtxt | 1 - .../sli_2/1/model.savedmodel/saved_model.pb | Bin 0 -> 82272 bytes .../variables/variables.data-00000-of-00001 | Bin 0 -> 1445 bytes .../variables/variables.index | Bin 0 -> 319 bytes .../sli_2/config.pbtxt | 27 ++++++++++++++++++ 9 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 example/e2e/data/router.yaml rename example/e2e/data/triton_model_repository/{sli => sli_1}/1/model.savedmodel/saved_model.pb (100%) rename example/e2e/data/triton_model_repository/{sli => sli_1}/1/model.savedmodel/variables/variables.data-00000-of-00001 (100%) rename example/e2e/data/triton_model_repository/{sli => sli_1}/1/model.savedmodel/variables/variables.index (100%) rename example/e2e/data/triton_model_repository/{sli => sli_1}/config.pbtxt (96%) create mode 100644 example/e2e/data/triton_model_repository/sli_2/1/model.savedmodel/saved_model.pb create mode 100644 example/e2e/data/triton_model_repository/sli_2/1/model.savedmodel/variables/variables.data-00000-of-00001 create mode 100644 example/e2e/data/triton_model_repository/sli_2/1/model.savedmodel/variables/variables.index create mode 100644 example/e2e/data/triton_model_repository/sli_2/config.pbtxt diff --git a/example/e2e/data/router.yaml b/example/e2e/data/router.yaml new file mode 100644 index 0000000..b271a64 --- /dev/null +++ b/example/e2e/data/router.yaml @@ -0,0 +1,3 @@ +entityMapping: + - entityID: 1 + modelName: sli \ No newline at end of file diff --git a/example/e2e/data/triton_model_repository/sli/1/model.savedmodel/saved_model.pb b/example/e2e/data/triton_model_repository/sli_1/1/model.savedmodel/saved_model.pb similarity index 100% rename from example/e2e/data/triton_model_repository/sli/1/model.savedmodel/saved_model.pb rename to example/e2e/data/triton_model_repository/sli_1/1/model.savedmodel/saved_model.pb diff --git a/example/e2e/data/triton_model_repository/sli/1/model.savedmodel/variables/variables.data-00000-of-00001 b/example/e2e/data/triton_model_repository/sli_1/1/model.savedmodel/variables/variables.data-00000-of-00001 similarity index 100% rename from example/e2e/data/triton_model_repository/sli/1/model.savedmodel/variables/variables.data-00000-of-00001 rename to example/e2e/data/triton_model_repository/sli_1/1/model.savedmodel/variables/variables.data-00000-of-00001 diff --git a/example/e2e/data/triton_model_repository/sli/1/model.savedmodel/variables/variables.index b/example/e2e/data/triton_model_repository/sli_1/1/model.savedmodel/variables/variables.index similarity index 100% rename from example/e2e/data/triton_model_repository/sli/1/model.savedmodel/variables/variables.index rename to example/e2e/data/triton_model_repository/sli_1/1/model.savedmodel/variables/variables.index diff --git a/example/e2e/data/triton_model_repository/sli/config.pbtxt b/example/e2e/data/triton_model_repository/sli_1/config.pbtxt similarity index 96% rename from example/e2e/data/triton_model_repository/sli/config.pbtxt rename to example/e2e/data/triton_model_repository/sli_1/config.pbtxt index ffa375d..566ef4d 100644 --- a/example/e2e/data/triton_model_repository/sli/config.pbtxt +++ b/example/e2e/data/triton_model_repository/sli_1/config.pbtxt @@ -1,5 +1,4 @@ -name: "sli" backend: "tensorflow" max_batch_size: 32 diff --git a/example/e2e/data/triton_model_repository/sli_2/1/model.savedmodel/saved_model.pb b/example/e2e/data/triton_model_repository/sli_2/1/model.savedmodel/saved_model.pb new file mode 100644 index 0000000000000000000000000000000000000000..cb4a79b07f3325adbee16c00df05346ed42b1193 GIT binary patch literal 82272 zcmeHw3v3+ec^GGx$)k5 z6hR-TTf5)?&tw0Y{bxA4JJfT1hL$t)KfnL`zyEvxNs0X6(>?I+2>Fl0kcarGLV@&x zbR#WYp}#lrSH|DB@i)B}@MU-H=7ydhhC!u&a8!zQ_x8k7Ns@r8kX)#gm$lkU3K@jn zYg%bjH?USlxZ*wD&_ zr;F+br|7#J6$XnM13I)%)a7Rie<731`7I$wppsFtRn;sE}C3lS@xVpxY5!KDR3>> z%X-I4u4$fK_nW4>>*o5K8f?m>Vx>_j})IzapknW{Qr6k7=OB9B`DPcdGY;~U1jH_(j zUQ*1G18UZ1AWF-t*RH)vbL_fK0OS(HVs`ZR|@zK zepG2etmh1&D?I`!!~m7yxdrY~=wnO6zobLOeR834aRZ)*?n~P8ns+z4k&@qk62Je3 z%stEYrW~8-f^SGLbV;isjw9go!h%*R(RI_RtA;|6fZ~R^uN4zFMorv+Qqia#ru*}; z!%}+8!V&jd++-`Hdu6k{j0JiTek;XQ7ldT!H{arlRcaO2x4kf+-_VygYn7@>yWu~= z0`y%fY0LUmTvol>NHW|M0(!kKCP)O-S&I5`wZ?De!xn?12$n%*|znN4Teo z%Si786mAz?Iei0h3TcjwQ(fr;4ynuUf>C8eip9HodXuTX{(->}GP-*_fC5$^wTMVu zsUp_nn0ih8M(n2O$S5B}BZ}{1Fw7>TB1KV+5*_430_jM?EN3Xa45bY0&H9VDmL|)v zzXZLPwQDW*Mw;#IN$d^x;&P1)u+3CpC^rH0K%$2R{nhc;jmdRF4bQ^RW!ympy>Pl% z(%E+FhvbrGu)h&1DYnej!bBW*2b4G0*^Vn16LA>}u2_{O67W3<#xK{jn!d7Gy62Fe z5`(8;jE=v!yr{40H%@PsO3!Px<*O6|?C?WmKm;=P?F1m1No;7fnqDp2y9h1-TxL}4 zIV7#PBE760ViBI~T-}80D3>T5H1rLvsv(-%Z8197W9ZdudZtG?HgjxR8NWtC z<>=}OWoc<2#9iKHw>!gjOem% z=(z15mhZ|8@ia7+O=R}ENpe2{^Y~TfPR?dV+~hTuO_`%9-Tu+c&WT2I#^QsB$qxBW zyU%8Va0(e>vq-7=L^4IX77<6zLV__=YOd|3{W^qq13D))7yTyEAJZ z^_(C3$X-Z5eBsiI!xH`D4F1uj#GdOqDScY%%B1Oev~O`Q>`}3m6}_sLvAvI#wDqNe z_Jle;JDY|7BEg7YL0l-R%Q))|l>uDd<&~OPXPjN8uoOxKvrrKNU3G%wz*u z0Z3B*fbj@ywgI#uqS*%Y(EMzJ8VjE7=lg7$p;$B{Jup?!uOWYt$4!;b`tDVZ8YMD+ zA7wC8V*7oV|0X08q-*}`06&$WFDa2kNxP|6k7n^9WhhF<(79SG!!*P5-8P^=n3D|>#b5~Vg-7F!O z{h^0Rl#G6{V6* zBwx^l|7Bq`IY@>K%6;Irup5Hp5a~4!KWucEZ-v$v5!E1EjZwbFBF<&Ze=fWH=Ca#8 zmvO$$Asp6(_r)Im1?^S#?{%+VuaoXx_wj8~h;_l&DdIdt66-p0EXxLrB=?g66Ibk4 zdy@yqco{`M(JJjvK1}wS<;Cj@$u#L@1&k=rfR6bjISxIH2FgdxuH9%oWiIyAu~S#B zES{Zz@yauor&w_|<85l^f@?c4JIKTAkw%z38U(XL+rjK39L(BAH*=+(ksszq{#fJ4 zGeIMNe7lh!;YQvz%Gx7G1r|~_DT_ZbBIWQWP9z0?x`{N6KRra6!Jl3t&EijjNQfXv zf20#^#qCz?-%TKtqegXsYHMr^jqp-$<|7R!7mA$u5z?3Znf*VB#F7#{K}-z;JufG1 zSy)sQMBSo7fD^WNq}wmX{RJ{VNlg|2Nbs%{%uL9Z)^XAZI5uUQlSYP}X~vL6PRhw!hM0UzItJAr;EY)OMx}_9V!xb%y z%0xHEO(3YO}BBV{#CX{C6CwN(J|yr9TUnr z398GbGG$nrt@QJq$*Y|C$T1|zqxJ6E=?YIE+cuTnSBEMYvESAkPs4zzG_mz&BQTU7 zaIp#bbIC4p1`alG6pcmU0F0?<*Qlz-hQ3@}DcYuwB(We0--!v>ZlL2R3FvN$yMpRP>kVVG>GL(kWWpW8961MPT5rqd z)0pTxkzxb$QjK;7)^b~(fw^}fs*|^*Iq$5eE(jsWYj92@1Yc5UUC+Qm*Ok8hxC!Dw<=3{)JJKhs}-X*Rn<4pZlmS1DE1j^_~X*E*veF7*ugrU zo1#P?Z3D3KdvsY^T~zV1cv?fFXbT(EA=ziVqYK}jYcJe^MezV4{9gHC9QNT6i>?@G z?n2$s^pr^_W&D;2NXj&eY8&*dn1RNI|`Tpjr8= zXzOTrPpGqyd?;|74sRh(Hq@WG>3nUPgNiAmf)UAoTY@8YKg>9X9A%wr=ziMnv#ukZ^oIO@^)6w9bs&`QO( zsd{qe4QKU_PiX)Nz>Gq=W3EvnTDn5%;r-HnSB*yj!6Q(1G_9 zJj(MPCXwKoj+HV3d~VZu|a z0V|qN8#O^OZ@Vt%`$_5~o8z%CSeHXFQbDy}FT{)zs%Pl0hQH`quvuO!SFV>Q#;6CN z^`K@^Q^Gyw++P(`6S|a!OkLq?E_k;UI}(ml#xctF_~iQ7>VM|ye|nYZ_mmarMatw{ zTD%aYdhW!Wvd7ncCx21Q@f`56200r^o_N!zh)sBRW{X9{lqkLs@wG`vK2w&TqQN?Ci^c=4=H$P|{Q6NTMVvSxM@v^% zqKnt&A9tn zdH5g&e<8tMo&m5eh4iSOotdT4H`c3yY6T$RvCg7$8s6vdxW9-Vq#of1Ekcg>w`G*E zdokU^nbD@mVvQQiHZBShXB@&4;XB}M8g?*~{G%AO*#zMoTb*{JoVYB2y5LI_#>eRM{KeciTJnQOF{;r-*!T#zsjeib|FpL zMCkl^R69Hi6AgHPdVS_AeZ+?y86yHj#nz})o?2Uu zT?KU=0})H;lQBEpAe_AcpAblOUX5dTD;uNMb+h`L@M@&ZyNq~vp!f{md&ab6bVPa7 zXZS5Q?-{-eIaBQTI^PJcDer28HXUwB!sa}~58a&ngE$Bq^aON;Zct<~-Z^w+qW%t| zV>G92Sg}n(K|V@c@m<_ju_g54dOB#0*5KlnWZ~kr+`MbE-W`kUnM>%6#tf+fY%zr; z+pU0;)!LR8(U96qfAUXb@R5)eIDzv;L6w%NrQ^0B3!7~f_Vs3G1*7#{0ha{ZsQAE*OQFlr;mgwYPv3D1w}>hbwDdm32F#t>{PHh|Iqr! zm~trG4CFtM;K_i|gz*t*d()n3dkFI9(T3O5G%O#9!vU2X++%JN&jyqX10}&?hVrDC zYI0)o-;zKyE6d*hOtk*bnectd|4Y298U{wV>^k!Croiq1SwA2c6ParsH$#30FX;zhof^)vgn2uQ#Xz{pLrOJD0<#|UF z45r-I5GBW#ww0n|JLBN1d@Oi|ByhFDhx^PP=be9DTO%cR!hI;s2$`GaPRN-}DcWy) zxX(6}_=KAX-M5tZGkf8mVZH@kKh%(TiVQ&?&5q{WHb7p2MVgih{gZ=emOC#E8kq2w z2rEG@pPALG7ba7e`PFsj!Oi#`AQ*_^WLih<=bOfKeroDiM%gXy7^4@= zfK$t6AGQ})n!Vk2?90GBO>WyY-*apOFLbB}zm)8xzIGz;mb%$%cSGifSvP>b{_7i4 ztgn>Qh5QA)s=~_iZ~e;qXdIU}SAE@(>UGQ>USKPmb4qx}YbEAN_^kpB4>5-z*Ia4t zxs>;=)s=_L;z2!{&Nn_G%?f7zy6mLWmtW;?A86Yj1KY0OWq=VkyF9lbOktMAYC(uX zp%ONWVxhZ~ai4zVuVFHH&j^V3g*;k^h67ajAx|}P;PvmL^=UdU-D~eVA9|8|T9^Mv z3`Q@r`z@yU>oa@+B{%rBBNpW`lrGuhPN4d^n7tGJpEUn}B-{(E(7e)An%|@J=AZeQ z=IWSPd4xUrrv&!zDWHzk)1@y4JE?qo(;mWD`^UtUk=bw9K;fi`@@zkYfX<8Wp ze5nuFxb+?}b3^AYDQOq>`)tsU%@YUkUGvs|Ovhj@xVK~Z%iYdpC)TAWvg|>ayq)V5 z1&K+)#2lQI5BN;4USbCr0eMH50NEL7bO&{Pq|vph=46%&wtnz?DT6RTDKqL^fP-h0 z(u4Ue?aUML$d*7BCopeON#xfj%stw2kOHsSgY29`#`XU*W&* zg73s&f|tP!B-$#AI?iPYN`f4jMs^A%<=5er2t{vCc379DtwHK^Nuge;blM}O&Ul_@ zC(O97NYk7DW$ZTG)U#voZZgycMPlDOfhHSRdps=|!KIP4&qoR+`3m%)r+QQI5%g5E zF3fRcc*eC;8J;yJFG3vuFasPsXfF@4BK5;&Tk#n4@?jN}QWN;2=9(Pqggw@w`2nT~ zNE|h#1qC@Qt3mk{HgG(BSvE=Uh=;9WO^n%u1ag7DA~qAyo>^eP`9KpufGUfR@qWg- zyVa(U;rNb=Zf%aAdcrMEj@aN#&i68KcGWdEA4oo&j8|oHn#a#cAU8?G=i@FIL*y9#ZdZAU?4xhX-uDE-&N9t-YJ3C zLRbW-j)j~~4->`KXFbEsxg%C?zMHEhQQ5?eTDl*L#nHCqB;fl-dW6FGrCLJE$CG6WcjWe|}-??)uaH$LKk}DeIwC^nHCv+S6`cT~| z>fkotcYpz%e)k=C?qx6s>rB0K%>mv3Y~1VD9Bja@hH&mkZXH8Yxv*iXa2{#+;)~jbnUrPtUhC@Y~@!Pcw9cWtQlHv!4WB2u=Ax0-c8CP z?O7zEgHp#LK}{TY)*=zzYTiQ@iQ748UJ0HHvPeWXD9$1gU8D8o4W|VTZIRfCA%;=P z-xU^#J2m-0i$rvTs^=C&i$rwI+PK)UNHA|wgLo_w(LtI7r-k?DSwvh`WEP1Z?S@{m8>EAa^8k%xG zllq_T7?=G{5f|>%l{p9N1-#R93VHo<4>!10QO{Q1r`7sf?1aK&&BPw}c<~0U;-|RfJ-y|gH(61<^rSs3Y4_F?@65J!R^%P~f57|qY~$H~$7gD@ z&;GuHE}_-sX_Mo8Wa@E{nSEX#8El~*Mqu6%)7J9h9WiayzZK2 zN1=6ZM7iU-rscC!HO*MVpMri3-CgnvmtM?g{ltc*mc?`QcU;#T5Bhnpa2Fajb)9#| zb*)my3wYfwhK|Cf2 z-QHTI>9$rN^xaWS<%^5x?)r}F8qHf{5KM5BZT;7x9xM2N*Q zqJ~x~zRi;Jo^a>kxNlQJ{`w?*CCd0bMLE%M4Ra?Z@1Bjx`(nHe`CAkb0DglS3{m!TIHv{I?@j-eaOI?|>^fH#G7w6j)^m22@74(A>1C-`iaWX1$8CLd-i`O?=CseQ#DyWr(1WD@+iYP z+R0Tb>>;%8OGi5?GRra#IFE`pG)U!+c2c#XT!q?-SoGS8OH^BNZt-k1j_*0VHNK;r ztOYNkf_a~6E63Kg+SOw;U-9(RDa-?oIgO9lZ>xG?6LnCiZlYf=;m;I%MSTHi-WsYc zY$CC+*y-q4bN$`xdB-~1$!N8c*^YKnFQeh?=622^5lLAOnm5?}DIrFnokYVxM?3kz zX(zuk2_Ho2_=Jhc0W6O_R4ep@9TSL|Habd%wR={{z=DW8PD`N$FtJSQX{|+%8wbB0 zNJpsmsApQMaJgv33EVk3`gP4@OqizV6R6FVh8ncti5c^)9)O;eDB3+A;M6cbo z#dSxB#{`!hXDFW-r;fUz?B`(FafV`-QwK!7bey3aZ?BHJ!8an1w9aAWFX9DK=OC=t zARO?yQ7TC+ehM3uqHS<887Jrv*x=XL4Kd6<6nuy82Pyaq3HI`lXXxozt5ofaTu+kS zK&)2<)yko!W>FLrz0Xag$i;0g>@*FGb}y#C1$*bD6yr^hnC+2DpaoN-}((JjhCwfK0MS(IrpO-N@W*(bD3*g!dz37P#M=7;F&w`7DfgL29u4d8BjC z`rkDUM|=p|7!e>UwkAc^S}xs_{GIOMe)&8M(<`Q{824SmdV8mCcgJ zvs}$#qQ^acAC;4_^nMtntrgVuNULy!G1gAcv-!z?}|?1$s{ zkhC98z#f#uc2)J&&5~9vzO6Cas2L><<4GW+wJI((%O7wJ3(!9d7)bV!6#v*yQfqou zGgNJ(2!qK10!DGQtYP>ymd+%Pl0(ZF6UDQq^bx}WJb~HJpFBpAs>({Mus1nH#%*k1 z$fY{%rvLdd7*T60s@ZW_uU)TH*GP9#8kXd59s6XO2G)GdJL9u7 z^x`~4IyxM#LD9&(l~uL2xq%#_O6wMD`a0{v9DnYOckrb%XA_3BoUx%*4GIT)7FBI^ zRWEQa9Jp&~+6MPXyD2YKHZg3!j1-1-NBi*(?5>_w$vrEEYN2Lznc?C2N(B|>p4FM~Ws7AzNNU_du4~9YR@U?~T__8!%bV+JrE<;otiTUB93y?hO5$_+ zwHGg(dxMUA9kWx_U(+{wdAU-+okfdn)>e+5bi>la!qOTIkbUj7w4vdbEc^c_-+AK= z5e9{UwMQpRdwYOjEttI!))c>kVZBh#=0su05g{9`@l`$FlMkF7Qp1r~?M9KJ-q9RS zM;aOv4!aSRoJkxxfGE^BedoInp{|_1xN%-vUn)@C6V1`3;A~=!E7qAsw}kEHiRHYcA=V*eczh_CiqYYo)BGan}gQZs<9>e6HG=E7y>4&fIr(nsy|ZyB9w8 z+%4qcr_VL#1A@RMHo3>v=IcG;#Ak1M=K3?Iod3N*|DylQKTZEyzCJ_$&Yn6`nO`|I zzjo^77Z%=n;khfP7S^7=vbi=-%ba`RS#AEz=^5>n=Qmz2pQ=?B3TKwI1?8ogWo?CnMQJw=4IP8$BL(^OTvPT}wR<}_+mM6PXf9hD=LbbRt1o^;d~un~`5OWTOV zVF^Pzo-n+@a1ePeGYt{rU??@gLD6FPnLD1|prx&$)>*jMD4&UGhwLg0W-NqOHIVr&qEe{9V;r>JU#TSN2}R&lmgvvv>S|f zL*OEGy}dE!?d}{bU5};BVyWO^*&6_U1$mxI^)k(=ML{m&jlI*}whHaMXsD}IZR4tH zNiqm?OZG4Y9Av-@lwa_5S~)gzEK56I(w310qYQSsE`-t#rjX8|Ly$1U6|)Zmv0PL~ zRPPM$YOcH^YtS1x97#9~|J%qSJxKhoVD_Rzp(ATVAlEfA+X6<8J4W$P@saBm>Wr@E zEVQW_5;_+vEW&B~+)Q_5je?NxW?mZX`#`+$*paZbBtib0yx|m z`-6o~BO-hv96pUkj!y!vSYUs+xA7_59PclD`p4a9Zy)owx9{?^x9@h_+s8SKL;Lzn z6ZZAlx_v$U-MAm^+lqT>-$Gq@q9>nC7LZbGD^rEVQ%>X(ExWDCv|L!i5j30T2`E~a zp*ysQ8=K4Ybmw%2@4&x_;bAtxp+fqPVtxzy+YM}++oWT!r>*IB#Jo1>4hOTy*3-B^j<$HuS0~xJOdrk7MXO_z+2~>*%nwY`{ozKN(;$lWM=(n>;|q@sdH)RnFr$xIg(Y z*=v>;yBtC?O?p`YBMQ&N@a}|7c_|)3kH)muqY>E&k2hm_61{*|^|FqzQa8~zRIMz% zg>Hn_f*e6v^(4v`Zl~AuE*Nl}9MKYvmuOR$M(^@b_fpRSUxcyb92r)ZF%L6Jzvy7d zaxlYCGEe%@tZ83#0=tqQB_rroiF%AmJy-K$*Q*22!<_0#_i%P12M=vC0T0gk4C!OS zA${CCq$jo=k}@&f?2vY78+@H^gM<7wc%*R~JQ}nO4sEv$KEiE-wgra%B**nPB`+L8 z*`j?+-wu(s`|d%som|z!{Hi|IxT=|;RegNBRXxJ3YTHasf0E-=n&NQ|AwSgqsy4kU z0s_%=8-lfe1$xlGUdrN6j7T~Bi4(kNt_MBirD^=>A<_)~^b%!g{YYL{Z{k{ah zFa2)(8xr)LMyI+{)m7?FMRL%Mu5AW+?EUy5=zXi(&`T?je9H==1b8dS#CUYCreCS^ zH5q^e>c?3vyy$`S(b)Xz+I4zW0~v>;6@p`szW3uvh;4KM{V)QscAehv!0N@{k9Xm< zf`jHOr$+okd`+NFE0-&%t3jtFgV1-wQU=?A_u|Tz;*blE04rs68WV&!U1cuYY?Yau z(sUK&`2DabKarIGEx~?%Q7rD#j`*6+%}$elDZv*I{XXYGzdj577($HH5espRA&LvR z207&N!6}Td^xzaNC_t&q(_8UV@Z|gPkHO@v*d7-6)ff>rk+8pNMELdJO7s6(f(d^1 zG?GoFm^X{NZgBakzPz?kDVA#(Zgg`(N`EN9R}c_?(*uZo79e)LA15&UmZx6eo{JPL z{af)AByPpJNf%E3)3N!VZ42FE!%Q*92^32?Y0{iMHK;9a*BAuLg zXg95ibl!Wm;=3VrE7nUeq!4HB{F#ElHJ(0kzppXg#c}_y@qd?;|0YF~f_G+mnrwyG zFjYrqtIg*%<*Ljei4tqzaDh_d06Wao3%!UeC;}8h$21oC{z9SB<1T8 z?BOS3>H#ZN-15hdlP^i|IUM(Ani%)aac%Lfco%$AQhrC;<~HWLaM-^qDZlMurfgNJ zd4=@d20kA?LI~QQlSuc_ zljJG+!dCnoL?h+0MVk6Begra3x|0L9V*8v2foz;2|1?5|`ZJRJ>Q?+^xU?029?rcV ze-_fWV*Bls$x~U8be?jT$%)IbxjniSPs83@u?dg_O~ocsz!Vf;YnENUwxgq-xE0&g zI4K-0`3)%o=Jj=XdMloV$F@*2$aEx@QjiRgzNCGN=g%Yr4&@_a8xn+oB`wZi+5Qk` zbEMfJb~QD`8)5m`i>*OQynYBF60YatInr#;765{J4op(_2_g;2=eBVFo!W{&0sC&n zWKr5WONrw1ImbRD9&ofjj&t_!8AU1Vne0%{zZ475;QdcD5Dm$Pw&Dk2ax1>(=F^=vFeI~6)}yJP67-M@?jg5b4>`Vv6!C`&>bxja$b$$KRAPn^ z`o3tN!Y^*c7fnv*+=ukkVoAv?jkAwVnU*P$K&^DT>BIO>rHJiGKX1?QrLFj7IKLG? z+rBoPo+0!sY33Y>c4Ep2vNIE7R5S_L?cDukhlpzM3Ktd7{ezDDe3sNE>Bo@T1A~b5y$c%7IG~Iy6A#xK| zIYVv$2Z)q&AZk918W#>1naB=?oFI+O{;S6&vaq9ZBH6kfZ>M+F9I1v8hoOo*AIdQ$_zLKFVtz~m0%OuL` zlr5uW^F(Y-7KmguStOFvWQhpZWEqBe9tVB5dDIfV_e&`6u{PduY7Z9Y^YzuYdliH%E1|{ByMX7``69F$`)=@!L zO8Uag5=8VTMW7K;G9$LAmVwT-40fvJ<;_~kX3iqn8oGTjY#s!+jY(&^S$H*bAy z<_tP!!CA04qnP{QD&O0a(9g%P5bcUSs_-{hZqvk)rZmRiVkOci&lmVOWL7q;bA+EvtU=iKy z)XHL@5iCMX9IP6GroSfUPSRr&EKAHOO)ci&gorB$YG|1Hd+v-9mKQW6&L{;-oQ8Qp z4PyWTMi8;CZc+=JbKuj$4GfITxePDCa$v%< Date: Tue, 18 Nov 2025 12:41:35 -0800 Subject: [PATCH 33/38] Add Location and Dir explanations in CONFIG.md --- CONFIG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CONFIG.md b/CONFIG.md index e157e98..2256d13 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -17,6 +17,8 @@ Properties: - `URL`: `string` - required - model location source. * to use S3, set environment variable `AWS_SDK_LOAD_CONFIG=true` * to use GCS, set environment variable `GOOGLE_APPLICATION_CREDENTIALS=true` +- `Location`: `string` - optional - where a copy of the models will be stored when loading the model. Defaults to the system temporary directory. +- `Dir`: `string` - optional - any further path elements in `Location`. Mainly used if using a ZIP file with additional directories. - `DataStore`: `string` - optional - name of Datastore to cache, should match `Datastores[].ID`. - `Transformer`: `string` - optional - name of model output transformer. See [#Transformer](#Transformer). - `Batch`: optional - enables or overrides server-side batching configuration. See [`service/tfmodel/batcher/config/config.go`](service/tfmodel/batcher/config/config.go). From 79bba12cd2d1028bf96d48ae077c54858a301bc2 Mon Sep 17 00:00:00 2001 From: David Choi Date: Tue, 18 Nov 2025 13:16:13 -0800 Subject: [PATCH 34/38] Fix health bug - initial state for health is 1 on successful startup. - Updated the GetHealth method to use atomic.LoadInt32 for thread-safe access to ReloadOK. - Switched mutex in HealthHandler from sync.Mutex to sync.RWMutex for improved concurrency handling. --- service/endpoint/health/handler.go | 10 ++++++++-- service/service.go | 13 ++++++++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/service/endpoint/health/handler.go b/service/endpoint/health/handler.go index f123192..1a483ec 100644 --- a/service/endpoint/health/handler.go +++ b/service/endpoint/health/handler.go @@ -11,16 +11,18 @@ import ( type HealthHandler struct { healths map[string]GetHealth - mu *sync.Mutex + + mu *sync.RWMutex } type GetHealth interface { + // GetHealth returns the health status of the service, 1 if healthy, 0 if not. GetHealth() int32 } func NewHealthHandler() *HealthHandler { return &HealthHandler{ - mu: new(sync.Mutex), + mu: new(sync.RWMutex), healths: make(map[string]GetHealth), } } @@ -39,6 +41,10 @@ func (h *HealthHandler) Hook(model *config.Model, modelSrv *service.Service) { // implements http.Handler func (h *HealthHandler) ServeHTTP(writer http.ResponseWriter, request *http.Request) { healths := make(map[string]int32) + + h.mu.RLock() + defer h.mu.RUnlock() + for name, gh := range h.healths { healths[name] = gh.GetHealth() } diff --git a/service/service.go b/service/service.go index 7564d20..a21ff1c 100644 --- a/service/service.go +++ b/service/service.go @@ -305,6 +305,8 @@ func (s *Service) initializeService(ctx context.Context, cfg *config.Model, fs a return err } + atomic.StoreInt32(&s.ReloadOK, 1) + s.transformer, err = transform.Get(cfg.Transformer) if err != nil { return err @@ -441,7 +443,7 @@ func (s *Service) initDatastore(cfg *config.Model, datastores map[string]*datast // GetHealth returns the health status of the service // Implements service/endpoint/health.GetHealth func (s *Service) GetHealth() int32 { - return s.ReloadOK + return atomic.LoadInt32(&s.ReloadOK) } func (s *Service) pollModelReload() { @@ -457,14 +459,19 @@ func (s *Service) pollModelReload() { }() } + var reloadOK int32 err := s.evaluator.ReloadIfNeeded(ctx) if err != nil { stats.AppendError(err) log.Printf("[%s reload] failed to reload model:%v", s.config.ID, err) - // Update health status for reload failure (TensorFlow models) - atomic.StoreInt32(&s.ReloadOK, 0) + + reloadOK = 0 + } else { + reloadOK = 1 } + atomic.StoreInt32(&s.ReloadOK, reloadOK) + if atomic.LoadInt32(&s.closed) != 0 { log.Printf("[%s reload] shutting down, stopping reload loop", s.config.ID) return From ed0917027cea1df229c2b13e3d68220c34c2b48f Mon Sep 17 00:00:00 2001 From: David Choi Date: Tue, 18 Nov 2025 13:31:24 -0800 Subject: [PATCH 35/38] Update BREAKING_CHANGES.md with new changes and remove prometheus.go file - Documented breaking changes for version upgrade from v0.19.x to v0.20.x, including modifications to `example/server.RunApp`, `service.New()`, and endpoint methods. - Removed the `prometheus.go` file as part of the cleanup. --- BREAKING_CHANGES.md | 8 +++++++- service/prometheus.go | 1 - 2 files changed, 7 insertions(+), 2 deletions(-) delete mode 100644 service/prometheus.go diff --git a/BREAKING_CHANGES.md b/BREAKING_CHANGES.md index 53eea84..e4db6f4 100644 --- a/BREAKING_CHANGES.md +++ b/BREAKING_CHANGES.md @@ -4,4 +4,10 @@ See [wiki](https://github.com/viant/mly/wiki) for older entries and non-breaking ## `v0.19.x` to `v0.20.x` -`example/server.RunApp` return changes from none to `error`. +1. `example/server.RunApp` return changes from none to `error`. +2. `service.New()` added parameter `tritonClients`. +3. `service.NewWithPlatform()` removed. +3. `service/endpoint/checker.SelfTest()` removed parameters `inputs_` and `outputs`. +4. `service/endpoint/health.(*HealthHandler).RegisterHealthPoint()` second parameter changed. +5. `service/endpoint/prometheus.Handler()` parameter changed. +6. `service/endpoint.Build()` added parameter `tritonClients`. diff --git a/service/prometheus.go b/service/prometheus.go deleted file mode 100644 index 6d43c33..0000000 --- a/service/prometheus.go +++ /dev/null @@ -1 +0,0 @@ -package service From e7f83f75952f05cd1f8d7f9f9534d79b751c6f00 Mon Sep 17 00:00:00 2001 From: David Choi Date: Tue, 18 Nov 2025 14:52:02 -0800 Subject: [PATCH 36/38] Fix typo in error message for global model validation in router configuration --- service/config/router.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/config/router.go b/service/config/router.go index e5e9e73..d7cdd16 100644 --- a/service/config/router.go +++ b/service/config/router.go @@ -84,7 +84,7 @@ func (o *RouterConfig) Validate() error { } if !o.Global.Exists && len(o.Global.PredictionReplacements) == 0 { - return fmt.Errorf("global model does not exist but no rediction replacements were provided") + return fmt.Errorf("global model does not exist but no prediction replacements were provided") } if o.Output.NoModelID == "" { From 771d30bb92801de4035a9bd73dada02c5cc9e07f Mon Sep 17 00:00:00 2001 From: David Choi Date: Tue, 18 Nov 2025 15:20:43 -0800 Subject: [PATCH 37/38] Fix input index assignment in router to use the length of inputs for correct mapping --- service/platform/router/router.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/platform/router/router.go b/service/platform/router/router.go index ef6b09d..f4d1fc6 100644 --- a/service/platform/router/router.go +++ b/service/platform/router/router.go @@ -145,7 +145,7 @@ func (t *Router) handleIO(cfg *config.Model) error { mappedInputs[input.Name] = &domain.Input{ Name: input.Name, - Index: input.Index, + Index: len(inputs), Type: inputType, Vocab: false, Auxiliary: input.Auxiliary, From 473b9c30a6b5dea59d27a0ae3e6f67728fdda5fc Mon Sep 17 00:00:00 2001 From: David Choi Date: Mon, 24 Nov 2025 14:24:18 -0800 Subject: [PATCH 38/38] Add a configuration check mode. - Introduced a new `ConfigCheck` method in the `Config`, `Model`, and `Datastore` structures to validate relationships with other configuration entities. - Added documentation for the new configuration validation process in `doc.go`. --- service/config/doc.go | 44 ++++++++++++++++++++++++++ service/config/model.go | 41 ++++++++++++++++++++++-- service/config/models.go | 10 ++++++ service/domain/transformer/registry.go | 11 ++++--- service/endpoint/app.go | 19 +++++++++-- service/endpoint/config.go | 28 ++++++++++++++++ service/endpoint/model.go | 2 +- service/endpoint/options.go | 4 ++- shared/config/datastore.go | 23 +++++++++++--- 9 files changed, 166 insertions(+), 16 deletions(-) create mode 100644 service/config/doc.go diff --git a/service/config/doc.go b/service/config/doc.go new file mode 100644 index 0000000..cab6f3f --- /dev/null +++ b/service/config/doc.go @@ -0,0 +1,44 @@ +package config + +/* +Package service/config defines ingestible (and currently mixed reporting of) configuration values for mly. + +# General Usage Order + +1. Instantiate the config object. +2. Set fields as needed. +3. Call Init() to normalize and set defaults. +4. Call Validate() to check base field validation. Calling Validate() before Init() may catch false positive validation errors. +5. Call ConfigCheck() to check relationship validation. + +# Validation + +These are the following types of validation: + +## Base field validation + +These will check to make sure immediate fields are valid. +This is done via a method named Validate(). +This will check Storables and Transformers as well. + +## Relationship validation + +These will check to make sure relationships with other config entities are valid. +This is separate from Validate() for backwards compatibility. +Eventually, the signatures for Validate() will be updated to include these checks. +These checks can be done via an argument flag, as well as on startup. +This is done via a method named ConfigCheck(). + +## External validation + +These checks occur on startup. + +These checks include: + +1. Checking the model configured inputs and outputs match the actual inputs and outputs as defined by a model. + Failures here can occur if the model names, types, or shapes cannot be resolved to match the configured inputs and outputs. + These checks cannot be done independently of loading actual objects. +2. Checking that Triton servers can be connected to. +3. Checking that Aerospike servers can be connected to. + +*/ diff --git a/service/config/model.go b/service/config/model.go index 7bfa297..445aaa8 100644 --- a/service/config/model.go +++ b/service/config/model.go @@ -7,6 +7,7 @@ import ( "time" "github.com/viant/afs/file" + "github.com/viant/mly/service/domain/transformer" batchconfig "github.com/viant/mly/service/tfmodel/batcher/config" "github.com/viant/mly/shared" "github.com/viant/tapper/config" @@ -190,8 +191,6 @@ func (m *Model) Validate() error { return fmt.Errorf("triton model %s requires Triton configuration", m.ID) } - m.Triton.Init() - if err := m.Triton.Validate(m.Mode == "router", m.URL != ""); err != nil { return fmt.Errorf("triton model %s config invalid: %w", m.ID, err) } @@ -212,6 +211,35 @@ func (m *Model) Validate() error { return nil } +// ConfigCheck is a path to validate relationships with other config entities. +func (m *Model) ConfigCheck(validDatastoreIDs map[string]struct{}, validTritonServerIDs map[string]struct{}) error { + if m.DataStore != "" { + _, ok := validDatastoreIDs[m.DataStore] + if !ok { + return fmt.Errorf("datastore %s is not valid", m.DataStore) + } + } + + if m.Transformer != "" { + _, err := transformer.Singleton().Lookup(m.Transformer) + if err != nil { + return fmt.Errorf("transformer %s is not valid: %w", m.Transformer, err) + } + } + + if m.Platform == "triton" { + if m.Triton == nil { + return fmt.Errorf("triton model %s requires Triton configuration", m.ID) + } + + if err := m.Triton.CheckConfig(validTritonServerIDs); err != nil { + return fmt.Errorf("triton model %s config invalid: %w", m.ID, err) + } + } + + return nil +} + // TritonConfig represents Triton Inference Server specific configuration. type TritonConfig struct { // Model name in Triton. @@ -249,6 +277,15 @@ func (t *TritonConfig) Validate(isRouter bool, urlPresent bool) error { return nil } +func (m *TritonConfig) CheckConfig(validServerIDs map[string]struct{}) error { + _, ok := validServerIDs[m.ServerID] + if m.ServerID != "" && !ok { + return fmt.Errorf("triton server ID %s is not valid", m.ServerID) + } + + return nil +} + // GetPlatform returns the platform with default to "tensorflow" for backward compatibility func (m *Model) GetPlatform() string { if m.Platform == "" { diff --git a/service/config/models.go b/service/config/models.go index b93bab0..9ab6dfa 100644 --- a/service/config/models.go +++ b/service/config/models.go @@ -35,3 +35,13 @@ func (l *ModelList) Validate() error { } return nil } + +func (l *ModelList) ConfigCheck(validDatastoreIDs map[string]struct{}, validTransformerIDs map[string]struct{}) error { + for _, model := range l.Models { + if err := model.ConfigCheck(validDatastoreIDs, validTransformerIDs); err != nil { + return fmt.Errorf("failed to validate model: %s, err: %w", model.ID, err) + } + } + + return nil +} diff --git a/service/domain/transformer/registry.go b/service/domain/transformer/registry.go index fd92e69..59976e0 100644 --- a/service/domain/transformer/registry.go +++ b/service/domain/transformer/registry.go @@ -2,25 +2,26 @@ package transformer import ( "fmt" + "github.com/viant/mly/service/domain" ) -//Register register output transformer +// Register registers an output transformer. func Register(key string, transformer domain.Transformer) { Singleton().Register(key, transformer) } -//Registry represents a registry +// Registry represents a registry. +// Registry is not concurrency safe. type Registry struct { registry map[string]domain.Transformer } -//Register register transformer func (r *Registry) Register(key string, transformer domain.Transformer) { r.registry[key] = transformer } -//Lookup returns transformer or error +// Lookup returns a transformer by key or error. func (r *Registry) Lookup(key string) (domain.Transformer, error) { transformer, ok := r.registry[key] if !ok { @@ -33,7 +34,7 @@ var registry = &Registry{ registry: make(map[string]domain.Transformer), } -//Singleton return transformer registry +// Singleton return transformer registry func Singleton() *Registry { return registry } diff --git a/service/endpoint/app.go b/service/endpoint/app.go index f9a848c..2ba4ff8 100644 --- a/service/endpoint/app.go +++ b/service/endpoint/app.go @@ -51,25 +51,38 @@ func RunAppWithConfigWaitError(version string, args []string, cp configProvider, if err != nil { return err } + if IsHelpOption(args) { return nil } + if options.Version { - log.Printf("Mly: Version: %v\n", version) + log.Printf("mly version: %v\n", version) return nil } + config, err := cp(options) if err != nil { return err } - return runApp(config, wg) + + return runApp(config, wg, options.ConfigTestOnly) } -func runApp(config *Config, wg *sync.WaitGroup) error { +func runApp(config *Config, wg *sync.WaitGroup, configTestOnly bool) error { if err := config.Validate(); err != nil { return err } + if err := config.ConfigCheck(); err != nil { + return err + } + + if configTestOnly { + log.Printf("config OK") + return nil + } + if config.ProfilerPort > 0 { go func() { log.Printf("!!! starting profile server on port %d !!!\n", config.ProfilerPort) diff --git a/service/endpoint/config.go b/service/endpoint/config.go index d0dcb81..6c170e3 100644 --- a/service/endpoint/config.go +++ b/service/endpoint/config.go @@ -87,6 +87,34 @@ func (c *Config) Validate() error { return nil } +// ConfigCheck validates relationships with other config entities +func (c *Config) ConfigCheck() error { + connectionIDs := make(map[string]struct{}) + for _, connection := range c.DatastoreList.Connections { + connectionIDs[connection.ID] = struct{}{} + } + + validDatastoreIDs := make(map[string]struct{}) + for _, datastore := range c.DatastoreList.Datastores { + if err := datastore.ConfigCheck(connectionIDs); err != nil { + return err + } + + validDatastoreIDs[datastore.ID] = struct{}{} + } + + validTritonServerIDs := make(map[string]struct{}) + for _, tritonServer := range c.TritonServers { + validTritonServerIDs[tritonServer.ID] = struct{}{} + } + + if err := c.ModelList.ConfigCheck(validDatastoreIDs, validTritonServerIDs); err != nil { + return err + } + + return nil +} + func (c *Config) LoadFromURL(ctx context.Context, URL string, target interface{}) error { fs := afs.New() reader, err := fs.OpenURL(ctx, URL) diff --git a/service/endpoint/model.go b/service/endpoint/model.go index 46f1812..6afe7c3 100644 --- a/service/endpoint/model.go +++ b/service/endpoint/model.go @@ -114,7 +114,7 @@ func Build( log.Printf("[%s] Model loading", model.ID) - // Validate model configuration first + // Validate model configuration first - this is redundant if validateErr := model.Validate(); validateErr != nil { log.Printf("[%s] ERROR: Model validation failed: %v", model.ID, validateErr) lock.Lock() diff --git a/service/endpoint/options.go b/service/endpoint/options.go index 7bec12d..8f359e0 100644 --- a/service/endpoint/options.go +++ b/service/endpoint/options.go @@ -3,5 +3,7 @@ package endpoint // Options represents an option type Options struct { ConfigURL string `short:"c" long:"cfg" description:"config URI"` - Version bool `short:"v" long:"version" description:"indexer version"` + + Version bool `short:"v" long:"version" description:"print version and exit"` + ConfigTestOnly bool `short:"t" long:"test-only" description:"validate config and exit"` } diff --git a/shared/config/datastore.go b/shared/config/datastore.go index d6c8310..638a1c5 100644 --- a/shared/config/datastore.go +++ b/shared/config/datastore.go @@ -8,7 +8,7 @@ import ( "github.com/viant/scache" ) -//Datastore represents datastore +// Datastore represents datastore type Datastore struct { ID string Cache *scache.Config @@ -20,7 +20,7 @@ type Datastore struct { Debug bool `json:",omitempty" yaml:",omitempty"` } -//Init initialises datastore +// Init initialises datastore func (d *Datastore) Init() { if d.Reference == nil { d.Reference = &datastore.Reference{} @@ -28,7 +28,7 @@ func (d *Datastore) Init() { d.Reference.Init() } -//FieldsDescriptor sets field descriptors +// FieldsDescriptor sets field descriptors func (d *Datastore) FieldsDescriptor(fields []*storable.Field) error { d.Fields = fields for _, field := range d.Fields { @@ -36,14 +36,16 @@ func (d *Datastore) FieldsDescriptor(fields []*storable.Field) error { return err } } + return nil } -//Validate checks if datastore settings are valid +// Validate checks if datastore settings are valid func (d *Datastore) Validate() error { if d.ID == "" { return fmt.Errorf("datastore ID was empty") } + if d.Reference.Connection != "" { if d.Dataset == "" { return fmt.Errorf("datastore Dataset was empty") @@ -52,10 +54,23 @@ func (d *Datastore) Validate() error { return fmt.Errorf("datastore Namespace was empty") } } + if d.Storable != "" { if _, err := storable.Singleton().Lookup(d.Storable); err != nil { return fmt.Errorf("unknown storable: %v, on datastore: %v", d.Storable, d.ID) } } + + return nil +} + +// ConfigCheck validates relationships with other config entities +func (d *Datastore) ConfigCheck(validConnectionIDs map[string]struct{}) error { + if d.Reference.Connection != "" { + _, ok := validConnectionIDs[d.Reference.Connection] + if !ok { + return fmt.Errorf("connection %s is not valid", d.Reference.Connection) + } + } return nil }