[TF proto] Move tf.contrib.proto.* to tf.io.*
PiperOrigin-RevId: 243460620
This commit is contained in:
parent
50eee22d86
commit
06d2ea93fa
@ -4,7 +4,7 @@ licenses(["notice"]) # Apache 2.0
|
|||||||
|
|
||||||
exports_files(["LICENSE"])
|
exports_files(["LICENSE"])
|
||||||
|
|
||||||
load("//tensorflow/core:platform/default/build_config_root.bzl", "if_static")
|
load("//tensorflow:tensorflow.bzl", "tf_py_test")
|
||||||
|
|
||||||
py_library(
|
py_library(
|
||||||
name = "proto",
|
name = "proto",
|
||||||
@ -14,5 +14,15 @@ py_library(
|
|||||||
deps = [
|
deps = [
|
||||||
"//tensorflow/contrib/proto/python/ops:decode_proto_op_py",
|
"//tensorflow/contrib/proto/python/ops:decode_proto_op_py",
|
||||||
"//tensorflow/contrib/proto/python/ops:encode_proto_op_py",
|
"//tensorflow/contrib/proto/python/ops:encode_proto_op_py",
|
||||||
|
"//tensorflow/python:proto_ops",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
tf_py_test(
|
||||||
|
name = "import_test",
|
||||||
|
srcs = ["import_test.py"],
|
||||||
|
additional_deps = [
|
||||||
|
":proto",
|
||||||
|
"//tensorflow/python:client_testlib",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
@ -21,8 +21,8 @@ from __future__ import absolute_import
|
|||||||
from __future__ import division
|
from __future__ import division
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
from tensorflow.contrib.proto.python.ops.decode_proto_op import decode_proto
|
from tensorflow.python.ops.proto_ops import decode_proto
|
||||||
from tensorflow.contrib.proto.python.ops.encode_proto_op import encode_proto
|
from tensorflow.python.ops.proto_ops import encode_proto
|
||||||
|
|
||||||
from tensorflow.python.util.all_util import remove_undocumented
|
from tensorflow.python.util.all_util import remove_undocumented
|
||||||
remove_undocumented(__name__)
|
remove_undocumented(__name__)
|
||||||
|
33
tensorflow/contrib/proto/import_test.py
Normal file
33
tensorflow/contrib/proto/import_test.py
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
# =============================================================================
|
||||||
|
|
||||||
|
"""Backwards compatibility tests for imports of tf.contrib.proto."""
|
||||||
|
from __future__ import absolute_import
|
||||||
|
from __future__ import division
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
|
from tensorflow.contrib import proto
|
||||||
|
from tensorflow.python.platform import test
|
||||||
|
|
||||||
|
|
||||||
|
class ProtoImportTest(test.TestCase):
|
||||||
|
|
||||||
|
def testImport(self):
|
||||||
|
self.assertTrue(proto.decode_proto) # Should be accessible
|
||||||
|
self.assertTrue(proto.encode_proto) # Should be accessible
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
test.main()
|
@ -1,44 +1,20 @@
|
|||||||
package(default_visibility = ["//visibility:public"])
|
|
||||||
|
|
||||||
licenses(["notice"]) # Apache 2.0
|
licenses(["notice"]) # Apache 2.0
|
||||||
|
|
||||||
exports_files(["LICENSE"])
|
package(default_visibility = ["//tensorflow:__subpackages__"])
|
||||||
|
|
||||||
load(
|
# Placeholders for folks with old dependencies.
|
||||||
"//tensorflow:tensorflow.bzl",
|
py_library(
|
||||||
"tf_gen_op_wrapper_py",
|
name = "encode_proto_op_py",
|
||||||
|
srcs = ["encode_proto_op.py"],
|
||||||
|
deps = [
|
||||||
|
"//tensorflow/python:proto_ops",
|
||||||
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
py_library(
|
py_library(
|
||||||
name = "decode_proto_op_py",
|
name = "decode_proto_op_py",
|
||||||
srcs = ["decode_proto_op.py"],
|
srcs = ["decode_proto_op.py"],
|
||||||
deps = [
|
deps = [
|
||||||
":gen_decode_proto_op_py",
|
"//tensorflow/python:proto_ops",
|
||||||
"//tensorflow/python:framework_ops",
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
tf_gen_op_wrapper_py(
|
|
||||||
name = "gen_decode_proto_op_py",
|
|
||||||
out = "gen_decode_proto_op.py",
|
|
||||||
deps = [
|
|
||||||
"//tensorflow/core:decode_proto_ops_op_lib",
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
py_library(
|
|
||||||
name = "encode_proto_op_py",
|
|
||||||
srcs = ["encode_proto_op.py"],
|
|
||||||
deps = [
|
|
||||||
":gen_encode_proto_op_py",
|
|
||||||
"//tensorflow/python:framework_ops",
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
tf_gen_op_wrapper_py(
|
|
||||||
name = "gen_encode_proto_op_py",
|
|
||||||
out = "gen_encode_proto_op.py",
|
|
||||||
deps = [
|
|
||||||
"//tensorflow/core:encode_proto_ops_op_lib",
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
# =============================================================================
|
|
||||||
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
|
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -12,14 +11,11 @@
|
|||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
# =============================================================================
|
# ==============================================================================
|
||||||
|
|
||||||
# pylint: disable=wildcard-import,unused-import
|
|
||||||
"""Protocol Buffer decoding from tensors."""
|
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
from __future__ import division
|
from __future__ import division
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
from tensorflow.contrib.proto.python.ops.gen_decode_proto_op import decode_proto_v2 as decode_proto
|
# pylint: disable=unused-import
|
||||||
from tensorflow.python.framework import ops
|
from tensorflow.python.ops.proto_ops import decode_proto
|
||||||
ops.NotDifferentiable("DecodeProtoV2")
|
|
||||||
|
@ -11,15 +11,11 @@
|
|||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
# =============================================================================
|
# ==============================================================================
|
||||||
|
|
||||||
# pylint: disable=wildcard-import,unused-import
|
|
||||||
"""Protocol Buffer encoding from tensors."""
|
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
from __future__ import division
|
from __future__ import division
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
from tensorflow.contrib.proto.python.ops.gen_encode_proto_op import encode_proto
|
# pylint: disable=unused-import
|
||||||
from tensorflow.python.framework import ops
|
from tensorflow.python.ops.proto_ops import encode_proto
|
||||||
|
|
||||||
ops.NotDifferentiable("EncodeProto")
|
|
||||||
|
@ -22,13 +22,12 @@ import itertools
|
|||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from tensorflow.contrib.proto.python.ops import decode_proto_op
|
|
||||||
from tensorflow.contrib.proto.python.ops import encode_proto_op
|
|
||||||
from tensorflow.contrib.rpc.python.kernel_tests import test_example_pb2
|
from tensorflow.contrib.rpc.python.kernel_tests import test_example_pb2
|
||||||
from tensorflow.contrib.rpc.python.ops import rpc_op
|
from tensorflow.contrib.rpc.python.ops import rpc_op
|
||||||
from tensorflow.core.protobuf import config_pb2
|
from tensorflow.core.protobuf import config_pb2
|
||||||
from tensorflow.python.framework import dtypes
|
from tensorflow.python.framework import dtypes
|
||||||
from tensorflow.python.framework import errors
|
from tensorflow.python.framework import errors
|
||||||
|
from tensorflow.python.ops import proto_ops
|
||||||
|
|
||||||
__all__ = ['I_WARNED_YOU', 'RpcOpTestBase']
|
__all__ = ['I_WARNED_YOU', 'RpcOpTestBase']
|
||||||
|
|
||||||
@ -222,7 +221,7 @@ class RpcOpTestBase(object):
|
|||||||
|
|
||||||
def testVecHostPortRpcUsingEncodeAndDecodeProto(self):
|
def testVecHostPortRpcUsingEncodeAndDecodeProto(self):
|
||||||
with self.cached_session() as sess:
|
with self.cached_session() as sess:
|
||||||
request_tensors = encode_proto_op.encode_proto(
|
request_tensors = proto_ops.encode_proto(
|
||||||
message_type='tensorflow.contrib.rpc.TestCase',
|
message_type='tensorflow.contrib.rpc.TestCase',
|
||||||
field_names=['values'],
|
field_names=['values'],
|
||||||
sizes=[[3]] * 20,
|
sizes=[[3]] * 20,
|
||||||
@ -233,7 +232,7 @@ class RpcOpTestBase(object):
|
|||||||
method=self.get_method_name('Increment'),
|
method=self.get_method_name('Increment'),
|
||||||
address=self._address,
|
address=self._address,
|
||||||
request=request_tensors)
|
request=request_tensors)
|
||||||
_, (response_shape,) = decode_proto_op.decode_proto(
|
_, (response_shape,) = proto_ops.decode_proto(
|
||||||
bytes=response_tensor_strings,
|
bytes=response_tensor_strings,
|
||||||
message_type='tensorflow.contrib.rpc.TestCase',
|
message_type='tensorflow.contrib.rpc.TestCase',
|
||||||
field_names=['values'],
|
field_names=['values'],
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
op {
|
op {
|
||||||
graph_op_name: "DecodeProtoV2"
|
graph_op_name: "DecodeProtoV2"
|
||||||
|
visibility: HIDDEN
|
||||||
in_arg {
|
in_arg {
|
||||||
name: "bytes"
|
name: "bytes"
|
||||||
description: <<END
|
description: <<END
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
op {
|
op {
|
||||||
graph_op_name: "EncodeProto"
|
graph_op_name: "EncodeProto"
|
||||||
|
visibility: HIDDEN
|
||||||
in_arg {
|
in_arg {
|
||||||
name: "sizes"
|
name: "sizes"
|
||||||
description: <<END
|
description: <<END
|
||||||
|
@ -150,6 +150,7 @@ py_library(
|
|||||||
":nn",
|
":nn",
|
||||||
":ops",
|
":ops",
|
||||||
":platform",
|
":platform",
|
||||||
|
":proto_ops",
|
||||||
":pywrap_tensorflow",
|
":pywrap_tensorflow",
|
||||||
":saver_test_utils",
|
":saver_test_utils",
|
||||||
":script_ops",
|
":script_ops",
|
||||||
@ -3387,6 +3388,7 @@ py_library(
|
|||||||
":numerics",
|
":numerics",
|
||||||
":parsing_ops",
|
":parsing_ops",
|
||||||
":partitioned_variables",
|
":partitioned_variables",
|
||||||
|
":proto_ops",
|
||||||
":random_ops",
|
":random_ops",
|
||||||
":script_ops",
|
":script_ops",
|
||||||
":session_ops",
|
":session_ops",
|
||||||
@ -6348,6 +6350,30 @@ cuda_py_test(
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
tf_gen_op_wrapper_private_py(
|
||||||
|
name = "decode_proto_ops_gen",
|
||||||
|
deps = [
|
||||||
|
"//tensorflow/core:decode_proto_ops_op_lib",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
tf_gen_op_wrapper_private_py(
|
||||||
|
name = "encode_proto_ops_gen",
|
||||||
|
deps = [
|
||||||
|
"//tensorflow/core:encode_proto_ops_op_lib",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
py_library(
|
||||||
|
name = "proto_ops",
|
||||||
|
srcs = ["ops/proto_ops.py"],
|
||||||
|
deps = [
|
||||||
|
":decode_proto_ops_gen",
|
||||||
|
":encode_proto_ops_gen",
|
||||||
|
"//tensorflow/python:framework_ops",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
py_binary(
|
py_binary(
|
||||||
name = "graph_analyzer",
|
name = "graph_analyzer",
|
||||||
srcs = [
|
srcs = [
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
# Tests of tf.io.*proto.
|
||||||
|
|
||||||
package(default_visibility = ["//visibility:public"])
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
licenses(["notice"]) # Apache 2.0
|
licenses(["notice"]) # Apache 2.0
|
||||||
@ -7,8 +9,11 @@ exports_files(["LICENSE"])
|
|||||||
load("//tensorflow:tensorflow.bzl", "tf_py_test")
|
load("//tensorflow:tensorflow.bzl", "tf_py_test")
|
||||||
load("//tensorflow:tensorflow.bzl", "tf_cc_shared_object")
|
load("//tensorflow:tensorflow.bzl", "tf_cc_shared_object")
|
||||||
load("//tensorflow/core:platform/default/build_config_root.bzl", "if_static")
|
load("//tensorflow/core:platform/default/build_config_root.bzl", "if_static")
|
||||||
|
load("//tensorflow/core:platform/default/build_config.bzl", "tf_additional_all_protos")
|
||||||
load("//tensorflow/core:platform/default/build_config.bzl", "tf_proto_library")
|
load("//tensorflow/core:platform/default/build_config.bzl", "tf_proto_library")
|
||||||
|
|
||||||
|
# Google-internal targets go here (must be at the end).
|
||||||
|
|
||||||
tf_py_test(
|
tf_py_test(
|
||||||
name = "decode_proto_op_test",
|
name = "decode_proto_op_test",
|
||||||
size = "small",
|
size = "small",
|
||||||
@ -16,8 +21,7 @@ tf_py_test(
|
|||||||
additional_deps = [
|
additional_deps = [
|
||||||
":decode_proto_op_test_base",
|
":decode_proto_op_test_base",
|
||||||
":py_test_deps",
|
":py_test_deps",
|
||||||
"//tensorflow/contrib/proto:proto",
|
"//tensorflow/python:proto_ops",
|
||||||
"//tensorflow/contrib/proto/python/ops:decode_proto_op_py",
|
|
||||||
],
|
],
|
||||||
data = if_static(
|
data = if_static(
|
||||||
[],
|
[],
|
||||||
@ -36,9 +40,7 @@ tf_py_test(
|
|||||||
additional_deps = [
|
additional_deps = [
|
||||||
":encode_proto_op_test_base",
|
":encode_proto_op_test_base",
|
||||||
":py_test_deps",
|
":py_test_deps",
|
||||||
"//tensorflow/contrib/proto:proto",
|
"//tensorflow/python:proto_ops",
|
||||||
"//tensorflow/contrib/proto/python/ops:decode_proto_op_py",
|
|
||||||
"//tensorflow/contrib/proto/python/ops:encode_proto_op_py",
|
|
||||||
],
|
],
|
||||||
data = if_static(
|
data = if_static(
|
||||||
[],
|
[],
|
||||||
@ -90,7 +92,7 @@ tf_proto_library(
|
|||||||
name = "test_example_proto",
|
name = "test_example_proto",
|
||||||
srcs = ["test_example.proto"],
|
srcs = ["test_example.proto"],
|
||||||
cc_api_version = 2,
|
cc_api_version = 2,
|
||||||
protodeps = ["//tensorflow/core:protos_all"],
|
protodeps = tf_additional_all_protos(),
|
||||||
)
|
)
|
||||||
|
|
||||||
tf_cc_shared_object(
|
tf_cc_shared_object(
|
||||||
@ -119,8 +121,7 @@ tf_py_test(
|
|||||||
srcs = ["descriptor_source_test.py"],
|
srcs = ["descriptor_source_test.py"],
|
||||||
additional_deps = [
|
additional_deps = [
|
||||||
":descriptor_source_test_base",
|
":descriptor_source_test_base",
|
||||||
"//tensorflow/contrib/proto/python/ops:decode_proto_op_py",
|
"//tensorflow/python:proto_ops",
|
||||||
"//tensorflow/contrib/proto/python/ops:encode_proto_op_py",
|
|
||||||
"//tensorflow/python:client_testlib",
|
"//tensorflow/python:client_testlib",
|
||||||
],
|
],
|
||||||
tags = [
|
tags = [
|
@ -20,15 +20,15 @@ from __future__ import absolute_import
|
|||||||
from __future__ import division
|
from __future__ import division
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
from tensorflow.contrib.proto.python.kernel_tests import decode_proto_op_test_base as test_base
|
from tensorflow.python.kernel_tests.proto import decode_proto_op_test_base as test_base
|
||||||
from tensorflow.contrib.proto.python.ops import decode_proto_op
|
from tensorflow.python.ops import proto_ops as proto_ops
|
||||||
from tensorflow.python.platform import test
|
from tensorflow.python.platform import test
|
||||||
|
|
||||||
|
|
||||||
class DecodeProtoOpTest(test_base.DecodeProtoOpTestBase):
|
class DecodeProtoOpTest(test_base.DecodeProtoOpTestBase):
|
||||||
|
|
||||||
def __init__(self, methodName='runTest'): # pylint: disable=invalid-name
|
def __init__(self, methodName='runTest'): # pylint: disable=invalid-name
|
||||||
super(DecodeProtoOpTest, self).__init__(decode_proto_op, methodName)
|
super(DecodeProtoOpTest, self).__init__(proto_ops, methodName)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
@ -26,10 +26,10 @@ import numpy as np
|
|||||||
|
|
||||||
from google.protobuf import text_format
|
from google.protobuf import text_format
|
||||||
|
|
||||||
from tensorflow.contrib.proto.python.kernel_tests import proto_op_test_base as test_base
|
|
||||||
from tensorflow.contrib.proto.python.kernel_tests import test_example_pb2
|
|
||||||
from tensorflow.python.framework import dtypes
|
from tensorflow.python.framework import dtypes
|
||||||
from tensorflow.python.framework import errors
|
from tensorflow.python.framework import errors
|
||||||
|
from tensorflow.python.kernel_tests.proto import proto_op_test_base as test_base
|
||||||
|
from tensorflow.python.kernel_tests.proto import test_example_pb2
|
||||||
|
|
||||||
|
|
||||||
class DecodeProtoOpTestBase(test_base.ProtoOpTestBase, parameterized.TestCase):
|
class DecodeProtoOpTestBase(test_base.ProtoOpTestBase, parameterized.TestCase):
|
@ -19,17 +19,17 @@ from __future__ import absolute_import
|
|||||||
from __future__ import division
|
from __future__ import division
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
from tensorflow.contrib.proto.python.kernel_tests import descriptor_source_test_base as test_base
|
from tensorflow.python.kernel_tests.proto import descriptor_source_test_base as test_base
|
||||||
from tensorflow.contrib.proto.python.ops import decode_proto_op
|
from tensorflow.python.ops import proto_ops
|
||||||
from tensorflow.contrib.proto.python.ops import encode_proto_op
|
|
||||||
from tensorflow.python.platform import test
|
from tensorflow.python.platform import test
|
||||||
|
|
||||||
|
|
||||||
class DescriptorSourceTest(test_base.DescriptorSourceTestBase):
|
class DescriptorSourceTest(test_base.DescriptorSourceTestBase):
|
||||||
|
|
||||||
def __init__(self, methodName='runTest'): # pylint: disable=invalid-name
|
def __init__(self, methodName='runTest'): # pylint: disable=invalid-name
|
||||||
super(DescriptorSourceTest, self).__init__(decode_proto_op, encode_proto_op,
|
super(DescriptorSourceTest, self).__init__(decode_module=proto_ops,
|
||||||
methodName)
|
encode_module=proto_ops,
|
||||||
|
methodName=methodName)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
@ -25,8 +25,8 @@ import numpy as np
|
|||||||
|
|
||||||
from google.protobuf.descriptor_pb2 import FieldDescriptorProto
|
from google.protobuf.descriptor_pb2 import FieldDescriptorProto
|
||||||
from google.protobuf.descriptor_pb2 import FileDescriptorSet
|
from google.protobuf.descriptor_pb2 import FileDescriptorSet
|
||||||
from tensorflow.contrib.proto.python.kernel_tests import proto_op_test_base as test_base
|
|
||||||
from tensorflow.python.framework import dtypes
|
from tensorflow.python.framework import dtypes
|
||||||
|
from tensorflow.python.kernel_tests.proto import proto_op_test_base as test_base
|
||||||
from tensorflow.python.platform import test
|
from tensorflow.python.platform import test
|
||||||
|
|
||||||
|
|
@ -20,17 +20,17 @@ from __future__ import absolute_import
|
|||||||
from __future__ import division
|
from __future__ import division
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
from tensorflow.contrib.proto.python.kernel_tests import encode_proto_op_test_base as test_base
|
from tensorflow.python.kernel_tests.proto import encode_proto_op_test_base as test_base
|
||||||
from tensorflow.contrib.proto.python.ops import decode_proto_op
|
from tensorflow.python.ops import proto_ops
|
||||||
from tensorflow.contrib.proto.python.ops import encode_proto_op
|
|
||||||
from tensorflow.python.platform import test
|
from tensorflow.python.platform import test
|
||||||
|
|
||||||
|
|
||||||
class EncodeProtoOpTest(test_base.EncodeProtoOpTestBase):
|
class EncodeProtoOpTest(test_base.EncodeProtoOpTestBase):
|
||||||
|
|
||||||
def __init__(self, methodName='runTest'): # pylint: disable=invalid-name
|
def __init__(self, methodName='runTest'): # pylint: disable=invalid-name
|
||||||
super(EncodeProtoOpTest, self).__init__(decode_proto_op, encode_proto_op,
|
super(EncodeProtoOpTest, self).__init__(encode_module=proto_ops,
|
||||||
methodName)
|
decode_module=proto_ops,
|
||||||
|
methodName=methodName)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
@ -28,11 +28,11 @@ import numpy as np
|
|||||||
|
|
||||||
from google.protobuf import text_format
|
from google.protobuf import text_format
|
||||||
|
|
||||||
from tensorflow.contrib.proto.python.kernel_tests import proto_op_test_base as test_base
|
|
||||||
from tensorflow.contrib.proto.python.kernel_tests import test_example_pb2
|
|
||||||
from tensorflow.python.eager import context
|
from tensorflow.python.eager import context
|
||||||
from tensorflow.python.framework import dtypes
|
from tensorflow.python.framework import dtypes
|
||||||
from tensorflow.python.framework import errors
|
from tensorflow.python.framework import errors
|
||||||
|
from tensorflow.python.kernel_tests.proto import proto_op_test_base as test_base
|
||||||
|
from tensorflow.python.kernel_tests.proto import test_example_pb2
|
||||||
from tensorflow.python.ops import array_ops
|
from tensorflow.python.ops import array_ops
|
||||||
|
|
||||||
|
|
@ -23,8 +23,8 @@ from __future__ import print_function
|
|||||||
import ctypes as ct
|
import ctypes as ct
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from tensorflow.contrib.proto.python.kernel_tests import test_example_pb2
|
|
||||||
from tensorflow.core.framework import types_pb2
|
from tensorflow.core.framework import types_pb2
|
||||||
|
from tensorflow.python.kernel_tests.proto import test_example_pb2
|
||||||
from tensorflow.python.platform import test
|
from tensorflow.python.platform import test
|
||||||
|
|
||||||
|
|
31
tensorflow/python/ops/proto_ops.py
Normal file
31
tensorflow/python/ops/proto_ops.py
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
# =============================================================================
|
||||||
|
|
||||||
|
# pylint: disable=wildcard-import,unused-import
|
||||||
|
"""Protocol Buffer encoding and decoding from tensors."""
|
||||||
|
from __future__ import absolute_import
|
||||||
|
from __future__ import division
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
|
from tensorflow.python.framework import ops
|
||||||
|
from tensorflow.python.ops.gen_decode_proto_ops import decode_proto_v2 as decode_proto
|
||||||
|
from tensorflow.python.ops.gen_encode_proto_ops import encode_proto
|
||||||
|
from tensorflow.python.util.tf_export import tf_export
|
||||||
|
|
||||||
|
tf_export("io.decode_proto")(decode_proto)
|
||||||
|
tf_export("io.encode_proto")(encode_proto)
|
||||||
|
|
||||||
|
ops.NotDifferentiable("DecodeProtoV2")
|
||||||
|
ops.NotDifferentiable("EncodeProto")
|
@ -73,6 +73,7 @@ from tensorflow.python.ops.math_ops import *
|
|||||||
from tensorflow.python.ops.numerics import *
|
from tensorflow.python.ops.numerics import *
|
||||||
from tensorflow.python.ops.parsing_ops import *
|
from tensorflow.python.ops.parsing_ops import *
|
||||||
from tensorflow.python.ops.partitioned_variables import *
|
from tensorflow.python.ops.partitioned_variables import *
|
||||||
|
from tensorflow.python.ops.proto_ops import *
|
||||||
from tensorflow.python.ops.ragged import ragged_dispatch as _ragged_dispatch
|
from tensorflow.python.ops.ragged import ragged_dispatch as _ragged_dispatch
|
||||||
from tensorflow.python.ops.ragged import ragged_operators as _ragged_operators
|
from tensorflow.python.ops.ragged import ragged_operators as _ragged_operators
|
||||||
from tensorflow.python.ops.random_ops import *
|
from tensorflow.python.ops.random_ops import *
|
||||||
|
@ -88,6 +88,10 @@ tf_module {
|
|||||||
name: "decode_png"
|
name: "decode_png"
|
||||||
argspec: "args=[\'contents\', \'channels\', \'dtype\', \'name\'], varargs=None, keywords=None, defaults=[\'0\', \"<dtype: \'uint8\'>\", \'None\'], "
|
argspec: "args=[\'contents\', \'channels\', \'dtype\', \'name\'], varargs=None, keywords=None, defaults=[\'0\', \"<dtype: \'uint8\'>\", \'None\'], "
|
||||||
}
|
}
|
||||||
|
member_method {
|
||||||
|
name: "decode_proto"
|
||||||
|
argspec: "args=[\'bytes\', \'message_type\', \'field_names\', \'output_types\', \'descriptor_source\', \'message_format\', \'sanitize\', \'name\'], varargs=None, keywords=None, defaults=[\'local://\', \'binary\', \'False\', \'None\'], "
|
||||||
|
}
|
||||||
member_method {
|
member_method {
|
||||||
name: "decode_raw"
|
name: "decode_raw"
|
||||||
argspec: "args=[\'bytes\', \'out_type\', \'little_endian\', \'name\'], varargs=None, keywords=None, defaults=[\'True\', \'None\'], "
|
argspec: "args=[\'bytes\', \'out_type\', \'little_endian\', \'name\'], varargs=None, keywords=None, defaults=[\'True\', \'None\'], "
|
||||||
@ -104,6 +108,10 @@ tf_module {
|
|||||||
name: "encode_jpeg"
|
name: "encode_jpeg"
|
||||||
argspec: "args=[\'image\', \'format\', \'quality\', \'progressive\', \'optimize_size\', \'chroma_downsampling\', \'density_unit\', \'x_density\', \'y_density\', \'xmp_metadata\', \'name\'], varargs=None, keywords=None, defaults=[\'\', \'95\', \'False\', \'False\', \'True\', \'in\', \'300\', \'300\', \'\', \'None\'], "
|
argspec: "args=[\'image\', \'format\', \'quality\', \'progressive\', \'optimize_size\', \'chroma_downsampling\', \'density_unit\', \'x_density\', \'y_density\', \'xmp_metadata\', \'name\'], varargs=None, keywords=None, defaults=[\'\', \'95\', \'False\', \'False\', \'True\', \'in\', \'300\', \'300\', \'\', \'None\'], "
|
||||||
}
|
}
|
||||||
|
member_method {
|
||||||
|
name: "encode_proto"
|
||||||
|
argspec: "args=[\'sizes\', \'values\', \'field_names\', \'message_type\', \'descriptor_source\', \'name\'], varargs=None, keywords=None, defaults=[\'local://\', \'None\'], "
|
||||||
|
}
|
||||||
member_method {
|
member_method {
|
||||||
name: "extract_jpeg_shape"
|
name: "extract_jpeg_shape"
|
||||||
argspec: "args=[\'contents\', \'output_type\', \'name\'], varargs=None, keywords=None, defaults=[\"<dtype: \'int32\'>\", \'None\'], "
|
argspec: "args=[\'contents\', \'output_type\', \'name\'], varargs=None, keywords=None, defaults=[\"<dtype: \'int32\'>\", \'None\'], "
|
||||||
|
@ -856,6 +856,10 @@ tf_module {
|
|||||||
name: "DecodePng"
|
name: "DecodePng"
|
||||||
argspec: "args=[\'contents\', \'channels\', \'dtype\', \'name\'], varargs=None, keywords=None, defaults=[\'0\', \"<dtype: \'uint8\'>\", \'None\'], "
|
argspec: "args=[\'contents\', \'channels\', \'dtype\', \'name\'], varargs=None, keywords=None, defaults=[\'0\', \"<dtype: \'uint8\'>\", \'None\'], "
|
||||||
}
|
}
|
||||||
|
member_method {
|
||||||
|
name: "DecodeProtoV2"
|
||||||
|
argspec: "args=[\'bytes\', \'message_type\', \'field_names\', \'output_types\', \'descriptor_source\', \'message_format\', \'sanitize\', \'name\'], varargs=None, keywords=None, defaults=[\'local://\', \'binary\', \'False\', \'None\'], "
|
||||||
|
}
|
||||||
member_method {
|
member_method {
|
||||||
name: "DecodeRaw"
|
name: "DecodeRaw"
|
||||||
argspec: "args=[\'bytes\', \'out_type\', \'little_endian\', \'name\'], varargs=None, keywords=None, defaults=[\'True\', \'None\'], "
|
argspec: "args=[\'bytes\', \'out_type\', \'little_endian\', \'name\'], varargs=None, keywords=None, defaults=[\'True\', \'None\'], "
|
||||||
@ -1012,6 +1016,10 @@ tf_module {
|
|||||||
name: "EncodePng"
|
name: "EncodePng"
|
||||||
argspec: "args=[\'image\', \'compression\', \'name\'], varargs=None, keywords=None, defaults=[\'-1\', \'None\'], "
|
argspec: "args=[\'image\', \'compression\', \'name\'], varargs=None, keywords=None, defaults=[\'-1\', \'None\'], "
|
||||||
}
|
}
|
||||||
|
member_method {
|
||||||
|
name: "EncodeProto"
|
||||||
|
argspec: "args=[\'sizes\', \'values\', \'field_names\', \'message_type\', \'descriptor_source\', \'name\'], varargs=None, keywords=None, defaults=[\'local://\', \'None\'], "
|
||||||
|
}
|
||||||
member_method {
|
member_method {
|
||||||
name: "EncodeWav"
|
name: "EncodeWav"
|
||||||
argspec: "args=[\'audio\', \'sample_rate\', \'name\'], varargs=None, keywords=None, defaults=[\'None\'], "
|
argspec: "args=[\'audio\', \'sample_rate\', \'name\'], varargs=None, keywords=None, defaults=[\'None\'], "
|
||||||
|
@ -68,6 +68,10 @@ tf_module {
|
|||||||
name: "decode_png"
|
name: "decode_png"
|
||||||
argspec: "args=[\'contents\', \'channels\', \'dtype\', \'name\'], varargs=None, keywords=None, defaults=[\'0\', \"<dtype: \'uint8\'>\", \'None\'], "
|
argspec: "args=[\'contents\', \'channels\', \'dtype\', \'name\'], varargs=None, keywords=None, defaults=[\'0\', \"<dtype: \'uint8\'>\", \'None\'], "
|
||||||
}
|
}
|
||||||
|
member_method {
|
||||||
|
name: "decode_proto"
|
||||||
|
argspec: "args=[\'bytes\', \'message_type\', \'field_names\', \'output_types\', \'descriptor_source\', \'message_format\', \'sanitize\', \'name\'], varargs=None, keywords=None, defaults=[\'local://\', \'binary\', \'False\', \'None\'], "
|
||||||
|
}
|
||||||
member_method {
|
member_method {
|
||||||
name: "decode_raw"
|
name: "decode_raw"
|
||||||
argspec: "args=[\'bytes\', \'out_type\', \'little_endian\', \'name\'], varargs=None, keywords=None, defaults=[\'True\', \'None\'], "
|
argspec: "args=[\'bytes\', \'out_type\', \'little_endian\', \'name\'], varargs=None, keywords=None, defaults=[\'True\', \'None\'], "
|
||||||
@ -84,6 +88,10 @@ tf_module {
|
|||||||
name: "encode_jpeg"
|
name: "encode_jpeg"
|
||||||
argspec: "args=[\'image\', \'format\', \'quality\', \'progressive\', \'optimize_size\', \'chroma_downsampling\', \'density_unit\', \'x_density\', \'y_density\', \'xmp_metadata\', \'name\'], varargs=None, keywords=None, defaults=[\'\', \'95\', \'False\', \'False\', \'True\', \'in\', \'300\', \'300\', \'\', \'None\'], "
|
argspec: "args=[\'image\', \'format\', \'quality\', \'progressive\', \'optimize_size\', \'chroma_downsampling\', \'density_unit\', \'x_density\', \'y_density\', \'xmp_metadata\', \'name\'], varargs=None, keywords=None, defaults=[\'\', \'95\', \'False\', \'False\', \'True\', \'in\', \'300\', \'300\', \'\', \'None\'], "
|
||||||
}
|
}
|
||||||
|
member_method {
|
||||||
|
name: "encode_proto"
|
||||||
|
argspec: "args=[\'sizes\', \'values\', \'field_names\', \'message_type\', \'descriptor_source\', \'name\'], varargs=None, keywords=None, defaults=[\'local://\', \'None\'], "
|
||||||
|
}
|
||||||
member_method {
|
member_method {
|
||||||
name: "extract_jpeg_shape"
|
name: "extract_jpeg_shape"
|
||||||
argspec: "args=[\'contents\', \'output_type\', \'name\'], varargs=None, keywords=None, defaults=[\"<dtype: \'int32\'>\", \'None\'], "
|
argspec: "args=[\'contents\', \'output_type\', \'name\'], varargs=None, keywords=None, defaults=[\"<dtype: \'int32\'>\", \'None\'], "
|
||||||
|
@ -856,6 +856,10 @@ tf_module {
|
|||||||
name: "DecodePng"
|
name: "DecodePng"
|
||||||
argspec: "args=[\'contents\', \'channels\', \'dtype\', \'name\'], varargs=None, keywords=None, defaults=[\'0\', \"<dtype: \'uint8\'>\", \'None\'], "
|
argspec: "args=[\'contents\', \'channels\', \'dtype\', \'name\'], varargs=None, keywords=None, defaults=[\'0\', \"<dtype: \'uint8\'>\", \'None\'], "
|
||||||
}
|
}
|
||||||
|
member_method {
|
||||||
|
name: "DecodeProtoV2"
|
||||||
|
argspec: "args=[\'bytes\', \'message_type\', \'field_names\', \'output_types\', \'descriptor_source\', \'message_format\', \'sanitize\', \'name\'], varargs=None, keywords=None, defaults=[\'local://\', \'binary\', \'False\', \'None\'], "
|
||||||
|
}
|
||||||
member_method {
|
member_method {
|
||||||
name: "DecodeRaw"
|
name: "DecodeRaw"
|
||||||
argspec: "args=[\'bytes\', \'out_type\', \'little_endian\', \'name\'], varargs=None, keywords=None, defaults=[\'True\', \'None\'], "
|
argspec: "args=[\'bytes\', \'out_type\', \'little_endian\', \'name\'], varargs=None, keywords=None, defaults=[\'True\', \'None\'], "
|
||||||
@ -1012,6 +1016,10 @@ tf_module {
|
|||||||
name: "EncodePng"
|
name: "EncodePng"
|
||||||
argspec: "args=[\'image\', \'compression\', \'name\'], varargs=None, keywords=None, defaults=[\'-1\', \'None\'], "
|
argspec: "args=[\'image\', \'compression\', \'name\'], varargs=None, keywords=None, defaults=[\'-1\', \'None\'], "
|
||||||
}
|
}
|
||||||
|
member_method {
|
||||||
|
name: "EncodeProto"
|
||||||
|
argspec: "args=[\'sizes\', \'values\', \'field_names\', \'message_type\', \'descriptor_source\', \'name\'], varargs=None, keywords=None, defaults=[\'local://\', \'None\'], "
|
||||||
|
}
|
||||||
member_method {
|
member_method {
|
||||||
name: "EncodeWav"
|
name: "EncodeWav"
|
||||||
argspec: "args=[\'audio\', \'sample_rate\', \'name\'], varargs=None, keywords=None, defaults=[\'None\'], "
|
argspec: "args=[\'audio\', \'sample_rate\', \'name\'], varargs=None, keywords=None, defaults=[\'None\'], "
|
||||||
|
Loading…
Reference in New Issue
Block a user