| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 6aa9b8b commit 98ead99
93 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,17 +3,13 @@ Microsoft Visual Studio Solution File, Format Version 12.00 | |||
| 3 | 3 | # Visual Studio Version 16 | |
| 4 | 4 | VisualStudioVersion = 16.0.29102.190 | |
| 5 | 5 | MinimumVisualStudioVersion = 10.0.40219.1 | |
| 6 | - Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TensorFlowNET.UnitTest", "test\TensorFlowNET.UnitTest\TensorFlowNET.UnitTest.csproj", "{029A8CF1-CF95-4DCB-98AA-9D3D96A83B3E}" | ||
| 6 | + Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TensorFlow.Binding", "src\TensorFlowNET.Core\TensorFlow.Binding.csproj", "{FD682AC0-7B2D-45D3-8B0D-C6D678B04144}" | ||
| 7 | 7 | EndProject | |
| 8 | - Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TensorFlowNET.Core", "src\TensorFlowNET.Core\TensorFlowNET.Core.csproj", "{FD682AC0-7B2D-45D3-8B0D-C6D678B04144}" | ||
| 8 | + Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Keras.Core", "src\KerasNET.Core\Keras.Core.csproj", "{4A341A02-F595-4A2A-B671-D7591FC65CA7}" | ||
| 9 | 9 | EndProject | |
| 10 | - Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TensorFlowNET.Models", "src\TensorFlowNET.Models\TensorFlowNET.Models.csproj", "{D03F94CF-B283-4730-B177-21A57641061F}" | ||
| 10 | + Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Benchmark", "src\TensorFlowNet.Benchmarks\Benchmark.csproj", "{3A6EB896-604F-4E25-B677-B8103BCF3D2E}" | ||
| 11 | 11 | EndProject | |
| 12 | - Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TensorFlowNET.Text", "src\TensorFlowNET.Text\TensorFlowNET.Text.csproj", "{904472F8-40E1-4650-AA6F-C7F209B3691B}" | ||
| 13 | - EndProject | ||
| 14 | - Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TensorFlowNET.Hub", "src\TensorFlowNET.Hub\TensorFlowNET.Hub.csproj", "{4EAFAE19-C832-47C6-B01E-0F4268C9072C}" | ||
| 15 | - EndProject | ||
| 16 | - Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TensorFlowNET.Datasets", "src\TensorFlowNET.Datasets\TensorFlowNET.Datasets.csproj", "{494D6CAD-2C0D-4C0B-90E2-B097DB039383}" | ||
| 12 | + Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTest", "test\TensorFlowNET.UnitTest\UnitTest.csproj", "{23C28035-2FCE-41F3-9A12-E73CE8A5AE32}" | ||
| 17 | 13 | EndProject | |
| 18 | 14 | Global | |
| 19 | 15 | GlobalSection(SolutionConfigurationPlatforms) = preSolution | |
@@ -25,18 +21,6 @@ Global | |||
| 25 | 21 | Release|x64 = Release|x64 | |
| 26 | 22 | EndGlobalSection | |
| 27 | 23 | GlobalSection(ProjectConfigurationPlatforms) = postSolution | |
| 28 | - {029A8CF1-CF95-4DCB-98AA-9D3D96A83B3E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| 29 | - {029A8CF1-CF95-4DCB-98AA-9D3D96A83B3E}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| 30 | - {029A8CF1-CF95-4DCB-98AA-9D3D96A83B3E}.Debug|x64.ActiveCfg = Debug|Any CPU | ||
| 31 | - {029A8CF1-CF95-4DCB-98AA-9D3D96A83B3E}.Debug|x64.Build.0 = Debug|Any CPU | ||
| 32 | - {029A8CF1-CF95-4DCB-98AA-9D3D96A83B3E}.Publish|Any CPU.ActiveCfg = Release|Any CPU | ||
| 33 | - {029A8CF1-CF95-4DCB-98AA-9D3D96A83B3E}.Publish|Any CPU.Build.0 = Release|Any CPU | ||
| 34 | - {029A8CF1-CF95-4DCB-98AA-9D3D96A83B3E}.Publish|x64.ActiveCfg = Release|Any CPU | ||
| 35 | - {029A8CF1-CF95-4DCB-98AA-9D3D96A83B3E}.Publish|x64.Build.0 = Release|Any CPU | ||
| 36 | - {029A8CF1-CF95-4DCB-98AA-9D3D96A83B3E}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| 37 | - {029A8CF1-CF95-4DCB-98AA-9D3D96A83B3E}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| 38 | - {029A8CF1-CF95-4DCB-98AA-9D3D96A83B3E}.Release|x64.ActiveCfg = Release|Any CPU | ||
| 39 | - {029A8CF1-CF95-4DCB-98AA-9D3D96A83B3E}.Release|x64.Build.0 = Release|Any CPU | ||
| 40 | 24 | {FD682AC0-7B2D-45D3-8B0D-C6D678B04144}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |
| 41 | 25 | {FD682AC0-7B2D-45D3-8B0D-C6D678B04144}.Debug|Any CPU.Build.0 = Debug|Any CPU | |
| 42 | 26 | {FD682AC0-7B2D-45D3-8B0D-C6D678B04144}.Debug|x64.ActiveCfg = Debug|Any CPU | |
@@ -49,54 +33,42 @@ Global | |||
| 49 | 33 | {FD682AC0-7B2D-45D3-8B0D-C6D678B04144}.Release|Any CPU.Build.0 = Release|Any CPU | |
| 50 | 34 | {FD682AC0-7B2D-45D3-8B0D-C6D678B04144}.Release|x64.ActiveCfg = Release|Any CPU | |
| 51 | 35 | {FD682AC0-7B2D-45D3-8B0D-C6D678B04144}.Release|x64.Build.0 = Release|Any CPU | |
| 52 | - {D03F94CF-B283-4730-B177-21A57641061F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| 53 | - {D03F94CF-B283-4730-B177-21A57641061F}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| 54 | - {D03F94CF-B283-4730-B177-21A57641061F}.Debug|x64.ActiveCfg = Debug|Any CPU | ||
| 55 | - {D03F94CF-B283-4730-B177-21A57641061F}.Debug|x64.Build.0 = Debug|Any CPU | ||
| 56 | - {D03F94CF-B283-4730-B177-21A57641061F}.Publish|Any CPU.ActiveCfg = Release|Any CPU | ||
| 57 | - {D03F94CF-B283-4730-B177-21A57641061F}.Publish|Any CPU.Build.0 = Release|Any CPU | ||
| 58 | - {D03F94CF-B283-4730-B177-21A57641061F}.Publish|x64.ActiveCfg = Release|Any CPU | ||
| 59 | - {D03F94CF-B283-4730-B177-21A57641061F}.Publish|x64.Build.0 = Release|Any CPU | ||
| 60 | - {D03F94CF-B283-4730-B177-21A57641061F}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| 61 | - {D03F94CF-B283-4730-B177-21A57641061F}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| 62 | - {D03F94CF-B283-4730-B177-21A57641061F}.Release|x64.ActiveCfg = Release|Any CPU | ||
| 63 | - {D03F94CF-B283-4730-B177-21A57641061F}.Release|x64.Build.0 = Release|Any CPU | ||
| 64 | - {904472F8-40E1-4650-AA6F-C7F209B3691B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| 65 | - {904472F8-40E1-4650-AA6F-C7F209B3691B}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| 66 | - {904472F8-40E1-4650-AA6F-C7F209B3691B}.Debug|x64.ActiveCfg = Debug|Any CPU | ||
| 67 | - {904472F8-40E1-4650-AA6F-C7F209B3691B}.Debug|x64.Build.0 = Debug|Any CPU | ||
| 68 | - {904472F8-40E1-4650-AA6F-C7F209B3691B}.Publish|Any CPU.ActiveCfg = Release|Any CPU | ||
| 69 | - {904472F8-40E1-4650-AA6F-C7F209B3691B}.Publish|Any CPU.Build.0 = Release|Any CPU | ||
| 70 | - {904472F8-40E1-4650-AA6F-C7F209B3691B}.Publish|x64.ActiveCfg = Release|Any CPU | ||
| 71 | - {904472F8-40E1-4650-AA6F-C7F209B3691B}.Publish|x64.Build.0 = Release|Any CPU | ||
| 72 | - {904472F8-40E1-4650-AA6F-C7F209B3691B}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| 73 | - {904472F8-40E1-4650-AA6F-C7F209B3691B}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| 74 | - {904472F8-40E1-4650-AA6F-C7F209B3691B}.Release|x64.ActiveCfg = Release|Any CPU | ||
| 75 | - {904472F8-40E1-4650-AA6F-C7F209B3691B}.Release|x64.Build.0 = Release|Any CPU | ||
| 76 | - {4EAFAE19-C832-47C6-B01E-0F4268C9072C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| 77 | - {4EAFAE19-C832-47C6-B01E-0F4268C9072C}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| 78 | - {4EAFAE19-C832-47C6-B01E-0F4268C9072C}.Debug|x64.ActiveCfg = Debug|Any CPU | ||
| 79 | - {4EAFAE19-C832-47C6-B01E-0F4268C9072C}.Debug|x64.Build.0 = Debug|Any CPU | ||
| 80 | - {4EAFAE19-C832-47C6-B01E-0F4268C9072C}.Publish|Any CPU.ActiveCfg = Release|Any CPU | ||
| 81 | - {4EAFAE19-C832-47C6-B01E-0F4268C9072C}.Publish|Any CPU.Build.0 = Release|Any CPU | ||
| 82 | - {4EAFAE19-C832-47C6-B01E-0F4268C9072C}.Publish|x64.ActiveCfg = Release|Any CPU | ||
| 83 | - {4EAFAE19-C832-47C6-B01E-0F4268C9072C}.Publish|x64.Build.0 = Release|Any CPU | ||
| 84 | - {4EAFAE19-C832-47C6-B01E-0F4268C9072C}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| 85 | - {4EAFAE19-C832-47C6-B01E-0F4268C9072C}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| 86 | - {4EAFAE19-C832-47C6-B01E-0F4268C9072C}.Release|x64.ActiveCfg = Release|Any CPU | ||
| 87 | - {4EAFAE19-C832-47C6-B01E-0F4268C9072C}.Release|x64.Build.0 = Release|Any CPU | ||
| 88 | - {494D6CAD-2C0D-4C0B-90E2-B097DB039383}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| 89 | - {494D6CAD-2C0D-4C0B-90E2-B097DB039383}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| 90 | - {494D6CAD-2C0D-4C0B-90E2-B097DB039383}.Debug|x64.ActiveCfg = Debug|Any CPU | ||
| 91 | - {494D6CAD-2C0D-4C0B-90E2-B097DB039383}.Debug|x64.Build.0 = Debug|Any CPU | ||
| 92 | - {494D6CAD-2C0D-4C0B-90E2-B097DB039383}.Publish|Any CPU.ActiveCfg = Release|Any CPU | ||
| 93 | - {494D6CAD-2C0D-4C0B-90E2-B097DB039383}.Publish|Any CPU.Build.0 = Release|Any CPU | ||
| 94 | - {494D6CAD-2C0D-4C0B-90E2-B097DB039383}.Publish|x64.ActiveCfg = Release|Any CPU | ||
| 95 | - {494D6CAD-2C0D-4C0B-90E2-B097DB039383}.Publish|x64.Build.0 = Release|Any CPU | ||
| 96 | - {494D6CAD-2C0D-4C0B-90E2-B097DB039383}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| 97 | - {494D6CAD-2C0D-4C0B-90E2-B097DB039383}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| 98 | - {494D6CAD-2C0D-4C0B-90E2-B097DB039383}.Release|x64.ActiveCfg = Release|Any CPU | ||
| 99 | - {494D6CAD-2C0D-4C0B-90E2-B097DB039383}.Release|x64.Build.0 = Release|Any CPU | ||
| 36 | + {4A341A02-F595-4A2A-B671-D7591FC65CA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| 37 | + {4A341A02-F595-4A2A-B671-D7591FC65CA7}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| 38 | + {4A341A02-F595-4A2A-B671-D7591FC65CA7}.Debug|x64.ActiveCfg = Debug|Any CPU | ||
| 39 | + {4A341A02-F595-4A2A-B671-D7591FC65CA7}.Debug|x64.Build.0 = Debug|Any CPU | ||
| 40 | + {4A341A02-F595-4A2A-B671-D7591FC65CA7}.Publish|Any CPU.ActiveCfg = Debug|Any CPU | ||
| 41 | + {4A341A02-F595-4A2A-B671-D7591FC65CA7}.Publish|Any CPU.Build.0 = Debug|Any CPU | ||
| 42 | + {4A341A02-F595-4A2A-B671-D7591FC65CA7}.Publish|x64.ActiveCfg = Debug|Any CPU | ||
| 43 | + {4A341A02-F595-4A2A-B671-D7591FC65CA7}.Publish|x64.Build.0 = Debug|Any CPU | ||
| 44 | + {4A341A02-F595-4A2A-B671-D7591FC65CA7}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| 45 | + {4A341A02-F595-4A2A-B671-D7591FC65CA7}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| 46 | + {4A341A02-F595-4A2A-B671-D7591FC65CA7}.Release|x64.ActiveCfg = Release|Any CPU | ||
| 47 | + {4A341A02-F595-4A2A-B671-D7591FC65CA7}.Release|x64.Build.0 = Release|Any CPU | ||
| 48 | + {3A6EB896-604F-4E25-B677-B8103BCF3D2E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| 49 | + {3A6EB896-604F-4E25-B677-B8103BCF3D2E}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| 50 | + {3A6EB896-604F-4E25-B677-B8103BCF3D2E}.Debug|x64.ActiveCfg = Debug|Any CPU | ||
| 51 | + {3A6EB896-604F-4E25-B677-B8103BCF3D2E}.Debug|x64.Build.0 = Debug|Any CPU | ||
| 52 | + {3A6EB896-604F-4E25-B677-B8103BCF3D2E}.Publish|Any CPU.ActiveCfg = Debug|Any CPU | ||
| 53 | + {3A6EB896-604F-4E25-B677-B8103BCF3D2E}.Publish|Any CPU.Build.0 = Debug|Any CPU | ||
| 54 | + {3A6EB896-604F-4E25-B677-B8103BCF3D2E}.Publish|x64.ActiveCfg = Debug|Any CPU | ||
| 55 | + {3A6EB896-604F-4E25-B677-B8103BCF3D2E}.Publish|x64.Build.0 = Debug|Any CPU | ||
| 56 | + {3A6EB896-604F-4E25-B677-B8103BCF3D2E}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| 57 | + {3A6EB896-604F-4E25-B677-B8103BCF3D2E}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| 58 | + {3A6EB896-604F-4E25-B677-B8103BCF3D2E}.Release|x64.ActiveCfg = Release|Any CPU | ||
| 59 | + {3A6EB896-604F-4E25-B677-B8103BCF3D2E}.Release|x64.Build.0 = Release|Any CPU | ||
| 60 | + {23C28035-2FCE-41F3-9A12-E73CE8A5AE32}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| 61 | + {23C28035-2FCE-41F3-9A12-E73CE8A5AE32}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| 62 | + {23C28035-2FCE-41F3-9A12-E73CE8A5AE32}.Debug|x64.ActiveCfg = Debug|Any CPU | ||
| 63 | + {23C28035-2FCE-41F3-9A12-E73CE8A5AE32}.Debug|x64.Build.0 = Debug|Any CPU | ||
| 64 | + {23C28035-2FCE-41F3-9A12-E73CE8A5AE32}.Publish|Any CPU.ActiveCfg = Debug|Any CPU | ||
| 65 | + {23C28035-2FCE-41F3-9A12-E73CE8A5AE32}.Publish|Any CPU.Build.0 = Debug|Any CPU | ||
| 66 | + {23C28035-2FCE-41F3-9A12-E73CE8A5AE32}.Publish|x64.ActiveCfg = Debug|Any CPU | ||
| 67 | + {23C28035-2FCE-41F3-9A12-E73CE8A5AE32}.Publish|x64.Build.0 = Debug|Any CPU | ||
| 68 | + {23C28035-2FCE-41F3-9A12-E73CE8A5AE32}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| 69 | + {23C28035-2FCE-41F3-9A12-E73CE8A5AE32}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| 70 | + {23C28035-2FCE-41F3-9A12-E73CE8A5AE32}.Release|x64.ActiveCfg = Release|Any CPU | ||
| 71 | + {23C28035-2FCE-41F3-9A12-E73CE8A5AE32}.Release|x64.Build.0 = Release|Any CPU | ||
| 100 | 72 | EndGlobalSection | |
| 101 | 73 | GlobalSection(SolutionProperties) = preSolution | |
| 102 | 74 | HideSolutionNode = FALSE | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,7 +7,7 @@ | |||
| 7 | 7 | </PropertyGroup> | |
| 8 | 8 | ||
| 9 | 9 | <ItemGroup> | |
| 10 | - <ProjectReference Include="..\TensorFlowNET.Core\TensorFlowNET.Core.csproj" /> | ||
| 10 | + <ProjectReference Include="..\TensorFlowNET.Core\TensorFlow.Binding.csproj" /> | ||
| 11 | 11 | </ItemGroup> | |
| 12 | 12 | ||
| 13 | 13 | </Project> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -27,13 +27,17 @@ public partial class tensorflow | |||
| 27 | 27 | ||
| 28 | 28 | public class Estimator_Internal | |
| 29 | 29 | { | |
| 30 | - public Estimator Estimator(Action model_fn, RunConfig config) | ||
| 31 | - => new Estimator(model_fn: model_fn, config: config); | ||
| 30 | + public Experimental experimental { get; } = new Experimental(); | ||
| 31 | + public Estimator<Thyp> Estimator<Thyp>(Func<IEstimatorInputs, EstimatorSpec> model_fn, | ||
| 32 | + string model_dir = null, | ||
| 33 | + RunConfig config = null, | ||
| 34 | + Thyp hyperParams = default) | ||
| 35 | + => new Estimator<Thyp>(model_fn: model_fn, model_dir: model_dir, config: config, hyperParams: hyperParams); | ||
| 32 | 36 | ||
| 33 | - public RunConfig RunConfig(string model_dir) | ||
| 34 | - => new RunConfig(model_dir: model_dir); | ||
| 37 | + public RunConfig RunConfig(string model_dir = null, int save_checkpoints_secs = 180) | ||
| 38 | + => new RunConfig(model_dir: model_dir, save_checkpoints_secs: save_checkpoints_secs); | ||
| 35 | 39 | ||
| 36 | - public void train_and_evaluate(Estimator estimator, TrainSpec train_spec, EvalSpec eval_spec) | ||
| 40 | + public void train_and_evaluate<Thyp>(Estimator<Thyp> estimator, TrainSpec train_spec, EvalSpec eval_spec) | ||
| 37 | 41 | => Training.train_and_evaluate(estimator: estimator, train_spec: train_spec, eval_spec: eval_spec); | |
| 38 | 42 | ||
| 39 | 43 | public TrainSpec TrainSpec(Func<DatasetV1Adapter> input_fn, int max_steps) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,20 @@ | |||
| 1 | + using System; | ||
| 2 | + using System.Collections.Generic; | ||
| 3 | + using System.Linq; | ||
| 4 | + using System.Text; | ||
| 5 | + using System.Threading.Tasks; | ||
| 6 | + | ||
| 7 | + namespace Tensorflow | ||
| 8 | + { | ||
| 9 | + public static partial class Binding | ||
| 10 | + { | ||
| 11 | + public static class functools | ||
| 12 | + { | ||
| 13 | + public static Func<Tin, Tout> partial<Tin, Tout>(Func<Tin, Tout> func, Tin arg) | ||
| 14 | + => (arg0) => func(arg0); | ||
| 15 | + | ||
| 16 | + public static Func<Tin1, Tin2, Tout> partial<Tin1, Tin2, Tout>(Func<Tin1, Tin2, Tout> func, (Tin1, Tin2) args) | ||
| 17 | + => (arg1, arg2) => func(arg1, arg2); | ||
| 18 | + } | ||
| 19 | + } | ||
| 20 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -339,15 +339,5 @@ public static bool isinstance(object Item1, object tuple) | |||
| 339 | 339 | return true; | |
| 340 | 340 | return false; | |
| 341 | 341 | } | |
| 342 | - | ||
| 343 | - public static Func<Tin1, Tout> partial<Tin1, Tout>(Func<Tin1, Tout> func, Tin1 args) | ||
| 344 | - { | ||
| 345 | - Func<Tin1, Tout> newfunc = (args1) => | ||
| 346 | - { | ||
| 347 | - return func(args1); | ||
| 348 | - }; | ||
| 349 | - | ||
| 350 | - return newfunc; | ||
| 351 | - } | ||
| 352 | 342 | } | |
| 353 | 343 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,32 +12,36 @@ namespace Tensorflow.Estimators | |||
| 12 | 12 | /// <summary> | |
| 13 | 13 | /// Estimator class to train and evaluate TensorFlow models. | |
| 14 | 14 | /// </summary> | |
| 15 | - public class Estimator : IObjectLife | ||
| 15 | + public class Estimator<Thyp> : IObjectLife | ||
| 16 | 16 | { | |
| 17 | 17 | RunConfig _config; | |
| 18 | 18 | public RunConfig config => _config; | |
| 19 | 19 | ||
| 20 | 20 | ConfigProto _session_config; | |
| 21 | 21 | public ConfigProto session_config => _session_config; | |
| 22 | 22 | ||
| 23 | - string _model_dir; | ||
| 23 | + Func<IEstimatorInputs, EstimatorSpec> _model_fn; | ||
| 24 | 24 | ||
| 25 | - Action _model_fn; | ||
| 25 | + Thyp _hyperParams; | ||
| 26 | 26 | ||
| 27 | - public Estimator(Action model_fn, RunConfig config) | ||
| 27 | + public Estimator(Func<IEstimatorInputs, EstimatorSpec> model_fn, | ||
| 28 | + string model_dir, | ||
| 29 | + RunConfig config, | ||
| 30 | + Thyp hyperParams) | ||
| 28 | 31 | { | |
| 29 | 32 | _config = config; | |
| 30 | - _model_dir = _config.model_dir; | ||
| 31 | - _session_config = _config.session_config; | ||
| 33 | + _config.model_dir = config.model_dir ?? model_dir; | ||
| 34 | + _session_config = config.session_config; | ||
| 32 | 35 | _model_fn = model_fn; | |
| 36 | + _hyperParams = hyperParams; | ||
| 33 | 37 | } | |
| 34 | 38 | ||
| 35 | - public Estimator train(Func<DatasetV1Adapter> input_fn, int max_steps = 1, Action[] hooks = null, | ||
| 36 | - _NewCheckpointListenerForEvaluate[] saving_listeners = null) | ||
| 39 | + public Estimator<Thyp> train(Func<DatasetV1Adapter> input_fn, int max_steps = 1, Action[] hooks = null, | ||
| 40 | + _NewCheckpointListenerForEvaluate<Thyp>[] saving_listeners = null) | ||
| 37 | 41 | { | |
| 38 | 42 | if(max_steps > 0) | |
| 39 | 43 | { | |
| 40 | - var start_step = _load_global_step_from_checkpoint_dir(_model_dir); | ||
| 44 | + var start_step = _load_global_step_from_checkpoint_dir(_config.model_dir); | ||
| 41 | 45 | if (max_steps <= start_step) | |
| 42 | 46 | { | |
| 43 | 47 | Console.WriteLine("Skipping training since max_steps has already saved."); | |
@@ -110,6 +114,11 @@ private RefVariable _create_global_step(Graph graph) | |||
| 110 | 114 | return tf.train.create_global_step(graph); | |
| 111 | 115 | } | |
| 112 | 116 | ||
| 117 | + public string eval_dir(string name = null) | ||
| 118 | + { | ||
| 119 | + return Path.Combine(config.model_dir, string.IsNullOrEmpty(name) ? "eval" : $"eval_" + name); | ||
| 120 | + } | ||
| 121 | + | ||
| 113 | 122 | public void __init__() | |
| 114 | 123 | { | |
| 115 | 124 | throw new NotImplementedException(); | |
@@ -132,7 +141,7 @@ public void __exit__() | |||
| 132 | 141 | ||
| 133 | 142 | public void Dispose() | |
| 134 | 143 | { | |
| 135 | - throw new NotImplementedException(); | ||
| 144 | + | ||
| 136 | 145 | } | |
| 137 | 146 | } | |
| 138 | 147 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,16 @@ | |||
| 1 | + using System; | ||
| 2 | + using System.Collections.Generic; | ||
| 3 | + using System.Linq; | ||
| 4 | + using System.Text; | ||
| 5 | + using System.Threading.Tasks; | ||
| 6 | + | ||
| 7 | + namespace Tensorflow.Estimators | ||
| 8 | + { | ||
| 9 | + public class EstimatorSpec | ||
| 10 | + { | ||
| 11 | + public EstimatorSpec(Operation train_op) | ||
| 12 | + { | ||
| 13 | + | ||
| 14 | + } | ||
| 15 | + } | ||
| 16 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,61 @@ | |||
| 1 | + using System; | ||
| 2 | + using System.Collections.Generic; | ||
| 3 | + using System.Linq; | ||
| 4 | + using System.Text; | ||
| 5 | + using System.Threading.Tasks; | ||
| 6 | + | ||
| 7 | + namespace Tensorflow.Estimators | ||
| 8 | + { | ||
| 9 | + public class Experimental | ||
| 10 | + { | ||
| 11 | + /// <summary> | ||
| 12 | + /// Creates hook to stop if metric does not increase within given max steps. | ||
| 13 | + /// </summary> | ||
| 14 | + /// <typeparam name="Thyp">type of hyper parameters</typeparam> | ||
| 15 | + /// <param name="estimator"></param> | ||
| 16 | + /// <param name="metric_name"></param> | ||
| 17 | + /// <param name="max_steps_without_increase"></param> | ||
| 18 | + /// <param name="eval_dir"></param> | ||
| 19 | + /// <param name="min_steps"></param> | ||
| 20 | + /// <param name="run_every_secs"></param> | ||
| 21 | + /// <param name="run_every_steps"></param> | ||
| 22 | + /// <returns></returns> | ||
| 23 | + public object stop_if_no_increase_hook<Thyp>(Estimator<Thyp> estimator, | ||
| 24 | + string metric_name, | ||
| 25 | + int max_steps_without_increase, | ||
| 26 | + string eval_dir = null, | ||
| 27 | + int min_steps = 0, | ||
| 28 | + int run_every_secs = 60, | ||
| 29 | + int run_every_steps = 0) | ||
| 30 | + => _stop_if_no_metric_improvement_hook(estimator: estimator, | ||
| 31 | + metric_name: metric_name, | ||
| 32 | + max_steps_without_increase: max_steps_without_increase, | ||
| 33 | + eval_dir: eval_dir, | ||
| 34 | + min_steps: min_steps, | ||
| 35 | + run_every_secs: run_every_secs, | ||
| 36 | + run_every_steps: run_every_steps); | ||
| 37 | + | ||
| 38 | + private object _stop_if_no_metric_improvement_hook<Thyp>(Estimator<Thyp> estimator, | ||
| 39 | + string metric_name, | ||
| 40 | + int max_steps_without_increase, | ||
| 41 | + string eval_dir = null, | ||
| 42 | + int min_steps = 0, | ||
| 43 | + int run_every_secs = 60, | ||
| 44 | + int run_every_steps = 0) | ||
| 45 | + { | ||
| 46 | + eval_dir = eval_dir ?? estimator.eval_dir(); | ||
| 47 | + // var is_lhs_better = higher_is_better ? operator.gt: operator.lt; | ||
| 48 | + Func<bool> stop_if_no_metric_improvement_fn = () => | ||
| 49 | + { | ||
| 50 | + return false; | ||
| 51 | + }; | ||
| 52 | + | ||
| 53 | + return make_early_stopping_hook(); | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + public object make_early_stopping_hook() | ||
| 57 | + { | ||
| 58 | + throw new NotImplementedException(""); | ||
| 59 | + } | ||
| 60 | + } | ||
| 61 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,8 +4,8 @@ | |||
| 4 | 4 | ||
| 5 | 5 | namespace Tensorflow.Estimators | |
| 6 | 6 | { | |
| 7 | - public abstract class Exporter | ||
| 7 | + public abstract class Exporter<Thyp> | ||
| 8 | 8 | { | |
| 9 | - public abstract void export(Estimator estimator, string export_path, string checkpoint_path); | ||
| 9 | + public abstract void export(Estimator<Thyp> estimator, string export_path, string checkpoint_path); | ||
| 10 | 10 | } | |
| 11 | 11 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,12 @@ | |||
| 1 | + using System; | ||
| 2 | + using System.Collections.Generic; | ||
| 3 | + using System.Linq; | ||
| 4 | + using System.Text; | ||
| 5 | + using System.Threading.Tasks; | ||
| 6 | + | ||
| 7 | + namespace Tensorflow.Estimators | ||
| 8 | + { | ||
| 9 | + public interface IEstimatorInputs | ||
| 10 | + { | ||
| 11 | + } | ||
| 12 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments