Skip to content

Commit 4bc97cd

Browse files
committed
added all examples to the unit testing suite
1 parent efe5ef2 commit 4bc97cd

18 files changed

Lines changed: 125 additions & 18 deletions

src/TensorFlowNET.Core/Python.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ public static void with(IPython py, Action<IPython> action)
4646
catch (Exception ex)
4747
{
4848
Console.WriteLine(ex.ToString());
49-
throw ex;
49+
#if DEBUG
50+
Debugger.Break();
51+
#endif
52+
throw;
5053
}
5154
finally
5255
{
@@ -65,7 +68,10 @@ public static void with<T>(T py, Action<T> action) where T : IPython
6568
catch (Exception ex)
6669
{
6770
Console.WriteLine(ex.ToString());
68-
throw ex;
71+
#if DEBUG
72+
Debugger.Break();
73+
#endif
74+
throw;
6975
}
7076
finally
7177
{
@@ -85,8 +91,9 @@ public static TOut with<TIn, TOut>(TIn py, Func<TIn, TOut> action) where TIn : I
8591
{
8692
Console.WriteLine(ex.ToString());
8793
#if DEBUG
88-
Debugger.Break();
94+
Debugger.Break();
8995
#endif
96+
throw;
9097
return default(TOut);
9198
}
9299
finally

test/TensorFlowNET.Examples/BasicEagerApi.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace TensorFlowNET.Examples
1212
public class BasicEagerApi : IExample
1313
{
1414
public int Priority => 100;
15-
public bool Enabled => false;
15+
public bool Enabled { get; set; } = false;
1616
public string Name => "Basic Eager";
1717

1818
private Tensor a, b, c, d;

test/TensorFlowNET.Examples/BasicOperations.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace TensorFlowNET.Examples
1212
/// </summary>
1313
public class BasicOperations : Python, IExample
1414
{
15-
public bool Enabled => true;
15+
public bool Enabled { get; set; } = true;
1616
public int Priority => 2;
1717
public string Name => "Basic Operations";
1818

test/TensorFlowNET.Examples/HelloWorld.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace TensorFlowNET.Examples
1212
public class HelloWorld : Python, IExample
1313
{
1414
public int Priority => 1;
15-
public bool Enabled => true;
15+
public bool Enabled { get; set; } = true;
1616
public string Name => "Hello World";
1717

1818
public bool Run()

test/TensorFlowNET.Examples/IExample.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public interface IExample
1717
/// <summary>
1818
/// True to run example
1919
/// </summary>
20-
bool Enabled { get; }
20+
bool Enabled { get; set; }
2121

2222
string Name { get; }
2323

test/TensorFlowNET.Examples/ImageRecognition.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace TensorFlowNET.Examples
1313
public class ImageRecognition : Python, IExample
1414
{
1515
public int Priority => 7;
16-
public bool Enabled => true;
16+
public bool Enabled { get; set; } = true;
1717
public string Name => "Image Recognition";
1818

1919
string dir = "ImageRecognition";

test/TensorFlowNET.Examples/InceptionArchGoogLeNet.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace TensorFlowNET.Examples
1919
/// </summary>
2020
public class InceptionArchGoogLeNet : Python, IExample
2121
{
22-
public bool Enabled => false;
22+
public bool Enabled { get; set; } = false;
2323
public int Priority => 100;
2424
public string Name => "Inception Arch GoogLeNet";
2525

test/TensorFlowNET.Examples/KMeansClustering.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace TensorFlowNET.Examples
1616
public class KMeansClustering : Python, IExample
1717
{
1818
public int Priority => 8;
19-
public bool Enabled => true;
19+
public bool Enabled { get; set; } = true;
2020
public string Name => "K-means Clustering";
2121

2222
Datasets mnist;

test/TensorFlowNET.Examples/LinearRegression.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace TensorFlowNET.Examples
1313
public class LinearRegression : Python, IExample
1414
{
1515
public int Priority => 3;
16-
public bool Enabled => true;
16+
public bool Enabled { get; set; } = true;
1717
public string Name => "Linear Regression";
1818

1919
NumPyRandom rng = np.random;

test/TensorFlowNET.Examples/LogisticRegression.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace TensorFlowNET.Examples
1717
public class LogisticRegression : Python, IExample
1818
{
1919
public int Priority => 4;
20-
public bool Enabled => true;
20+
public bool Enabled { get; set; } = true;
2121
public string Name => "Logistic Regression";
2222

2323
private float learning_rate = 0.01f;

0 commit comments

Comments
 (0)