| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,6 +15,8 @@ public class BasicLinearModel | |||
| 15 | 15 | [TestMethod] | |
| 16 | 16 | public void LinearRegression() | |
| 17 | 17 | { | |
| 18 | + tf.Graph().as_default(); | ||
| 19 | + | ||
| 18 | 20 | // Initialize the weights to `5.0` and the bias to `0.0` | |
| 19 | 21 | // In practice, these should be initialized to random values (for example, with `tf.random.normal`) | |
| 20 | 22 | var W = tf.Variable(5.0f); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,8 +1,5 @@ | |||
| 1 | - using Microsoft.VisualStudio.TestPlatform.Utilities; | ||
| 2 | - using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
| 1 | + using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
| 3 | 2 | using System; | |
| 4 | - using System.Diagnostics; | ||
| 5 | - using System.Linq; | ||
| 6 | 3 | using Tensorflow.NumPy; | |
| 7 | 4 | using TensorFlowNET.UnitTest; | |
| 8 | 5 | using static Tensorflow.Binding; | |
@@ -27,8 +24,8 @@ private void TestBasic<T>() where T : struct | |||
| 27 | 24 | var dtype = GetTypeForNumericType<T>(); | |
| 28 | 25 | ||
| 29 | 26 | // train.GradientDescentOptimizer is V1 only API. | |
| 30 | - //tf.Graph().as_default(); | ||
| 31 | - /*using (var sess = self.cached_session()) | ||
| 27 | + tf.Graph().as_default(); | ||
| 28 | + using (var sess = self.cached_session()) | ||
| 32 | 29 | { | |
| 33 | 30 | var var0 = tf.Variable(new[] { 1.0, 2.0 }, dtype: dtype); | |
| 34 | 31 | var var1 = tf.Variable(new[] { 3.0, 4.0 }, dtype: dtype); | |
@@ -59,15 +56,15 @@ private void TestBasic<T>() where T : struct | |||
| 59 | 56 | new[] { 3.0 - 3.0 * 0.01, 4.0 - 3.0 * 0.01 }, | |
| 60 | 57 | self.evaluate<T[]>(var1)); | |
| 61 | 58 | // TODO: self.assertEqual(0, len(optimizer.variables())); | |
| 62 | - }*/ | ||
| 59 | + } | ||
| 63 | 60 | } | |
| 64 | 61 | ||
| 65 | 62 | [TestMethod] | |
| 66 | 63 | public void TestBasic() | |
| 67 | 64 | { | |
| 68 | 65 | //TODO: add np.half | |
| 69 | 66 | TestBasic<float>(); | |
| 70 | - // TestBasic<double>(); | ||
| 67 | + TestBasic<double>(); | ||
| 71 | 68 | } | |
| 72 | 69 | ||
| 73 | 70 | private void TestTensorLearningRate<T>() where T : struct | |
@@ -115,8 +112,8 @@ private void TestTensorLearningRate<T>() where T : struct | |||
| 115 | 112 | public void TestTensorLearningRate() | |
| 116 | 113 | { | |
| 117 | 114 | //TODO: add np.half | |
| 118 | - // TestTensorLearningRate<float>(); | ||
| 119 | - // TestTensorLearningRate<double>(); | ||
| 115 | + TestTensorLearningRate<float>(); | ||
| 116 | + TestTensorLearningRate<double>(); | ||
| 120 | 117 | } | |
| 121 | 118 | } | |
| 122 | 119 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments