FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

pad_sequences 2 · attackgithub/TensorFlow.NET@d7cb00f · GitHub

Repository navigation

Commit d7cb00f

Browse files
committed
pad_sequences 2
1 parent 2446988 commit d7cb00f

3 files changed

Lines changed: 34 additions & 15 deletions

File tree

‎TensorFlow.NET.sln‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TensorFlowNET.Core", "src\T
1111
EndProject
1212
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TensorFlowNET.Utility", "src\TensorFlowNET.Utility\TensorFlowNET.Utility.csproj", "{00D9085C-0FC7-453C-A0CC-BAD98F44FEA0}"
1313
EndProject
14-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "KerasNET.Core", "..\Keras.NET\src\KerasNET.Core\KerasNET.Core.csproj", "{07E37E81-3BCD-4BBB-AE5D-28527F1C7745}"
14+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TensorFlowNET.Visualization", "TensorFlowNET.Visualization\TensorFlowNET.Visualization.csproj", "{4BB2ABD1-635E-41E4-B534-CB5B6A2D754D}"
1515
EndProject
16-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TensorFlowNET.Visualization", "TensorFlowNET.Visualization\TensorFlowNET.Visualization.csproj", "{4BB2ABD1-635E-41E4-B534-CB5B6A2D754D}"
16+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "KerasNET.Core", "..\Keras.NET\src\KerasNET.Core\KerasNET.Core.csproj", "{E2F0C39C-D706-4CF5-AE00-81FB447F949D}"
1717
EndProject
1818
Global
1919
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -37,14 +37,14 @@ Global
3737
{00D9085C-0FC7-453C-A0CC-BAD98F44FEA0}.Debug|Any CPU.Build.0 = Debug|Any CPU
3838
{00D9085C-0FC7-453C-A0CC-BAD98F44FEA0}.Release|Any CPU.ActiveCfg = Release|Any CPU
3939
{00D9085C-0FC7-453C-A0CC-BAD98F44FEA0}.Release|Any CPU.Build.0 = Release|Any CPU
40-
{07E37E81-3BCD-4BBB-AE5D-28527F1C7745}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
41-
{07E37E81-3BCD-4BBB-AE5D-28527F1C7745}.Debug|Any CPU.Build.0 = Debug|Any CPU
42-
{07E37E81-3BCD-4BBB-AE5D-28527F1C7745}.Release|Any CPU.ActiveCfg = Release|Any CPU
43-
{07E37E81-3BCD-4BBB-AE5D-28527F1C7745}.Release|Any CPU.Build.0 = Release|Any CPU
4440
{4BB2ABD1-635E-41E4-B534-CB5B6A2D754D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
4541
{4BB2ABD1-635E-41E4-B534-CB5B6A2D754D}.Debug|Any CPU.Build.0 = Debug|Any CPU
4642
{4BB2ABD1-635E-41E4-B534-CB5B6A2D754D}.Release|Any CPU.ActiveCfg = Release|Any CPU
4743
{4BB2ABD1-635E-41E4-B534-CB5B6A2D754D}.Release|Any CPU.Build.0 = Release|Any CPU
44+
{E2F0C39C-D706-4CF5-AE00-81FB447F949D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
45+
{E2F0C39C-D706-4CF5-AE00-81FB447F949D}.Debug|Any CPU.Build.0 = Debug|Any CPU
46+
{E2F0C39C-D706-4CF5-AE00-81FB447F949D}.Release|Any CPU.ActiveCfg = Release|Any CPU
47+
{E2F0C39C-D706-4CF5-AE00-81FB447F949D}.Release|Any CPU.Build.0 = Release|Any CPU
4848
EndGlobalSection
4949
GlobalSection(SolutionProperties) = preSolution
5050
HideSolutionNode = FALSE

‎test/TensorFlowNET.Examples/TensorFlowNET.Examples.csproj‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>netcoreapp2.1</TargetFramework>
5+
<TargetFramework>netcoreapp2.2</TargetFramework>
66
</PropertyGroup>
77

88
<ItemGroup>

‎test/TensorFlowNET.Examples/TextClassificationWithMovieReviews.cs‎

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using Newtonsoft.Json;
88
using System.Linq;
99
using Keras;
10+
using System.Text.RegularExpressions;
1011

1112
namespace TensorFlowNET.Examples
1213
{
@@ -42,27 +43,45 @@ public void Run()
4243
Utility.Compress.UnZip(zipFile, dir);
4344

4445
// prepare training dataset
45-
NDArray x_train = File.ReadAllLines(Path.Join(dir, "x_train.txt"));
46-
NDArray labels_train = File.ReadAllLines(Path.Join(dir, "y_train.txt"));
47-
NDArray indices_train = File.ReadAllLines(Path.Join(dir, "indices_train.txt"));
46+
var x_train = ReadData(Path.Join(dir, "x_train.txt"));
47+
var labels_train = ReadData(Path.Join(dir, "y_train.txt"));
48+
var indices_train = ReadData(Path.Join(dir, "indices_train.txt"));
4849
// x_train = x_train[indices_train];
4950
// labels_train = labels_train[indices_train];
5051

51-
NDArray x_test = File.ReadAllLines(Path.Join(dir, "x_test.txt"));
52-
NDArray labels_test = File.ReadAllLines(Path.Join(dir, "y_test.txt"));
53-
NDArray indices_test = File.ReadAllLines(Path.Join(dir, "indices_test.txt"));
52+
var x_test = ReadData(Path.Join(dir, "x_test.txt"));
53+
var labels_test = ReadData(Path.Join(dir, "y_test.txt"));
54+
var indices_test = ReadData(Path.Join(dir, "indices_test.txt"));
5455
// x_test = x_test[indices_test];
5556
// labels_test = labels_test[indices_test];
5657

5758
// not completed
58-
var xs = x_train.hstack(x_test);
59+
/*var xs = x_train.hstack(x_test);
5960
var labels = labels_train.hstack(labels_test);
6061
6162
var idx = x_train.size;
6263
var y_train = labels_train;
6364
var y_test = labels_test;
6465
65-
return ((x_train, y_train), (x_test, y_test));
66+
return ((x_train, y_train), (x_test, y_test));*/
67+
68+
throw new NotImplementedException();
69+
}
70+
71+
private int[][] ReadData(string file)
72+
{
73+
var lines = new List<int[]>();
74+
75+
foreach(var line in File.ReadAllLines(file))
76+
{
77+
var matches = Regex.Matches(line, @"\d+,*");
78+
var data = new int[matches.Count];
79+
for (int i = 0; i < data.Length; i++)
80+
data[i] = Convert.ToInt32(matches[i].Value.Trim(','));
81+
lines.Add(data.ToArray());
82+
}
83+
84+
return lines.ToArray();
6685
}
6786

6887
private Dictionary<string, int> GetWordIndex()

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL