Skip to content

Commit

Permalink
Merge pull request dotnet#1 from Oceania2018/tftransferlearning
Browse files Browse the repository at this point in the history
fix TensorflowUtil.LoadTFSession, ugprade TF.NET to v0.10.4.
  • Loading branch information
codemzs committed Aug 1, 2019
2 parents 6ca73c2 + c3b8998 commit e4d87d3
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/Microsoft.ML.Dnn/Microsoft.ML.Dnn.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<ItemGroup>
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="$(SystemIOFileSystemAccessControl)" />
<PackageReference Include="System.Security.Principal.Windows" Version="$(SystemSecurityPrincipalWindows)" />
<PackageReference Include="TensorFlow.NET" Version="0.10.3" />
<PackageReference Include="TensorFlow.NET" Version="0.10.4" />
</ItemGroup>

<ItemGroup>
Expand Down
15 changes: 1 addition & 14 deletions src/Microsoft.ML.Dnn/TensorflowUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,22 +128,9 @@ internal static Session LoadTFSessionByModelFilePath(IExceptionContext ectx, str

private static Session LoadTFSession(IHostEnvironment env, string exportDirSavedModel)
{
//Contracts.Check(env != null, nameof(env));
//env.CheckValue(exportDirSavedModel, nameof(exportDirSavedModel));
//return Session.LoadFromSavedModel(exportDirSavedModel);

Contracts.Check(env != null, nameof(env));
env.CheckValue(exportDirSavedModel, nameof(exportDirSavedModel));
var sessionOptions = new TF_SessionOptions();
sessionOptions.options = c_api.TF_NewSessionOptions();
var tags = new string[] { "serve" };
var graph = new Graph();
TF_Buffer metaGraphDef = default;
var status = new Status();
var h = c_api.TF_LoadSessionFromSavedModel(sessionOptions.options, IntPtr.Zero, exportDirSavedModel, tags, 1, graph, ref metaGraphDef, status);
// return new Session(h);
return Session.LoadFromSavedModel(exportDirSavedModel);

return Session.LoadFromSavedModel(exportDirSavedModel);
}

// A TensorFlow frozen model is a single file. An un-frozen (SavedModel) on the other hand has a well-defined folder structure.
Expand Down
1 change: 0 additions & 1 deletion src/Microsoft.ML.TensorFlow/Microsoft.ML.TensorFlow.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
<ItemGroup>
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="$(SystemIOFileSystemAccessControl)" />
<PackageReference Include="System.Security.Principal.Windows" Version="$(SystemSecurityPrincipalWindows)" />
<PackageReference Include="TensorFlow.NET" Version="0.10.3" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit e4d87d3

Please sign in to comment.