Browse Source

init Session class

tags/v0.1.0-Tensor
Oceania2018 6 years ago
parent
commit
d392e9def8
4 changed files with 24 additions and 5 deletions
  1. +10
    -0
      src/TensorFlowNET.Core/Session.cs
  2. +7
    -1
      src/TensorFlowNET.Core/Status.cs
  3. +5
    -0
      src/TensorFlowNET.Core/Tensorflow.cs
  4. +2
    -4
      test/TensorFlowNET.Examples/HelloWorld.cs

+ 10
- 0
src/TensorFlowNET.Core/Session.cs View File

@@ -0,0 +1,10 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace TensorFlowNET.Core
{
public class Session
{
}
}

+ 7
- 1
src/TensorFlowNET.Core/Status.cs View File

@@ -10,8 +10,14 @@ namespace TensorFlowNET.Core
private IntPtr _handle;
public IntPtr Handle => _handle;

public string ErrorMessage => c_api.TF_Message(_handle);
/// <summary>
/// Error message
/// </summary>
public string Message => c_api.TF_Message(_handle);

/// <summary>
/// Error code
/// </summary>
public TF_Code Code => c_api.TF_GetCode(_handle);

public Status()


+ 5
- 0
src/TensorFlowNET.Core/Tensorflow.cs View File

@@ -51,5 +51,10 @@ namespace TensorFlowNET.Core
Graph g = new Graph(c_api.TF_NewGraph());
return g;
}

public static Session Session()
{
return new Session();
}
}
}

+ 2
- 4
test/TensorFlowNET.Examples/HelloWorld.cs View File

@@ -18,12 +18,10 @@ namespace TensorFlowNET.Examples
The value returned by the constructor represents the output
of the Constant op.*/
var graph = tf.get_default_graph();
var hello = tf.constant(4.0);
//var hello = tf.constant("Hello, TensorFlow!");
var hello = tf.constant("Hello, TensorFlow!");

// Start tf session
// var sess = tf.Session();
var sess = tf.Session();
}
}
}

Loading…
Cancel
Save