From 46e216279747397507f833e765843467c6f35e40 Mon Sep 17 00:00:00 2001 From: Haiping Chen Date: Wed, 21 Jun 2023 17:25:17 -0500 Subject: [PATCH] Fix model.evaluate in NeuralNetXorKeras. --- src/TensorFlowNET.Core/APIs/c_api.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/TensorFlowNET.Core/APIs/c_api.cs b/src/TensorFlowNET.Core/APIs/c_api.cs index 6049c95c..63bdfd27 100644 --- a/src/TensorFlowNET.Core/APIs/c_api.cs +++ b/src/TensorFlowNET.Core/APIs/c_api.cs @@ -53,6 +53,11 @@ namespace Tensorflow public unsafe static byte[] ByteStringPiece(IntPtr handle) { + if (handle == IntPtr.Zero) + { + return new byte[0]; + } + byte* str_data = (byte*)handle.ToPointer(); List bytes = new List(); byte current = 255;