Browse Source

Merge pull request #1 from SciSharp/master

Updated from Main Branch
tags/v0.20
Deepak Kumar Battini GitHub 5 years ago
parent
commit
c60fe3c6e1
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 61 additions and 16 deletions
  1. +1
    -0
      src/TensorFlowNET.Core/APIs/tf.io.cs
  2. +21
    -6
      src/TensorFlowNET.Core/GraphTransformation/GraphTransformer.cs
  3. +33
    -0
      src/TensorFlowNET.Core/GraphTransformation/c_api.transform_graph.cs
  4. +1
    -1
      src/TensorFlowNET.Core/Operations/gen_io_ops.cs
  5. +5
    -9
      src/TensorFlowNET.Core/TensorFlow.Binding.csproj

+ 1
- 0
src/TensorFlowNET.Core/APIs/tf.io.cs View File

@@ -23,6 +23,7 @@ namespace Tensorflow
{
public GFile gfile = new GFile();
public Tensor read_file(string filename, string name = null) => gen_io_ops.read_file(filename, name);
public Tensor read_file(Tensor filename, string name = null) => gen_io_ops.read_file(filename, name);

public ITensorOrOperation[] import_graph_def(GraphDef graph_def,
Dictionary<string, Tensor> input_map = null,


+ 21
- 6
src/TensorFlowNET.Core/GraphTransformation/GraphTransformer.cs View File

@@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using Google.Protobuf;

namespace Tensorflow
{
@@ -15,17 +17,30 @@ namespace Tensorflow
/// <param name="outputs">the model outputs</param>
/// <param name="transforms">transform names and parameters</param>
/// <returns></returns>
public GraphDef TransformGraph(GraphDef input_graph_def,
string[] inputs,
string[] outputs,
public GraphDef TransformGraph(GraphDef input_graph_def,
string[] inputs,
string[] outputs,
string[] transforms)
{
var input_graph_def_string = input_graph_def.ToString();
var input_graph_def_string = input_graph_def.ToByteArray();
var inputs_string = string.Join(",", inputs);
var outputs_string = string.Join(",", outputs);
var transforms_string = string.Join(",", transforms);
var transforms_string = string.Join(" ", transforms);
using (var status = new Status())
{
var buffer = new Buffer();
var len = c_api.TransformGraphWithStringInputs(input_graph_def_string,
input_graph_def_string.Length,
inputs_string,
outputs_string,
transforms_string,
buffer,
status);

throw new NotImplementedException("");
status.Check(false);
var bytes = buffer.ToArray();
return GraphDef.Parser.ParseFrom(bytes);
}
}
}
}

+ 33
- 0
src/TensorFlowNET.Core/GraphTransformation/c_api.transform_graph.cs View File

@@ -0,0 +1,33 @@
/*****************************************************************************
Copyright 2018 The TensorFlow.NET Authors. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
******************************************************************************/

using System;
using System.Runtime.InteropServices;

namespace Tensorflow
{
public partial class c_api
{
[DllImport(TensorFlowLibName)]
public static extern int TransformGraphWithStringInputs(byte[] graph_def_string,
int graph_def_string_len,
string inputs_string,
string outputs_string,
string transforms_string,
IntPtr output_buffer,
IntPtr status);
}
}

+ 1
- 1
src/TensorFlowNET.Core/Operations/gen_io_ops.cs View File

@@ -34,7 +34,7 @@ namespace Tensorflow
return _op.outputs;
}

public static Tensor read_file(string filename, string name = null)
public static Tensor read_file<T>(T filename, string name = null)
{
var _op = _op_def_lib._apply_op_helper("ReadFile", name: name, args: new { filename });



+ 5
- 9
src/TensorFlowNET.Core/TensorFlow.Binding.csproj View File

@@ -5,7 +5,7 @@
<AssemblyName>TensorFlow.NET</AssemblyName>
<RootNamespace>Tensorflow</RootNamespace>
<TargetTensorFlow>1.14.1</TargetTensorFlow>
<Version>0.14.0</Version>
<Version>0.15.0</Version>
<Authors>Haiping Chen, Meinrad Recheis, Eli Belash</Authors>
<Company>SciSharp STACK</Company>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
@@ -18,15 +18,11 @@
<Description>Google's TensorFlow full binding in .NET Standard.
Building, training and infering deep learning models.
https://tensorflownet.readthedocs.io</Description>
<AssemblyVersion>0.14.0.0</AssemblyVersion>
<PackageReleaseNotes>Changes since v0.13.0:
1: Upgrade NumSharp to v0.20.5
2: Return byte[] for TF_String
3: Fix return_tensors for import_graph_def
4: Add tf.nn.ctc_greedy_decoder
5: Fix calling RegisterGradientFunction too early</PackageReleaseNotes>
<AssemblyVersion>0.15.0.0</AssemblyVersion>
<PackageReleaseNotes>Changes since v0.14.0:
1: Add TransformGraphWithStringInputs.</PackageReleaseNotes>
<LangVersion>7.3</LangVersion>
<FileVersion>0.14.0.0</FileVersion>
<FileVersion>0.15.0.0</FileVersion>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<SignAssembly>true</SignAssembly>


Loading…
Cancel
Save