Plumbing SignatureDefParam and TensorSpec through to the C API.
PiperOrigin-RevId: 334632559 Change-Id: Ie4b2d1a5fa9de9bb513758286652b3f250d59a2b
This commit is contained in:
parent
bdf4d6dbf2
commit
4c52286c87
@ -224,6 +224,8 @@ cc_library(
|
|||||||
],
|
],
|
||||||
deps = [
|
deps = [
|
||||||
":signature_def_function_metadata_type",
|
":signature_def_function_metadata_type",
|
||||||
|
":signature_def_param_list",
|
||||||
|
":signature_def_param_list_type",
|
||||||
"//tensorflow/c:c_api_macros",
|
"//tensorflow/c:c_api_macros",
|
||||||
"//tensorflow/c/experimental/saved_model/core:signature_def_function_metadata",
|
"//tensorflow/c/experimental/saved_model/core:signature_def_function_metadata",
|
||||||
],
|
],
|
||||||
@ -240,6 +242,104 @@ cc_library(
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "signature_def_param",
|
||||||
|
srcs = [
|
||||||
|
"signature_def_param.cc",
|
||||||
|
],
|
||||||
|
hdrs = [
|
||||||
|
"//tensorflow/c/experimental/saved_model/public:signature_def_param.h",
|
||||||
|
],
|
||||||
|
copts = tf_copts(),
|
||||||
|
visibility = [
|
||||||
|
"//tensorflow/c/experimental/saved_model/public:__pkg__",
|
||||||
|
],
|
||||||
|
deps = [
|
||||||
|
":signature_def_param_type",
|
||||||
|
":tensor_spec",
|
||||||
|
":tensor_spec_type",
|
||||||
|
"//tensorflow/c:c_api_macros",
|
||||||
|
"//tensorflow/c:tf_shape_internal",
|
||||||
|
"//tensorflow/c/experimental/saved_model/core:signature_def_function_metadata",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "signature_def_param_type",
|
||||||
|
hdrs = [
|
||||||
|
"signature_def_param_type.h",
|
||||||
|
],
|
||||||
|
deps = [
|
||||||
|
"//tensorflow/c:conversion_macros",
|
||||||
|
"//tensorflow/c/experimental/saved_model/core:signature_def_function_metadata",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "signature_def_param_list",
|
||||||
|
srcs = [
|
||||||
|
"signature_def_param_list.cc",
|
||||||
|
],
|
||||||
|
hdrs = [
|
||||||
|
"//tensorflow/c/experimental/saved_model/public:signature_def_param_list.h",
|
||||||
|
],
|
||||||
|
copts = tf_copts(),
|
||||||
|
visibility = [
|
||||||
|
"//tensorflow/c/experimental/saved_model/public:__pkg__",
|
||||||
|
],
|
||||||
|
deps = [
|
||||||
|
":signature_def_param",
|
||||||
|
":signature_def_param_list_type",
|
||||||
|
":signature_def_param_type",
|
||||||
|
"//tensorflow/c:c_api_macros",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "signature_def_param_list_type",
|
||||||
|
hdrs = [
|
||||||
|
"signature_def_param_list_type.h",
|
||||||
|
],
|
||||||
|
deps = [
|
||||||
|
"//tensorflow/c:conversion_macros",
|
||||||
|
"//tensorflow/c/experimental/saved_model/core:signature_def_function_metadata",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "tensor_spec",
|
||||||
|
srcs = [
|
||||||
|
"tensor_spec.cc",
|
||||||
|
],
|
||||||
|
hdrs = [
|
||||||
|
"//tensorflow/c/experimental/saved_model/public:tensor_spec.h",
|
||||||
|
],
|
||||||
|
copts = tf_copts(),
|
||||||
|
visibility = [
|
||||||
|
"//tensorflow/c/experimental/saved_model/public:__pkg__",
|
||||||
|
],
|
||||||
|
deps = [
|
||||||
|
":tensor_spec_type",
|
||||||
|
"//tensorflow/c:c_api_macros",
|
||||||
|
"//tensorflow/c:tf_datatype",
|
||||||
|
"//tensorflow/c:tf_shape",
|
||||||
|
"//tensorflow/c:tf_shape_internal",
|
||||||
|
"//tensorflow/c/experimental/saved_model/core:tensor_spec",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "tensor_spec_type",
|
||||||
|
hdrs = [
|
||||||
|
"tensor_spec_type.h",
|
||||||
|
],
|
||||||
|
deps = [
|
||||||
|
"//tensorflow/c:conversion_macros",
|
||||||
|
"//tensorflow/c:tf_shape_internal",
|
||||||
|
"//tensorflow/c/experimental/saved_model/core:tensor_spec",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
tf_cc_test(
|
tf_cc_test(
|
||||||
name = "saved_model_api_test",
|
name = "saved_model_api_test",
|
||||||
size = "small",
|
size = "small",
|
||||||
|
@ -16,5 +16,18 @@ limitations under the License.
|
|||||||
#include "tensorflow/c/experimental/saved_model/public/signature_def_function_metadata.h"
|
#include "tensorflow/c/experimental/saved_model/public/signature_def_function_metadata.h"
|
||||||
|
|
||||||
#include "tensorflow/c/experimental/saved_model/internal/signature_def_function_metadata_type.h"
|
#include "tensorflow/c/experimental/saved_model/internal/signature_def_function_metadata_type.h"
|
||||||
|
#include "tensorflow/c/experimental/saved_model/internal/signature_def_param_list_type.h"
|
||||||
|
|
||||||
// TODO(bmzhao): Add getter functions here as necessary.
|
extern "C" {
|
||||||
|
|
||||||
|
extern const TF_SignatureDefParamList* TF_SignatureDefFunctionMetadataArgs(
|
||||||
|
const TF_SignatureDefFunctionMetadata* list) {
|
||||||
|
return tensorflow::wrap(&tensorflow::unwrap(list)->arguments());
|
||||||
|
}
|
||||||
|
|
||||||
|
extern const TF_SignatureDefParamList* TF_SignatureDefFunctionMetadataReturns(
|
||||||
|
const TF_SignatureDefFunctionMetadata* list) {
|
||||||
|
return tensorflow::wrap(&tensorflow::unwrap(list)->returns());
|
||||||
|
}
|
||||||
|
|
||||||
|
} // end extern "C"
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
==============================================================================*/
|
||||||
|
|
||||||
|
#include "tensorflow/c/experimental/saved_model/public/signature_def_param.h"
|
||||||
|
|
||||||
|
#include "tensorflow/c/experimental/saved_model/core/signature_def_function_metadata.h"
|
||||||
|
#include "tensorflow/c/experimental/saved_model/internal/signature_def_param_type.h"
|
||||||
|
#include "tensorflow/c/experimental/saved_model/internal/tensor_spec_type.h"
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
|
||||||
|
extern const char* TF_SignatureDefParamName(const TF_SignatureDefParam* param) {
|
||||||
|
return tensorflow::unwrap(param)->name().c_str();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern const TF_TensorSpec* TF_SignatureDefParamTensorSpec(
|
||||||
|
const TF_SignatureDefParam* param) {
|
||||||
|
return tensorflow::wrap(&tensorflow::unwrap(param)->spec());
|
||||||
|
}
|
||||||
|
|
||||||
|
} // end extern "C"
|
@ -0,0 +1,33 @@
|
|||||||
|
/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
==============================================================================*/
|
||||||
|
|
||||||
|
#include "tensorflow/c/experimental/saved_model/public/signature_def_param_list.h"
|
||||||
|
|
||||||
|
#include "tensorflow/c/experimental/saved_model/internal/signature_def_param_list_type.h"
|
||||||
|
#include "tensorflow/c/experimental/saved_model/internal/signature_def_param_type.h"
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
|
||||||
|
extern size_t TF_SignatureDefParamListSize(
|
||||||
|
const TF_SignatureDefParamList* list) {
|
||||||
|
return tensorflow::unwrap(list)->size();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern const TF_SignatureDefParam* TF_SignatureDefParamListGet(
|
||||||
|
const TF_SignatureDefParamList* list, int i) {
|
||||||
|
return tensorflow::wrap(&tensorflow::unwrap(list)->at(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
} // end extern "C"
|
@ -0,0 +1,33 @@
|
|||||||
|
/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
==============================================================================*/
|
||||||
|
|
||||||
|
#ifndef TENSORFLOW_C_EXPERIMENTAL_SAVED_MODEL_INTERNAL_SIGNATURE_DEF_PARAM_LIST_TYPE_H_
|
||||||
|
#define TENSORFLOW_C_EXPERIMENTAL_SAVED_MODEL_INTERNAL_SIGNATURE_DEF_PARAM_LIST_TYPE_H_
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "tensorflow/c/conversion_macros.h"
|
||||||
|
#include "tensorflow/c/experimental/saved_model/core/signature_def_function_metadata.h"
|
||||||
|
|
||||||
|
typedef struct TF_SignatureDefParamList TF_SignatureDefParamList;
|
||||||
|
|
||||||
|
namespace tensorflow {
|
||||||
|
|
||||||
|
DEFINE_CONVERSION_FUNCTIONS(std::vector<SignatureDefParam>,
|
||||||
|
TF_SignatureDefParamList)
|
||||||
|
|
||||||
|
} // namespace tensorflow
|
||||||
|
|
||||||
|
#endif // TENSORFLOW_C_EXPERIMENTAL_SAVED_MODEL_INTERNAL_SIGNATURE_DEF_PARAM_LIST_TYPE_H_
|
@ -0,0 +1,30 @@
|
|||||||
|
/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
==============================================================================*/
|
||||||
|
|
||||||
|
#ifndef TENSORFLOW_C_EXPERIMENTAL_SAVED_MODEL_INTERNAL_SIGNATURE_DEF_PARAM_TYPE_H_
|
||||||
|
#define TENSORFLOW_C_EXPERIMENTAL_SAVED_MODEL_INTERNAL_SIGNATURE_DEF_PARAM_TYPE_H_
|
||||||
|
|
||||||
|
#include "tensorflow/c/conversion_macros.h"
|
||||||
|
#include "tensorflow/c/experimental/saved_model/core/signature_def_function_metadata.h"
|
||||||
|
|
||||||
|
typedef struct TF_SignatureDefParam TF_SignatureDefParam;
|
||||||
|
|
||||||
|
namespace tensorflow {
|
||||||
|
|
||||||
|
DEFINE_CONVERSION_FUNCTIONS(tensorflow::SignatureDefParam, TF_SignatureDefParam)
|
||||||
|
|
||||||
|
} // namespace tensorflow
|
||||||
|
|
||||||
|
#endif // TENSORFLOW_C_EXPERIMENTAL_SAVED_MODEL_INTERNAL_SIGNATURE_DEF_PARAM_TYPE_H_
|
@ -0,0 +1,32 @@
|
|||||||
|
/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
==============================================================================*/
|
||||||
|
|
||||||
|
#include "tensorflow/c/experimental/saved_model/public/tensor_spec.h"
|
||||||
|
|
||||||
|
#include "tensorflow/c/experimental/saved_model/core/tensor_spec.h"
|
||||||
|
#include "tensorflow/c/experimental/saved_model/internal/tensor_spec_type.h"
|
||||||
|
#include "tensorflow/c/tf_shape_internal.h"
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
|
||||||
|
TF_DataType TF_TensorSpecDataType(const TF_TensorSpec* spec) {
|
||||||
|
return static_cast<TF_DataType>(tensorflow::unwrap(spec)->dtype());
|
||||||
|
}
|
||||||
|
|
||||||
|
const TF_Shape* TF_TensorSpecShape(const TF_TensorSpec* spec) {
|
||||||
|
return tensorflow::wrap(&tensorflow::unwrap(spec)->shape());
|
||||||
|
}
|
||||||
|
|
||||||
|
} // end extern "C"
|
@ -0,0 +1,30 @@
|
|||||||
|
/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
==============================================================================*/
|
||||||
|
|
||||||
|
#ifndef TENSORFLOW_C_EXPERIMENTAL_SAVED_MODEL_INTERNAL_TENSOR_SPEC_TYPE_H_
|
||||||
|
#define TENSORFLOW_C_EXPERIMENTAL_SAVED_MODEL_INTERNAL_TENSOR_SPEC_TYPE_H_
|
||||||
|
|
||||||
|
#include "tensorflow/c/conversion_macros.h"
|
||||||
|
#include "tensorflow/c/experimental/saved_model/core/tensor_spec.h"
|
||||||
|
|
||||||
|
typedef struct TF_TensorSpec TF_TensorSpec;
|
||||||
|
|
||||||
|
namespace tensorflow {
|
||||||
|
|
||||||
|
DEFINE_CONVERSION_FUNCTIONS(tensorflow::TensorSpec, TF_TensorSpec)
|
||||||
|
|
||||||
|
} // namespace tensorflow
|
||||||
|
|
||||||
|
#endif // TENSORFLOW_C_EXPERIMENTAL_SAVED_MODEL_INTERNAL_TENSOR_SPEC_TYPE_H_
|
@ -28,6 +28,9 @@ exports_files(
|
|||||||
"saved_model_api.h",
|
"saved_model_api.h",
|
||||||
"signature_def_function.h",
|
"signature_def_function.h",
|
||||||
"signature_def_function_metadata.h",
|
"signature_def_function_metadata.h",
|
||||||
|
"signature_def_param.h",
|
||||||
|
"signature_def_param_list.h",
|
||||||
|
"tensor_spec.h",
|
||||||
],
|
],
|
||||||
visibility = ["//tensorflow/c/experimental/saved_model/internal:__pkg__"],
|
visibility = ["//tensorflow/c/experimental/saved_model/internal:__pkg__"],
|
||||||
)
|
)
|
||||||
@ -45,6 +48,9 @@ cc_library(
|
|||||||
":saved_model_api",
|
":saved_model_api",
|
||||||
":signature_def_function",
|
":signature_def_function",
|
||||||
":signature_def_function_metadata",
|
":signature_def_function_metadata",
|
||||||
|
":signature_def_param",
|
||||||
|
":signature_def_param_list",
|
||||||
|
":tensor_spec",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -77,3 +83,18 @@ alias(
|
|||||||
name = "signature_def_function_metadata",
|
name = "signature_def_function_metadata",
|
||||||
actual = "//tensorflow/c/experimental/saved_model/internal:signature_def_function_metadata",
|
actual = "//tensorflow/c/experimental/saved_model/internal:signature_def_function_metadata",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
alias(
|
||||||
|
name = "signature_def_param",
|
||||||
|
actual = "//tensorflow/c/experimental/saved_model/internal:signature_def_param",
|
||||||
|
)
|
||||||
|
|
||||||
|
alias(
|
||||||
|
name = "signature_def_param_list",
|
||||||
|
actual = "//tensorflow/c/experimental/saved_model/internal:signature_def_param_list",
|
||||||
|
)
|
||||||
|
|
||||||
|
alias(
|
||||||
|
name = "tensor_spec",
|
||||||
|
actual = "//tensorflow/c/experimental/saved_model/internal:tensor_spec",
|
||||||
|
)
|
||||||
|
@ -23,6 +23,9 @@ limitations under the License.
|
|||||||
#include "tensorflow/c/experimental/saved_model/public/saved_model_api.h"
|
#include "tensorflow/c/experimental/saved_model/public/saved_model_api.h"
|
||||||
#include "tensorflow/c/experimental/saved_model/public/signature_def_function.h"
|
#include "tensorflow/c/experimental/saved_model/public/signature_def_function.h"
|
||||||
#include "tensorflow/c/experimental/saved_model/public/signature_def_function_metadata.h"
|
#include "tensorflow/c/experimental/saved_model/public/signature_def_function_metadata.h"
|
||||||
|
#include "tensorflow/c/experimental/saved_model/public/signature_def_param.h"
|
||||||
|
#include "tensorflow/c/experimental/saved_model/public/signature_def_param_list.h"
|
||||||
|
#include "tensorflow/c/experimental/saved_model/public/tensor_spec.h"
|
||||||
// IWYU pragma: end_exports
|
// IWYU pragma: end_exports
|
||||||
|
|
||||||
#endif // TENSORFLOW_C_EXPERIMENTAL_SAVED_MODEL_PUBLIC_C_SAVED_MODEL_API_H_
|
#endif // TENSORFLOW_C_EXPERIMENTAL_SAVED_MODEL_PUBLIC_C_SAVED_MODEL_API_H_
|
||||||
|
@ -16,6 +16,9 @@ limitations under the License.
|
|||||||
#ifndef TENSORFLOW_C_EXPERIMENTAL_SAVED_MODEL_PUBLIC_SIGNATURE_DEF_FUNCTION_METADATA_H_
|
#ifndef TENSORFLOW_C_EXPERIMENTAL_SAVED_MODEL_PUBLIC_SIGNATURE_DEF_FUNCTION_METADATA_H_
|
||||||
#define TENSORFLOW_C_EXPERIMENTAL_SAVED_MODEL_PUBLIC_SIGNATURE_DEF_FUNCTION_METADATA_H_
|
#define TENSORFLOW_C_EXPERIMENTAL_SAVED_MODEL_PUBLIC_SIGNATURE_DEF_FUNCTION_METADATA_H_
|
||||||
|
|
||||||
|
#include "tensorflow/c/c_api_macros.h"
|
||||||
|
#include "tensorflow/c/experimental/saved_model/public/signature_def_param_list.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
@ -24,6 +27,18 @@ extern "C" {
|
|||||||
// SavedModel.
|
// SavedModel.
|
||||||
typedef struct TF_SignatureDefFunctionMetadata TF_SignatureDefFunctionMetadata;
|
typedef struct TF_SignatureDefFunctionMetadata TF_SignatureDefFunctionMetadata;
|
||||||
|
|
||||||
|
// Retrieves the arguments of the SignatureDefFunction. The caller is not
|
||||||
|
// responsible for freeing the returned pointer.
|
||||||
|
TF_CAPI_EXPORT extern const TF_SignatureDefParamList*
|
||||||
|
TF_SignatureDefFunctionMetadataArgs(
|
||||||
|
const TF_SignatureDefFunctionMetadata* list);
|
||||||
|
|
||||||
|
// Retrieves the returns of the SignatureDefFunction. The caller is not
|
||||||
|
// responsible for freeing the returned pointer.
|
||||||
|
TF_CAPI_EXPORT extern const TF_SignatureDefParamList*
|
||||||
|
TF_SignatureDefFunctionMetadataReturns(
|
||||||
|
const TF_SignatureDefFunctionMetadata* list);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} // end extern "C"
|
} // end extern "C"
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
@ -0,0 +1,44 @@
|
|||||||
|
/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
==============================================================================*/
|
||||||
|
|
||||||
|
#ifndef TENSORFLOW_C_EXPERIMENTAL_SAVED_MODEL_PUBLIC_SIGNATURE_DEF_PARAM_H_
|
||||||
|
#define TENSORFLOW_C_EXPERIMENTAL_SAVED_MODEL_PUBLIC_SIGNATURE_DEF_PARAM_H_
|
||||||
|
|
||||||
|
#include "tensorflow/c/c_api_macros.h"
|
||||||
|
#include "tensorflow/c/experimental/saved_model/public/tensor_spec.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
// An opaque type that containing metadata of an input/output of a
|
||||||
|
// TF_SignatureDefFunction loaded from a SavedModel.
|
||||||
|
typedef struct TF_SignatureDefParam TF_SignatureDefParam;
|
||||||
|
|
||||||
|
// Returns the name of the given parameter. The caller is not responsible for
|
||||||
|
// freeing the returned char*.
|
||||||
|
TF_CAPI_EXPORT extern const char* TF_SignatureDefParamName(
|
||||||
|
const TF_SignatureDefParam* param);
|
||||||
|
|
||||||
|
// Returns the TensorSpec associated with the given parameter. The caller is
|
||||||
|
// not reponsible for freeing the returned TF_TensorSpec*.
|
||||||
|
TF_CAPI_EXPORT extern const TF_TensorSpec* TF_SignatureDefParamTensorSpec(
|
||||||
|
const TF_SignatureDefParam* param);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} // end extern "C"
|
||||||
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
#endif // TENSORFLOW_C_EXPERIMENTAL_SAVED_MODEL_PUBLIC_SIGNATURE_DEF_PARAM_H_
|
@ -0,0 +1,44 @@
|
|||||||
|
/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
==============================================================================*/
|
||||||
|
|
||||||
|
#ifndef TENSORFLOW_C_EXPERIMENTAL_SAVED_MODEL_PUBLIC_SIGNATURE_DEF_PARAM_LIST_H_
|
||||||
|
#define TENSORFLOW_C_EXPERIMENTAL_SAVED_MODEL_PUBLIC_SIGNATURE_DEF_PARAM_LIST_H_
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#include "tensorflow/c/c_api_macros.h"
|
||||||
|
#include "tensorflow/c/experimental/saved_model/public/signature_def_param.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
// An opaque type that containing metadata of an input/output of a
|
||||||
|
// ConcreteFunction loaded from a SavedModel.
|
||||||
|
typedef struct TF_SignatureDefParamList TF_SignatureDefParamList;
|
||||||
|
|
||||||
|
// Returns the size of `list`.
|
||||||
|
TF_CAPI_EXPORT extern size_t TF_SignatureDefParamListSize(
|
||||||
|
const TF_SignatureDefParamList* list);
|
||||||
|
|
||||||
|
// Returns the `i`th TF_SignatureDefParam in the list.
|
||||||
|
TF_CAPI_EXPORT extern const TF_SignatureDefParam* TF_SignatureDefParamListGet(
|
||||||
|
const TF_SignatureDefParamList* list, int i);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} // end extern "C"
|
||||||
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
#endif // TENSORFLOW_C_EXPERIMENTAL_SAVED_MODEL_PUBLIC_SIGNATURE_DEF_PARAM_LIST_H_
|
46
tensorflow/c/experimental/saved_model/public/tensor_spec.h
Normal file
46
tensorflow/c/experimental/saved_model/public/tensor_spec.h
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
==============================================================================*/
|
||||||
|
|
||||||
|
#ifndef TENSORFLOW_C_EXPERIMENTAL_SAVED_MODEL_PUBLIC_TENSOR_SPEC_H_
|
||||||
|
#define TENSORFLOW_C_EXPERIMENTAL_SAVED_MODEL_PUBLIC_TENSOR_SPEC_H_
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#include "tensorflow/c/c_api_macros.h"
|
||||||
|
#include "tensorflow/c/tf_datatype.h"
|
||||||
|
#include "tensorflow/c/tf_shape.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
// An opaque type corresponding to TensorSpec
|
||||||
|
typedef struct TF_TensorSpec TF_TensorSpec;
|
||||||
|
|
||||||
|
// Returns the dtype associated with the TensorSpec.
|
||||||
|
TF_CAPI_EXPORT extern TF_DataType TF_TensorSpecDataType(
|
||||||
|
const TF_TensorSpec* spec);
|
||||||
|
|
||||||
|
// Returns the shape associated with the TensorSpec. The returned Shape is not
|
||||||
|
// owned by the caller. Caller must not call TF_DeleteShape on the returned
|
||||||
|
// shape.
|
||||||
|
TF_CAPI_EXPORT extern const TF_Shape* TF_TensorSpecShape(
|
||||||
|
const TF_TensorSpec* spec);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} // end extern "C"
|
||||||
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
#endif // TENSORFLOW_C_EXPERIMENTAL_SAVED_MODEL_PUBLIC_TENSOR_SPEC_H_
|
Loading…
Reference in New Issue
Block a user