Skip to content

Commit 6eb4124

Browse files
committed
Document shortcoming for Issue migueldeicaza#133
1 parent ba49e18 commit 6eb4124

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

SampleTest/SampleTest.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,14 @@ void LinearRegression ()
290290

291291
var X = g.Placeholder (TFDataType.Float);
292292
var Y = g.Placeholder (TFDataType.Float);
293-
var W = g.Variable (g.Const (rng.Next ()), operName: "weight");
294-
var b = g.Variable (g.Const (rng.Next ()), operName: "bias");
293+
294+
// For now, use constants which are not as nice as variables, which can retain
295+
// values across invocations to Run().
296+
297+
// var W = g.Variable (g.Const (rng.Next ()), operName: "weight");
298+
// var b = g.Variable (g.Const (rng.Next ()), operName: "bias");
299+
var W = g.Const ((float) rng.Next (), operName: "weight");
300+
var b = g.Const ((float) rng.Next (), operName: "bias");
295301
var pred = g.Add (g.Mul (X, W), b);
296302

297303
var cost = g.Div (g.ReduceSum (g.Pow (g.Sub (pred, Y), g.Const (2))), g.Mul (g.Const (2), g.Const (n_samples)));
@@ -312,6 +318,7 @@ public static void Main (string [] args)
312318

313319

314320
var t = new MainClass ();
321+
t.LinearRegression ();
315322
t.TestParametersWithIndexes ();
316323
t.AddControlInput ();
317324
t.TestImportGraphDef ();

0 commit comments

Comments
 (0)