| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent d7cb00f commit 031670b
12 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,7 +13,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TensorFlowNET.Utility", "sr | |||
| 13 | 13 | EndProject | |
| 14 | 14 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TensorFlowNET.Visualization", "TensorFlowNET.Visualization\TensorFlowNET.Visualization.csproj", "{4BB2ABD1-635E-41E4-B534-CB5B6A2D754D}" | |
| 15 | 15 | EndProject | |
| 16 | - Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "KerasNET.Core", "..\Keras.NET\src\KerasNET.Core\KerasNET.Core.csproj", "{E2F0C39C-D706-4CF5-AE00-81FB447F949D}" | ||
| 16 | + Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NumSharp.Core", "..\NumSharp\src\NumSharp.Core\NumSharp.Core.csproj", "{0AB4662E-7E3C-455F-BF0C-23D56CBE74F3}" | ||
| 17 | 17 | EndProject | |
| 18 | 18 | Global | |
| 19 | 19 | GlobalSection(SolutionConfigurationPlatforms) = preSolution | |
@@ -41,10 +41,10 @@ Global | |||
| 41 | 41 | {4BB2ABD1-635E-41E4-B534-CB5B6A2D754D}.Debug|Any CPU.Build.0 = Debug|Any CPU | |
| 42 | 42 | {4BB2ABD1-635E-41E4-B534-CB5B6A2D754D}.Release|Any CPU.ActiveCfg = Release|Any CPU | |
| 43 | 43 | {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 | ||
| 44 | + {0AB4662E-7E3C-455F-BF0C-23D56CBE74F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| 45 | + {0AB4662E-7E3C-455F-BF0C-23D56CBE74F3}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| 46 | + {0AB4662E-7E3C-455F-BF0C-23D56CBE74F3}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| 47 | + {0AB4662E-7E3C-455F-BF0C-23D56CBE74F3}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| 48 | 48 | EndGlobalSection | |
| 49 | 49 | GlobalSection(SolutionProperties) = preSolution | |
| 50 | 50 | HideSolutionNode = FALSE | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,15 @@ | |||
| 1 | + using System; | ||
| 2 | + using System.Collections.Generic; | ||
| 3 | + using System.Text; | ||
| 4 | + using Tensorflow.Keras; | ||
| 5 | + using Tensorflow.Keras.Engine; | ||
| 6 | + | ||
| 7 | + namespace Tensorflow | ||
| 8 | + { | ||
| 9 | + public static partial class keras | ||
| 10 | + { | ||
| 11 | + public static Preprocessing preprocessing => new Preprocessing(); | ||
| 12 | + public static Sequence sequence = new Sequence(); | ||
| 13 | + public static Sequential Sequential() => new Sequential(); | ||
| 14 | + } | ||
| 15 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,17 @@ | |||
| 1 | + using System; | ||
| 2 | + using System.Collections.Generic; | ||
| 3 | + using System.Text; | ||
| 4 | + | ||
| 5 | + namespace Tensorflow.Keras.Engine | ||
| 6 | + { | ||
| 7 | + /// <summary> | ||
| 8 | + /// Base layer class. | ||
| 9 | + /// A layer is a class implementing common neural networks operations, such | ||
| 10 | + /// as convolution, batch norm, etc. These operations require managing weights, | ||
| 11 | + /// losses, updates, and inter-layer connectivity. | ||
| 12 | + /// </summary> | ||
| 13 | + public class Layer : CheckpointableBase | ||
| 14 | + { | ||
| 15 | + | ||
| 16 | + } | ||
| 17 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,10 @@ | |||
| 1 | + using System; | ||
| 2 | + using System.Collections.Generic; | ||
| 3 | + using System.Text; | ||
| 4 | + | ||
| 5 | + namespace Tensorflow.Keras.Engine | ||
| 6 | + { | ||
| 7 | + internal class Model : Network | ||
| 8 | + { | ||
| 9 | + } | ||
| 10 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,10 @@ | |||
| 1 | + using System; | ||
| 2 | + using System.Collections.Generic; | ||
| 3 | + using System.Text; | ||
| 4 | + | ||
| 5 | + namespace Tensorflow.Keras.Engine | ||
| 6 | + { | ||
| 7 | + public class Network : Layer | ||
| 8 | + { | ||
| 9 | + } | ||
| 10 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,24 @@ | |||
| 1 | + using System; | ||
| 2 | + using System.Collections.Generic; | ||
| 3 | + using System.Text; | ||
| 4 | + | ||
| 5 | + namespace Tensorflow.Keras.Engine | ||
| 6 | + { | ||
| 7 | + public class Sequential : Network, IPython | ||
| 8 | + { | ||
| 9 | + public void Dispose() | ||
| 10 | + { | ||
| 11 | + throw new NotImplementedException(); | ||
| 12 | + } | ||
| 13 | + | ||
| 14 | + public void __enter__() | ||
| 15 | + { | ||
| 16 | + throw new NotImplementedException(); | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + public void __exit__() | ||
| 20 | + { | ||
| 21 | + throw new NotImplementedException(); | ||
| 22 | + } | ||
| 23 | + } | ||
| 24 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,11 @@ | |||
| 1 | + using System; | ||
| 2 | + using System.Collections.Generic; | ||
| 3 | + using System.Text; | ||
| 4 | + | ||
| 5 | + namespace Tensorflow.Keras | ||
| 6 | + { | ||
| 7 | + public class Preprocessing | ||
| 8 | + { | ||
| 9 | + public Sequence sequence => new Sequence(); | ||
| 10 | + } | ||
| 11 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,77 @@ | |||
| 1 | + using NumSharp.Core; | ||
| 2 | + using System; | ||
| 3 | + using System.Collections.Generic; | ||
| 4 | + using System.Linq; | ||
| 5 | + using System.Text; | ||
| 6 | + using System.Text.RegularExpressions; | ||
| 7 | + using System.Threading.Tasks; | ||
| 8 | + | ||
| 9 | + namespace Tensorflow.Keras | ||
| 10 | + { | ||
| 11 | + public class Sequence | ||
| 12 | + { | ||
| 13 | + /// <summary> | ||
| 14 | + /// Pads sequences to the same length. | ||
| 15 | + /// https://keras.io/preprocessing/sequence/ | ||
| 16 | + /// https://faroit.github.io/keras-docs/1.2.0/preprocessing/sequence/ | ||
| 17 | + /// </summary> | ||
| 18 | + /// <param name="sequences">List of lists, where each element is a sequence.</param> | ||
| 19 | + /// <param name="maxlen">Int, maximum length of all sequences.</param> | ||
| 20 | + /// <param name="dtype">Type of the output sequences.</param> | ||
| 21 | + /// <param name="padding">String, 'pre' or 'post':</param> | ||
| 22 | + /// <param name="truncating">String, 'pre' or 'post'</param> | ||
| 23 | + /// <param name="value">Float or String, padding value.</param> | ||
| 24 | + /// <returns></returns> | ||
| 25 | + public NDArray pad_sequences(NDArray sequences, | ||
| 26 | + int? maxlen = null, | ||
| 27 | + string dtype = "int32", | ||
| 28 | + string padding = "pre", | ||
| 29 | + string truncating = "pre", | ||
| 30 | + object value = null) | ||
| 31 | + { | ||
| 32 | + int[] length = new int[sequences.size]; | ||
| 33 | + switch (sequences.dtype.Name) | ||
| 34 | + { | ||
| 35 | + case "Object": | ||
| 36 | + for (int i = 0; i < sequences.size; i++) | ||
| 37 | + { | ||
| 38 | + switch (sequences.Data<object>(i)) | ||
| 39 | + { | ||
| 40 | + case string data: | ||
| 41 | + length[i] = Regex.Matches(data, ",").Count; | ||
| 42 | + break; | ||
| 43 | + } | ||
| 44 | + } | ||
| 45 | + break; | ||
| 46 | + case "Int32": | ||
| 47 | + for (int i = 0; i < sequences.size; i++) | ||
| 48 | + length[i] = Regex.Matches(sequences.Data<object>(i).ToString(), ",").Count; | ||
| 49 | + break; | ||
| 50 | + default: | ||
| 51 | + throw new NotImplementedException($"pad_sequences: {sequences.dtype.Name}"); | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + if (maxlen == null) | ||
| 55 | + maxlen = length.Max(); | ||
| 56 | + | ||
| 57 | + if (value == null) | ||
| 58 | + value = 0f; | ||
| 59 | + | ||
| 60 | + var nd = new NDArray(np.int32, new Shape(sequences.size, maxlen.Value)); | ||
| 61 | + for (int i = 0; i < nd.shape[0]; i++) | ||
| 62 | + { | ||
| 63 | + switch(sequences[i]) | ||
| 64 | + { | ||
| 65 | + case int[] data: | ||
| 66 | + for (int j = 0; j < nd.shape[1]; j++) | ||
| 67 | + nd[i, j] = j < data.Length ? data[j] : value; | ||
| 68 | + break; | ||
| 69 | + default: | ||
| 70 | + throw new NotImplementedException("pad_sequences"); | ||
| 71 | + } | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + return nd; | ||
| 75 | + } | ||
| 76 | + } | ||
| 77 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -52,7 +52,7 @@ Docs: https://tensorflownet.readthedocs.io</Description> | |||
| 52 | 52 | </ItemGroup> | |
| 53 | 53 | ||
| 54 | 54 | <ItemGroup> | |
| 55 | - <Folder Include="APIs\Keras\" /> | ||
| 55 | + <ProjectReference Include="..\..\..\NumSharp\src\NumSharp.Core\NumSharp.Core.csproj" /> | ||
| 56 | 56 | </ItemGroup> | |
| 57 | 57 | ||
| 58 | 58 | </Project> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,10 @@ | |||
| 1 | + using System; | ||
| 2 | + using System.Collections.Generic; | ||
| 3 | + using System.Text; | ||
| 4 | + | ||
| 5 | + namespace Tensorflow | ||
| 6 | + { | ||
| 7 | + public class CheckpointableBase | ||
| 8 | + { | ||
| 9 | + } | ||
| 10 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments