From 24418b76534a49d5bb498ed1c3e23a3cddb7b0b1 Mon Sep 17 00:00:00 2001 From: Oceania2018 Date: Tue, 10 Sep 2019 13:26:32 -0500 Subject: [PATCH] Protocol message was too large when parsing to GraphDef. #383 --- src/TensorFlowNET.Core/Estimators/Training.cs | 4 ++-- src/TensorFlowNET.Core/Graphs/Graph.Export.cs | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/TensorFlowNET.Core/Estimators/Training.cs b/src/TensorFlowNET.Core/Estimators/Training.cs index 2d43fa4e..d4540219 100644 --- a/src/TensorFlowNET.Core/Estimators/Training.cs +++ b/src/TensorFlowNET.Core/Estimators/Training.cs @@ -8,8 +8,8 @@ namespace Tensorflow.Estimators { public static void train_and_evaluate() { - var executor = new _TrainingExecutor(); - executor.run(); + //var executor = new _TrainingExecutor(); + //executor.run(); } } } diff --git a/src/TensorFlowNET.Core/Graphs/Graph.Export.cs b/src/TensorFlowNET.Core/Graphs/Graph.Export.cs index 4a7e0ed8..2a0d939e 100644 --- a/src/TensorFlowNET.Core/Graphs/Graph.Export.cs +++ b/src/TensorFlowNET.Core/Graphs/Graph.Export.cs @@ -14,6 +14,7 @@ limitations under the License. ******************************************************************************/ +using Google.Protobuf; using System.IO; using Tensorflow.Util; @@ -37,7 +38,9 @@ namespace Tensorflow using (var buffer = ToGraphDef(status)) { status.Check(true); - def = GraphDef.Parser.ParseFrom(buffer.MemoryBlock.Stream()); + // limit size to 250M, recursion to max 100 + var inputStream = CodedInputStream.CreateWithLimits(buffer.MemoryBlock.Stream(), 250 * 1024 * 1024, 100); + def = GraphDef.Parser.ParseFrom(inputStream); } // Strip the experimental library field iff it's empty.