feat: add tfserving prediction client proto (#101)

Signed-off-by: Gaius <gaius.qi@gmail.com>
This commit is contained in:
Gaius 2023-03-22 14:28:24 +08:00 committed by GitHub
parent 4acbc514b0
commit d42d357479
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 4592 additions and 343 deletions

View File

@ -10,7 +10,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
"proto/dfdaemon.proto",
"proto/manager.proto",
"proto/scheduler.proto",
"proto/trainer.proto",
],
&["proto/"],
)?;

View File

@ -4,7 +4,9 @@ PROTOC_ALL_IMAGE=${PROTOC_ALL_IMAGE:-"namely/protoc-all:1.51_1"}
PROTO_PATH=pkg/apis
LANGUAGE=go
proto_modules="common/v1 common/v2 cdnsystem/v1 dfdaemon/v1 dfdaemon/v2 errordetails/v1 manager/v1 manager/v2 scheduler/v1 scheduler/v2 security/v1 trainer/v1"
proto_modules="common/v1 common/v2 cdnsystem/v1 dfdaemon/v1 dfdaemon/v2
errordetails/v1 manager/v1 manager/v2 scheduler/v1 scheduler/v2
security/v1 trainer/v1 tfserving/v1"
echo "generate protos..."

View File

@ -0,0 +1,19 @@
/*
* Copyright 2023 The Dragonfly Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT 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 mocks
//go:generate mockgen -destination prediction_service_mock.go -source ../prediction_service_grpc.pb.go -package mocks

View File

@ -0,0 +1,130 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: ../prediction_service_grpc.pb.go
// Package mocks is a generated GoMock package.
package mocks
import (
context "context"
reflect "reflect"
tfserving "d7y.io/api/pkg/apis/tfserving/v1"
gomock "github.com/golang/mock/gomock"
grpc "google.golang.org/grpc"
)
// MockPredictionServiceClient is a mock of PredictionServiceClient interface.
type MockPredictionServiceClient struct {
ctrl *gomock.Controller
recorder *MockPredictionServiceClientMockRecorder
}
// MockPredictionServiceClientMockRecorder is the mock recorder for MockPredictionServiceClient.
type MockPredictionServiceClientMockRecorder struct {
mock *MockPredictionServiceClient
}
// NewMockPredictionServiceClient creates a new mock instance.
func NewMockPredictionServiceClient(ctrl *gomock.Controller) *MockPredictionServiceClient {
mock := &MockPredictionServiceClient{ctrl: ctrl}
mock.recorder = &MockPredictionServiceClientMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockPredictionServiceClient) EXPECT() *MockPredictionServiceClientMockRecorder {
return m.recorder
}
// Predict mocks base method.
func (m *MockPredictionServiceClient) Predict(ctx context.Context, in *tfserving.PredictRequest, opts ...grpc.CallOption) (*tfserving.PredictResponse, error) {
m.ctrl.T.Helper()
varargs := []interface{}{ctx, in}
for _, a := range opts {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "Predict", varargs...)
ret0, _ := ret[0].(*tfserving.PredictResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Predict indicates an expected call of Predict.
func (mr *MockPredictionServiceClientMockRecorder) Predict(ctx, in interface{}, opts ...interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
varargs := append([]interface{}{ctx, in}, opts...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Predict", reflect.TypeOf((*MockPredictionServiceClient)(nil).Predict), varargs...)
}
// MockPredictionServiceServer is a mock of PredictionServiceServer interface.
type MockPredictionServiceServer struct {
ctrl *gomock.Controller
recorder *MockPredictionServiceServerMockRecorder
}
// MockPredictionServiceServerMockRecorder is the mock recorder for MockPredictionServiceServer.
type MockPredictionServiceServerMockRecorder struct {
mock *MockPredictionServiceServer
}
// NewMockPredictionServiceServer creates a new mock instance.
func NewMockPredictionServiceServer(ctrl *gomock.Controller) *MockPredictionServiceServer {
mock := &MockPredictionServiceServer{ctrl: ctrl}
mock.recorder = &MockPredictionServiceServerMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockPredictionServiceServer) EXPECT() *MockPredictionServiceServerMockRecorder {
return m.recorder
}
// Predict mocks base method.
func (m *MockPredictionServiceServer) Predict(arg0 context.Context, arg1 *tfserving.PredictRequest) (*tfserving.PredictResponse, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Predict", arg0, arg1)
ret0, _ := ret[0].(*tfserving.PredictResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Predict indicates an expected call of Predict.
func (mr *MockPredictionServiceServerMockRecorder) Predict(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Predict", reflect.TypeOf((*MockPredictionServiceServer)(nil).Predict), arg0, arg1)
}
// MockUnsafePredictionServiceServer is a mock of UnsafePredictionServiceServer interface.
type MockUnsafePredictionServiceServer struct {
ctrl *gomock.Controller
recorder *MockUnsafePredictionServiceServerMockRecorder
}
// MockUnsafePredictionServiceServerMockRecorder is the mock recorder for MockUnsafePredictionServiceServer.
type MockUnsafePredictionServiceServerMockRecorder struct {
mock *MockUnsafePredictionServiceServer
}
// NewMockUnsafePredictionServiceServer creates a new mock instance.
func NewMockUnsafePredictionServiceServer(ctrl *gomock.Controller) *MockUnsafePredictionServiceServer {
mock := &MockUnsafePredictionServiceServer{ctrl: ctrl}
mock.recorder = &MockUnsafePredictionServiceServerMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockUnsafePredictionServiceServer) EXPECT() *MockUnsafePredictionServiceServerMockRecorder {
return m.recorder
}
// mustEmbedUnimplementedPredictionServiceServer mocks base method.
func (m *MockUnsafePredictionServiceServer) mustEmbedUnimplementedPredictionServiceServer() {
m.ctrl.T.Helper()
m.ctrl.Call(m, "mustEmbedUnimplementedPredictionServiceServer")
}
// mustEmbedUnimplementedPredictionServiceServer indicates an expected call of mustEmbedUnimplementedPredictionServiceServer.
func (mr *MockUnsafePredictionServiceServerMockRecorder) mustEmbedUnimplementedPredictionServiceServer() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "mustEmbedUnimplementedPredictionServiceServer", reflect.TypeOf((*MockUnsafePredictionServiceServer)(nil).mustEmbedUnimplementedPredictionServiceServer))
}

View File

@ -0,0 +1,245 @@
//
// Copyright 2023 The Dragonfly Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT 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.28.1
// protoc v3.21.6
// source: pkg/apis/tfserving/v1/model.proto
package tfserving
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
wrapperspb "google.golang.org/protobuf/types/known/wrapperspb"
reflect "reflect"
sync "sync"
)
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)
)
// Metadata for an inference request such as the model name and version.
type ModelSpec struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Required servable name.
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
// Optional choice of which version of the model to use.
//
// Recommended to be left unset in the common case. Should be specified only
// when there is a strong version consistency requirement.
//
// When left unspecified, the system will serve the best available version.
// This is typically the latest version, though during version transitions,
// notably when serving on a fleet of instances, may be either the previous or
// new version.
//
// Types that are assignable to VersionChoice:
//
// *ModelSpec_Version
// *ModelSpec_VersionLabel
VersionChoice isModelSpec_VersionChoice `protobuf_oneof:"version_choice"`
// A named signature to evaluate. If unspecified, the default signature will
// be used.
SignatureName string `protobuf:"bytes,3,opt,name=signature_name,json=signatureName,proto3" json:"signature_name,omitempty"`
}
func (x *ModelSpec) Reset() {
*x = ModelSpec{}
if protoimpl.UnsafeEnabled {
mi := &file_pkg_apis_tfserving_v1_model_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ModelSpec) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ModelSpec) ProtoMessage() {}
func (x *ModelSpec) ProtoReflect() protoreflect.Message {
mi := &file_pkg_apis_tfserving_v1_model_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ModelSpec.ProtoReflect.Descriptor instead.
func (*ModelSpec) Descriptor() ([]byte, []int) {
return file_pkg_apis_tfserving_v1_model_proto_rawDescGZIP(), []int{0}
}
func (x *ModelSpec) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (m *ModelSpec) GetVersionChoice() isModelSpec_VersionChoice {
if m != nil {
return m.VersionChoice
}
return nil
}
func (x *ModelSpec) GetVersion() *wrapperspb.Int64Value {
if x, ok := x.GetVersionChoice().(*ModelSpec_Version); ok {
return x.Version
}
return nil
}
func (x *ModelSpec) GetVersionLabel() string {
if x, ok := x.GetVersionChoice().(*ModelSpec_VersionLabel); ok {
return x.VersionLabel
}
return ""
}
func (x *ModelSpec) GetSignatureName() string {
if x != nil {
return x.SignatureName
}
return ""
}
type isModelSpec_VersionChoice interface {
isModelSpec_VersionChoice()
}
type ModelSpec_Version struct {
// Use this specific version number.
Version *wrapperspb.Int64Value `protobuf:"bytes,2,opt,name=version,proto3,oneof"`
}
type ModelSpec_VersionLabel struct {
// Use the version associated with the given label.
VersionLabel string `protobuf:"bytes,4,opt,name=version_label,json=versionLabel,proto3,oneof"`
}
func (*ModelSpec_Version) isModelSpec_VersionChoice() {}
func (*ModelSpec_VersionLabel) isModelSpec_VersionChoice() {}
var File_pkg_apis_tfserving_v1_model_proto protoreflect.FileDescriptor
var file_pkg_apis_tfserving_v1_model_proto_rawDesc = []byte{
0x0a, 0x21, 0x70, 0x6b, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x74, 0x66, 0x73, 0x65, 0x72,
0x76, 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x74, 0x66, 0x73, 0x65, 0x72, 0x76, 0x69, 0x6e, 0x67, 0x2e, 0x76,
0x31, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x22, 0xb8, 0x01, 0x0a, 0x09, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x53, 0x70, 0x65, 0x63, 0x12,
0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e,
0x61, 0x6d, 0x65, 0x12, 0x37, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75,
0x65, 0x48, 0x00, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x25, 0x0a, 0x0d,
0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x04, 0x20,
0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x61,
0x62, 0x65, 0x6c, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65,
0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x73, 0x69, 0x67,
0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x42, 0x10, 0x0a, 0x0e, 0x76, 0x65,
0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x2c, 0x5a, 0x2a,
0x64, 0x37, 0x79, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x61,
0x70, 0x69, 0x73, 0x2f, 0x74, 0x66, 0x73, 0x65, 0x72, 0x76, 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31,
0x3b, 0x74, 0x66, 0x73, 0x65, 0x72, 0x76, 0x69, 0x6e, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x33,
}
var (
file_pkg_apis_tfserving_v1_model_proto_rawDescOnce sync.Once
file_pkg_apis_tfserving_v1_model_proto_rawDescData = file_pkg_apis_tfserving_v1_model_proto_rawDesc
)
func file_pkg_apis_tfserving_v1_model_proto_rawDescGZIP() []byte {
file_pkg_apis_tfserving_v1_model_proto_rawDescOnce.Do(func() {
file_pkg_apis_tfserving_v1_model_proto_rawDescData = protoimpl.X.CompressGZIP(file_pkg_apis_tfserving_v1_model_proto_rawDescData)
})
return file_pkg_apis_tfserving_v1_model_proto_rawDescData
}
var file_pkg_apis_tfserving_v1_model_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_pkg_apis_tfserving_v1_model_proto_goTypes = []interface{}{
(*ModelSpec)(nil), // 0: tfserving.v1.ModelSpec
(*wrapperspb.Int64Value)(nil), // 1: google.protobuf.Int64Value
}
var file_pkg_apis_tfserving_v1_model_proto_depIdxs = []int32{
1, // 0: tfserving.v1.ModelSpec.version:type_name -> google.protobuf.Int64Value
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_pkg_apis_tfserving_v1_model_proto_init() }
func file_pkg_apis_tfserving_v1_model_proto_init() {
if File_pkg_apis_tfserving_v1_model_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_pkg_apis_tfserving_v1_model_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ModelSpec); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
file_pkg_apis_tfserving_v1_model_proto_msgTypes[0].OneofWrappers = []interface{}{
(*ModelSpec_Version)(nil),
(*ModelSpec_VersionLabel)(nil),
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_pkg_apis_tfserving_v1_model_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_pkg_apis_tfserving_v1_model_proto_goTypes,
DependencyIndexes: file_pkg_apis_tfserving_v1_model_proto_depIdxs,
MessageInfos: file_pkg_apis_tfserving_v1_model_proto_msgTypes,
}.Build()
File_pkg_apis_tfserving_v1_model_proto = out.File
file_pkg_apis_tfserving_v1_model_proto_rawDesc = nil
file_pkg_apis_tfserving_v1_model_proto_goTypes = nil
file_pkg_apis_tfserving_v1_model_proto_depIdxs = nil
}

View File

@ -0,0 +1,197 @@
// Code generated by protoc-gen-validate. DO NOT EDIT.
// source: pkg/apis/tfserving/v1/model.proto
package tfserving
import (
"bytes"
"errors"
"fmt"
"net"
"net/mail"
"net/url"
"regexp"
"sort"
"strings"
"time"
"unicode/utf8"
"google.golang.org/protobuf/types/known/anypb"
)
// ensure the imports are used
var (
_ = bytes.MinRead
_ = errors.New("")
_ = fmt.Print
_ = utf8.UTFMax
_ = (*regexp.Regexp)(nil)
_ = (*strings.Reader)(nil)
_ = net.IPv4len
_ = time.Duration(0)
_ = (*url.URL)(nil)
_ = (*mail.Address)(nil)
_ = anypb.Any{}
_ = sort.Sort
)
// Validate checks the field values on ModelSpec with the rules defined in the
// proto definition for this message. If any rules are violated, the first
// error encountered is returned, or nil if there are no violations.
func (m *ModelSpec) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on ModelSpec with the rules defined in
// the proto definition for this message. If any rules are violated, the
// result is a list of violation errors wrapped in ModelSpecMultiError, or nil
// if none found.
func (m *ModelSpec) ValidateAll() error {
return m.validate(true)
}
func (m *ModelSpec) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
// no validation rules for Name
// no validation rules for SignatureName
switch v := m.VersionChoice.(type) {
case *ModelSpec_Version:
if v == nil {
err := ModelSpecValidationError{
field: "VersionChoice",
reason: "oneof value cannot be a typed-nil",
}
if !all {
return err
}
errors = append(errors, err)
}
if all {
switch v := interface{}(m.GetVersion()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, ModelSpecValidationError{
field: "Version",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, ModelSpecValidationError{
field: "Version",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetVersion()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ModelSpecValidationError{
field: "Version",
reason: "embedded message failed validation",
cause: err,
}
}
}
case *ModelSpec_VersionLabel:
if v == nil {
err := ModelSpecValidationError{
field: "VersionChoice",
reason: "oneof value cannot be a typed-nil",
}
if !all {
return err
}
errors = append(errors, err)
}
// no validation rules for VersionLabel
default:
_ = v // ensures v is used
}
if len(errors) > 0 {
return ModelSpecMultiError(errors)
}
return nil
}
// ModelSpecMultiError is an error wrapping multiple validation errors returned
// by ModelSpec.ValidateAll() if the designated constraints aren't met.
type ModelSpecMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m ModelSpecMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m ModelSpecMultiError) AllErrors() []error { return m }
// ModelSpecValidationError is the validation error returned by
// ModelSpec.Validate if the designated constraints aren't met.
type ModelSpecValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e ModelSpecValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e ModelSpecValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e ModelSpecValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e ModelSpecValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e ModelSpecValidationError) ErrorName() string { return "ModelSpecValidationError" }
// Error satisfies the builtin error interface
func (e ModelSpecValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sModelSpec.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = ModelSpecValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = ModelSpecValidationError{}

View File

@ -0,0 +1,50 @@
/*
* Copyright 2023 The Dragonfly Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
syntax = "proto3";
package tfserving.v1;
import "google/protobuf/wrappers.proto";
option go_package = "d7y.io/api/pkg/apis/tfserving/v1;tfserving";
// Metadata for an inference request such as the model name and version.
message ModelSpec {
// Required servable name.
string name = 1;
// Optional choice of which version of the model to use.
//
// Recommended to be left unset in the common case. Should be specified only
// when there is a strong version consistency requirement.
//
// When left unspecified, the system will serve the best available version.
// This is typically the latest version, though during version transitions,
// notably when serving on a fleet of instances, may be either the previous or
// new version.
oneof version_choice {
// Use this specific version number.
google.protobuf.Int64Value version = 2;
// Use the version associated with the given label.
string version_label = 4;
}
// A named signature to evaluate. If unspecified, the default signature will
// be used.
string signature_name = 3;
}

View File

@ -0,0 +1,309 @@
//
// Copyright 2023 The Dragonfly Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT 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.28.1
// protoc v3.21.6
// source: pkg/apis/tfserving/v1/predict.proto
package tfserving
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
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)
)
// PredictRequest specifies which TensorFlow model to run, as well as
// how inputs are mapped to tensors and how outputs are filtered before
// returning to user.
type PredictRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Model Specification. If version is not specified, will use the latest
// (numerical) version.
ModelSpec *ModelSpec `protobuf:"bytes,1,opt,name=model_spec,json=modelSpec,proto3" json:"model_spec,omitempty"`
// Input tensors.
// Names of input tensor are alias names. The mapping from aliases to real
// input tensor names is stored in the SavedModel export as a prediction
// SignatureDef under the 'inputs' field.
Inputs map[string]*TensorProto `protobuf:"bytes,2,rep,name=inputs,proto3" json:"inputs,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
// Output filter.
// Names specified are alias names. The mapping from aliases to real output
// tensor names is stored in the SavedModel export as a prediction
// SignatureDef under the 'outputs' field.
// Only tensors specified here will be run/fetched and returned, with the
// exception that when none is specified, all tensors specified in the
// named signature will be run/fetched and returned.
OutputFilter []string `protobuf:"bytes,3,rep,name=output_filter,json=outputFilter,proto3" json:"output_filter,omitempty"`
}
func (x *PredictRequest) Reset() {
*x = PredictRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_pkg_apis_tfserving_v1_predict_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *PredictRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*PredictRequest) ProtoMessage() {}
func (x *PredictRequest) ProtoReflect() protoreflect.Message {
mi := &file_pkg_apis_tfserving_v1_predict_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use PredictRequest.ProtoReflect.Descriptor instead.
func (*PredictRequest) Descriptor() ([]byte, []int) {
return file_pkg_apis_tfserving_v1_predict_proto_rawDescGZIP(), []int{0}
}
func (x *PredictRequest) GetModelSpec() *ModelSpec {
if x != nil {
return x.ModelSpec
}
return nil
}
func (x *PredictRequest) GetInputs() map[string]*TensorProto {
if x != nil {
return x.Inputs
}
return nil
}
func (x *PredictRequest) GetOutputFilter() []string {
if x != nil {
return x.OutputFilter
}
return nil
}
// Response for PredictRequest on successful run.
type PredictResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Effective Model Specification used to process PredictRequest.
ModelSpec *ModelSpec `protobuf:"bytes,2,opt,name=model_spec,json=modelSpec,proto3" json:"model_spec,omitempty"`
// Output tensors.
Outputs map[string]*TensorProto `protobuf:"bytes,1,rep,name=outputs,proto3" json:"outputs,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
}
func (x *PredictResponse) Reset() {
*x = PredictResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_pkg_apis_tfserving_v1_predict_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *PredictResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*PredictResponse) ProtoMessage() {}
func (x *PredictResponse) ProtoReflect() protoreflect.Message {
mi := &file_pkg_apis_tfserving_v1_predict_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use PredictResponse.ProtoReflect.Descriptor instead.
func (*PredictResponse) Descriptor() ([]byte, []int) {
return file_pkg_apis_tfserving_v1_predict_proto_rawDescGZIP(), []int{1}
}
func (x *PredictResponse) GetModelSpec() *ModelSpec {
if x != nil {
return x.ModelSpec
}
return nil
}
func (x *PredictResponse) GetOutputs() map[string]*TensorProto {
if x != nil {
return x.Outputs
}
return nil
}
var File_pkg_apis_tfserving_v1_predict_proto protoreflect.FileDescriptor
var file_pkg_apis_tfserving_v1_predict_proto_rawDesc = []byte{
0x0a, 0x23, 0x70, 0x6b, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x74, 0x66, 0x73, 0x65, 0x72,
0x76, 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x72, 0x65, 0x64, 0x69, 0x63, 0x74, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x74, 0x66, 0x73, 0x65, 0x72, 0x76, 0x69, 0x6e, 0x67,
0x2e, 0x76, 0x31, 0x1a, 0x22, 0x70, 0x6b, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x74, 0x66,
0x73, 0x65, 0x72, 0x76, 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x65, 0x6e, 0x73, 0x6f,
0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x70, 0x6b, 0x67, 0x2f, 0x61, 0x70, 0x69,
0x73, 0x2f, 0x74, 0x66, 0x73, 0x65, 0x72, 0x76, 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x6d,
0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x85, 0x02, 0x0a, 0x0e, 0x50,
0x72, 0x65, 0x64, 0x69, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x36, 0x0a,
0x0a, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x17, 0x2e, 0x74, 0x66, 0x73, 0x65, 0x72, 0x76, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31,
0x2e, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x53, 0x70, 0x65, 0x63, 0x52, 0x09, 0x6d, 0x6f, 0x64, 0x65,
0x6c, 0x53, 0x70, 0x65, 0x63, 0x12, 0x40, 0x0a, 0x06, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x73, 0x18,
0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x74, 0x66, 0x73, 0x65, 0x72, 0x76, 0x69, 0x6e,
0x67, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52,
0x06, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x6f, 0x75, 0x74, 0x70, 0x75,
0x74, 0x5f, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c,
0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x1a, 0x54, 0x0a, 0x0b,
0x49, 0x6e, 0x70, 0x75, 0x74, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b,
0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2f, 0x0a,
0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x74,
0x66, 0x73, 0x65, 0x72, 0x76, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x6e, 0x73,
0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02,
0x38, 0x01, 0x22, 0xe6, 0x01, 0x0a, 0x0f, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x74, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x0a, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f,
0x73, 0x70, 0x65, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x74, 0x66, 0x73,
0x65, 0x72, 0x76, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x53,
0x70, 0x65, 0x63, 0x52, 0x09, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x53, 0x70, 0x65, 0x63, 0x12, 0x44,
0x0a, 0x07, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x2a, 0x2e, 0x74, 0x66, 0x73, 0x65, 0x72, 0x76, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x50,
0x72, 0x65, 0x64, 0x69, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x4f,
0x75, 0x74, 0x70, 0x75, 0x74, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x6f, 0x75, 0x74,
0x70, 0x75, 0x74, 0x73, 0x1a, 0x55, 0x0a, 0x0c, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x73, 0x45,
0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2f, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18,
0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x74, 0x66, 0x73, 0x65, 0x72, 0x76, 0x69, 0x6e,
0x67, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f,
0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x2c, 0x5a, 0x2a, 0x64,
0x37, 0x79, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x61, 0x70,
0x69, 0x73, 0x2f, 0x74, 0x66, 0x73, 0x65, 0x72, 0x76, 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x3b,
0x74, 0x66, 0x73, 0x65, 0x72, 0x76, 0x69, 0x6e, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x33,
}
var (
file_pkg_apis_tfserving_v1_predict_proto_rawDescOnce sync.Once
file_pkg_apis_tfserving_v1_predict_proto_rawDescData = file_pkg_apis_tfserving_v1_predict_proto_rawDesc
)
func file_pkg_apis_tfserving_v1_predict_proto_rawDescGZIP() []byte {
file_pkg_apis_tfserving_v1_predict_proto_rawDescOnce.Do(func() {
file_pkg_apis_tfserving_v1_predict_proto_rawDescData = protoimpl.X.CompressGZIP(file_pkg_apis_tfserving_v1_predict_proto_rawDescData)
})
return file_pkg_apis_tfserving_v1_predict_proto_rawDescData
}
var file_pkg_apis_tfserving_v1_predict_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_pkg_apis_tfserving_v1_predict_proto_goTypes = []interface{}{
(*PredictRequest)(nil), // 0: tfserving.v1.PredictRequest
(*PredictResponse)(nil), // 1: tfserving.v1.PredictResponse
nil, // 2: tfserving.v1.PredictRequest.InputsEntry
nil, // 3: tfserving.v1.PredictResponse.OutputsEntry
(*ModelSpec)(nil), // 4: tfserving.v1.ModelSpec
(*TensorProto)(nil), // 5: tfserving.v1.TensorProto
}
var file_pkg_apis_tfserving_v1_predict_proto_depIdxs = []int32{
4, // 0: tfserving.v1.PredictRequest.model_spec:type_name -> tfserving.v1.ModelSpec
2, // 1: tfserving.v1.PredictRequest.inputs:type_name -> tfserving.v1.PredictRequest.InputsEntry
4, // 2: tfserving.v1.PredictResponse.model_spec:type_name -> tfserving.v1.ModelSpec
3, // 3: tfserving.v1.PredictResponse.outputs:type_name -> tfserving.v1.PredictResponse.OutputsEntry
5, // 4: tfserving.v1.PredictRequest.InputsEntry.value:type_name -> tfserving.v1.TensorProto
5, // 5: tfserving.v1.PredictResponse.OutputsEntry.value:type_name -> tfserving.v1.TensorProto
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_pkg_apis_tfserving_v1_predict_proto_init() }
func file_pkg_apis_tfserving_v1_predict_proto_init() {
if File_pkg_apis_tfserving_v1_predict_proto != nil {
return
}
file_pkg_apis_tfserving_v1_tensor_proto_init()
file_pkg_apis_tfserving_v1_model_proto_init()
if !protoimpl.UnsafeEnabled {
file_pkg_apis_tfserving_v1_predict_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*PredictRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_pkg_apis_tfserving_v1_predict_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*PredictResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_pkg_apis_tfserving_v1_predict_proto_rawDesc,
NumEnums: 0,
NumMessages: 4,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_pkg_apis_tfserving_v1_predict_proto_goTypes,
DependencyIndexes: file_pkg_apis_tfserving_v1_predict_proto_depIdxs,
MessageInfos: file_pkg_apis_tfserving_v1_predict_proto_msgTypes,
}.Build()
File_pkg_apis_tfserving_v1_predict_proto = out.File
file_pkg_apis_tfserving_v1_predict_proto_rawDesc = nil
file_pkg_apis_tfserving_v1_predict_proto_goTypes = nil
file_pkg_apis_tfserving_v1_predict_proto_depIdxs = nil
}

View File

@ -0,0 +1,386 @@
// Code generated by protoc-gen-validate. DO NOT EDIT.
// source: pkg/apis/tfserving/v1/predict.proto
package tfserving
import (
"bytes"
"errors"
"fmt"
"net"
"net/mail"
"net/url"
"regexp"
"sort"
"strings"
"time"
"unicode/utf8"
"google.golang.org/protobuf/types/known/anypb"
)
// ensure the imports are used
var (
_ = bytes.MinRead
_ = errors.New("")
_ = fmt.Print
_ = utf8.UTFMax
_ = (*regexp.Regexp)(nil)
_ = (*strings.Reader)(nil)
_ = net.IPv4len
_ = time.Duration(0)
_ = (*url.URL)(nil)
_ = (*mail.Address)(nil)
_ = anypb.Any{}
_ = sort.Sort
)
// Validate checks the field values on PredictRequest with the rules defined in
// the proto definition for this message. If any rules are violated, the first
// error encountered is returned, or nil if there are no violations.
func (m *PredictRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on PredictRequest with the rules defined
// in the proto definition for this message. If any rules are violated, the
// result is a list of violation errors wrapped in PredictRequestMultiError,
// or nil if none found.
func (m *PredictRequest) ValidateAll() error {
return m.validate(true)
}
func (m *PredictRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if all {
switch v := interface{}(m.GetModelSpec()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, PredictRequestValidationError{
field: "ModelSpec",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, PredictRequestValidationError{
field: "ModelSpec",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetModelSpec()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return PredictRequestValidationError{
field: "ModelSpec",
reason: "embedded message failed validation",
cause: err,
}
}
}
{
sorted_keys := make([]string, len(m.GetInputs()))
i := 0
for key := range m.GetInputs() {
sorted_keys[i] = key
i++
}
sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] })
for _, key := range sorted_keys {
val := m.GetInputs()[key]
_ = val
// no validation rules for Inputs[key]
if all {
switch v := interface{}(val).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, PredictRequestValidationError{
field: fmt.Sprintf("Inputs[%v]", key),
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, PredictRequestValidationError{
field: fmt.Sprintf("Inputs[%v]", key),
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(val).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return PredictRequestValidationError{
field: fmt.Sprintf("Inputs[%v]", key),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
if len(errors) > 0 {
return PredictRequestMultiError(errors)
}
return nil
}
// PredictRequestMultiError is an error wrapping multiple validation errors
// returned by PredictRequest.ValidateAll() if the designated constraints
// aren't met.
type PredictRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m PredictRequestMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m PredictRequestMultiError) AllErrors() []error { return m }
// PredictRequestValidationError is the validation error returned by
// PredictRequest.Validate if the designated constraints aren't met.
type PredictRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e PredictRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e PredictRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e PredictRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e PredictRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e PredictRequestValidationError) ErrorName() string { return "PredictRequestValidationError" }
// Error satisfies the builtin error interface
func (e PredictRequestValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sPredictRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = PredictRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = PredictRequestValidationError{}
// Validate checks the field values on PredictResponse with the rules defined
// in the proto definition for this message. If any rules are violated, the
// first error encountered is returned, or nil if there are no violations.
func (m *PredictResponse) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on PredictResponse with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// PredictResponseMultiError, or nil if none found.
func (m *PredictResponse) ValidateAll() error {
return m.validate(true)
}
func (m *PredictResponse) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if all {
switch v := interface{}(m.GetModelSpec()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, PredictResponseValidationError{
field: "ModelSpec",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, PredictResponseValidationError{
field: "ModelSpec",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetModelSpec()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return PredictResponseValidationError{
field: "ModelSpec",
reason: "embedded message failed validation",
cause: err,
}
}
}
{
sorted_keys := make([]string, len(m.GetOutputs()))
i := 0
for key := range m.GetOutputs() {
sorted_keys[i] = key
i++
}
sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] })
for _, key := range sorted_keys {
val := m.GetOutputs()[key]
_ = val
// no validation rules for Outputs[key]
if all {
switch v := interface{}(val).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, PredictResponseValidationError{
field: fmt.Sprintf("Outputs[%v]", key),
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, PredictResponseValidationError{
field: fmt.Sprintf("Outputs[%v]", key),
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(val).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return PredictResponseValidationError{
field: fmt.Sprintf("Outputs[%v]", key),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
if len(errors) > 0 {
return PredictResponseMultiError(errors)
}
return nil
}
// PredictResponseMultiError is an error wrapping multiple validation errors
// returned by PredictResponse.ValidateAll() if the designated constraints
// aren't met.
type PredictResponseMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m PredictResponseMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m PredictResponseMultiError) AllErrors() []error { return m }
// PredictResponseValidationError is the validation error returned by
// PredictResponse.Validate if the designated constraints aren't met.
type PredictResponseValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e PredictResponseValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e PredictResponseValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e PredictResponseValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e PredictResponseValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e PredictResponseValidationError) ErrorName() string { return "PredictResponseValidationError" }
// Error satisfies the builtin error interface
func (e PredictResponseValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sPredictResponse.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = PredictResponseValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = PredictResponseValidationError{}

View File

@ -0,0 +1,58 @@
/*
* Copyright 2023 The Dragonfly Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
syntax = "proto3";
package tfserving.v1;
import "pkg/apis/tfserving/v1/tensor.proto";
import "pkg/apis/tfserving/v1/model.proto";
option go_package = "d7y.io/api/pkg/apis/tfserving/v1;tfserving";
// PredictRequest specifies which TensorFlow model to run, as well as
// how inputs are mapped to tensors and how outputs are filtered before
// returning to user.
message PredictRequest {
// Model Specification. If version is not specified, will use the latest
// (numerical) version.
tfserving.v1.ModelSpec model_spec = 1;
// Input tensors.
// Names of input tensor are alias names. The mapping from aliases to real
// input tensor names is stored in the SavedModel export as a prediction
// SignatureDef under the 'inputs' field.
map<string, tfserving.v1.TensorProto> inputs = 2;
// Output filter.
// Names specified are alias names. The mapping from aliases to real output
// tensor names is stored in the SavedModel export as a prediction
// SignatureDef under the 'outputs' field.
// Only tensors specified here will be run/fetched and returned, with the
// exception that when none is specified, all tensors specified in the
// named signature will be run/fetched and returned.
repeated string output_filter = 3;
}
// Response for PredictRequest on successful run.
message PredictResponse {
// Effective Model Specification used to process PredictRequest.
tfserving.v1.ModelSpec model_spec = 2;
// Output tensors.
map<string, tfserving.v1.TensorProto> outputs = 1;
}

View File

@ -0,0 +1,95 @@
//
// Copyright 2023 The Dragonfly Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT 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.28.1
// protoc v3.21.6
// source: pkg/apis/tfserving/v1/prediction_service.proto
package tfserving
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
)
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_pkg_apis_tfserving_v1_prediction_service_proto protoreflect.FileDescriptor
var file_pkg_apis_tfserving_v1_prediction_service_proto_rawDesc = []byte{
0x0a, 0x2e, 0x70, 0x6b, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x74, 0x66, 0x73, 0x65, 0x72,
0x76, 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x72, 0x65, 0x64, 0x69, 0x63, 0x74, 0x69,
0x6f, 0x6e, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x12, 0x0c, 0x74, 0x66, 0x73, 0x65, 0x72, 0x76, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x1a, 0x23,
0x70, 0x6b, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x74, 0x66, 0x73, 0x65, 0x72, 0x76, 0x69,
0x6e, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x72, 0x65, 0x64, 0x69, 0x63, 0x74, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x32, 0x5b, 0x0a, 0x11, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x74, 0x69, 0x6f,
0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x46, 0x0a, 0x07, 0x50, 0x72, 0x65, 0x64,
0x69, 0x63, 0x74, 0x12, 0x1c, 0x2e, 0x74, 0x66, 0x73, 0x65, 0x72, 0x76, 0x69, 0x6e, 0x67, 0x2e,
0x76, 0x31, 0x2e, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x1a, 0x1d, 0x2e, 0x74, 0x66, 0x73, 0x65, 0x72, 0x76, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31,
0x2e, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x42, 0x2c, 0x5a, 0x2a, 0x64, 0x37, 0x79, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70,
0x6b, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x74, 0x66, 0x73, 0x65, 0x72, 0x76, 0x69, 0x6e,
0x67, 0x2f, 0x76, 0x31, 0x3b, 0x74, 0x66, 0x73, 0x65, 0x72, 0x76, 0x69, 0x6e, 0x67, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var file_pkg_apis_tfserving_v1_prediction_service_proto_goTypes = []interface{}{
(*PredictRequest)(nil), // 0: tfserving.v1.PredictRequest
(*PredictResponse)(nil), // 1: tfserving.v1.PredictResponse
}
var file_pkg_apis_tfserving_v1_prediction_service_proto_depIdxs = []int32{
0, // 0: tfserving.v1.PredictionService.Predict:input_type -> tfserving.v1.PredictRequest
1, // 1: tfserving.v1.PredictionService.Predict:output_type -> tfserving.v1.PredictResponse
1, // [1:2] is the sub-list for method output_type
0, // [0:1] 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_pkg_apis_tfserving_v1_prediction_service_proto_init() }
func file_pkg_apis_tfserving_v1_prediction_service_proto_init() {
if File_pkg_apis_tfserving_v1_prediction_service_proto != nil {
return
}
file_pkg_apis_tfserving_v1_predict_proto_init()
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_pkg_apis_tfserving_v1_prediction_service_proto_rawDesc,
NumEnums: 0,
NumMessages: 0,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_pkg_apis_tfserving_v1_prediction_service_proto_goTypes,
DependencyIndexes: file_pkg_apis_tfserving_v1_prediction_service_proto_depIdxs,
}.Build()
File_pkg_apis_tfserving_v1_prediction_service_proto = out.File
file_pkg_apis_tfserving_v1_prediction_service_proto_rawDesc = nil
file_pkg_apis_tfserving_v1_prediction_service_proto_goTypes = nil
file_pkg_apis_tfserving_v1_prediction_service_proto_depIdxs = nil
}

View File

@ -0,0 +1,36 @@
// Code generated by protoc-gen-validate. DO NOT EDIT.
// source: pkg/apis/tfserving/v1/prediction_service.proto
package tfserving
import (
"bytes"
"errors"
"fmt"
"net"
"net/mail"
"net/url"
"regexp"
"sort"
"strings"
"time"
"unicode/utf8"
"google.golang.org/protobuf/types/known/anypb"
)
// ensure the imports are used
var (
_ = bytes.MinRead
_ = errors.New("")
_ = fmt.Print
_ = utf8.UTFMax
_ = (*regexp.Regexp)(nil)
_ = (*strings.Reader)(nil)
_ = net.IPv4len
_ = time.Duration(0)
_ = (*url.URL)(nil)
_ = (*mail.Address)(nil)
_ = anypb.Any{}
_ = sort.Sort
)

View File

@ -0,0 +1,32 @@
/*
* Copyright 2023 The Dragonfly Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
syntax = "proto3";
package tfserving.v1;
import "pkg/apis/tfserving/v1/predict.proto";
option go_package = "d7y.io/api/pkg/apis/tfserving/v1;tfserving";
// open source marker; do not remove
// PredictionService provides access to machine-learned models loaded by
// model_servers.
service PredictionService {
// Predict -- provides access to loaded TensorFlow model.
rpc Predict(tfserving.v1.PredictRequest) returns (tfserving.v1.PredictResponse);
}

View File

@ -0,0 +1,105 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc v3.21.6
// source: pkg/apis/tfserving/v1/prediction_service.proto
package tfserving
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// PredictionServiceClient is the client API for PredictionService 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.
type PredictionServiceClient interface {
// Predict -- provides access to loaded TensorFlow model.
Predict(ctx context.Context, in *PredictRequest, opts ...grpc.CallOption) (*PredictResponse, error)
}
type predictionServiceClient struct {
cc grpc.ClientConnInterface
}
func NewPredictionServiceClient(cc grpc.ClientConnInterface) PredictionServiceClient {
return &predictionServiceClient{cc}
}
func (c *predictionServiceClient) Predict(ctx context.Context, in *PredictRequest, opts ...grpc.CallOption) (*PredictResponse, error) {
out := new(PredictResponse)
err := c.cc.Invoke(ctx, "/tfserving.v1.PredictionService/Predict", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// PredictionServiceServer is the server API for PredictionService service.
// All implementations should embed UnimplementedPredictionServiceServer
// for forward compatibility
type PredictionServiceServer interface {
// Predict -- provides access to loaded TensorFlow model.
Predict(context.Context, *PredictRequest) (*PredictResponse, error)
}
// UnimplementedPredictionServiceServer should be embedded to have forward compatible implementations.
type UnimplementedPredictionServiceServer struct {
}
func (UnimplementedPredictionServiceServer) Predict(context.Context, *PredictRequest) (*PredictResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Predict not implemented")
}
// UnsafePredictionServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to PredictionServiceServer will
// result in compilation errors.
type UnsafePredictionServiceServer interface {
mustEmbedUnimplementedPredictionServiceServer()
}
func RegisterPredictionServiceServer(s grpc.ServiceRegistrar, srv PredictionServiceServer) {
s.RegisterService(&PredictionService_ServiceDesc, srv)
}
func _PredictionService_Predict_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PredictRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PredictionServiceServer).Predict(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/tfserving.v1.PredictionService/Predict",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PredictionServiceServer).Predict(ctx, req.(*PredictRequest))
}
return interceptor(ctx, in, info, handler)
}
// PredictionService_ServiceDesc is the grpc.ServiceDesc for PredictionService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var PredictionService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "tfserving.v1.PredictionService",
HandlerType: (*PredictionServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Predict",
Handler: _PredictionService_Predict_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "pkg/apis/tfserving/v1/prediction_service.proto",
}

View File

@ -0,0 +1,314 @@
//
// Copyright 2023 The Dragonfly Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT 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.28.1
// protoc v3.21.6
// source: pkg/apis/tfserving/v1/resource_handle.proto
package tfserving
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
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
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// 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"`
}
func (x *ResourceHandleProto) Reset() {
*x = ResourceHandleProto{}
if protoimpl.UnsafeEnabled {
mi := &file_pkg_apis_tfserving_v1_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_pkg_apis_tfserving_v1_resource_handle_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && 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_pkg_apis_tfserving_v1_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
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Dtype DataType `protobuf:"varint,1,opt,name=dtype,proto3,enum=tfserving.v1.DataType" json:"dtype,omitempty"`
Shape *TensorShapeProto `protobuf:"bytes,2,opt,name=shape,proto3" json:"shape,omitempty"`
}
func (x *ResourceHandleProto_DtypeAndShape) Reset() {
*x = ResourceHandleProto_DtypeAndShape{}
if protoimpl.UnsafeEnabled {
mi := &file_pkg_apis_tfserving_v1_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_pkg_apis_tfserving_v1_resource_handle_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && 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_pkg_apis_tfserving_v1_resource_handle_proto_rawDescGZIP(), []int{0, 0}
}
func (x *ResourceHandleProto_DtypeAndShape) GetDtype() DataType {
if x != nil {
return x.Dtype
}
return DataType_DT_INVALID
}
func (x *ResourceHandleProto_DtypeAndShape) GetShape() *TensorShapeProto {
if x != nil {
return x.Shape
}
return nil
}
var File_pkg_apis_tfserving_v1_resource_handle_proto protoreflect.FileDescriptor
var file_pkg_apis_tfserving_v1_resource_handle_proto_rawDesc = []byte{
0x0a, 0x2b, 0x70, 0x6b, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x74, 0x66, 0x73, 0x65, 0x72,
0x76, 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
0x5f, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x74,
0x66, 0x73, 0x65, 0x72, 0x76, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x1a, 0x28, 0x70, 0x6b, 0x67,
0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x74, 0x66, 0x73, 0x65, 0x72, 0x76, 0x69, 0x6e, 0x67, 0x2f,
0x76, 0x31, 0x2f, 0x74, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x5f, 0x73, 0x68, 0x61, 0x70, 0x65, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x70, 0x6b, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f,
0x74, 0x66, 0x73, 0x65, 0x72, 0x76, 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x79, 0x70,
0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xfc, 0x02, 0x0a, 0x13, 0x52, 0x65, 0x73,
0x6f, 0x75, 0x72, 0x63, 0x65, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f,
0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x74,
0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x6f, 0x6e,
0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03,
0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x68, 0x61,
0x73, 0x68, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x68,
0x61, 0x73, 0x68, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x26, 0x0a, 0x0f, 0x6d, 0x61, 0x79, 0x62, 0x65,
0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09,
0x52, 0x0d, 0x6d, 0x61, 0x79, 0x62, 0x65, 0x54, 0x79, 0x70, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12,
0x5b, 0x0a, 0x11, 0x64, 0x74, 0x79, 0x70, 0x65, 0x73, 0x5f, 0x61, 0x6e, 0x64, 0x5f, 0x73, 0x68,
0x61, 0x70, 0x65, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x74, 0x66, 0x73,
0x65, 0x72, 0x76, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72,
0x63, 0x65, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x74,
0x79, 0x70, 0x65, 0x41, 0x6e, 0x64, 0x53, 0x68, 0x61, 0x70, 0x65, 0x52, 0x0f, 0x64, 0x74, 0x79,
0x70, 0x65, 0x73, 0x41, 0x6e, 0x64, 0x53, 0x68, 0x61, 0x70, 0x65, 0x73, 0x1a, 0x73, 0x0a, 0x0d,
0x44, 0x74, 0x79, 0x70, 0x65, 0x41, 0x6e, 0x64, 0x53, 0x68, 0x61, 0x70, 0x65, 0x12, 0x2c, 0x0a,
0x05, 0x64, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x74,
0x66, 0x73, 0x65, 0x72, 0x76, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x61, 0x74, 0x61,
0x54, 0x79, 0x70, 0x65, 0x52, 0x05, 0x64, 0x74, 0x79, 0x70, 0x65, 0x12, 0x34, 0x0a, 0x05, 0x73,
0x68, 0x61, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x74, 0x66, 0x73,
0x65, 0x72, 0x76, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x6e, 0x73, 0x6f, 0x72,
0x53, 0x68, 0x61, 0x70, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x05, 0x73, 0x68, 0x61, 0x70,
0x65, 0x4a, 0x04, 0x08, 0x07, 0x10, 0x08, 0x42, 0x2c, 0x5a, 0x2a, 0x64, 0x37, 0x79, 0x2e, 0x69,
0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x74,
0x66, 0x73, 0x65, 0x72, 0x76, 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x3b, 0x74, 0x66, 0x73, 0x65,
0x72, 0x76, 0x69, 0x6e, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_pkg_apis_tfserving_v1_resource_handle_proto_rawDescOnce sync.Once
file_pkg_apis_tfserving_v1_resource_handle_proto_rawDescData = file_pkg_apis_tfserving_v1_resource_handle_proto_rawDesc
)
func file_pkg_apis_tfserving_v1_resource_handle_proto_rawDescGZIP() []byte {
file_pkg_apis_tfserving_v1_resource_handle_proto_rawDescOnce.Do(func() {
file_pkg_apis_tfserving_v1_resource_handle_proto_rawDescData = protoimpl.X.CompressGZIP(file_pkg_apis_tfserving_v1_resource_handle_proto_rawDescData)
})
return file_pkg_apis_tfserving_v1_resource_handle_proto_rawDescData
}
var file_pkg_apis_tfserving_v1_resource_handle_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_pkg_apis_tfserving_v1_resource_handle_proto_goTypes = []interface{}{
(*ResourceHandleProto)(nil), // 0: tfserving.v1.ResourceHandleProto
(*ResourceHandleProto_DtypeAndShape)(nil), // 1: tfserving.v1.ResourceHandleProto.DtypeAndShape
(DataType)(0), // 2: tfserving.v1.DataType
(*TensorShapeProto)(nil), // 3: tfserving.v1.TensorShapeProto
}
var file_pkg_apis_tfserving_v1_resource_handle_proto_depIdxs = []int32{
1, // 0: tfserving.v1.ResourceHandleProto.dtypes_and_shapes:type_name -> tfserving.v1.ResourceHandleProto.DtypeAndShape
2, // 1: tfserving.v1.ResourceHandleProto.DtypeAndShape.dtype:type_name -> tfserving.v1.DataType
3, // 2: tfserving.v1.ResourceHandleProto.DtypeAndShape.shape:type_name -> tfserving.v1.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_pkg_apis_tfserving_v1_resource_handle_proto_init() }
func file_pkg_apis_tfserving_v1_resource_handle_proto_init() {
if File_pkg_apis_tfserving_v1_resource_handle_proto != nil {
return
}
file_pkg_apis_tfserving_v1_tensor_shape_proto_init()
file_pkg_apis_tfserving_v1_types_proto_init()
if !protoimpl.UnsafeEnabled {
file_pkg_apis_tfserving_v1_resource_handle_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ResourceHandleProto); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_pkg_apis_tfserving_v1_resource_handle_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ResourceHandleProto_DtypeAndShape); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_pkg_apis_tfserving_v1_resource_handle_proto_rawDesc,
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_pkg_apis_tfserving_v1_resource_handle_proto_goTypes,
DependencyIndexes: file_pkg_apis_tfserving_v1_resource_handle_proto_depIdxs,
MessageInfos: file_pkg_apis_tfserving_v1_resource_handle_proto_msgTypes,
}.Build()
File_pkg_apis_tfserving_v1_resource_handle_proto = out.File
file_pkg_apis_tfserving_v1_resource_handle_proto_rawDesc = nil
file_pkg_apis_tfserving_v1_resource_handle_proto_goTypes = nil
file_pkg_apis_tfserving_v1_resource_handle_proto_depIdxs = nil
}

View File

@ -0,0 +1,318 @@
// Code generated by protoc-gen-validate. DO NOT EDIT.
// source: pkg/apis/tfserving/v1/resource_handle.proto
package tfserving
import (
"bytes"
"errors"
"fmt"
"net"
"net/mail"
"net/url"
"regexp"
"sort"
"strings"
"time"
"unicode/utf8"
"google.golang.org/protobuf/types/known/anypb"
)
// ensure the imports are used
var (
_ = bytes.MinRead
_ = errors.New("")
_ = fmt.Print
_ = utf8.UTFMax
_ = (*regexp.Regexp)(nil)
_ = (*strings.Reader)(nil)
_ = net.IPv4len
_ = time.Duration(0)
_ = (*url.URL)(nil)
_ = (*mail.Address)(nil)
_ = anypb.Any{}
_ = sort.Sort
)
// Validate checks the field values on ResourceHandleProto with the rules
// defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *ResourceHandleProto) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on ResourceHandleProto with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// ResourceHandleProtoMultiError, or nil if none found.
func (m *ResourceHandleProto) ValidateAll() error {
return m.validate(true)
}
func (m *ResourceHandleProto) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
// no validation rules for Device
// no validation rules for Container
// no validation rules for Name
// no validation rules for HashCode
// no validation rules for MaybeTypeName
for idx, item := range m.GetDtypesAndShapes() {
_, _ = idx, item
if all {
switch v := interface{}(item).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, ResourceHandleProtoValidationError{
field: fmt.Sprintf("DtypesAndShapes[%v]", idx),
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, ResourceHandleProtoValidationError{
field: fmt.Sprintf("DtypesAndShapes[%v]", idx),
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ResourceHandleProtoValidationError{
field: fmt.Sprintf("DtypesAndShapes[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
if len(errors) > 0 {
return ResourceHandleProtoMultiError(errors)
}
return nil
}
// ResourceHandleProtoMultiError is an error wrapping multiple validation
// errors returned by ResourceHandleProto.ValidateAll() if the designated
// constraints aren't met.
type ResourceHandleProtoMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m ResourceHandleProtoMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m ResourceHandleProtoMultiError) AllErrors() []error { return m }
// ResourceHandleProtoValidationError is the validation error returned by
// ResourceHandleProto.Validate if the designated constraints aren't met.
type ResourceHandleProtoValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e ResourceHandleProtoValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e ResourceHandleProtoValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e ResourceHandleProtoValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e ResourceHandleProtoValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e ResourceHandleProtoValidationError) ErrorName() string {
return "ResourceHandleProtoValidationError"
}
// Error satisfies the builtin error interface
func (e ResourceHandleProtoValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sResourceHandleProto.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = ResourceHandleProtoValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = ResourceHandleProtoValidationError{}
// Validate checks the field values on ResourceHandleProto_DtypeAndShape with
// the rules defined in the proto definition for this message. If any rules
// are violated, the first error encountered is returned, or nil if there are
// no violations.
func (m *ResourceHandleProto_DtypeAndShape) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on ResourceHandleProto_DtypeAndShape
// with the rules defined in the proto definition for this message. If any
// rules are violated, the result is a list of violation errors wrapped in
// ResourceHandleProto_DtypeAndShapeMultiError, or nil if none found.
func (m *ResourceHandleProto_DtypeAndShape) ValidateAll() error {
return m.validate(true)
}
func (m *ResourceHandleProto_DtypeAndShape) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
// no validation rules for Dtype
if all {
switch v := interface{}(m.GetShape()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, ResourceHandleProto_DtypeAndShapeValidationError{
field: "Shape",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, ResourceHandleProto_DtypeAndShapeValidationError{
field: "Shape",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetShape()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ResourceHandleProto_DtypeAndShapeValidationError{
field: "Shape",
reason: "embedded message failed validation",
cause: err,
}
}
}
if len(errors) > 0 {
return ResourceHandleProto_DtypeAndShapeMultiError(errors)
}
return nil
}
// ResourceHandleProto_DtypeAndShapeMultiError is an error wrapping multiple
// validation errors returned by
// ResourceHandleProto_DtypeAndShape.ValidateAll() if the designated
// constraints aren't met.
type ResourceHandleProto_DtypeAndShapeMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m ResourceHandleProto_DtypeAndShapeMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m ResourceHandleProto_DtypeAndShapeMultiError) AllErrors() []error { return m }
// ResourceHandleProto_DtypeAndShapeValidationError is the validation error
// returned by ResourceHandleProto_DtypeAndShape.Validate if the designated
// constraints aren't met.
type ResourceHandleProto_DtypeAndShapeValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e ResourceHandleProto_DtypeAndShapeValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e ResourceHandleProto_DtypeAndShapeValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e ResourceHandleProto_DtypeAndShapeValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e ResourceHandleProto_DtypeAndShapeValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e ResourceHandleProto_DtypeAndShapeValidationError) ErrorName() string {
return "ResourceHandleProto_DtypeAndShapeValidationError"
}
// Error satisfies the builtin error interface
func (e ResourceHandleProto_DtypeAndShapeValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sResourceHandleProto_DtypeAndShape.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = ResourceHandleProto_DtypeAndShapeValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = ResourceHandleProto_DtypeAndShapeValidationError{}

View File

@ -0,0 +1,58 @@
/*
* Copyright 2023 The Dragonfly Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
syntax = "proto3";
package tfserving.v1;
import "pkg/apis/tfserving/v1/tensor_shape.proto";
import "pkg/apis/tfserving/v1/types.proto";
option go_package = "d7y.io/api/pkg/apis/tfserving/v1;tfserving";
// 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.
message ResourceHandleProto {
// Unique name for the device containing the resource.
string device = 1;
// Container in which this resource is placed.
string container = 2;
// Unique name of this resource.
string name = 3;
// Hash code for the type of the resource. Is only valid in the same device
// and in the same execution.
uint64 hash_code = 4;
// For debug-only, the name of the type pointed to by this handle, if
// available.
string maybe_type_name = 5;
// Protocol buffer representing a pair of (data type, tensor shape).
message DtypeAndShape {
tfserving.v1.DataType dtype = 1;
tfserving.v1.TensorShapeProto shape = 2;
}
// Data types and shapes for the underlying resource.
repeated DtypeAndShape dtypes_and_shapes = 6;
reserved 7;
}

View File

@ -0,0 +1,479 @@
//
// Copyright 2023 The Dragonfly Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT 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.28.1
// protoc v3.21.6
// source: pkg/apis/tfserving/v1/tensor.proto
package tfserving
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
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
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Dtype DataType `protobuf:"varint,1,opt,name=dtype,proto3,enum=tfserving.v1.DataType" json:"dtype,omitempty"`
// Shape of the tensor. TODO(touts): sort out the 0-rank issues.
TensorShape *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_UINT16, 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 []*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"`
// DT_FLOAT8_*, use variable-sized set of bytes
// (i.e. the equivalent of repeated uint8, if such a thing existed).
Float8Val []byte `protobuf:"bytes,18,opt,name=float8_val,json=float8Val,proto3" json:"float8_val,omitempty"`
}
func (x *TensorProto) Reset() {
*x = TensorProto{}
if protoimpl.UnsafeEnabled {
mi := &file_pkg_apis_tfserving_v1_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_pkg_apis_tfserving_v1_tensor_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && 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_pkg_apis_tfserving_v1_tensor_proto_rawDescGZIP(), []int{0}
}
func (x *TensorProto) GetDtype() DataType {
if x != nil {
return x.Dtype
}
return DataType_DT_INVALID
}
func (x *TensorProto) GetTensorShape() *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() []*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
}
func (x *TensorProto) GetFloat8Val() []byte {
if x != nil {
return x.Float8Val
}
return nil
}
// Protocol buffer representing the serialization format of DT_VARIANT tensors.
type VariantTensorDataProto struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// 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"`
}
func (x *VariantTensorDataProto) Reset() {
*x = VariantTensorDataProto{}
if protoimpl.UnsafeEnabled {
mi := &file_pkg_apis_tfserving_v1_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_pkg_apis_tfserving_v1_tensor_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && 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_pkg_apis_tfserving_v1_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_pkg_apis_tfserving_v1_tensor_proto protoreflect.FileDescriptor
var file_pkg_apis_tfserving_v1_tensor_proto_rawDesc = []byte{
0x0a, 0x22, 0x70, 0x6b, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x74, 0x66, 0x73, 0x65, 0x72,
0x76, 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x74, 0x66, 0x73, 0x65, 0x72, 0x76, 0x69, 0x6e, 0x67, 0x2e,
0x76, 0x31, 0x1a, 0x2b, 0x70, 0x6b, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x74, 0x66, 0x73,
0x65, 0x72, 0x76, 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72,
0x63, 0x65, 0x5f, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a,
0x28, 0x70, 0x6b, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x74, 0x66, 0x73, 0x65, 0x72, 0x76,
0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x5f, 0x73, 0x68,
0x61, 0x70, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x70, 0x6b, 0x67, 0x2f, 0x61,
0x70, 0x69, 0x73, 0x2f, 0x74, 0x66, 0x73, 0x65, 0x72, 0x76, 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31,
0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf8, 0x05, 0x0a,
0x0b, 0x54, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x2c, 0x0a, 0x05,
0x64, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x74, 0x66,
0x73, 0x65, 0x72, 0x76, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x54,
0x79, 0x70, 0x65, 0x52, 0x05, 0x64, 0x74, 0x79, 0x70, 0x65, 0x12, 0x41, 0x0a, 0x0c, 0x74, 0x65,
0x6e, 0x73, 0x6f, 0x72, 0x5f, 0x73, 0x68, 0x61, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x1e, 0x2e, 0x74, 0x66, 0x73, 0x65, 0x72, 0x76, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e,
0x54, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x53, 0x68, 0x61, 0x70, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f,
0x52, 0x0b, 0x74, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x53, 0x68, 0x61, 0x70, 0x65, 0x12, 0x25, 0x0a,
0x0e, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18,
0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x4e, 0x75,
0x6d, 0x62, 0x65, 0x72, 0x12, 0x25, 0x0a, 0x0e, 0x74, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x5f, 0x63,
0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0d, 0x74, 0x65,
0x6e, 0x73, 0x6f, 0x72, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x1d, 0x0a, 0x08, 0x68,
0x61, 0x6c, 0x66, 0x5f, 0x76, 0x61, 0x6c, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x05, 0x42, 0x02, 0x10,
0x01, 0x52, 0x07, 0x68, 0x61, 0x6c, 0x66, 0x56, 0x61, 0x6c, 0x12, 0x1f, 0x0a, 0x09, 0x66, 0x6c,
0x6f, 0x61, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x18, 0x05, 0x20, 0x03, 0x28, 0x02, 0x42, 0x02, 0x10,
0x01, 0x52, 0x08, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x56, 0x61, 0x6c, 0x12, 0x21, 0x0a, 0x0a, 0x64,
0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x18, 0x06, 0x20, 0x03, 0x28, 0x01, 0x42,
0x02, 0x10, 0x01, 0x52, 0x09, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x12, 0x1b,
0x0a, 0x07, 0x69, 0x6e, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x18, 0x07, 0x20, 0x03, 0x28, 0x05, 0x42,
0x02, 0x10, 0x01, 0x52, 0x06, 0x69, 0x6e, 0x74, 0x56, 0x61, 0x6c, 0x12, 0x1d, 0x0a, 0x0a, 0x73,
0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0c, 0x52,
0x09, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x12, 0x25, 0x0a, 0x0c, 0x73, 0x63,
0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x78, 0x5f, 0x76, 0x61, 0x6c, 0x18, 0x09, 0x20, 0x03, 0x28, 0x02,
0x42, 0x02, 0x10, 0x01, 0x52, 0x0b, 0x73, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x78, 0x56, 0x61,
0x6c, 0x12, 0x1f, 0x0a, 0x09, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x18, 0x0a,
0x20, 0x03, 0x28, 0x03, 0x42, 0x02, 0x10, 0x01, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x56,
0x61, 0x6c, 0x12, 0x1d, 0x0a, 0x08, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x18, 0x0b,
0x20, 0x03, 0x28, 0x08, 0x42, 0x02, 0x10, 0x01, 0x52, 0x07, 0x62, 0x6f, 0x6f, 0x6c, 0x56, 0x61,
0x6c, 0x12, 0x25, 0x0a, 0x0c, 0x64, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x78, 0x5f, 0x76, 0x61,
0x6c, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x01, 0x42, 0x02, 0x10, 0x01, 0x52, 0x0b, 0x64, 0x63, 0x6f,
0x6d, 0x70, 0x6c, 0x65, 0x78, 0x56, 0x61, 0x6c, 0x12, 0x51, 0x0a, 0x13, 0x72, 0x65, 0x73, 0x6f,
0x75, 0x72, 0x63, 0x65, 0x5f, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x18,
0x0e, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x74, 0x66, 0x73, 0x65, 0x72, 0x76, 0x69, 0x6e,
0x67, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x48, 0x61, 0x6e,
0x64, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x11, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72,
0x63, 0x65, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x12, 0x45, 0x0a, 0x0b, 0x76,
0x61, 0x72, 0x69, 0x61, 0x6e, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x18, 0x0f, 0x20, 0x03, 0x28, 0x0b,
0x32, 0x24, 0x2e, 0x74, 0x66, 0x73, 0x65, 0x72, 0x76, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e,
0x56, 0x61, 0x72, 0x69, 0x61, 0x6e, 0x74, 0x54, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x44, 0x61, 0x74,
0x61, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x0a, 0x76, 0x61, 0x72, 0x69, 0x61, 0x6e, 0x74, 0x56,
0x61, 0x6c, 0x12, 0x21, 0x0a, 0x0a, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c,
0x18, 0x10, 0x20, 0x03, 0x28, 0x0d, 0x42, 0x02, 0x10, 0x01, 0x52, 0x09, 0x75, 0x69, 0x6e, 0x74,
0x33, 0x32, 0x56, 0x61, 0x6c, 0x12, 0x21, 0x0a, 0x0a, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f,
0x76, 0x61, 0x6c, 0x18, 0x11, 0x20, 0x03, 0x28, 0x04, 0x42, 0x02, 0x10, 0x01, 0x52, 0x09, 0x75,
0x69, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x12, 0x1d, 0x0a, 0x0a, 0x66, 0x6c, 0x6f, 0x61,
0x74, 0x38, 0x5f, 0x76, 0x61, 0x6c, 0x18, 0x12, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x66, 0x6c,
0x6f, 0x61, 0x74, 0x38, 0x56, 0x61, 0x6c, 0x22, 0x86, 0x01, 0x0a, 0x16, 0x56, 0x61, 0x72, 0x69,
0x61, 0x6e, 0x74, 0x54, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x44, 0x61, 0x74, 0x61, 0x50, 0x72, 0x6f,
0x74, 0x6f, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x79, 0x70, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12,
0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28,
0x0c, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x33, 0x0a, 0x07, 0x74,
0x65, 0x6e, 0x73, 0x6f, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x74,
0x66, 0x73, 0x65, 0x72, 0x76, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x6e, 0x73,
0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x07, 0x74, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x73,
0x42, 0x2c, 0x5a, 0x2a, 0x64, 0x37, 0x79, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70,
0x6b, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x74, 0x66, 0x73, 0x65, 0x72, 0x76, 0x69, 0x6e,
0x67, 0x2f, 0x76, 0x31, 0x3b, 0x74, 0x66, 0x73, 0x65, 0x72, 0x76, 0x69, 0x6e, 0x67, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_pkg_apis_tfserving_v1_tensor_proto_rawDescOnce sync.Once
file_pkg_apis_tfserving_v1_tensor_proto_rawDescData = file_pkg_apis_tfserving_v1_tensor_proto_rawDesc
)
func file_pkg_apis_tfserving_v1_tensor_proto_rawDescGZIP() []byte {
file_pkg_apis_tfserving_v1_tensor_proto_rawDescOnce.Do(func() {
file_pkg_apis_tfserving_v1_tensor_proto_rawDescData = protoimpl.X.CompressGZIP(file_pkg_apis_tfserving_v1_tensor_proto_rawDescData)
})
return file_pkg_apis_tfserving_v1_tensor_proto_rawDescData
}
var file_pkg_apis_tfserving_v1_tensor_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_pkg_apis_tfserving_v1_tensor_proto_goTypes = []interface{}{
(*TensorProto)(nil), // 0: tfserving.v1.TensorProto
(*VariantTensorDataProto)(nil), // 1: tfserving.v1.VariantTensorDataProto
(DataType)(0), // 2: tfserving.v1.DataType
(*TensorShapeProto)(nil), // 3: tfserving.v1.TensorShapeProto
(*ResourceHandleProto)(nil), // 4: tfserving.v1.ResourceHandleProto
}
var file_pkg_apis_tfserving_v1_tensor_proto_depIdxs = []int32{
2, // 0: tfserving.v1.TensorProto.dtype:type_name -> tfserving.v1.DataType
3, // 1: tfserving.v1.TensorProto.tensor_shape:type_name -> tfserving.v1.TensorShapeProto
4, // 2: tfserving.v1.TensorProto.resource_handle_val:type_name -> tfserving.v1.ResourceHandleProto
1, // 3: tfserving.v1.TensorProto.variant_val:type_name -> tfserving.v1.VariantTensorDataProto
0, // 4: tfserving.v1.VariantTensorDataProto.tensors:type_name -> tfserving.v1.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_pkg_apis_tfserving_v1_tensor_proto_init() }
func file_pkg_apis_tfserving_v1_tensor_proto_init() {
if File_pkg_apis_tfserving_v1_tensor_proto != nil {
return
}
file_pkg_apis_tfserving_v1_resource_handle_proto_init()
file_pkg_apis_tfserving_v1_tensor_shape_proto_init()
file_pkg_apis_tfserving_v1_types_proto_init()
if !protoimpl.UnsafeEnabled {
file_pkg_apis_tfserving_v1_tensor_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TensorProto); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_pkg_apis_tfserving_v1_tensor_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*VariantTensorDataProto); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_pkg_apis_tfserving_v1_tensor_proto_rawDesc,
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_pkg_apis_tfserving_v1_tensor_proto_goTypes,
DependencyIndexes: file_pkg_apis_tfserving_v1_tensor_proto_depIdxs,
MessageInfos: file_pkg_apis_tfserving_v1_tensor_proto_msgTypes,
}.Build()
File_pkg_apis_tfserving_v1_tensor_proto = out.File
file_pkg_apis_tfserving_v1_tensor_proto_rawDesc = nil
file_pkg_apis_tfserving_v1_tensor_proto_goTypes = nil
file_pkg_apis_tfserving_v1_tensor_proto_depIdxs = nil
}

View File

@ -0,0 +1,380 @@
// Code generated by protoc-gen-validate. DO NOT EDIT.
// source: pkg/apis/tfserving/v1/tensor.proto
package tfserving
import (
"bytes"
"errors"
"fmt"
"net"
"net/mail"
"net/url"
"regexp"
"sort"
"strings"
"time"
"unicode/utf8"
"google.golang.org/protobuf/types/known/anypb"
)
// ensure the imports are used
var (
_ = bytes.MinRead
_ = errors.New("")
_ = fmt.Print
_ = utf8.UTFMax
_ = (*regexp.Regexp)(nil)
_ = (*strings.Reader)(nil)
_ = net.IPv4len
_ = time.Duration(0)
_ = (*url.URL)(nil)
_ = (*mail.Address)(nil)
_ = anypb.Any{}
_ = sort.Sort
)
// Validate checks the field values on TensorProto with the rules defined in
// the proto definition for this message. If any rules are violated, the first
// error encountered is returned, or nil if there are no violations.
func (m *TensorProto) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on TensorProto with the rules defined in
// the proto definition for this message. If any rules are violated, the
// result is a list of violation errors wrapped in TensorProtoMultiError, or
// nil if none found.
func (m *TensorProto) ValidateAll() error {
return m.validate(true)
}
func (m *TensorProto) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
// no validation rules for Dtype
if all {
switch v := interface{}(m.GetTensorShape()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, TensorProtoValidationError{
field: "TensorShape",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, TensorProtoValidationError{
field: "TensorShape",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetTensorShape()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return TensorProtoValidationError{
field: "TensorShape",
reason: "embedded message failed validation",
cause: err,
}
}
}
// no validation rules for VersionNumber
// no validation rules for TensorContent
for idx, item := range m.GetResourceHandleVal() {
_, _ = idx, item
if all {
switch v := interface{}(item).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, TensorProtoValidationError{
field: fmt.Sprintf("ResourceHandleVal[%v]", idx),
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, TensorProtoValidationError{
field: fmt.Sprintf("ResourceHandleVal[%v]", idx),
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return TensorProtoValidationError{
field: fmt.Sprintf("ResourceHandleVal[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
for idx, item := range m.GetVariantVal() {
_, _ = idx, item
if all {
switch v := interface{}(item).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, TensorProtoValidationError{
field: fmt.Sprintf("VariantVal[%v]", idx),
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, TensorProtoValidationError{
field: fmt.Sprintf("VariantVal[%v]", idx),
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return TensorProtoValidationError{
field: fmt.Sprintf("VariantVal[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
// no validation rules for Float8Val
if len(errors) > 0 {
return TensorProtoMultiError(errors)
}
return nil
}
// TensorProtoMultiError is an error wrapping multiple validation errors
// returned by TensorProto.ValidateAll() if the designated constraints aren't met.
type TensorProtoMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m TensorProtoMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m TensorProtoMultiError) AllErrors() []error { return m }
// TensorProtoValidationError is the validation error returned by
// TensorProto.Validate if the designated constraints aren't met.
type TensorProtoValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e TensorProtoValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e TensorProtoValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e TensorProtoValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e TensorProtoValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e TensorProtoValidationError) ErrorName() string { return "TensorProtoValidationError" }
// Error satisfies the builtin error interface
func (e TensorProtoValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sTensorProto.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = TensorProtoValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = TensorProtoValidationError{}
// Validate checks the field values on VariantTensorDataProto with the rules
// defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *VariantTensorDataProto) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on VariantTensorDataProto with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// VariantTensorDataProtoMultiError, or nil if none found.
func (m *VariantTensorDataProto) ValidateAll() error {
return m.validate(true)
}
func (m *VariantTensorDataProto) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
// no validation rules for TypeName
// no validation rules for Metadata
for idx, item := range m.GetTensors() {
_, _ = idx, item
if all {
switch v := interface{}(item).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, VariantTensorDataProtoValidationError{
field: fmt.Sprintf("Tensors[%v]", idx),
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, VariantTensorDataProtoValidationError{
field: fmt.Sprintf("Tensors[%v]", idx),
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return VariantTensorDataProtoValidationError{
field: fmt.Sprintf("Tensors[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
if len(errors) > 0 {
return VariantTensorDataProtoMultiError(errors)
}
return nil
}
// VariantTensorDataProtoMultiError is an error wrapping multiple validation
// errors returned by VariantTensorDataProto.ValidateAll() if the designated
// constraints aren't met.
type VariantTensorDataProtoMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m VariantTensorDataProtoMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m VariantTensorDataProtoMultiError) AllErrors() []error { return m }
// VariantTensorDataProtoValidationError is the validation error returned by
// VariantTensorDataProto.Validate if the designated constraints aren't met.
type VariantTensorDataProtoValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e VariantTensorDataProtoValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e VariantTensorDataProtoValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e VariantTensorDataProtoValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e VariantTensorDataProtoValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e VariantTensorDataProtoValidationError) ErrorName() string {
return "VariantTensorDataProtoValidationError"
}
// Error satisfies the builtin error interface
func (e VariantTensorDataProtoValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sVariantTensorDataProto.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = VariantTensorDataProtoValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = VariantTensorDataProtoValidationError{}

View File

@ -0,0 +1,112 @@
/*
* Copyright 2023 The Dragonfly Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
syntax = "proto3";
package tfserving.v1;
import "pkg/apis/tfserving/v1/resource_handle.proto";
import "pkg/apis/tfserving/v1/tensor_shape.proto";
import "pkg/apis/tfserving/v1/types.proto";
option go_package = "d7y.io/api/pkg/apis/tfserving/v1;tfserving";
// Protocol buffer representing a tensor.
message TensorProto {
tfserving.v1.DataType dtype = 1;
// Shape of the tensor. TODO(touts): sort out the 0-rank issues.
tfserving.v1.TensorShapeProto tensor_shape = 2;
// Only one of the representations below is set, one of "tensor_contents" and
// the "xxx_val" attributes. We are not using oneof because as oneofs cannot
// contain repeated fields it would require another extra set of messages.
// 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.
int32 version_number = 3;
// 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.
bytes tensor_content = 4;
// Type specific representations that make it easy to create tensor protos in
// all languages. Only the representation corresponding to "dtype" can
// be set. The values hold the flattened representation of the tensor in
// row major order.
// DT_HALF, DT_BFLOAT16. Note that since protobuf has no int16 type, we'll
// have some pointless zero padding for each value here.
repeated int32 half_val = 13 [packed = true];
// DT_FLOAT.
repeated float float_val = 5 [packed = true];
// DT_DOUBLE.
repeated double double_val = 6 [packed = true];
// DT_INT32, DT_INT16, DT_UINT16, DT_INT8, DT_UINT8.
repeated int32 int_val = 7 [packed = true];
// DT_STRING
repeated bytes string_val = 8;
// DT_COMPLEX64. scomplex_val(2*i) and scomplex_val(2*i+1) are real
// and imaginary parts of i-th single precision complex.
repeated float scomplex_val = 9 [packed = true];
// DT_INT64
repeated int64 int64_val = 10 [packed = true];
// DT_BOOL
repeated bool bool_val = 11 [packed = true];
// DT_COMPLEX128. dcomplex_val(2*i) and dcomplex_val(2*i+1) are real
// and imaginary parts of i-th double precision complex.
repeated double dcomplex_val = 12 [packed = true];
// DT_RESOURCE
repeated tfserving.v1.ResourceHandleProto resource_handle_val = 14;
// DT_VARIANT
repeated VariantTensorDataProto variant_val = 15;
// DT_UINT32
repeated uint32 uint32_val = 16 [packed = true];
// DT_UINT64
repeated uint64 uint64_val = 17 [packed = true];
// DT_FLOAT8_*, use variable-sized set of bytes
// (i.e. the equivalent of repeated uint8, if such a thing existed).
bytes float8_val = 18;
}
// Protocol buffer representing the serialization format of DT_VARIANT tensors.
message VariantTensorDataProto {
// Name of the type of objects being serialized.
string type_name = 1;
// Portions of the object that are not Tensors.
bytes metadata = 2;
// Tensors contained within objects being serialized.
repeated tfserving.v1.TensorProto tensors = 3;
}

View File

@ -0,0 +1,269 @@
//
// Copyright 2023 The Dragonfly Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT 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.28.1
// protoc v3.21.6
// source: pkg/apis/tfserving/v1/tensor_shape.proto
package tfserving
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
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
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// 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"`
}
func (x *TensorShapeProto) Reset() {
*x = TensorShapeProto{}
if protoimpl.UnsafeEnabled {
mi := &file_pkg_apis_tfserving_v1_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_pkg_apis_tfserving_v1_tensor_shape_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && 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_pkg_apis_tfserving_v1_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
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// 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"`
}
func (x *TensorShapeProto_Dim) Reset() {
*x = TensorShapeProto_Dim{}
if protoimpl.UnsafeEnabled {
mi := &file_pkg_apis_tfserving_v1_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_pkg_apis_tfserving_v1_tensor_shape_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && 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_pkg_apis_tfserving_v1_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_pkg_apis_tfserving_v1_tensor_shape_proto protoreflect.FileDescriptor
var file_pkg_apis_tfserving_v1_tensor_shape_proto_rawDesc = []byte{
0x0a, 0x28, 0x70, 0x6b, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x74, 0x66, 0x73, 0x65, 0x72,
0x76, 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x5f, 0x73,
0x68, 0x61, 0x70, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x74, 0x66, 0x73, 0x65,
0x72, 0x76, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x22, 0x9a, 0x01, 0x0a, 0x10, 0x54, 0x65, 0x6e,
0x73, 0x6f, 0x72, 0x53, 0x68, 0x61, 0x70, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x34, 0x0a,
0x03, 0x64, 0x69, 0x6d, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x74, 0x66, 0x73,
0x65, 0x72, 0x76, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x6e, 0x73, 0x6f, 0x72,
0x53, 0x68, 0x61, 0x70, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x69, 0x6d, 0x52, 0x03,
0x64, 0x69, 0x6d, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x5f, 0x72,
0x61, 0x6e, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x75, 0x6e, 0x6b, 0x6e, 0x6f,
0x77, 0x6e, 0x52, 0x61, 0x6e, 0x6b, 0x1a, 0x2d, 0x0a, 0x03, 0x44, 0x69, 0x6d, 0x12, 0x12, 0x0a,
0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x69, 0x7a,
0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
0x04, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x2c, 0x5a, 0x2a, 0x64, 0x37, 0x79, 0x2e, 0x69, 0x6f, 0x2f,
0x61, 0x70, 0x69, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x74, 0x66, 0x73,
0x65, 0x72, 0x76, 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x3b, 0x74, 0x66, 0x73, 0x65, 0x72, 0x76,
0x69, 0x6e, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_pkg_apis_tfserving_v1_tensor_shape_proto_rawDescOnce sync.Once
file_pkg_apis_tfserving_v1_tensor_shape_proto_rawDescData = file_pkg_apis_tfserving_v1_tensor_shape_proto_rawDesc
)
func file_pkg_apis_tfserving_v1_tensor_shape_proto_rawDescGZIP() []byte {
file_pkg_apis_tfserving_v1_tensor_shape_proto_rawDescOnce.Do(func() {
file_pkg_apis_tfserving_v1_tensor_shape_proto_rawDescData = protoimpl.X.CompressGZIP(file_pkg_apis_tfserving_v1_tensor_shape_proto_rawDescData)
})
return file_pkg_apis_tfserving_v1_tensor_shape_proto_rawDescData
}
var file_pkg_apis_tfserving_v1_tensor_shape_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_pkg_apis_tfserving_v1_tensor_shape_proto_goTypes = []interface{}{
(*TensorShapeProto)(nil), // 0: tfserving.v1.TensorShapeProto
(*TensorShapeProto_Dim)(nil), // 1: tfserving.v1.TensorShapeProto.Dim
}
var file_pkg_apis_tfserving_v1_tensor_shape_proto_depIdxs = []int32{
1, // 0: tfserving.v1.TensorShapeProto.dim:type_name -> tfserving.v1.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_pkg_apis_tfserving_v1_tensor_shape_proto_init() }
func file_pkg_apis_tfserving_v1_tensor_shape_proto_init() {
if File_pkg_apis_tfserving_v1_tensor_shape_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_pkg_apis_tfserving_v1_tensor_shape_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TensorShapeProto); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_pkg_apis_tfserving_v1_tensor_shape_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TensorShapeProto_Dim); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_pkg_apis_tfserving_v1_tensor_shape_proto_rawDesc,
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_pkg_apis_tfserving_v1_tensor_shape_proto_goTypes,
DependencyIndexes: file_pkg_apis_tfserving_v1_tensor_shape_proto_depIdxs,
MessageInfos: file_pkg_apis_tfserving_v1_tensor_shape_proto_msgTypes,
}.Build()
File_pkg_apis_tfserving_v1_tensor_shape_proto = out.File
file_pkg_apis_tfserving_v1_tensor_shape_proto_rawDesc = nil
file_pkg_apis_tfserving_v1_tensor_shape_proto_goTypes = nil
file_pkg_apis_tfserving_v1_tensor_shape_proto_depIdxs = nil
}

View File

@ -0,0 +1,278 @@
// Code generated by protoc-gen-validate. DO NOT EDIT.
// source: pkg/apis/tfserving/v1/tensor_shape.proto
package tfserving
import (
"bytes"
"errors"
"fmt"
"net"
"net/mail"
"net/url"
"regexp"
"sort"
"strings"
"time"
"unicode/utf8"
"google.golang.org/protobuf/types/known/anypb"
)
// ensure the imports are used
var (
_ = bytes.MinRead
_ = errors.New("")
_ = fmt.Print
_ = utf8.UTFMax
_ = (*regexp.Regexp)(nil)
_ = (*strings.Reader)(nil)
_ = net.IPv4len
_ = time.Duration(0)
_ = (*url.URL)(nil)
_ = (*mail.Address)(nil)
_ = anypb.Any{}
_ = sort.Sort
)
// Validate checks the field values on TensorShapeProto with the rules defined
// in the proto definition for this message. If any rules are violated, the
// first error encountered is returned, or nil if there are no violations.
func (m *TensorShapeProto) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on TensorShapeProto with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// TensorShapeProtoMultiError, or nil if none found.
func (m *TensorShapeProto) ValidateAll() error {
return m.validate(true)
}
func (m *TensorShapeProto) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
for idx, item := range m.GetDim() {
_, _ = idx, item
if all {
switch v := interface{}(item).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, TensorShapeProtoValidationError{
field: fmt.Sprintf("Dim[%v]", idx),
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, TensorShapeProtoValidationError{
field: fmt.Sprintf("Dim[%v]", idx),
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return TensorShapeProtoValidationError{
field: fmt.Sprintf("Dim[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
// no validation rules for UnknownRank
if len(errors) > 0 {
return TensorShapeProtoMultiError(errors)
}
return nil
}
// TensorShapeProtoMultiError is an error wrapping multiple validation errors
// returned by TensorShapeProto.ValidateAll() if the designated constraints
// aren't met.
type TensorShapeProtoMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m TensorShapeProtoMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m TensorShapeProtoMultiError) AllErrors() []error { return m }
// TensorShapeProtoValidationError is the validation error returned by
// TensorShapeProto.Validate if the designated constraints aren't met.
type TensorShapeProtoValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e TensorShapeProtoValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e TensorShapeProtoValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e TensorShapeProtoValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e TensorShapeProtoValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e TensorShapeProtoValidationError) ErrorName() string { return "TensorShapeProtoValidationError" }
// Error satisfies the builtin error interface
func (e TensorShapeProtoValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sTensorShapeProto.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = TensorShapeProtoValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = TensorShapeProtoValidationError{}
// Validate checks the field values on TensorShapeProto_Dim with the rules
// defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *TensorShapeProto_Dim) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on TensorShapeProto_Dim with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// TensorShapeProto_DimMultiError, or nil if none found.
func (m *TensorShapeProto_Dim) ValidateAll() error {
return m.validate(true)
}
func (m *TensorShapeProto_Dim) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
// no validation rules for Size
// no validation rules for Name
if len(errors) > 0 {
return TensorShapeProto_DimMultiError(errors)
}
return nil
}
// TensorShapeProto_DimMultiError is an error wrapping multiple validation
// errors returned by TensorShapeProto_Dim.ValidateAll() if the designated
// constraints aren't met.
type TensorShapeProto_DimMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m TensorShapeProto_DimMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m TensorShapeProto_DimMultiError) AllErrors() []error { return m }
// TensorShapeProto_DimValidationError is the validation error returned by
// TensorShapeProto_Dim.Validate if the designated constraints aren't met.
type TensorShapeProto_DimValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e TensorShapeProto_DimValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e TensorShapeProto_DimValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e TensorShapeProto_DimValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e TensorShapeProto_DimValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e TensorShapeProto_DimValidationError) ErrorName() string {
return "TensorShapeProto_DimValidationError"
}
// Error satisfies the builtin error interface
func (e TensorShapeProto_DimValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sTensorShapeProto_Dim.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = TensorShapeProto_DimValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = TensorShapeProto_DimValidationError{}

View File

@ -0,0 +1,57 @@
/*
* Copyright 2023 The Dragonfly Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
syntax = "proto3";
package tfserving.v1;
option go_package = "d7y.io/api/pkg/apis/tfserving/v1;tfserving";
// Dimensions of a tensor.
message TensorShapeProto {
// One dimension of the tensor.
message Dim {
// 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.
int64 size = 1;
// Optional name of the tensor dimension.
string name = 2;
}
// 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.
repeated Dim dim = 2;
// If true, the number of dimensions in the shape is unknown.
//
// If true, "dim.size()" must be 0.
bool unknown_rank = 3;
}

View File

@ -0,0 +1,425 @@
//
// Copyright 2023 The Dragonfly Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT 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.28.1
// protoc v3.21.6
// source: pkg/apis/tfserving/v1/types.proto
package tfserving
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
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.
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
DataType_DT_FLOAT8_E5M2 DataType = 24 // 5 exponent bits, 2 mantissa bits.
DataType_DT_FLOAT8_E4M3FN DataType = 25 // 4 exponent bits, 3 mantissa bits, finite-only, with
// 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
DataType_DT_FLOAT8_E5M2_REF DataType = 124
DataType_DT_FLOAT8_E4M3FN_REF DataType = 125
)
// 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",
24: "DT_FLOAT8_E5M2",
25: "DT_FLOAT8_E4M3FN",
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",
124: "DT_FLOAT8_E5M2_REF",
125: "DT_FLOAT8_E4M3FN_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_FLOAT8_E5M2": 24,
"DT_FLOAT8_E4M3FN": 25,
"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,
"DT_FLOAT8_E5M2_REF": 124,
"DT_FLOAT8_E4M3FN_REF": 125,
}
)
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_pkg_apis_tfserving_v1_types_proto_enumTypes[0].Descriptor()
}
func (DataType) Type() protoreflect.EnumType {
return &file_pkg_apis_tfserving_v1_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_pkg_apis_tfserving_v1_types_proto_rawDescGZIP(), []int{0}
}
// Represents a serialized tf.dtypes.Dtype
type SerializedDType struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Datatype DataType `protobuf:"varint,1,opt,name=datatype,proto3,enum=tfserving.v1.DataType" json:"datatype,omitempty"`
}
func (x *SerializedDType) Reset() {
*x = SerializedDType{}
if protoimpl.UnsafeEnabled {
mi := &file_pkg_apis_tfserving_v1_types_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SerializedDType) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SerializedDType) ProtoMessage() {}
func (x *SerializedDType) ProtoReflect() protoreflect.Message {
mi := &file_pkg_apis_tfserving_v1_types_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SerializedDType.ProtoReflect.Descriptor instead.
func (*SerializedDType) Descriptor() ([]byte, []int) {
return file_pkg_apis_tfserving_v1_types_proto_rawDescGZIP(), []int{0}
}
func (x *SerializedDType) GetDatatype() DataType {
if x != nil {
return x.Datatype
}
return DataType_DT_INVALID
}
var File_pkg_apis_tfserving_v1_types_proto protoreflect.FileDescriptor
var file_pkg_apis_tfserving_v1_types_proto_rawDesc = []byte{
0x0a, 0x21, 0x70, 0x6b, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x74, 0x66, 0x73, 0x65, 0x72,
0x76, 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x74, 0x66, 0x73, 0x65, 0x72, 0x76, 0x69, 0x6e, 0x67, 0x2e, 0x76,
0x31, 0x22, 0x45, 0x0a, 0x0f, 0x53, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x44,
0x54, 0x79, 0x70, 0x65, 0x12, 0x32, 0x0a, 0x08, 0x64, 0x61, 0x74, 0x61, 0x74, 0x79, 0x70, 0x65,
0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x74, 0x66, 0x73, 0x65, 0x72, 0x76, 0x69,
0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x54, 0x79, 0x70, 0x65, 0x52, 0x08,
0x64, 0x61, 0x74, 0x61, 0x74, 0x79, 0x70, 0x65, 0x2a, 0x86, 0x07, 0x0a, 0x08, 0x44, 0x61, 0x74,
0x61, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0e, 0x0a, 0x0a, 0x44, 0x54, 0x5f, 0x49, 0x4e, 0x56, 0x41,
0x4c, 0x49, 0x44, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x54, 0x5f, 0x46, 0x4c, 0x4f, 0x41,
0x54, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x44, 0x54, 0x5f, 0x44, 0x4f, 0x55, 0x42, 0x4c, 0x45,
0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x54, 0x5f, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x10, 0x03,
0x12, 0x0c, 0x0a, 0x08, 0x44, 0x54, 0x5f, 0x55, 0x49, 0x4e, 0x54, 0x38, 0x10, 0x04, 0x12, 0x0c,
0x0a, 0x08, 0x44, 0x54, 0x5f, 0x49, 0x4e, 0x54, 0x31, 0x36, 0x10, 0x05, 0x12, 0x0b, 0x0a, 0x07,
0x44, 0x54, 0x5f, 0x49, 0x4e, 0x54, 0x38, 0x10, 0x06, 0x12, 0x0d, 0x0a, 0x09, 0x44, 0x54, 0x5f,
0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x07, 0x12, 0x10, 0x0a, 0x0c, 0x44, 0x54, 0x5f, 0x43,
0x4f, 0x4d, 0x50, 0x4c, 0x45, 0x58, 0x36, 0x34, 0x10, 0x08, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x54,
0x5f, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x10, 0x09, 0x12, 0x0b, 0x0a, 0x07, 0x44, 0x54, 0x5f, 0x42,
0x4f, 0x4f, 0x4c, 0x10, 0x0a, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x54, 0x5f, 0x51, 0x49, 0x4e, 0x54,
0x38, 0x10, 0x0b, 0x12, 0x0d, 0x0a, 0x09, 0x44, 0x54, 0x5f, 0x51, 0x55, 0x49, 0x4e, 0x54, 0x38,
0x10, 0x0c, 0x12, 0x0d, 0x0a, 0x09, 0x44, 0x54, 0x5f, 0x51, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x10,
0x0d, 0x12, 0x0f, 0x0a, 0x0b, 0x44, 0x54, 0x5f, 0x42, 0x46, 0x4c, 0x4f, 0x41, 0x54, 0x31, 0x36,
0x10, 0x0e, 0x12, 0x0d, 0x0a, 0x09, 0x44, 0x54, 0x5f, 0x51, 0x49, 0x4e, 0x54, 0x31, 0x36, 0x10,
0x0f, 0x12, 0x0e, 0x0a, 0x0a, 0x44, 0x54, 0x5f, 0x51, 0x55, 0x49, 0x4e, 0x54, 0x31, 0x36, 0x10,
0x10, 0x12, 0x0d, 0x0a, 0x09, 0x44, 0x54, 0x5f, 0x55, 0x49, 0x4e, 0x54, 0x31, 0x36, 0x10, 0x11,
0x12, 0x11, 0x0a, 0x0d, 0x44, 0x54, 0x5f, 0x43, 0x4f, 0x4d, 0x50, 0x4c, 0x45, 0x58, 0x31, 0x32,
0x38, 0x10, 0x12, 0x12, 0x0b, 0x0a, 0x07, 0x44, 0x54, 0x5f, 0x48, 0x41, 0x4c, 0x46, 0x10, 0x13,
0x12, 0x0f, 0x0a, 0x0b, 0x44, 0x54, 0x5f, 0x52, 0x45, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x10,
0x14, 0x12, 0x0e, 0x0a, 0x0a, 0x44, 0x54, 0x5f, 0x56, 0x41, 0x52, 0x49, 0x41, 0x4e, 0x54, 0x10,
0x15, 0x12, 0x0d, 0x0a, 0x09, 0x44, 0x54, 0x5f, 0x55, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x10, 0x16,
0x12, 0x0d, 0x0a, 0x09, 0x44, 0x54, 0x5f, 0x55, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x10, 0x17, 0x12,
0x12, 0x0a, 0x0e, 0x44, 0x54, 0x5f, 0x46, 0x4c, 0x4f, 0x41, 0x54, 0x38, 0x5f, 0x45, 0x35, 0x4d,
0x32, 0x10, 0x18, 0x12, 0x14, 0x0a, 0x10, 0x44, 0x54, 0x5f, 0x46, 0x4c, 0x4f, 0x41, 0x54, 0x38,
0x5f, 0x45, 0x34, 0x4d, 0x33, 0x46, 0x4e, 0x10, 0x19, 0x12, 0x10, 0x0a, 0x0c, 0x44, 0x54, 0x5f,
0x46, 0x4c, 0x4f, 0x41, 0x54, 0x5f, 0x52, 0x45, 0x46, 0x10, 0x65, 0x12, 0x11, 0x0a, 0x0d, 0x44,
0x54, 0x5f, 0x44, 0x4f, 0x55, 0x42, 0x4c, 0x45, 0x5f, 0x52, 0x45, 0x46, 0x10, 0x66, 0x12, 0x10,
0x0a, 0x0c, 0x44, 0x54, 0x5f, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x5f, 0x52, 0x45, 0x46, 0x10, 0x67,
0x12, 0x10, 0x0a, 0x0c, 0x44, 0x54, 0x5f, 0x55, 0x49, 0x4e, 0x54, 0x38, 0x5f, 0x52, 0x45, 0x46,
0x10, 0x68, 0x12, 0x10, 0x0a, 0x0c, 0x44, 0x54, 0x5f, 0x49, 0x4e, 0x54, 0x31, 0x36, 0x5f, 0x52,
0x45, 0x46, 0x10, 0x69, 0x12, 0x0f, 0x0a, 0x0b, 0x44, 0x54, 0x5f, 0x49, 0x4e, 0x54, 0x38, 0x5f,
0x52, 0x45, 0x46, 0x10, 0x6a, 0x12, 0x11, 0x0a, 0x0d, 0x44, 0x54, 0x5f, 0x53, 0x54, 0x52, 0x49,
0x4e, 0x47, 0x5f, 0x52, 0x45, 0x46, 0x10, 0x6b, 0x12, 0x14, 0x0a, 0x10, 0x44, 0x54, 0x5f, 0x43,
0x4f, 0x4d, 0x50, 0x4c, 0x45, 0x58, 0x36, 0x34, 0x5f, 0x52, 0x45, 0x46, 0x10, 0x6c, 0x12, 0x10,
0x0a, 0x0c, 0x44, 0x54, 0x5f, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x5f, 0x52, 0x45, 0x46, 0x10, 0x6d,
0x12, 0x0f, 0x0a, 0x0b, 0x44, 0x54, 0x5f, 0x42, 0x4f, 0x4f, 0x4c, 0x5f, 0x52, 0x45, 0x46, 0x10,
0x6e, 0x12, 0x10, 0x0a, 0x0c, 0x44, 0x54, 0x5f, 0x51, 0x49, 0x4e, 0x54, 0x38, 0x5f, 0x52, 0x45,
0x46, 0x10, 0x6f, 0x12, 0x11, 0x0a, 0x0d, 0x44, 0x54, 0x5f, 0x51, 0x55, 0x49, 0x4e, 0x54, 0x38,
0x5f, 0x52, 0x45, 0x46, 0x10, 0x70, 0x12, 0x11, 0x0a, 0x0d, 0x44, 0x54, 0x5f, 0x51, 0x49, 0x4e,
0x54, 0x33, 0x32, 0x5f, 0x52, 0x45, 0x46, 0x10, 0x71, 0x12, 0x13, 0x0a, 0x0f, 0x44, 0x54, 0x5f,
0x42, 0x46, 0x4c, 0x4f, 0x41, 0x54, 0x31, 0x36, 0x5f, 0x52, 0x45, 0x46, 0x10, 0x72, 0x12, 0x11,
0x0a, 0x0d, 0x44, 0x54, 0x5f, 0x51, 0x49, 0x4e, 0x54, 0x31, 0x36, 0x5f, 0x52, 0x45, 0x46, 0x10,
0x73, 0x12, 0x12, 0x0a, 0x0e, 0x44, 0x54, 0x5f, 0x51, 0x55, 0x49, 0x4e, 0x54, 0x31, 0x36, 0x5f,
0x52, 0x45, 0x46, 0x10, 0x74, 0x12, 0x11, 0x0a, 0x0d, 0x44, 0x54, 0x5f, 0x55, 0x49, 0x4e, 0x54,
0x31, 0x36, 0x5f, 0x52, 0x45, 0x46, 0x10, 0x75, 0x12, 0x15, 0x0a, 0x11, 0x44, 0x54, 0x5f, 0x43,
0x4f, 0x4d, 0x50, 0x4c, 0x45, 0x58, 0x31, 0x32, 0x38, 0x5f, 0x52, 0x45, 0x46, 0x10, 0x76, 0x12,
0x0f, 0x0a, 0x0b, 0x44, 0x54, 0x5f, 0x48, 0x41, 0x4c, 0x46, 0x5f, 0x52, 0x45, 0x46, 0x10, 0x77,
0x12, 0x13, 0x0a, 0x0f, 0x44, 0x54, 0x5f, 0x52, 0x45, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f,
0x52, 0x45, 0x46, 0x10, 0x78, 0x12, 0x12, 0x0a, 0x0e, 0x44, 0x54, 0x5f, 0x56, 0x41, 0x52, 0x49,
0x41, 0x4e, 0x54, 0x5f, 0x52, 0x45, 0x46, 0x10, 0x79, 0x12, 0x11, 0x0a, 0x0d, 0x44, 0x54, 0x5f,
0x55, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x5f, 0x52, 0x45, 0x46, 0x10, 0x7a, 0x12, 0x11, 0x0a, 0x0d,
0x44, 0x54, 0x5f, 0x55, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x5f, 0x52, 0x45, 0x46, 0x10, 0x7b, 0x12,
0x16, 0x0a, 0x12, 0x44, 0x54, 0x5f, 0x46, 0x4c, 0x4f, 0x41, 0x54, 0x38, 0x5f, 0x45, 0x35, 0x4d,
0x32, 0x5f, 0x52, 0x45, 0x46, 0x10, 0x7c, 0x12, 0x18, 0x0a, 0x14, 0x44, 0x54, 0x5f, 0x46, 0x4c,
0x4f, 0x41, 0x54, 0x38, 0x5f, 0x45, 0x34, 0x4d, 0x33, 0x46, 0x4e, 0x5f, 0x52, 0x45, 0x46, 0x10,
0x7d, 0x42, 0x2c, 0x5a, 0x2a, 0x64, 0x37, 0x79, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f,
0x70, 0x6b, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x74, 0x66, 0x73, 0x65, 0x72, 0x76, 0x69,
0x6e, 0x67, 0x2f, 0x76, 0x31, 0x3b, 0x74, 0x66, 0x73, 0x65, 0x72, 0x76, 0x69, 0x6e, 0x67, 0x62,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_pkg_apis_tfserving_v1_types_proto_rawDescOnce sync.Once
file_pkg_apis_tfserving_v1_types_proto_rawDescData = file_pkg_apis_tfserving_v1_types_proto_rawDesc
)
func file_pkg_apis_tfserving_v1_types_proto_rawDescGZIP() []byte {
file_pkg_apis_tfserving_v1_types_proto_rawDescOnce.Do(func() {
file_pkg_apis_tfserving_v1_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_pkg_apis_tfserving_v1_types_proto_rawDescData)
})
return file_pkg_apis_tfserving_v1_types_proto_rawDescData
}
var file_pkg_apis_tfserving_v1_types_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_pkg_apis_tfserving_v1_types_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_pkg_apis_tfserving_v1_types_proto_goTypes = []interface{}{
(DataType)(0), // 0: tfserving.v1.DataType
(*SerializedDType)(nil), // 1: tfserving.v1.SerializedDType
}
var file_pkg_apis_tfserving_v1_types_proto_depIdxs = []int32{
0, // 0: tfserving.v1.SerializedDType.datatype:type_name -> tfserving.v1.DataType
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_pkg_apis_tfserving_v1_types_proto_init() }
func file_pkg_apis_tfserving_v1_types_proto_init() {
if File_pkg_apis_tfserving_v1_types_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_pkg_apis_tfserving_v1_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SerializedDType); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_pkg_apis_tfserving_v1_types_proto_rawDesc,
NumEnums: 1,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_pkg_apis_tfserving_v1_types_proto_goTypes,
DependencyIndexes: file_pkg_apis_tfserving_v1_types_proto_depIdxs,
EnumInfos: file_pkg_apis_tfserving_v1_types_proto_enumTypes,
MessageInfos: file_pkg_apis_tfserving_v1_types_proto_msgTypes,
}.Build()
File_pkg_apis_tfserving_v1_types_proto = out.File
file_pkg_apis_tfserving_v1_types_proto_rawDesc = nil
file_pkg_apis_tfserving_v1_types_proto_goTypes = nil
file_pkg_apis_tfserving_v1_types_proto_depIdxs = nil
}

View File

@ -0,0 +1,138 @@
// Code generated by protoc-gen-validate. DO NOT EDIT.
// source: pkg/apis/tfserving/v1/types.proto
package tfserving
import (
"bytes"
"errors"
"fmt"
"net"
"net/mail"
"net/url"
"regexp"
"sort"
"strings"
"time"
"unicode/utf8"
"google.golang.org/protobuf/types/known/anypb"
)
// ensure the imports are used
var (
_ = bytes.MinRead
_ = errors.New("")
_ = fmt.Print
_ = utf8.UTFMax
_ = (*regexp.Regexp)(nil)
_ = (*strings.Reader)(nil)
_ = net.IPv4len
_ = time.Duration(0)
_ = (*url.URL)(nil)
_ = (*mail.Address)(nil)
_ = anypb.Any{}
_ = sort.Sort
)
// Validate checks the field values on SerializedDType with the rules defined
// in the proto definition for this message. If any rules are violated, the
// first error encountered is returned, or nil if there are no violations.
func (m *SerializedDType) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on SerializedDType with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// SerializedDTypeMultiError, or nil if none found.
func (m *SerializedDType) ValidateAll() error {
return m.validate(true)
}
func (m *SerializedDType) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
// no validation rules for Datatype
if len(errors) > 0 {
return SerializedDTypeMultiError(errors)
}
return nil
}
// SerializedDTypeMultiError is an error wrapping multiple validation errors
// returned by SerializedDType.ValidateAll() if the designated constraints
// aren't met.
type SerializedDTypeMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m SerializedDTypeMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m SerializedDTypeMultiError) AllErrors() []error { return m }
// SerializedDTypeValidationError is the validation error returned by
// SerializedDType.Validate if the designated constraints aren't met.
type SerializedDTypeValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e SerializedDTypeValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e SerializedDTypeValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e SerializedDTypeValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e SerializedDTypeValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e SerializedDTypeValidationError) ErrorName() string { return "SerializedDTypeValidationError" }
// Error satisfies the builtin error interface
func (e SerializedDTypeValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sSerializedDType.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = SerializedDTypeValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = SerializedDTypeValidationError{}

View File

@ -0,0 +1,99 @@
/*
* Copyright 2023 The Dragonfly Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
syntax = "proto3";
package tfserving.v1;
option go_package = "d7y.io/api/pkg/apis/tfserving/v1;tfserving";
// (== suppress_warning documentation-presence ==)
// LINT.IfChange
enum DataType {
// Not a legal value for DataType. Used to indicate a DataType field
// has not been set.
DT_INVALID = 0;
// Data types that all computation devices are expected to be
// capable to support.
DT_FLOAT = 1;
DT_DOUBLE = 2;
DT_INT32 = 3;
DT_UINT8 = 4;
DT_INT16 = 5;
DT_INT8 = 6;
DT_STRING = 7;
DT_COMPLEX64 = 8; // Single-precision complex
DT_INT64 = 9;
DT_BOOL = 10;
DT_QINT8 = 11; // Quantized int8
DT_QUINT8 = 12; // Quantized uint8
DT_QINT32 = 13; // Quantized int32
DT_BFLOAT16 = 14; // Float32 truncated to 16 bits.
DT_QINT16 = 15; // Quantized int16
DT_QUINT16 = 16; // Quantized uint16
DT_UINT16 = 17;
DT_COMPLEX128 = 18; // Double-precision complex
DT_HALF = 19;
DT_RESOURCE = 20;
DT_VARIANT = 21; // Arbitrary C++ data types
DT_UINT32 = 22;
DT_UINT64 = 23;
DT_FLOAT8_E5M2 = 24; // 5 exponent bits, 2 mantissa bits.
DT_FLOAT8_E4M3FN = 25; // 4 exponent bits, 3 mantissa bits, finite-only, with
// 2 NaNs (0bS1111111).
// Do not use! These are only for parameters. Every enum above
// should have a corresponding value below (verified by types_test).
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;
DT_FLOAT8_E5M2_REF = 124;
DT_FLOAT8_E4M3FN_REF = 125;
}
// LINT.ThenChange(
// https://www.tensorflow.org/code/tensorflow/c/tf_datatype.h,
// https://www.tensorflow.org/code/tensorflow/go/tensor.go,
// https://www.tensorflow.org/code/tensorflow/core/framework/tensor.cc,
// https://www.tensorflow.org/code/tensorflow/core/framework/types.h,
// https://www.tensorflow.org/code/tensorflow/core/framework/types.cc,
// https://www.tensorflow.org/code/tensorflow/python/framework/dtypes.py,
// https://www.tensorflow.org/code/tensorflow/python/framework/function.py)
// Represents a serialized tf.dtypes.Dtype
message SerializedDType {
DataType datatype = 1;
}

View File

@ -1,54 +0,0 @@
/*
* Copyright 2023 The Dragonfly Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
syntax = "proto3";
package trainer;
import "google/protobuf/empty.proto";
// GNNRequest represents gnn model request of TrainRequest.
message GNNRequest {
// Dataset of training gnn.
bytes dataset = 1;
}
// MLPRequest represents mlp model request of TrainRequest.
message MLPRequest {
// Dataset of training mlp.
bytes dataset = 1;
}
// TrainRequest represents request of Train.
message TrainRequest {
// Scheduler hostname.
string hostname = 1;
// Scheduler ip.
string ip = 2;
// Scheduler cluster id.
uint64 cluster_id = 3;
oneof request {
GNNRequest gnn_request = 4;
MLPRequest mlp_request = 5;
}
}
// Trainer RPC Service.
service Trainer {
// Train trains models of scheduler using dataset.
rpc Train(stream TrainRequest) returns(google.protobuf.Empty);
}

View File

@ -1,287 +0,0 @@
/// GNNRequest represents gnn model request of TrainRequest.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GnnRequest {
/// Dataset of training gnn.
#[prost(bytes = "vec", tag = "1")]
pub dataset: ::prost::alloc::vec::Vec<u8>,
}
/// MLPRequest represents mlp model request of TrainRequest.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MlpRequest {
/// Dataset of training mlp.
#[prost(bytes = "vec", tag = "1")]
pub dataset: ::prost::alloc::vec::Vec<u8>,
}
/// TrainRequest represents request of Train.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TrainRequest {
/// Scheduler hostname.
#[prost(string, tag = "1")]
pub hostname: ::prost::alloc::string::String,
/// Scheduler ip.
#[prost(string, tag = "2")]
pub ip: ::prost::alloc::string::String,
/// Scheduler cluster id.
#[prost(uint64, tag = "3")]
pub cluster_id: u64,
#[prost(oneof = "train_request::Request", tags = "4, 5")]
pub request: ::core::option::Option<train_request::Request>,
}
/// Nested message and enum types in `TrainRequest`.
pub mod train_request {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Request {
#[prost(message, tag = "4")]
GnnRequest(super::GnnRequest),
#[prost(message, tag = "5")]
MlpRequest(super::MlpRequest),
}
}
/// Generated client implementations.
pub mod trainer_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
/// Trainer RPC Service.
#[derive(Debug, Clone)]
pub struct TrainerClient<T> {
inner: tonic::client::Grpc<T>,
}
impl TrainerClient<tonic::transport::Channel> {
/// Attempt to create a new client by connecting to a given endpoint.
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: std::convert::TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> TrainerClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> TrainerClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + Send + Sync,
{
TrainerClient::new(InterceptedService::new(inner, interceptor))
}
/// Compress requests with the given encoding.
///
/// This requires the server to support it otherwise it might respond with an
/// error.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
/// Enable decompressing responses.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
/// Train trains models of scheduler using dataset.
pub async fn train(
&mut self,
request: impl tonic::IntoStreamingRequest<Message = super::TrainRequest>,
) -> Result<tonic::Response<()>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/trainer.Trainer/Train");
self.inner
.client_streaming(request.into_streaming_request(), path, codec)
.await
}
}
}
/// Generated server implementations.
pub mod trainer_server {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
/// Generated trait containing gRPC methods that should be implemented for use with TrainerServer.
#[async_trait]
pub trait Trainer: Send + Sync + 'static {
/// Train trains models of scheduler using dataset.
async fn train(
&self,
request: tonic::Request<tonic::Streaming<super::TrainRequest>>,
) -> Result<tonic::Response<()>, tonic::Status>;
}
/// Trainer RPC Service.
#[derive(Debug)]
pub struct TrainerServer<T: Trainer> {
inner: _Inner<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
}
struct _Inner<T>(Arc<T>);
impl<T: Trainer> TrainerServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
let inner = _Inner(inner);
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
/// Enable decompressing requests with the given encoding.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
/// Compress responses with the given encoding, if the client supports it.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for TrainerServer<T>
where
T: Trainer,
B: Body + Send + 'static,
B::Error: Into<StdError> + Send + 'static,
{
type Response = http::Response<tonic::body::BoxBody>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
let inner = self.inner.clone();
match req.uri().path() {
"/trainer.Trainer/Train" => {
#[allow(non_camel_case_types)]
struct TrainSvc<T: Trainer>(pub Arc<T>);
impl<
T: Trainer,
> tonic::server::ClientStreamingService<super::TrainRequest>
for TrainSvc<T> {
type Response = ();
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<
tonic::Streaming<super::TrainRequest>,
>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move { (*inner).train(request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = TrainSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
);
let res = grpc.client_streaming(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
Ok(
http::Response::builder()
.status(200)
.header("grpc-status", "12")
.header("content-type", "application/grpc")
.body(empty_body())
.unwrap(),
)
})
}
}
}
}
impl<T: Trainer> Clone for TrainerServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
}
}
}
impl<T: Trainer> Clone for _Inner<T> {
fn clone(&self) -> Self {
Self(self.0.clone())
}
}
impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:?}", self.0)
}
}
impl<T: Trainer> tonic::server::NamedService for TrainerServer<T> {
const NAME: &'static str = "trainer.Trainer";
}
}