@@ -46,7 +46,10 @@ namespace Tensorflow | |||||
catch (Exception ex) | catch (Exception ex) | ||||
{ | { | ||||
Console.WriteLine(ex.ToString()); | Console.WriteLine(ex.ToString()); | ||||
throw ex; | |||||
#if DEBUG | |||||
Debugger.Break(); | |||||
#endif | |||||
throw; | |||||
} | } | ||||
finally | finally | ||||
{ | { | ||||
@@ -65,7 +68,10 @@ namespace Tensorflow | |||||
catch (Exception ex) | catch (Exception ex) | ||||
{ | { | ||||
Console.WriteLine(ex.ToString()); | Console.WriteLine(ex.ToString()); | ||||
throw ex; | |||||
#if DEBUG | |||||
Debugger.Break(); | |||||
#endif | |||||
throw; | |||||
} | } | ||||
finally | finally | ||||
{ | { | ||||
@@ -85,8 +91,9 @@ namespace Tensorflow | |||||
{ | { | ||||
Console.WriteLine(ex.ToString()); | Console.WriteLine(ex.ToString()); | ||||
#if DEBUG | #if DEBUG | ||||
Debugger.Break(); | |||||
Debugger.Break(); | |||||
#endif | #endif | ||||
throw; | |||||
return default(TOut); | return default(TOut); | ||||
} | } | ||||
finally | finally | ||||
@@ -12,7 +12,7 @@ namespace TensorFlowNET.Examples | |||||
public class BasicEagerApi : IExample | public class BasicEagerApi : IExample | ||||
{ | { | ||||
public int Priority => 100; | public int Priority => 100; | ||||
public bool Enabled => false; | |||||
public bool Enabled { get; set; } = false; | |||||
public string Name => "Basic Eager"; | public string Name => "Basic Eager"; | ||||
private Tensor a, b, c, d; | private Tensor a, b, c, d; | ||||
@@ -12,7 +12,7 @@ namespace TensorFlowNET.Examples | |||||
/// </summary> | /// </summary> | ||||
public class BasicOperations : Python, IExample | public class BasicOperations : Python, IExample | ||||
{ | { | ||||
public bool Enabled => true; | |||||
public bool Enabled { get; set; } = true; | |||||
public int Priority => 2; | public int Priority => 2; | ||||
public string Name => "Basic Operations"; | public string Name => "Basic Operations"; | ||||
@@ -12,7 +12,7 @@ namespace TensorFlowNET.Examples | |||||
public class HelloWorld : Python, IExample | public class HelloWorld : Python, IExample | ||||
{ | { | ||||
public int Priority => 1; | public int Priority => 1; | ||||
public bool Enabled => true; | |||||
public bool Enabled { get; set; } = true; | |||||
public string Name => "Hello World"; | public string Name => "Hello World"; | ||||
public bool Run() | public bool Run() | ||||
@@ -17,7 +17,7 @@ namespace TensorFlowNET.Examples | |||||
/// <summary> | /// <summary> | ||||
/// True to run example | /// True to run example | ||||
/// </summary> | /// </summary> | ||||
bool Enabled { get; } | |||||
bool Enabled { get; set; } | |||||
string Name { get; } | string Name { get; } | ||||
@@ -13,7 +13,7 @@ namespace TensorFlowNET.Examples | |||||
public class ImageRecognition : Python, IExample | public class ImageRecognition : Python, IExample | ||||
{ | { | ||||
public int Priority => 7; | public int Priority => 7; | ||||
public bool Enabled => true; | |||||
public bool Enabled { get; set; } = true; | |||||
public string Name => "Image Recognition"; | public string Name => "Image Recognition"; | ||||
string dir = "ImageRecognition"; | string dir = "ImageRecognition"; | ||||
@@ -19,7 +19,7 @@ namespace TensorFlowNET.Examples | |||||
/// </summary> | /// </summary> | ||||
public class InceptionArchGoogLeNet : Python, IExample | public class InceptionArchGoogLeNet : Python, IExample | ||||
{ | { | ||||
public bool Enabled => false; | |||||
public bool Enabled { get; set; } = false; | |||||
public int Priority => 100; | public int Priority => 100; | ||||
public string Name => "Inception Arch GoogLeNet"; | public string Name => "Inception Arch GoogLeNet"; | ||||
@@ -16,7 +16,7 @@ namespace TensorFlowNET.Examples | |||||
public class KMeansClustering : Python, IExample | public class KMeansClustering : Python, IExample | ||||
{ | { | ||||
public int Priority => 8; | public int Priority => 8; | ||||
public bool Enabled => true; | |||||
public bool Enabled { get; set; } = true; | |||||
public string Name => "K-means Clustering"; | public string Name => "K-means Clustering"; | ||||
Datasets mnist; | Datasets mnist; | ||||
@@ -13,7 +13,7 @@ namespace TensorFlowNET.Examples | |||||
public class LinearRegression : Python, IExample | public class LinearRegression : Python, IExample | ||||
{ | { | ||||
public int Priority => 3; | public int Priority => 3; | ||||
public bool Enabled => true; | |||||
public bool Enabled { get; set; } = true; | |||||
public string Name => "Linear Regression"; | public string Name => "Linear Regression"; | ||||
NumPyRandom rng = np.random; | NumPyRandom rng = np.random; | ||||
@@ -17,7 +17,7 @@ namespace TensorFlowNET.Examples | |||||
public class LogisticRegression : Python, IExample | public class LogisticRegression : Python, IExample | ||||
{ | { | ||||
public int Priority => 4; | public int Priority => 4; | ||||
public bool Enabled => true; | |||||
public bool Enabled { get; set; } = true; | |||||
public string Name => "Logistic Regression"; | public string Name => "Logistic Regression"; | ||||
private float learning_rate = 0.01f; | private float learning_rate = 0.01f; | ||||
@@ -10,7 +10,7 @@ namespace TensorFlowNET.Examples | |||||
public class MetaGraph : Python, IExample | public class MetaGraph : Python, IExample | ||||
{ | { | ||||
public int Priority => 100; | public int Priority => 100; | ||||
public bool Enabled => false; | |||||
public bool Enabled { get; set; } = false; | |||||
public string Name => "Meta Graph"; | public string Name => "Meta Graph"; | ||||
public bool Run() | public bool Run() | ||||
@@ -13,7 +13,7 @@ namespace TensorFlowNET.Examples | |||||
public class NaiveBayesClassifier : Python, IExample | public class NaiveBayesClassifier : Python, IExample | ||||
{ | { | ||||
public int Priority => 6; | public int Priority => 6; | ||||
public bool Enabled => true; | |||||
public bool Enabled { get; set; } = true; | |||||
public string Name => "Naive Bayes Classifier"; | public string Name => "Naive Bayes Classifier"; | ||||
public Normal dist { get; set; } | public Normal dist { get; set; } | ||||
@@ -11,7 +11,7 @@ namespace TensorFlowNET.Examples | |||||
public class NamedEntityRecognition : Python, IExample | public class NamedEntityRecognition : Python, IExample | ||||
{ | { | ||||
public int Priority => 100; | public int Priority => 100; | ||||
public bool Enabled => false; | |||||
public bool Enabled { get; set; } = false; | |||||
public string Name => "NER"; | public string Name => "NER"; | ||||
public bool Run() | public bool Run() | ||||
@@ -15,7 +15,7 @@ namespace TensorFlowNET.Examples | |||||
public class NearestNeighbor : Python, IExample | public class NearestNeighbor : Python, IExample | ||||
{ | { | ||||
public int Priority => 5; | public int Priority => 5; | ||||
public bool Enabled => true; | |||||
public bool Enabled { get; set; } = true; | |||||
public string Name => "Nearest Neighbor"; | public string Name => "Nearest Neighbor"; | ||||
Datasets mnist; | Datasets mnist; | ||||
NDArray Xtr, Ytr, Xte, Yte; | NDArray Xtr, Ytr, Xte, Yte; | ||||
@@ -15,7 +15,7 @@ namespace TensorFlowNET.Examples.CnnTextClassification | |||||
public class TextClassificationTrain : Python, IExample | public class TextClassificationTrain : Python, IExample | ||||
{ | { | ||||
public int Priority => 100; | public int Priority => 100; | ||||
public bool Enabled => false; | |||||
public bool Enabled { get; set; }= false; | |||||
public string Name => "Text Classification"; | public string Name => "Text Classification"; | ||||
private string dataDir = "text_classification"; | private string dataDir = "text_classification"; | ||||
@@ -12,7 +12,7 @@ namespace TensorFlowNET.Examples | |||||
public class TextClassificationWithMovieReviews : Python, IExample | public class TextClassificationWithMovieReviews : Python, IExample | ||||
{ | { | ||||
public int Priority => 9; | public int Priority => 9; | ||||
public bool Enabled => false; | |||||
public bool Enabled { get; set; } = false; | |||||
public string Name => "Movie Reviews"; | public string Name => "Movie Reviews"; | ||||
string dir = "text_classification_with_movie_reviews"; | string dir = "text_classification_with_movie_reviews"; | ||||
@@ -0,0 +1,99 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using Microsoft.VisualStudio.TestTools.UnitTesting; | |||||
using TensorFlowNET.Examples; | |||||
using TensorFlowNET.Examples.CnnTextClassification; | |||||
namespace TensorFlowNET.UnitTest.ExamplesTests | |||||
{ | |||||
[TestClass] | |||||
public class ExamplesTest | |||||
{ | |||||
[TestMethod] | |||||
public void BasicOperations() | |||||
{ | |||||
new BasicOperations() { Enabled = true }.Run(); | |||||
} | |||||
[TestMethod] | |||||
public void HelloWorld() | |||||
{ | |||||
new HelloWorld() { Enabled = true }.Run(); | |||||
} | |||||
[TestMethod] | |||||
public void ImageRecognition() | |||||
{ | |||||
new HelloWorld() { Enabled = true }.Run(); | |||||
} | |||||
[Ignore] | |||||
[TestMethod] | |||||
public void InceptionArchGoogLeNet() | |||||
{ | |||||
new InceptionArchGoogLeNet() { Enabled = true }.Run(); | |||||
} | |||||
[Ignore] | |||||
[TestMethod] | |||||
public void KMeansClustering() | |||||
{ | |||||
new KMeansClustering() { Enabled = true }.Run(); | |||||
} | |||||
[TestMethod] | |||||
public void LinearRegression() | |||||
{ | |||||
new LinearRegression() { Enabled = true }.Run(); | |||||
} | |||||
[TestMethod] | |||||
public void LogisticRegression() | |||||
{ | |||||
new LogisticRegression() { Enabled = true }.Run(); | |||||
} | |||||
[Ignore] | |||||
[TestMethod] | |||||
public void MetaGraph() | |||||
{ | |||||
new MetaGraph() { Enabled = true }.Run(); | |||||
} | |||||
[Ignore] | |||||
[TestMethod] | |||||
public void NaiveBayesClassifier() | |||||
{ | |||||
new NaiveBayesClassifier() { Enabled = true }.Run(); | |||||
} | |||||
[Ignore] | |||||
[TestMethod] | |||||
public void NamedEntityRecognition() | |||||
{ | |||||
new NamedEntityRecognition() { Enabled = true }.Run(); | |||||
} | |||||
[TestMethod] | |||||
public void NearestNeighbor() | |||||
{ | |||||
new NearestNeighbor() { Enabled = true }.Run(); | |||||
} | |||||
[Ignore] | |||||
[TestMethod] | |||||
public void TextClassificationTrain() | |||||
{ | |||||
new TextClassificationTrain() { Enabled = true }.Run(); | |||||
} | |||||
[Ignore] | |||||
[TestMethod] | |||||
public void TextClassificationWithMovieReviews() | |||||
{ | |||||
new TextClassificationWithMovieReviews() { Enabled = true }.Run(); | |||||
} | |||||
} | |||||
} |
@@ -23,6 +23,7 @@ | |||||
<ItemGroup> | <ItemGroup> | ||||
<ProjectReference Include="..\..\src\TensorFlowNET.Core\TensorFlowNET.Core.csproj" /> | <ProjectReference Include="..\..\src\TensorFlowNET.Core\TensorFlowNET.Core.csproj" /> | ||||
<ProjectReference Include="..\TensorFlowNET.Examples\TensorFlowNET.Examples.csproj" /> | |||||
</ItemGroup> | </ItemGroup> | ||||
</Project> | </Project> |