fix bug in normal distribution: _log_probtags/v0.9
| @@ -1,7 +1,7 @@ | |||||
| | | ||||
| Microsoft Visual Studio Solution File, Format Version 12.00 | Microsoft Visual Studio Solution File, Format Version 12.00 | ||||
| # Visual Studio Version 16 | |||||
| VisualStudioVersion = 16.0.28803.452 | |||||
| # Visual Studio 15 | |||||
| VisualStudioVersion = 15.0.28307.168 | |||||
| MinimumVisualStudioVersion = 10.0.40219.1 | MinimumVisualStudioVersion = 10.0.40219.1 | ||||
| Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TensorFlowNET.UnitTest", "test\TensorFlowNET.UnitTest\TensorFlowNET.UnitTest.csproj", "{029A8CF1-CF95-4DCB-98AA-9D3D96A83B3E}" | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TensorFlowNET.UnitTest", "test\TensorFlowNET.UnitTest\TensorFlowNET.UnitTest.csproj", "{029A8CF1-CF95-4DCB-98AA-9D3D96A83B3E}" | ||||
| EndProject | EndProject | ||||
| @@ -82,7 +82,7 @@ namespace Tensorflow | |||||
| protected override Tensor _log_prob(Tensor x) | protected override Tensor _log_prob(Tensor x) | ||||
| { | { | ||||
| var log_prob = _log_unnormalized_prob(_z(x)); | |||||
| var log_prob = _log_unnormalized_prob(x); | |||||
| var log_norm = _log_normalization(); | var log_norm = _log_normalization(); | ||||
| return tf.sub(log_prob, log_norm); | return tf.sub(log_prob, log_norm); | ||||
| } | } | ||||
| @@ -62,4 +62,10 @@ Docs: https://tensorflownet.readthedocs.io</Description> | |||||
| <Folder Include="Keras\Initializers\" /> | <Folder Include="Keras\Initializers\" /> | ||||
| </ItemGroup> | </ItemGroup> | ||||
| <ItemGroup> | |||||
| <Reference Include="NumSharp.Core"> | |||||
| <HintPath>..\..\..\..\NumSharp\src\NumSharp.Core\bin\Debug\netstandard2.0\NumSharp.Core.dll</HintPath> | |||||
| </Reference> | |||||
| </ItemGroup> | |||||
| </Project> | </Project> | ||||
| @@ -5,6 +5,8 @@ using Tensorflow; | |||||
| using NumSharp; | using NumSharp; | ||||
| using System.Linq; | using System.Linq; | ||||
| using static Tensorflow.Python; | using static Tensorflow.Python; | ||||
| using System.IO; | |||||
| using TensorFlowNET.Examples.Utility; | |||||
| namespace TensorFlowNET.Examples | namespace TensorFlowNET.Examples | ||||
| { | { | ||||
| @@ -34,7 +36,10 @@ namespace TensorFlowNET.Examples | |||||
| var (xx, yy) = np.meshgrid(np.linspace(x_min, x_max, 30), np.linspace(y_min, y_max, 30)); | var (xx, yy) = np.meshgrid(np.linspace(x_min, x_max, 30), np.linspace(y_min, y_max, 30)); | ||||
| with(tf.Session(), sess => | with(tf.Session(), sess => | ||||
| { | { | ||||
| var samples = np.hstack<float>(xx.ravel().reshape(xx.size, 1), yy.ravel().reshape(yy.size, 1)); | |||||
| //var samples = np.vstack<float>(xx.ravel(), yy.ravel()); | |||||
| //samples = np.transpose(samples); | |||||
| var array = np.Load<double[,]>(Path.Join("nb", "nb_example.npy")); | |||||
| var samples = np.array(array).astype(np.float32); | |||||
| var Z = sess.run(predict(samples)); | var Z = sess.run(predict(samples)); | ||||
| }); | }); | ||||
| @@ -167,6 +172,10 @@ namespace TensorFlowNET.Examples | |||||
| 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||||
| 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||||
| 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2); | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2); | ||||
| string url = "https://raw.githubusercontent.com/SciSharp/TensorFlow.NET/master/data/nb_example.npy"; | |||||
| Web.Download(url, "nb", "nb_example.npy"); | |||||
| #endregion | #endregion | ||||
| } | } | ||||
| @@ -24,4 +24,10 @@ | |||||
| <ProjectReference Include="..\..\src\TensorFlowNET.Core\TensorFlowNET.Core.csproj" /> | <ProjectReference Include="..\..\src\TensorFlowNET.Core\TensorFlowNET.Core.csproj" /> | ||||
| </ItemGroup> | </ItemGroup> | ||||
| <ItemGroup> | |||||
| <Reference Include="NumSharp.Core"> | |||||
| <HintPath>..\..\..\..\NumSharp\src\NumSharp.Core\bin\Debug\netstandard2.0\NumSharp.Core.dll</HintPath> | |||||
| </Reference> | |||||
| </ItemGroup> | |||||
| </Project> | </Project> | ||||