Skip to content

Commit 9d4e1d3

Browse files
committed
Sole addition to the 1.8.0 C API
1 parent 6f114ae commit 9d4e1d3

File tree

3 files changed

+12
-28
lines changed

3 files changed

+12
-28
lines changed

.editorconfig

Lines changed: 0 additions & 24 deletions
This file was deleted.

SampleTest/SampleTest.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ void BasicConstantOps ()
8888
results = s.GetRunner ().Run (g.Mul (a, b));
8989
Console.WriteLine ("a*b={0}", results.GetValue ());
9090

91+
Console.WriteLine ("graph to string: " + g.ToString ());
9192
// TODO: API-wise, perhaps session.Run () can have a simple
9293
// overload where we only care about the fetched values,
9394
// making the above:

TensorFlowSharp/Tensorflow.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,13 @@
3939
using System.Linq.Expressions;
4040

4141
namespace TensorFlow
42-
{
42+
{
4343
static partial class NativeBinding
4444
{
4545
public const string TensorFlowLibrary = "libtensorflow";
4646
public const string TensorFlowLibraryGPU = "libtensorflowgpu";
4747

4848
internal static string GetStr (this IntPtr x) => Marshal.PtrToStringAnsi (x);
49-
50-
5149
}
5250

5351
/// <summary>
@@ -1256,7 +1254,16 @@ public bool TryEvaluateConstant (TFOutput output, ref TFTensor tensor)
12561254
tensor = null;
12571255
return ret;
12581256
}
1259-
}
1257+
1258+
[DllImport (NativeBinding.TensorFlowLibrary)]
1259+
static extern string TF_GraphDebugString (TF_Graph graph, out IntPtr len);
1260+
1261+
public override string ToString ()
1262+
{
1263+
IntPtr len;
1264+
return TF_GraphDebugString (Handle, out len);
1265+
}
1266+
}
12601267

12611268
//
12621269
// A TFGraph that will not release the undelying handle, this is used

0 commit comments

Comments
 (0)