Skip to content

Commit 24418b7

Browse files
committed
Protocol message was too large when parsing to GraphDef. SciSharp#383
1 parent 83b9eb8 commit 24418b7

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

src/TensorFlowNET.Core/Estimators/Training.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ public class Training
88
{
99
public static void train_and_evaluate()
1010
{
11-
var executor = new _TrainingExecutor();
12-
executor.run();
11+
//var executor = new _TrainingExecutor();
12+
//executor.run();
1313
}
1414
}
1515
}

src/TensorFlowNET.Core/Graphs/Graph.Export.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ You may obtain a copy of the License at
1414
limitations under the License.
1515
******************************************************************************/
1616

17+
using Google.Protobuf;
1718
using System.IO;
1819
using Tensorflow.Util;
1920

@@ -37,7 +38,9 @@ private GraphDef _as_graph_def(bool add_shapes = false)
3738
using (var buffer = ToGraphDef(status))
3839
{
3940
status.Check(true);
40-
def = GraphDef.Parser.ParseFrom(buffer.MemoryBlock.Stream());
41+
// limit size to 250M, recursion to max 100
42+
var inputStream = CodedInputStream.CreateWithLimits(buffer.MemoryBlock.Stream(), 250 * 1024 * 1024, 100);
43+
def = GraphDef.Parser.ParseFrom(inputStream);
4144
}
4245

4346
// Strip the experimental library field iff it's empty.

0 commit comments

Comments
 (0)