Browse Source

changes for example project

tags/v0.8.0
Esther2013 6 years ago
parent
commit
aac35afd05
2 changed files with 8 additions and 3 deletions
  1. +4
    -3
      test/TensorFlowNET.Examples/HelloWorld.cs
  2. +4
    -0
      test/TensorFlowNET.Examples/IExample.cs

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

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

// Start tf session
using (var sess = tf.Session())
@@ -26,9 +27,9 @@ namespace TensorFlowNET.Examples
// Run the op
var result = sess.run(hello);
Console.WriteLine(result.ToString());
if(!result.ToString().Equals("Hello, TensorFlow!"))
if(!result.ToString().Equals(str))
{
throw new ValueError("HelloWorld");
throw new ValueError("HelloWorld example acts in unexpected way.");
}
}
}


+ 4
- 0
test/TensorFlowNET.Examples/IExample.cs View File

@@ -4,6 +4,10 @@ using System.Text;

namespace TensorFlowNET.Examples
{
/// <summary>
/// Interface of Example project
/// All example should implement IExample so the entry program will find it.
/// </summary>
public interface IExample
{
void Run();


Loading…
Cancel
Save