Skip to content

Commit 2f75601

Browse files
kevemantensorflower-gardener
authored andcommitted
Enable deserializing protos > 64MB in length.
Update protobuf commit Change: 114990608
1 parent d0a822f commit 2f75601

File tree

7 files changed

+53
-52
lines changed

7 files changed

+53
-52
lines changed

google/protobuf

tensorflow/python/BUILD

+11
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,17 @@ py_test(
251251
],
252252
)
253253

254+
py_test(
255+
name = "proto_test",
256+
srcs = ["framework/proto_test.py"],
257+
main = "framework/proto_test.py",
258+
srcs_version = "PY2AND3",
259+
deps = [
260+
":framework_test_lib",
261+
"//tensorflow:tensorflow_py",
262+
],
263+
)
264+
254265
tf_gen_op_wrapper_py(
255266
name = "functional_ops",
256267
out = "ops/gen_functional_ops.py",
+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Copyright 2015 Google Inc. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
# ==============================================================================
15+
"""Protobuf related tests."""
16+
17+
from __future__ import absolute_import
18+
from __future__ import division
19+
from __future__ import print_function
20+
21+
import numpy as np
22+
import tensorflow as tf
23+
24+
class ProtoTest(tf.test.TestCase):
25+
26+
def testLargeProto(self):
27+
# create a constant of size > 64MB.
28+
a = tf.constant(np.zeros([1024, 1024, 17]))
29+
# Serialize the resulting graph def.
30+
gdef = a.op.graph.as_graph_def()
31+
serialized = gdef.SerializeToString()
32+
unserialized = tf.Graph().as_graph_def()
33+
# Deserialize back. Protobuf python library should support
34+
# protos larger than 64MB.
35+
unserialized.ParseFromString(serialized)
36+
self.assertProtoEquals(unserialized, gdef)
37+
38+
39+
if __name__ == "__main__":
40+
tf.test.main()

tensorflow/tensorboard/lib/js/backend/test/blaze.html

-17
This file was deleted.

tensorflow/tensorboard/lib/js/nanite/test/blaze.html

-21
This file was deleted.

tensorflow/tensorboard/lib/js/requestManager/test/blaze.html

-13
This file was deleted.

tools/bazel.rc.template

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ build:cuda --crosstool_top=//third_party/gpus/crosstool
33
build --force_python=py$PYTHON_MAJOR_VERSION
44
build --python$PYTHON_MAJOR_VERSION_path=$PYTHON_BINARY
55
build --define=use_fast_cpp_protos=true
6+
build --define=allow_oversize_protos=true
67

78
build --spawn_strategy=standalone
89
test --spawn_strategy=standalone

0 commit comments

Comments
 (0)